Landed sourcepawn-1.2. The big changes:

1) JIT compilation/optimization now occurs per-function, and only when functions are first used.  We're now officially a whole-method JIT rather than an AOT compiler (albiet, still a simple JIT).  This has two implications: Functions are now much better abstracted internally, and loading a plugin is now much less expensive.  If a function contains calls to other functions, THOSE functions are only compiled when they're invoked as well.

2) I've removed debug mode.  We always show full backtraces now, as there was a very cheap way to implement this which really cleaned up everything.  This is great for a number of reasons -- there's less code, the JIT is better designed, we don't need to relocate debug tables, and best of all we no longer have to tell users to enable debug mode at their own expense.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402459
This commit is contained in:
David Anderson
2008-08-15 05:22:26 +00:00
parent 95aca7b61b
commit 7875fe1acd
49 changed files with 3475 additions and 1724 deletions
+4
View File
@@ -65,6 +65,10 @@ public:
inptr++;
return val;
}
inline cell_t peek_cell()
{
return *inptr;
}
inline cell_t *read_cellptr()
{
cell_t *val = *(cell_t **)(inptr);
+52 -5
View File
@@ -998,6 +998,38 @@ inline void IA32_Mov_Rm_Imm32_Disp32(JitWriter *jit,
jit->write_int32(val);
}
inline void IA32_Mov_Rm_Imm32_SIB(JitWriter *jit,
jit_uint8_t dest,
jit_int32_t val,
jit_int32_t disp,
jit_uint8_t index,
jit_uint8_t scale)
{
jit->write_ubyte(IA32_MOV_RM_IMM32);
if (disp >= SCHAR_MIN && disp <= SCHAR_MAX)
{
jit->write_ubyte(ia32_modrm(MOD_DISP8, 0, REG_SIB));
}
else
{
jit->write_ubyte(ia32_modrm(MOD_DISP32, 0, REG_SIB));
}
jit->write_ubyte(ia32_sib(scale, index, dest));
if (disp >= SCHAR_MIN && disp <= SCHAR_MAX)
{
jit->write_byte((jit_int8_t)disp);
}
else
{
jit->write_int32(disp);
}
jit->write_int32(val);
}
inline void IA32_Mov_RmEBP_Imm32_Disp_Reg(JitWriter *jit,
jit_uint8_t dest_base,
jit_uint8_t dest_index,
@@ -1347,24 +1379,39 @@ inline void IA32_Write_Jump32_Abs(JitWriter *jit, jitoffs_t jmp, void *target)
jit->outptr = oldptr;
}
/* For writing and auto-calculating an absolute target */
inline void IA32_Jump_Imm32_Abs(JitWriter *jit, jitoffs_t target)
/* For writing and auto-calculating a relative target */
inline void IA32_Jump_Imm32_Rel(JitWriter *jit, jitoffs_t target)
{
/* :TODO: this should work, but does it? */
jit->write_ubyte(IA32_JMP_IMM32);
IA32_Write_Jump32(jit, jit->get_outputpos(), target);
jit->outptr += 4;
}
inline void IA32_Jump_Cond_Imm32_Abs(JitWriter *jit, jit_uint8_t cond, jitoffs_t target)
/* For writing and auto-calculating an absolute target */
inline void IA32_Jump_Imm32_Abs(JitWriter *jit, void *target)
{
jitoffs_t jmp;
jmp = IA32_Jump_Imm32(jit, 0);
IA32_Write_Jump32_Abs(jit, jmp, target);
}
inline void IA32_Jump_Cond_Imm32_Rel(JitWriter *jit, jit_uint8_t cond, jitoffs_t target)
{
/* :TODO: this should work, but does it? */
jit->write_ubyte(IA32_JCC_IMM32_1);
jit->write_ubyte(IA32_JCC_IMM32_2+cond);
IA32_Write_Jump32(jit, jit->get_outputpos(), target);
jit->outptr += 4;
}
inline void IA32_Jump_Cond_Imm32_Abs(JitWriter *jit, jit_uint8_t cond, void *target)
{
jit->write_ubyte(IA32_JCC_IMM32_1);
jit->write_ubyte(IA32_JCC_IMM32_2+cond);
IA32_Write_Jump32_Abs(jit, jit->get_outputpos(), target);
jit->outptr += 4;
}
inline void IA32_Send_Jump8_Here(JitWriter *jit, jitoffs_t jmp)
{
jitoffs_t curptr = jit->get_outputpos();