On 11 Oct 2001, Brian Wheeler wrote:

> On Thu, 2001-10-11 at 21:23, Dan Sugalski wrote:
> > At 09:12 PM 10/11/2001 -0500, Brian Wheeler wrote:
> > >On Thu, 2001-10-11 at 20:49, Dan Sugalski wrote:
> > > > At 08:25 PM 10/11/2001 -0500, Brian Wheeler wrote:
> > > > >Since we're passing guilt around, there's an equate of '*' which is the
> > > > >current PC...and I didn't document it.  You can do
> > > > >       set  I1,*
> > > > >and it will set I1 to the current PC.  It doesn't allow any math,
> > > > >though.  I thought about hooking up eval to various brackets but I never
> > > > >got the time before my job got busy...
> > > >
> > > > Absolute or relative PC?
> > >
> > >Well, its relative to the start of the bytecode...which I suppose would
> > >be absolute...unless multiple bytecode chunks are placed in the same
> > >memory block, in which case it'd be relative.  Now I'm confused. :)
> > 
> > Absolute addresses are, well, absolute addresses. Relative addresses are 
> > offsets from the current location.
> > 
> > I think the confusion's because the jump opcode's broken. When you say
> > 
> >    jump 12
> > 
> > It should jump to absolute address 12, not 12 bytes/words/opcodes from the 
> > current position.
> > 
> 
> Ok, fair enough...but should it be jumping to:
>     (char *)byte_code+12
> or
>     (char *)12
> 
> If its the former, it seems there will be some problems jumping to other
> bytecode blocks, and if its the latter, at the very least someone can do
> a "jump 0" and coredump the process.

Latter, and yes it has potential problems. That's one of the reasons the
Safe-mode interpreter will be slower--branches and jumps will validate
their destination addresses.

                                        Dan

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


Reply via email to