summaryrefslogtreecommitdiff
path: root/libguile/instructions.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-08-11 16:42:06 +0200
committerAndy Wingo <wingo@pobox.com>2013-08-11 16:45:31 +0200
commitaf95414f1dcbacf7fd5311a3ee89a799b20fd17b (patch)
tree5810d5e2948259839704216a2d8b05eb0a251e26 /libguile/instructions.c
parent99983d544a931c29065ecb749acd349efc5f36c5 (diff)
downloadguile-af95414f1dcbacf7fd5311a3ee89a799b20fd17b.tar.gz
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.
Diffstat (limited to 'libguile/instructions.c')
-rw-r--r--libguile/instructions.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libguile/instructions.c b/libguile/instructions.c
index 9e7e5193c..43937d76a 100644
--- a/libguile/instructions.c
+++ b/libguile/instructions.c
@@ -67,7 +67,9 @@ SCM_SYMBOL (sym_bang, "!");
M(X8_U12_U12) \
M(X8_L24) \
M(B1_X7_L24) \
- M(B1_U7_L24)
+ M(B1_U7_L24) \
+ M(B1_X7_U24) \
+ M(B1_X31)
#define TYPE_WIDTH 5
@@ -105,6 +107,8 @@ static SCM word_type_symbols[] =
(OP (0, type0) | OP (1, type1) | OP (2, type2))
#define OP4(type0, type1, type2, type3) \
(OP (0, type0) | OP (1, type1) | OP (2, type2) | OP (3, type3))
+#define OP5(type0, type1, type2, type3, type4) \
+ (OP (0, type0) | OP (1, type1) | OP (2, type2) | OP (3, type3) | OP (4, type4))
#define OP_DST (1 << (TYPE_WIDTH * 5))
@@ -254,7 +258,9 @@ SCM_DEFINE (scm_rtl_instruction_list, "rtl-instruction-list", 0, 0, 0,
/* Format: (name opcode word0 word1 ...) */
- if (WORD_TYPE (3, meta))
+ if (WORD_TYPE (4, meta))
+ len = 5;
+ else if (WORD_TYPE (3, meta))
len = 4;
else if (WORD_TYPE (2, meta))
len = 3;
@@ -267,6 +273,8 @@ SCM_DEFINE (scm_rtl_instruction_list, "rtl-instruction-list", 0, 0, 0,
switch (len)
{
+ case 5:
+ tail = scm_cons (word_type_symbols[WORD_TYPE (4, meta)], tail);
case 4:
tail = scm_cons (word_type_symbols[WORD_TYPE (3, meta)], tail);
case 3: