From ccc54b2abd9064cd2a86b46b5adc70611f0bf78d Mon Sep 17 00:00:00 2001 From: Aleksey Demakov Date: Sat, 2 Sep 2006 13:46:28 +0000 Subject: [PATCH] remove last traces of register allocation from the interpreter --- ChangeLog | 6 ++++++ jit/jit-interp.c | 18 +++++++---------- jit/jit-rules-interp.c | 45 +++++++++++++----------------------------- 3 files changed, 27 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index b46a3f6..082138c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-02 Aleksey Demakov + + * jit/jit-interp.c (_jit_run_function): + * jit/jit-rules-interp.c (_jit_gen_insn): remove last traces of + register allocation from the interpreter. + 2006-08-31 Klaus Treichel * configure.in: Replace the deprecated AM_PROG_LIBTOOL with the current diff --git a/jit/jit-interp.c b/jit/jit-interp.c index a8dd9be..3cebea7 100644 --- a/jit/jit-interp.c +++ b/jit/jit-interp.c @@ -3532,8 +3532,8 @@ restart_tail: tempptr2 = ((jit_item *)tempptr2)[1].ptr_value; --temparg; } - VM_STK_PTRP = ((jit_item *)tempptr) + VM_NINT_ARG; - VM_MODIFY_PC_AND_STACK(3, -1); + VM_R0_PTR = ((jit_item *)tempptr) + VM_NINT_ARG; + VM_MODIFY_PC(3); } VMBREAK; @@ -3548,8 +3548,8 @@ restart_tail: tempptr = ((jit_item *)tempptr)[1].ptr_value; --temparg; } - VM_STK_PTRP = ((jit_item *)tempptr) + VM_NINT_ARG; - VM_MODIFY_PC_AND_STACK(3, -1); + VM_R0_PTR = ((jit_item *)tempptr) + VM_NINT_ARG; + VM_MODIFY_PC(3); } VMBREAK; @@ -3665,20 +3665,16 @@ restart_tail: VMCASE(JIT_OP_LEAVE_FILTER): { - /* TODO!!! */ - /* Return from a "filter" handler: pc and value on stack */ - pc = (void **)(stacktop[1].ptr_value); - stacktop[1] = stacktop[0]; + /* Return from a "filter" handler: pc on stack */ + pc = (void **)(stacktop[0].ptr_value); VM_MODIFY_STACK(1); } VMBREAK; VMCASE(JIT_OP_CALL_FILTER): { - /* TODO!!! */ /* Call a "filter" handler with pc and value on stack */ - stacktop[-1] = stacktop[0]; - stacktop[0].ptr_value = (void *)(pc + 2); + stacktop[-1].ptr_value = (void *)(pc + 2); VM_MODIFY_STACK(-1); pc = VM_BR_TARGET; } diff --git a/jit/jit-rules-interp.c b/jit/jit-rules-interp.c index aedc8c3..e38cebe 100644 --- a/jit/jit-rules-interp.c +++ b/jit/jit-rules-interp.c @@ -1103,7 +1103,6 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, case JIT_OP_BR_ITRUE: case JIT_OP_BR_LFALSE: case JIT_OP_BR_LTRUE: - case JIT_OP_CALL_FILTER: /* Unary branch */ load_value(gen, insn->value1, 1); /* Fall through */ @@ -1111,6 +1110,7 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, case JIT_OP_BR: case JIT_OP_CALL_FINALLY: /* Unconditional branch */ + branch: label = (jit_label_t)(insn->dest); pc = (void **)(gen->posn.ptr); jit_cache_opcode(&(gen->posn), insn->opcode); @@ -1132,6 +1132,12 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, } break; + case JIT_OP_CALL_FILTER: + /* Branch to a filter subroutine, load the filter + parameter to the r0 register */ + load_value(gen, insn->value1, 0); + goto branch; + case JIT_OP_JUMP_TABLE: { jit_label_t *labels; @@ -1192,13 +1198,6 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, store_value(gen, insn->dest, 0); break; -#if 0 - case JIT_OP_OUTGOING_REG: - /* Load a value to a register */ - load_value(gen, insn->value1, insn->value2->address); - break; -#endif - case JIT_OP_CALL: case JIT_OP_CALL_TAIL: /* Call a function, whose pointer is supplied explicitly */ @@ -1272,12 +1271,7 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, break; case JIT_OP_IMPORT: - /* TODO!!! */ /* Import a local variable from an outer nested scope */ - if(_jit_regs_num_used(gen, 0) >= JIT_NUM_REGS) - { - _jit_regs_spill_all(gen); - } _jit_gen_fix_value(insn->value1); if(insn->value1->frame_offset >= 0) { @@ -1291,8 +1285,7 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, jit_cache_native(&(gen->posn), -(insn->value1->frame_offset + 1)); jit_cache_native(&(gen->posn), jit_value_get_nint_constant(insn->value2)); } - reg = _jit_regs_new_top(gen, insn->dest, 0); - adjust_working(gen, 1); + store_value(gen, insn->dest, 0); break; case JIT_OP_THROW: @@ -1309,10 +1302,8 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, break; case JIT_OP_CALL_FILTER_RETURN: - /* TODO!!! */ - /* The top of stack currently contains "dest" */ - _jit_regs_set_value(gen, 0, insn->dest, 0); - adjust_working(gen, 1); + /* The r0 register currently contains "dest" */ + store_value(gen, insn->dest, 0); break; case JIT_OP_ENTER_FINALLY: @@ -1326,24 +1317,16 @@ void _jit_gen_insn(jit_gencode_t gen, jit_function_t func, break; case JIT_OP_ENTER_FILTER: - /* TODO!!! */ - /* The top of stack contains "dest" and a return address */ + /* The top of the stack contains the return address, + the r0 register contains the "dest" (filter parameter). */ ++(gen->extra_working_space); - _jit_regs_set_value(gen, 0, insn->dest, 0); - adjust_working(gen, 1); + store_value(gen, insn->dest, 0); break; case JIT_OP_LEAVE_FILTER: - /* TODO!!! */ /* Leave a filter clause, returning a particular value */ - if(!_jit_regs_is_top(gen, insn->value1) || - _jit_regs_num_used(gen, 0) != 1) - { - _jit_regs_spill_all(gen); - } - reg = _jit_regs_load_to_top(gen, insn->value1, 0, 0); + load_value(gen, insn->value1, 0); jit_cache_opcode(&(gen->posn), insn->opcode); - _jit_regs_free_reg(gen, reg, 1); break; case JIT_OP_RETURN_REG: -- 2.47.3