Dan Sugalski <[EMAIL PROTECTED]> wrote:
>   Runtime code generation works mostly, but for some reason the sequence

Another note: jsr/ret are not prepared to do inter-segment branches. A
compiled code segments is currently an entirely new packfile (it should
be only a new packfile directory finally) with its own const table and
bytecode segment. The C<jsr> or C<jump> opcodes have no means to switch
to a different bytecode segment. Also C<ret> gets just a simple address
and can't switch back the segment of the caller.

I only see 2 things:

1) you use invokecc/invoke P1, that is you compile:

   .pcc_sub _compiled_word_n:
   dosomething
   invoke P1

  after compilation you can obtain the Sub via:

   find_global P0, "_compiled_word_n"
   invokecc     # call it

2) We expand C<jsr> syntax:

   jsr "_the_sub" # push addr_next; push current_seg

   which could find the Sub PMC and branch to it, and C<ret> has to
   check that there are 2 return words on the stack, or we have an new
   opcode C<retfar> that does it.

leo


Reply via email to