diff --git a/sourcepawn/vm/jit/x86/dll_exports.cpp b/sourcepawn/vm/jit/x86/dll_exports.cpp index db593b19..1cbaa90a 100644 --- a/sourcepawn/vm/jit/x86/dll_exports.cpp +++ b/sourcepawn/vm/jit/x86/dll_exports.cpp @@ -12,7 +12,7 @@ EXPORTFUNC void GiveEnginePointer(SourcePawn::ISourcePawnEngine *engine_p) EXPORTFUNC unsigned int GetExportCount() { - return 0; + return 1; } EXPORTFUNC SourcePawn::IVirtualMachine *GetExport(unsigned int exportnum) diff --git a/sourcepawn/vm/jit/x86/jit_x86.cpp b/sourcepawn/vm/jit/x86/jit_x86.cpp index b28619f9..8e6e4e6e 100644 --- a/sourcepawn/vm/jit/x86/jit_x86.cpp +++ b/sourcepawn/vm/jit/x86/jit_x86.cpp @@ -1138,7 +1138,7 @@ inline void WriteOp_Retn(JitWriter *jit) /* pop params */ //mov ecx, [edi] - //lea edi, [edi+edi*4+4] + //lea edi, [edi+ecx*4+4] IA32_Mov_Reg_Rm(jit, AMX_REG_TMP, AMX_REG_STK, MOD_MEM_REG); IA32_Lea_Reg_DispRegMultImm8(jit, AMX_REG_STK, AMX_REG_STK, AMX_REG_TMP, SCALE4, 4); @@ -1538,7 +1538,9 @@ sp_context_t *JITX86::CompileToContext(ICompilation *co, int *err) OPCODE op; int op_c; - /* FIRST PASS (light load) - Get initial opcode information */ + /* FIRST PASS (light load) - Get initial opcode information + * :TODO: remove this pass soon, it's not needed anymore! + */ for (cip = code; cip < end_cip;) { op = (OPCODE)*(ucell_t *)cip; diff --git a/sourcepawn/vm/jit/x86/jit_x86.h b/sourcepawn/vm/jit/x86/jit_x86.h index ee0e0524..cf720dc3 100644 --- a/sourcepawn/vm/jit/x86/jit_x86.h +++ b/sourcepawn/vm/jit/x86/jit_x86.h @@ -69,7 +69,7 @@ jitoffs_t RelocLookup(JitWriter *jit, cell_t pcode_offs, bool relative=false); #define AMX_INFO_RETVAL 8 //physical #define AMX_INFO_CONTEXT 12 //physical #define AMX_INFO_STACKTOP 16 //relocated -#define AMX_INFO_HEAPLOW 20 //not relocated +#define AMX_INFO_HEAPLOW 20 //not relocated. currently unused #define AMX_INFO_STACKTOP_U 24 //not relocated extern ISourcePawnEngine *engine; diff --git a/sourcepawn/vm/jit/x86/opcode_helpers.cpp b/sourcepawn/vm/jit/x86/opcode_helpers.cpp index a218ff82..a02032a3 100644 --- a/sourcepawn/vm/jit/x86/opcode_helpers.cpp +++ b/sourcepawn/vm/jit/x86/opcode_helpers.cpp @@ -322,7 +322,6 @@ void Macro_PushN_Addr(JitWriter *jit, int i) IA32_Lea_DispRegImm32(jit, AMX_REG_TMP, AMX_REG_PRI, val); IA32_Mov_Rm_Reg_Disp8(jit, AMX_REG_STK, AMX_REG_TMP, -4*n); } while (n++ < i); - //:TODO: fix the case of this size > imm8! IA32_Sub_Rm_Imm8(jit, AMX_REG_STK, 4*i, MOD_REG); IA32_Pop_Reg(jit, AMX_REG_PRI); } diff --git a/sourcepawn/vm/jit/x86/ungen_opcodes.h b/sourcepawn/vm/jit/x86/ungen_opcodes.h index 466ff54c..94836acf 100644 --- a/sourcepawn/vm/jit/x86/ungen_opcodes.h +++ b/sourcepawn/vm/jit/x86/ungen_opcodes.h @@ -56,9 +56,11 @@ inline void WriteOp_Align_Pri(JitWriter *jit) //xor eax, cell_t val = sizeof(cell_t) - jit->read_cell(); if (val < SCHAR_MAX && val > SCHAR_MIN) + { IA32_Xor_Rm_Imm8(jit, AMX_REG_PRI, MOD_REG, (jit_int8_t)val); - else + } else { IA32_Xor_Eax_Imm32(jit, val); + } } inline void WriteOp_Align_Alt(JitWriter *jit) @@ -66,9 +68,11 @@ inline void WriteOp_Align_Alt(JitWriter *jit) //xor edx, cell_t val = sizeof(cell_t) - jit->read_cell(); if (val < SCHAR_MAX && val > SCHAR_MIN) + { IA32_Xor_Rm_Imm8(jit, AMX_REG_ALT, MOD_REG, (jit_int8_t)val); - else + } else { IA32_Xor_Rm_Imm32(jit, AMX_REG_ALT, MOD_REG, val); + } } inline void WriteOp_Cmps(JitWriter *jit) diff --git a/sourcepawn/vm/jit/x86/x86_macros.h b/sourcepawn/vm/jit/x86/x86_macros.h index 0a733d0a..1a8d957d 100644 --- a/sourcepawn/vm/jit/x86/x86_macros.h +++ b/sourcepawn/vm/jit/x86/x86_macros.h @@ -1,6 +1,8 @@ #ifndef _INCLUDE_JIT_X86_MACROS_H #define _INCLUDE_JIT_X86_MACROS_H +#include + //MOD R/M #define MOD_MEM_REG 0 #define MOD_DISP8 1