All --

> I've created a varargs-ish example by making a new op, print_s_v.
> This is pretty rough, and I haven't updated the assembler, but it
> seems to work.

Um.. I *have* updated the assembler. Its the *dis*assembler I haven't
updated. This is what happens:

  * *_v ops list their number of args as 1 + the number of fixed
    args. They list the types of the fixed args, plus a last arg of 'v'.

  * The assembler sees all this and splices in an arg count for the
    'v' arg place, and then hangs however many args remained on the
    line after the count.

  * The op decides how many args it is expecting. For print_s_v,
    that is via the format string (but really should take care to
    not read more than the "arg count" arg says are present.

  * Since the op is in control of returning the next address to
    execute, it is trivial for the op to arrange for excecution to
    continue after the last vararg (thanks, Dan!)

  * Since the assembler splices in the arg count, though, the
    disassembler won't have to think very hard to find the beginning
    of the next op when doing its job.

  * Of course, all this assumes that all args have sizeof() ==
    sizeof(IV), which won't be true until NV constants are moved to
    the constants area. SO DON'T USE THEM. :)

Anyway, whether or not folks really like the idea of having ops with
variable numbers of args, this proves its not too hard to do with a
small amount of cooperation between the assembler and the op func.


Regards,
 
-- Gregor
 _____________________________________________________________________ 
/     perl -e 'srand(-2091643526); print chr rand 90 for (0..4)'      \

   Gregor N. Purdy                          [EMAIL PROTECTED]
   Focus Research, Inc.                http://www.focusresearch.com/
   8080 Beckett Center Drive #203                   513-860-3570 vox
   West Chester, OH 45069                           513-860-3579 fax
\_____________________________________________________________________/


Reply via email to