Various RTL VM and calling convention tweaks
authorAndy Wingo <wingo@pobox.com>
Sun, 11 Aug 2013 14:42:06 +0000 (16:42 +0200)
committerAndy Wingo <wingo@pobox.com>
Sun, 11 Aug 2013 14:45:31 +0000 (16:45 +0200)
commitaf95414f1dcbacf7fd5311a3ee89a799b20fd17b
tree5810d5e2948259839704216a2d8b05eb0a251e26
parent99983d544a931c29065ecb749acd349efc5f36c5
Various RTL VM and calling convention tweaks

* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Allow for
  five-word instructions, and for new instruction word types.

* libguile/vm-engine.c (RETURN_ONE_VALUE): Instead of returning the
  value in the fixed part of the call frame, return it in the same place
  multiple-value returns go: from slot 1.
  (BR_ARITHMETIC): Allow arithmetic tests to be negated.
  (rtl_vm_engine): Change calling convention to use the same location
  for single and multiple-value returns.  Renumber all instructions.

  (halt, halt/values): Fold into a single instruction (halt).
  (call): Take the location of the procedure instead of the location of
  the call frame.  Also take the number of args, and reset the sp before
  jumping to the procedure, so as to indicate the number of arguments.
  (call/values): Remove, as the new calling convention has RA == MVRA.
  (tail-call): Require the procedure to be shuffled down already, and
  take "nlocals" as an arg instead of "nargs".
  (receive, receive-values): New instructions, for receiving returned
  values from calls.
  (return-values): Rename from return/values.  Remove "values".
  (alloc-frame): Rename from reserve-locals.
  (reset-frame): New instruction.
  (drop-locals): Remove.
  (br-if-=, br-if-<, br-if-<=): Allow these instructions to be
  negatable.
  (br-if->, br-if->=): Remove.  Probably a bad idea, given NaN.
  (box-ref): Don't bother trying to do a reverse lookup -- the
  toplevel-box, module-box, and resolve instructions should handle
  that.
  (resolve): Add arg to check that the variable is bound.
  (toplevel-box, module-box): New instructions, replacing toplevel-ref,
  toplevel-set, module-ref, and module-set.

* libguile/vm.c (rtl_boot_continuation_code, rtl_values_code): Adapt to
  instruction set changes.

* module/Makefile.am: Make the assembler and disassembler dependent on
  vm-operations.h.

* module/system/vm/assembler.scm:
* module/system/vm/disassembler.scm: Adapt to instruction changes and
  new instruction word kinds.

* test-suite/tests/rtl.test: Adapt to instruction set changes.
libguile/instructions.c
libguile/vm-engine.c
libguile/vm.c
module/Makefile.am
module/system/vm/assembler.scm
module/system/vm/disassembler.scm
test-suite/tests/rtl.test