version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2012/10/09 09:19:18
|
Line 66 static sljit_ub* generate_far_jump_code(struct sljit_j
|
Line 66 static sljit_ub* generate_far_jump_code(struct sljit_j
|
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size) |
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size) |
{ |
{ |
int size; |
int size; |
|
int locals_offset; |
sljit_ub *buf; |
sljit_ub *buf; |
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
Line 75 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
Line 76 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
compiler->saveds = saveds; |
compiler->saveds = saveds; |
compiler->args = args; |
compiler->args = args; |
compiler->flags_saved = 0; |
compiler->flags_saved = 0; |
|
#if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
|
compiler->logical_local_size = local_size; |
|
#endif |
|
|
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL) |
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL) |
size = 1 + (saveds <= 3 ? saveds : 3) + (args > 0 ? (args * 2) : 0) + (args > 2 ? 2 : 0); |
size = 1 + (saveds <= 3 ? saveds : 3) + (args > 0 ? (args * 2) : 0) + (args > 2 ? 2 : 0); |
Line 132 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
Line 136 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
} |
} |
#endif |
#endif |
|
|
local_size = (local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1); | locals_offset = 2 * sizeof(sljit_uw); |
compiler->temporaries_start = local_size; | compiler->temporaries_start = locals_offset; |
if (temporaries > 3) |
if (temporaries > 3) |
local_size += (temporaries - 3) * sizeof(sljit_uw); | locals_offset += (temporaries - 3) * sizeof(sljit_uw); |
compiler->saveds_start = local_size; | compiler->saveds_start = locals_offset; |
if (saveds > 3) |
if (saveds > 3) |
local_size += (saveds - 3) * sizeof(sljit_uw); | locals_offset += (saveds - 3) * sizeof(sljit_uw); |
| compiler->locals_offset = locals_offset; |
| local_size = locals_offset + ((local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1)); |
|
|
#ifdef _WIN32 |
#ifdef _WIN32 |
if (local_size > 1024) { |
if (local_size > 1024) { |
FAIL_IF(emit_do_imm(compiler, 0xb8 + reg_map[SLJIT_TEMPORARY_REG1], local_size)); |
FAIL_IF(emit_do_imm(compiler, 0xb8 + reg_map[SLJIT_TEMPORARY_REG1], local_size)); |
FAIL_IF(sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_touch_stack))); | FAIL_IF(sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack))); |
} |
} |
#endif |
#endif |
|
|
compiler->local_size = local_size; |
compiler->local_size = local_size; |
if (local_size > 0) | SLJIT_ASSERT(local_size > 0); |
return emit_non_cum_binary(compiler, 0x2b, 0x29, 0x5 << 3, 0x2d, | return emit_non_cum_binary(compiler, 0x2b, 0x29, 0x5 << 3, 0x2d, |
SLJIT_LOCALS_REG, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, local_size); | SLJIT_LOCALS_REG, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, local_size); |
|
|
return SLJIT_SUCCESS; |
return SLJIT_SUCCESS; |
} |
} |
|
|
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size) |
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size) |
{ |
{ |
|
int locals_offset; |
|
|
CHECK_ERROR_VOID(); |
CHECK_ERROR_VOID(); |
check_sljit_set_context(compiler, args, temporaries, saveds, local_size); |
check_sljit_set_context(compiler, args, temporaries, saveds, local_size); |
|
|
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
compiler->saveds = saveds; |
compiler->saveds = saveds; |
compiler->args = args; |
compiler->args = args; |
compiler->local_size = (local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1); | #if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
compiler->temporaries_start = compiler->local_size; | compiler->logical_local_size = local_size; |
| #endif |
| |
| locals_offset = 2 * sizeof(sljit_uw); |
| compiler->temporaries_start = locals_offset; |
if (temporaries > 3) |
if (temporaries > 3) |
compiler->local_size += (temporaries - 3) * sizeof(sljit_uw); | locals_offset += (temporaries - 3) * sizeof(sljit_uw); |
compiler->saveds_start = compiler->local_size; | compiler->saveds_start = locals_offset; |
if (saveds > 3) |
if (saveds > 3) |
compiler->local_size += (saveds - 3) * sizeof(sljit_uw); | locals_offset += (saveds - 3) * sizeof(sljit_uw); |
| compiler->locals_offset = locals_offset; |
| compiler->local_size = locals_offset + ((local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1)); |
} |
} |
|
|
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw) |
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw) |
Line 180 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct
|
Line 194 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_return(compiler, op, src, srcw); |
check_sljit_emit_return(compiler, op, src, srcw); |
SLJIT_ASSERT(compiler->args >= 0); |
SLJIT_ASSERT(compiler->args >= 0); |
|
ADJUST_LOCAL_OFFSET(src, srcw); |
|
|
compiler->flags_saved = 0; |
compiler->flags_saved = 0; |
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); |
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); |
|
|
if (compiler->local_size > 0) | SLJIT_ASSERT(compiler->local_size > 0); |
FAIL_IF(emit_cum_binary(compiler, 0x03, 0x01, 0x0 << 3, 0x05, | FAIL_IF(emit_cum_binary(compiler, 0x03, 0x01, 0x0 << 3, 0x05, |
SLJIT_LOCALS_REG, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, compiler->local_size)); | SLJIT_LOCALS_REG, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, compiler->local_size)); |
|
|
size = 2 + (compiler->saveds <= 3 ? compiler->saveds : 3); |
size = 2 + (compiler->saveds <= 3 ? compiler->saveds : 3); |
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL) |
#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL) |
Line 431 static SLJIT_INLINE int call_with_args(struct sljit_co
|
Line 446 static SLJIT_INLINE int call_with_args(struct sljit_co
|
return SLJIT_SUCCESS; |
return SLJIT_SUCCESS; |
} |
} |
|
|
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size) | SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw) |
{ |
{ |
sljit_ub *buf; |
sljit_ub *buf; |
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_fast_enter(compiler, dst, dstw, args, temporaries, saveds, local_size); | check_sljit_emit_fast_enter(compiler, dst, dstw); |
| ADJUST_LOCAL_OFFSET(dst, dstw); |
|
|
compiler->temporaries = temporaries; |
|
compiler->saveds = saveds; |
|
compiler->args = args; |
|
compiler->local_size = (local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1); |
|
compiler->temporaries_start = compiler->local_size; |
|
if (temporaries > 3) |
|
compiler->local_size += (temporaries - 3) * sizeof(sljit_uw); |
|
compiler->saveds_start = compiler->local_size; |
|
if (saveds > 3) |
|
compiler->local_size += (saveds - 3) * sizeof(sljit_uw); |
|
|
|
CHECK_EXTRA_REGS(dst, dstw, (void)0); |
CHECK_EXTRA_REGS(dst, dstw, (void)0); |
|
|
if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) { |
if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) { |
Line 481 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(st
|
Line 486 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(st
|
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_fast_return(compiler, src, srcw); |
check_sljit_emit_fast_return(compiler, src, srcw); |
|
ADJUST_LOCAL_OFFSET(src, srcw); |
|
|
CHECK_EXTRA_REGS(src, srcw, (void)0); |
CHECK_EXTRA_REGS(src, srcw, (void)0); |
|
|