On Thu, Apr 18, 2002 at 11:11:31PM +0200, Marco Baringer wrote:
> Jason Gloudon <[EMAIL PROTECTED]> writes:
> 
> > So thus far, goto ADDRESS(X) means set the program counter to the pointer value
> > X.
> 
> ok, but i find this highly counter-intuitive.

I used to use this. I kept my own return address stack for regular
expression backtracking.

> > > p.s. - i think the problem is related to directly setting cur_opcode
> > > to interpreter->int_reg.registers[cur_opcode[1]] and not something
> > > like interpreter->code->byte_code + $1, could this be?
> > 
> > Ok, so you expect goto ADDRESS(X) to jump to the opcode at address X, relative
> > to the start of the byte code. 
> > 
> > It probably  makes sense to rename the current ADDRESS() to something like
> > OPPOINTER() or a name that gives a better idea of what it does and to document
> > all the address expressions while 'fixing' ADDRESS.
> 
> i am attaching a patch to Parrot::OpTrans::CGoto which makes goto
> ADDRESS(X) jump to the offset X relative to the start of the byte_code
> (in other words interpreter->code->byte_code + X). given this "new"
> interpretation of goto ADDRESS() i have found a reason to have jump
> and jsr :) jump is like branch, but uses goto ADDRESS() as opposed to
> goto OFFSET(), jsr is like bsr but uses goto ADDRESS() as opposed to
> goto OFFSET(). relative to this modification of core.ops i have added
> a test to t/ops/basic.t to test jsr and modified the test of jump
> since its semantics have changed.

I think Dan had some strong opinions about relative vs
start_address-relative vs absolute addressing.

> i also modified Parrot::Assembler: when label arithmetic involed a
> label whose name contained digits the label name got mangled.

Isn't this still the "old" assembler? Is someone ever going to check
in the new one?
 
> note: this breaks enternative, i'll add goto ABS_ADDRESS() or goto
> OPPOINTER() tomorow or the day after, which should allow me to fix the
> bug i'm introducing :)

Try to check your changes against all of the dispatchers (cgoto,
plain, prederef, jit, ops2c.pl). Hopefully docs/running.pod has enough
information now to figure out how.

We really need a test target that does this automatically.

Reply via email to