At 05:32 PM 5/29/2001 -0400, Bryan C. Warnock wrote:
>On Tuesday 29 May 2001 05:15 pm, Hong Zhang wrote:
> > > either each op code knows how many args it has,
> >
> > I like to do so, otherwise we will lose most of the performance gain.
>
>I would think, though, that some ops would benefit more from varargs.
>String assembly comes to mind.
If an opcode wants some undefined number of arguments passed, it'll get a
single one (a list) passed to it. I don't know that we'll have too many
opcodes other than perhaps sub and method call ones that'll take a variable
number of arguments, and the ones that do will really take one--a list with
potentially a variable number of entries in it. So instead of seeing:
some_op a, b, c, d, e...
we'd see:
templist r1
push r1, array1
push r1, scalar2
push r1, 15
some_op, r1
Though that might have sufficient performance loss in opcode dispatch to
warrant doing things in another way.
> > > or we have an end marker (e.g 0xff which is never used as a register
> >
> > index).
> >
> > If we have to use variable arguments, I strongly recommend to add one
> > "argc" byte immediately following the opcode. Linear scan bytecode will be
> > very slow.
>
>Agreed.
I don't think this'll come up. Ops that take a variable number of arguments
will have a count, though, and it'll probably have to be the first element.
> > The 16-bit op has both endian issue and alignment issue. Most of RISC
> > machine can not access byte-aligned opcode, so we have to add a lot
> > of padding. Anyway, it will be fatter and slower than 8-bit opcode.
> > I prefer to using escape opcode.
>
>This is a discussion we've had before. It seems if we solve the Unicode
>issue, we've solved the bytecode issue, too. Better yet, make all the
>opcodes map to UTF-8 characters, so you can write and execute bytecode as
>simple strings. ;-)
Nah, bytecode'll have an endianness marker at the top. If you load in
bytecode with the wrong endianness, the loader will have to swap for you.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk