It's needed for spilling the exception object reference at exception handler entry.
Signed-off-by: Tomek Grabiec <[email protected]> --- arch/x86/emit-code_32.c | 8 ++++++++ arch/x86/include/arch/instruction.h | 2 ++ arch/x86/instruction.c | 9 +++++++++ arch/x86/lir-printer.c | 7 +++++++ 4 files changed, 26 insertions(+), 0 deletions(-) diff --git a/arch/x86/emit-code_32.c b/arch/x86/emit-code_32.c index 43ae427..3fbd072 100644 --- a/arch/x86/emit-code_32.c +++ b/arch/x86/emit-code_32.c @@ -417,6 +417,13 @@ void emit_prolog(struct buffer *buf, unsigned long nr_locals) __emit_sub_imm_reg(buf, nr_locals * sizeof(unsigned long), REG_ESP); } +static void emit_pop_memlocal(struct buffer *buf, struct operand *operand) +{ + unsigned long disp = slot_offset(operand->slot); + + __emit_membase_reg(buf, 0x8f, REG_EBP, disp, REG_EAX); +} + static void emit_pop_reg(struct buffer *buf, struct operand *operand) { __emit_pop_reg(buf, mach_reg(&operand->reg)); @@ -858,6 +865,7 @@ static struct emitter emitters[] = { DECL_EMITTER(INSN_OR_REG_REG, emit_or_reg_reg, TWO_OPERANDS), DECL_EMITTER(INSN_PUSH_IMM, emit_push_imm, SINGLE_OPERAND), DECL_EMITTER(INSN_PUSH_REG, emit_push_reg, SINGLE_OPERAND), + DECL_EMITTER(INSN_POP_MEMLOCAL, emit_pop_memlocal, SINGLE_OPERAND), DECL_EMITTER(INSN_POP_REG, emit_pop_reg, SINGLE_OPERAND), DECL_EMITTER(INSN_RET, emit_ret, NO_OPERANDS), DECL_EMITTER(INSN_SAR_IMM_REG, emit_sar_imm_reg, TWO_OPERANDS), diff --git a/arch/x86/include/arch/instruction.h b/arch/x86/include/arch/instruction.h index 6264946..0a5cd20 100644 --- a/arch/x86/include/arch/instruction.h +++ b/arch/x86/include/arch/instruction.h @@ -92,6 +92,7 @@ enum insn_type { INSN_OR_REG_REG, INSN_PUSH_IMM, INSN_PUSH_REG, + INSN_POP_MEMLOCAL, INSN_POP_REG, INSN_RET, INSN_SAR_IMM_REG, @@ -147,6 +148,7 @@ struct insn *imm_membase_insn(enum insn_type, unsigned long, struct var_info *, struct insn *imm_insn(enum insn_type, unsigned long); struct insn *rel_insn(enum insn_type, unsigned long); struct insn *branch_insn(enum insn_type, struct basic_block *); +struct insn *memlocal_insn(enum insn_type, struct stack_slot *); /* * These functions are used by generic code to insert spill/reload diff --git a/arch/x86/instruction.c b/arch/x86/instruction.c index 467bb74..d3ce609 100644 --- a/arch/x86/instruction.c +++ b/arch/x86/instruction.c @@ -307,3 +307,12 @@ struct insn *branch_insn(enum insn_type insn_type, struct basic_block *if_true) } return insn; } + +struct insn *memlocal_insn(enum insn_type insn_type, struct stack_slot *slot) +{ + struct insn *insn = alloc_insn(insn_type); + if (insn) + init_memlocal_operand(insn, 0, slot); + + return insn; +} diff --git a/arch/x86/lir-printer.c b/arch/x86/lir-printer.c index 3c9b6d1..9707abd 100644 --- a/arch/x86/lir-printer.c +++ b/arch/x86/lir-printer.c @@ -369,6 +369,12 @@ static int print_push_reg(struct string *str, struct insn *insn) return print_reg(str, &insn->operand); } +static int print_pop_memlocal(struct string *str, struct insn *insn) +{ + print_func_name(str); + return print_memlocal(str, &insn->operand); +} + static int print_pop_reg(struct string *str, struct insn *insn) { print_func_name(str); @@ -494,6 +500,7 @@ static print_insn_fn insn_printers[] = { [INSN_OR_REG_REG] = print_or_reg_reg, [INSN_PUSH_IMM] = print_push_imm, [INSN_PUSH_REG] = print_push_reg, + [INSN_POP_MEMLOCAL] = print_pop_memlocal, [INSN_POP_REG] = print_pop_reg, [INSN_RET] = print_ret, [INSN_SAR_IMM_REG] = print_sar_imm_reg, -- 1.6.0.6 ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Jatovm-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jatovm-devel
