Browse Source

remove last traces of register allocation from the interpreter

cache-refactoring
Aleksey Demakov 18 years ago
parent
commit
ccc54b2abd
  1. 6
      ChangeLog
  2. 18
      jit/jit-interp.c
  3. 45
      jit/jit-rules-interp.c

6
ChangeLog

@ -1,3 +1,9 @@
2006-09-02 Aleksey Demakov <ademakov@gmail.com>
* 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 <ktreichel@web.de>
* configure.in: Replace the deprecated AM_PROG_LIBTOOL with the current

18
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;
}

45
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:

Loading…
Cancel
Save