+2006-11-27 Kirill Kononenko <Kirill.Kononenko@gmail.com>
+
+ * jit/jit-rules-x86.c (throw_builtin):
+ * jit/jit-rules-x86.ins (JIT_OP_THROW, JIT_OP_LOAD_PC): directly use
+ the inst variable to get current PC value for the position-dependent
+ code case (patch #5503).
+
2006-11-27 Aleksey Demakov <ademakov@gmail.com>
* include/jit/jit-context.h: add JIT_OPTION_POSITION_INDEPENDENT
* jit/jit-function.c (_jit_function_ensure_builder): initialize
position_independent field.
+ * jit/jit-rules-x86.c (throw_builtin):
+ * jit/jit-rules-x86.ins (JIT_OP_ADDRESS_OF_LABEL, JIT_OP_JUMP_TABLE)
+ (JIT_OP_THROW, JIT_OP_LOAD_PC): add position_independent check and
+ stub missing cases.
+
2006-11-26 Kirill Kononenko <Kirill.Kononenko@gmail.com>
* jit/jit-rules-x86.ins: if JIT_USE_SIGNALS is defined do not emit
if(func->builder->setjmp_value != 0)
{
_jit_gen_fix_value(func->builder->setjmp_value);
- x86_call_imm(inst, 0);
- x86_pop_membase(inst, X86_EBP,
- func->builder->setjmp_value->frame_offset +
- jit_jmp_catch_pc_offset);
+ if(func->builder->position_independent)
+ {
+ x86_call_imm(inst, 0);
+ x86_pop_membase(inst, X86_EBP,
+ func->builder->setjmp_value->frame_offset
+ + jit_jmp_catch_pc_offset);
+ }
+ else
+ {
+ int pc = (int) inst;
+ x86_mov_membase_imm(inst, X86_EBP,
+ func->builder->setjmp_value->frame_offset
+ + jit_jmp_catch_pc_offset, pc, 4);
+ }
}
/* Push the exception type onto the stack */
/* We have a "setjmp" block in the current function,
so we must record the location of the throw first */
_jit_gen_fix_value(func->builder->setjmp_value);
- x86_call_imm(inst, 0);
- x86_pop_membase(inst, X86_EBP,
- func->builder->setjmp_value->frame_offset +
- jit_jmp_catch_pc_offset);
+ if(func->builder->position_independent)
+ {
+ x86_call_imm(inst, 0);
+ x86_pop_membase(inst, X86_EBP,
+ func->builder->setjmp_value->frame_offset
+ + jit_jmp_catch_pc_offset);
+ }
+ else
+ {
+ int pc = (int) inst;
+ x86_mov_membase_imm(inst, X86_EBP,
+ func->builder->setjmp_value->frame_offset
+ + jit_jmp_catch_pc_offset, pc, 4);
+ }
}
x86_call_code(inst, (void *)jit_exception_throw);
}
JIT_OP_LOAD_PC:
[=reg] -> {
- x86_call_imm(inst, 0);
- x86_pop_reg(inst, $1);
+ if(func->builder->position_independent)
+ {
+ x86_call_imm(inst, 0);
+ x86_pop_reg(inst, $1);
+ }
+ else
+ {
+ int pc = (int) inst;
+ x86_mov_reg_imm(inst, $1, pc);
+ }
}
JIT_OP_LOAD_EXCEPTION_PC: manual