At 11:49 AM 9/17/2001 -0500, Brian Wheeler wrote:
>On Mon, 2001-09-17 at 11:20, Gregor N. Purdy wrote:
> > > > It would also be helpful to have jump_ic and absjump_ic, rather than
> > > > having to load these things into registers.
> > >
> > > You can use branch_ic for this.  absjump is probably a bad idea since it
> > > appears the return value of the opcode function is really a memory
> > > address of the host machine.  If an absolute value (relative to the
> > > beginning of the opcode stream) was used, then it would have to be
> > > relocated at load-time and wouldn't be able to remain read-only.
> >
> > My mental model for this thing is "Parrot is a CPU architecture" and
> > a lot of what I'm trying to make it do is behave as much as possible
> > in that way. So, if we are talking about a CPU architecture (ISA),
> > lacking the full complement of relative and absolute jumps, register
> > and constant comparisons, etc. is a bummer.
>
>I think we're ok on relative ops, but you're right, we're short of
>absolute.

FWIW, all the absolute ops should be done against register values, not 
constants. There'll be ways to get absolute addresses of things like 
subroutines and PMCs.

> > Mucking with things like memory addresses of host machines, etc. is
> > important, but only at the interpreter level, not at the ISA design
> > level (IMHO).
> >
> > I don't see a relocation issue anyway, since the way I look at the
> > interpreter code is:
> >
> >     PC === (code - start_code)
> >
> > So if an instruction says  "absjump 43", then I know that I need
> > to do:
> >
> >     code = (start_code + 43)
> >
> > and if an instruction says "(rel)jump 43" then I know that I need
> > to do:
> >
> >     code += 43
> >
> > neither of these is a problem in my eyes.

Both of those ought to be plain relative jumps. The absolute jump should be 
resolved by the assembler to a relative offset. ;)

>Ok, they're not really problems, per se, but the way the interpreter is
>constructed, the ops *always* return the offset to the next PC.

Nope. The ops always return the absolute next PC. The un-preprocessed 
versions generally return relative values which the preprocessor munches 
(the AUTO_OP ones) but that's just a preprocessor thing.


                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to