Index: core.ops =================================================================== RCS file: /cvs/public/parrot/core.ops,v retrieving revision 1.260 diff -p -u -b -r1.260 core.ops --- core.ops 23 Feb 2003 09:58:29 -0000 1.260 +++ core.ops 23 Feb 2003 18:59:36 -0000 @@ -19,10 +19,10 @@ Parrot's core library of ops. =head1 NOTE Some branching ops use B as branch destination and -not B. This is done, to get a branch destination in terms +not B. This is done to get a branch destination in terms of offsets in the normal core, and not in terms of the running core. -This is needed, for all branching ops, that might leave the actual +This is needed for all branching ops that might leave the actual core, so that the branch offset can be recalculated to the other core, Currently used in the native run core generated by B. @@ -3799,7 +3799,7 @@ stack for later returning. =cut inline op bsr (in INT) { - stack_push(interpreter, &interpreter->ctx.control_stack, CUR_OPCODE + 2, STACK_ENTRY_DESTINATION, STACK_CLEANUP_NULL); + stack_push(interpreter, &interpreter->ctx.control_stack, CUR_OPCODE + OP_SIZE, STACK_ENTRY_DESTINATION, STACK_CLEANUP_NULL); goto OFFSET($1); } @@ -3815,7 +3815,7 @@ location onto the call stack for later r inline op jsr(in INT) { opcode_t * loc; - stack_push(interpreter, &interpreter->ctx.control_stack, CUR_OPCODE + 2, STACK_ENTRY_DESTINATION, STACK_CLEANUP_NULL); + stack_push(interpreter, &interpreter->ctx.control_stack, CUR_OPCODE + OP_SIZE, STACK_ENTRY_DESTINATION, STACK_CLEANUP_NULL); loc = INTVAL2PTR(opcode_t *, $1); goto ADDRESS(loc); } @@ -4592,7 +4592,7 @@ inline op invoke() { opcode_t *dest; PMC * p = interpreter->ctx.pmc_reg.registers[0]; - dest = (opcode_t *)p->vtable->invoke(interpreter, p, CUR_OPCODE + 1); + dest = (opcode_t *)p->vtable->invoke(interpreter, p, CUR_OPCODE + OP_SIZE); goto ADDRESS(dest); } @@ -4601,7 +4601,7 @@ inline op invoke(in PMC) { opcode_t *dest; PMC * p = $1; - dest = (opcode_t *)p->vtable->invoke(interpreter, p, CUR_OPCODE + 2); + dest = (opcode_t *)p->vtable->invoke(interpreter, p, CUR_OPCODE + OP_SIZE); goto ADDRESS(dest); } Index: lib/Parrot/Op.pm =================================================================== RCS file: /cvs/public/parrot/lib/Parrot/Op.pm,v retrieving revision 1.9 diff -p -u -b -r1.9 Op.pm --- lib/Parrot/Op.pm 22 Apr 2002 02:40:59 -0000 1.9 +++ lib/Parrot/Op.pm 23 Feb 2003 18:59:37 -0000 @@ -202,6 +202,7 @@ sub _substitute { s/{{-=([^{]*?)}}/ $trans->goto_offset(-$1); /me; s/{{=([^*][^{]*?)}}/ $trans->goto_address($1); /me; + s/{{\^(-?\d+)}}/ $1 /me; s/{{\^\+([^{]*?)}}/ $trans->expr_offset($1); /me; s/{{\^-([^{]*?)}}/ $trans->expr_offset(-$1); /me; s/{{\^([^{]*?)}}/ $trans->expr_address($1); /me; Index: lib/Parrot/OpsFile.pm =================================================================== RCS file: /cvs/public/parrot/lib/Parrot/OpsFile.pm,v retrieving revision 1.31 diff -p -u -b -r1.31 OpsFile.pm --- lib/Parrot/OpsFile.pm 22 Jan 2003 15:57:24 -0000 1.31 +++ lib/Parrot/OpsFile.pm 23 Feb 2003 18:59:37 -0000 @@ -232,7 +232,7 @@ sub read_ops } # - # Accummulate the code into the op's body: + # Accumulate the code into the op's body: # if ($seen_op) { @@ -301,6 +301,7 @@ sub make_op # expr OFFSET(X) {{^+X}} PC + X Relative address # expr NEXT() {{^+S}} PC + S Where S is op size # expr ADDRESS(X) {{^X}} X Absolute address + # OP_SIZE {{^S}} S op size # # HALT() {{=0}} PC' = 0 Halts run_ops loop, no resume # @@ -327,6 +328,7 @@ sub make_op $absolute ||= $body =~ s/\bgoto\s+ADDRESS\(\( (.*?) \)\)/{{=$1}}/mg; $body =~ s/\bexpr\s+OFFSET\(\( (.*?) \)\)/{{^+$1}}/mg; $body =~ s/\bexpr\s+ADDRESS\(\( (.*?) \)\)/{{^$1}}/mg; + $body =~ s/\bOP_SIZE\b/{{^$op_size}}/mg; $branch ||= $body =~ s/\bgoto\s+OFFSET\((.*?)\)/{{+=$1}}/mg; $body =~ s/\bgoto\s+NEXT\(\)/{{+=$op_size}}/mg;