Commit 5e821261 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

(Dynarec) Get rid of function pointers

parent b92311e7
Pipeline #15780 failed with stages
in 2 minutes and 16 seconds
......@@ -93,10 +93,10 @@ u32 DYNACALL rdv_DoInterrupts_pc(u32 pc);
void ngen_init();
//Called to compile a block
extern void (*ngen_Compile)(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise);
void ngen_Compile(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise);
//Called when blocks are reseted
extern void (*ngen_ResetBlocks)();
void ngen_ResetBlocks(void);
//Value to be returned when the block manager failed to find a block,
//should call rdv_FailedToFindBlock and then jump to the return value
extern void (*ngen_FailedToFindBlock)();
......@@ -119,10 +119,10 @@ enum CanonicalParamType
CPT_ptr
};
extern void (*ngen_CC_Start)(shil_opcode* op);
extern void (*ngen_CC_Param)(shil_opcode* op,shil_param* par,CanonicalParamType tp);
extern void (*ngen_CC_Call)(shil_opcode* op,void* function);
extern void (*ngen_CC_Finish)(shil_opcode* op);
void ngen_CC_Start(shil_opcode* op);
void ngen_CC_Param(shil_opcode* op,shil_param* par,CanonicalParamType tp);
void ngen_CC_Call(shil_opcode* op,void* function);
void ngen_CC_Finish(shil_opcode* op);
RuntimeBlockInfo* ngen_AllocateBlock();
......
......@@ -571,12 +571,12 @@ struct CC_PS
};
vector<CC_PS> CC_pars;
void ngen_CC_Start_arm(shil_opcode* op)
void ngen_CC_Start(shil_opcode* op)
{
CC_pars.clear();
}
void ngen_CC_Param_arm(shil_opcode* op,shil_param* par,CanonicalParamType tp)
void ngen_CC_Param(shil_opcode* op,shil_param* par,CanonicalParamType tp)
{
switch(tp)
{
......@@ -637,7 +637,7 @@ void ngen_CC_Param_arm(shil_opcode* op,shil_param* par,CanonicalParamType tp)
}
}
void ngen_CC_Call_arm(shil_opcode* op,void* function)
void ngen_CC_Call(shil_opcode* op,void* function)
{
u32 rd=r0;
u32 fd=f0;
......@@ -699,7 +699,7 @@ void ngen_CC_Call_arm(shil_opcode* op,void* function)
CALL((u32)function);
}
void ngen_CC_Finish_arm(shil_opcode* op)
void ngen_CC_Finish(shil_opcode* op)
{
CC_pars.clear();
}
......@@ -2206,7 +2206,7 @@ __default:
}
void ngen_Compile_arm(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise)
void ngen_Compile(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise)
{
//printf("Compile: %08X, %d, %d\n",block->addr,staging,optimise);
block->code=(DynarecCodeEntryPtr)EMIT_GET_PTR();
......@@ -2367,6 +2367,9 @@ void ngen_Compile_arm(RuntimeBlockInfo* block,bool force_checks, bool reset, boo
block->host_code_size=(pEnd-(u8*)block->code);
}
void ngen_ResetBlocks()
{
}
/*
SHR ..
CMP ..
......@@ -2375,7 +2378,7 @@ void ngen_Compile_arm(RuntimeBlockInfo* block,bool force_checks, bool reset, boo
add
str
*/
void ngen_init_arm(void)
void ngen_init(void)
{
INFO_LOG(DYNAREC, "Initializing the ARM32 dynarec");
verify(FPCB_OFFSET == -0x2100000 || FPCB_OFFSET == -0x4100000);
......
......@@ -83,13 +83,13 @@ void ngen_mainloop(void* v_cntx)
} while (restarting);
}
void ngen_init_arm64()
void ngen_init()
{
INFO_LOG(DYNAREC, "Initializing the ARM64 dynarec");
ngen_FailedToFindBlock = &ngen_FailedToFindBlock_nommu;
}
void ngen_ResetBlocks_arm64()
void ngen_ResetBlocks()
{
mainloop = NULL;
if (mmu_enabled())
......@@ -2105,7 +2105,7 @@ private:
static Arm64Assembler* compiler;
void ngen_Compile_arm64(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
void ngen_Compile(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
{
verify(emit_FreeSpace() >= 16 * 1024);
......@@ -2117,22 +2117,22 @@ void ngen_Compile_arm64(RuntimeBlockInfo* block, bool force_checks, bool reset,
compiler = NULL;
}
void ngen_CC_Start_arm64(shil_opcode* op)
void ngen_CC_Start(shil_opcode* op)
{
compiler->ngen_CC_Start(op);
}
void ngen_CC_Param_arm64(shil_opcode* op, shil_param* par, CanonicalParamType tp)
void ngen_CC_Param(shil_opcode* op, shil_param* par, CanonicalParamType tp)
{
compiler->ngen_CC_Param(*op, *par, tp);
}
void ngen_CC_Call_arm64(shil_opcode*op, void* function)
void ngen_CC_Call(shil_opcode*op, void* function)
{
compiler->ngen_CC_Call(op, function);
}
void ngen_CC_Finish_arm64(shil_opcode* op)
void ngen_CC_Finish(shil_opcode* op)
{
}
......
......@@ -28,7 +28,7 @@ void ngen_blockcheckfail_CC(u32 pc) {
}
int idxnxx = 0;
void ngen_ResetBlocks_cpp(void)
void ngen_ResetBlocks(void)
{
idxnxx = 0;
}
......@@ -1875,7 +1875,7 @@ public:
BlockCompilercpp *compilercpp_data;
void ngen_Compile_cpp(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
void ngen_Compile(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
{
verify(emit_FreeSpace() >= 16 * 1024);
......@@ -1888,25 +1888,25 @@ void ngen_Compile_cpp(RuntimeBlockInfo* block, bool force_checks, bool reset, bo
delete compiler;
}
void ngen_CC_Call_cpp(shil_opcode*op, void* function)
void ngen_CC_Call(shil_opcode*op, void* function)
{
BlockCompilercpp *compiler = compilercpp_data;
compiler->ngen_CC_Call(op, function);
}
void ngen_CC_Finish_cpp(shil_opcode* op)
void ngen_CC_Finish(shil_opcode* op)
{
BlockCompilercpp *compiler = compilercpp_data;
compiler->ngen_CC_Finish(op);
}
void ngen_CC_Start_cpp(shil_opcode* op)
void ngen_CC_Start(shil_opcode* op)
{
BlockCompilercpp *compiler = compilercpp_data;
compiler->ngen_CC_Start(op);
}
void ngen_CC_Param_cpp(shil_opcode* op,shil_param* par,CanonicalParamType tp)
void ngen_CC_Param(shil_opcode* op,shil_param* par,CanonicalParamType tp)
{
BlockCompilercpp *compiler = compilercpp_data;
compiler->ngen_CC_param(*op, *par, tp);
......
......@@ -169,6 +169,14 @@ WIN32_ONLY( ".seh_pushreg %r14 \n\t")
#undef _U
#undef _S
void ngen_init()
{
}
void ngen_ResetBlocks()
{
}
RuntimeBlockInfo* ngen_AllocateBlock(void)
{
return new DynaRBI();
......@@ -2136,7 +2144,7 @@ void X64RegAlloc::Writeback_FPU(u32 reg, s8 nreg)
static BlockCompilerx64* compilerx64_data;
void ngen_Compile_x64(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
void ngen_Compile(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise)
{
verify(CPU_RUNNING == offsetof(Sh4RCB, cntx.CpuRunning));
verify(PC == offsetof(Sh4RCB, cntx.pc));
......@@ -2151,25 +2159,25 @@ void ngen_Compile_x64(RuntimeBlockInfo* block, bool force_checks, bool reset, bo
delete compiler;
}
void ngen_CC_Call_x64(shil_opcode*op, void* function)
void ngen_CC_Call(shil_opcode*op, void* function)
{
BlockCompilerx64 *compiler = compilerx64_data;
compiler->ngen_CC_Call(*op, function);
}
void ngen_CC_Param_x64(shil_opcode* op,shil_param* par,CanonicalParamType tp)
void ngen_CC_Param(shil_opcode* op,shil_param* par,CanonicalParamType tp)
{
BlockCompilerx64 *compiler = compilerx64_data;
compiler->ngen_CC_param(*op, *par, tp);
}
void ngen_CC_Start_x64(shil_opcode* op)
void ngen_CC_Start(shil_opcode* op)
{
BlockCompilerx64 *compiler = compilerx64_data;
compiler->ngen_CC_Start(*op);
}
void ngen_CC_Finish_x64(shil_opcode* op)
void ngen_CC_Finish(shil_opcode* op)
{
}
......
......@@ -18,6 +18,11 @@ struct DynaRBI: RuntimeBlockInfo
}
};
void ngen_ResetBlocks()
{
mem_code_end = 0;
}
RuntimeBlockInfo* ngen_AllocateBlock(void)
{
return new DynaRBI();
......@@ -261,7 +266,7 @@ void CheckBlock(RuntimeBlockInfo* block,x86_ptr_imm place)
}
void ngen_Compile_x86(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise)
void ngen_Compile(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise)
{
//initialise stuff
DetectCpuFeatures();
......@@ -689,7 +694,7 @@ size_t mem_code_base=0;
size_t mem_code_end=0;
void* mem_code[3][2][5];
void ngen_init_x86_32bit(void)
void ngen_init(void)
{
if (mem_code_end != 0)
return;
......
......@@ -3,110 +3,6 @@
int cycle_counter;
static void ngen_ResetBlocksNop() { }
void (*ngen_Compile)(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise);
void (*ngen_CC_Start)(shil_opcode* op);
void (*ngen_CC_Call)(shil_opcode*op, void* function);
void (*ngen_CC_Param)(shil_opcode* op, shil_param* par, CanonicalParamType tp);
void (*ngen_CC_Finish)(shil_opcode* op);
void (*ngen_ResetBlocks)() = &ngen_ResetBlocksNop;
void ngen_init(void)
{
switch (settings.dynarec.Type)
{
case 0: /* native dynarec */
#if FEAT_SHREC == DYNAREC_JIT && HOST_CPU == CPU_X86
extern void ngen_init_x86_32bit(void);
extern void ngen_Compile_x86(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise);
extern void ngen_CC_Start_x86(shil_opcode* op);
extern void ngen_CC_Call_x86(shil_opcode*op,void* function);
extern void ngen_CC_Param_x86(shil_opcode* op,shil_param* par,CanonicalParamType tp);
extern void ngen_CC_Finish_x86(shil_opcode* op);
ngen_init_x86_32bit();
ngen_Compile = ngen_Compile_x86;
ngen_CC_Start = ngen_CC_Start_x86;
ngen_CC_Call = ngen_CC_Call_x86;
ngen_CC_Param = ngen_CC_Param_x86;
ngen_CC_Finish = ngen_CC_Finish_x86;
break;
#elif FEAT_SHREC == DYNAREC_JIT && HOST_CPU == CPU_ARM
extern void ngen_init_arm(void);
extern void ngen_Compile_arm(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise);
extern void ngen_CC_Start_arm(shil_opcode* op);
extern void ngen_CC_Call_arm(shil_opcode* op,void* function);
extern void ngen_CC_Param_arm(shil_opcode* op,shil_param* par,CanonicalParamType tp);
extern void ngen_CC_Finish_arm(shil_opcode* op);
ngen_init_arm();
ngen_Compile = ngen_Compile_arm;
ngen_CC_Start = ngen_CC_Start_arm;
ngen_CC_Call = ngen_CC_Call_arm;
ngen_CC_Param = ngen_CC_Param_arm;
ngen_CC_Finish = ngen_CC_Finish_arm;
break;
#elif FEAT_SHREC == DYNAREC_JIT && HOST_CPU == CPU_ARM64
extern void ngen_init_arm64(void);
extern void ngen_Compile_arm64(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise);
extern void ngen_CC_Start_arm64(shil_opcode* op);
extern void ngen_CC_Call_arm64(shil_opcode* op,void* function);
extern void ngen_CC_Param_arm64(shil_opcode* op,shil_param* par,CanonicalParamType tp);
extern void ngen_CC_Finish_arm64(shil_opcode* op);
extern void ngen_ResetBlocks_arm64();
ngen_init_arm64();
ngen_Compile = ngen_Compile_arm64;
ngen_CC_Start = ngen_CC_Start_arm64;
ngen_CC_Call = ngen_CC_Call_arm64;
ngen_CC_Param = ngen_CC_Param_arm64;
ngen_CC_Finish = ngen_CC_Finish_arm64;
ngen_ResetBlocks = ngen_ResetBlocks_arm64;
break;
#elif FEAT_SHREC == DYNAREC_JIT && HOST_CPU == CPU_X64
extern void ngen_Compile_x64(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise);
extern void ngen_CC_Start_x64(shil_opcode* op);
extern void ngen_CC_Call_x64(shil_opcode*op, void* function);
extern void ngen_CC_Param_x64(shil_opcode* op,shil_param* par,CanonicalParamType tp);
extern void ngen_CC_Finish_x64(shil_opcode* op);
ngen_Compile = ngen_Compile_x64;
ngen_CC_Start = ngen_CC_Start_x64;
ngen_CC_Call = ngen_CC_Call_x64;
ngen_CC_Param = ngen_CC_Param_x64;
ngen_CC_Finish = ngen_CC_Finish_x64;
break;
#elif defined(TARGET_NO_JIT)
/* we want this to fall through */
#else
break;
#endif
case 1: /* rec_cpp */
#ifdef TARGET_NO_JIT
extern void ngen_Compile_cpp(RuntimeBlockInfo* block, bool force_checks, bool reset, bool staging, bool optimise);
extern void ngen_CC_Start_cpp(shil_opcode* op);
extern void ngen_CC_Call_cpp(shil_opcode*op, void* function);
extern void ngen_CC_Param_cpp(shil_opcode* op,shil_param* par,CanonicalParamType tp);
extern void ngen_CC_Finish_cpp(shil_opcode* op);
extern void ngen_ResetBlocks_cpp();
ngen_Compile = ngen_Compile_cpp;
ngen_CC_Start = ngen_CC_Start_cpp;
ngen_CC_Call = ngen_CC_Call_cpp;
ngen_CC_Param = ngen_CC_Param_cpp;
ngen_CC_Finish = ngen_CC_Finish_cpp;
ngen_ResetBlocks = ngen_ResetBlocks_cpp;
#endif
break;
}
}
void ngen_GetFeatures(ngen_features* dst)
{
dst->InterpreterFallback = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment