summaryrefslogtreecommitdiff
path: root/libguile/vm.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-07-19 10:56:44 +0200
committerAndy Wingo <wingo@pobox.com>2018-07-20 11:42:30 +0200
commitc2a8224a63da432c82f24a76c008e4cfe9cba25b (patch)
tree76416a0cb8f23953912b4ac8ce5c691f6e4a8635 /libguile/vm.c
parent043432fd573648fe8591672aca7e2438b71e6774 (diff)
downloadguile-c2a8224a63da432c82f24a76c008e4cfe9cba25b.tar.gz
Rework VM approach to shuffling unknown numbers of args
* libguile/vm-engine.c (shuffle-down, expand-apply-argument): New instructions. (tail-call, tail-call-label, return-values): Don't reset the frame. The compiler should reset the frame appropriately. (tail-call/shuffle, tail-apply): Remove unused instructions. * libguile/vm.c (vm_builtin_apply_code): Use new shuffle-down and expand-apply-argument opcodes. (vm_builtin_call_with_values_code): Replace tail-call/shuffle with shuffle-down then tail-call. * libguile/jit.c (compile_shuffle_down, compile_expand_apply_argument): Add compiler stubs (COMPILE_X8_F12_F12): New definition. (compile_tail_call_shuffle, compile_tail_apply): Remove unused compilers. * module/language/cps/compile-bytecode.scm (compile-function): Emit reset-frame before tail calls and returns. * module/system/vm/assembler.scm (system): Remove unbound "emit-return" export. * module/system/vm/disassembler.scm (code-annotation) (instruction-has-fallthrough?, define-stack-effect-parser): Adapt for opcode changes.
Diffstat (limited to 'libguile/vm.c')
-rw-r--r--libguile/vm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libguile/vm.c b/libguile/vm.c
index 1f2373acd..0e6112035 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -335,11 +335,13 @@ static const uint32_t vm_boot_continuation_code[] = {
static const uint32_t vm_builtin_apply_code[] = {
SCM_PACK_OP_24 (assert_nargs_ge, 3),
- SCM_PACK_OP_24 (tail_apply, 0), /* proc in r1, args from r2 */
+ SCM_PACK_OP_12_12 (shuffle_down, 1, 0),
+ SCM_PACK_OP_24 (expand_apply_argument, 0),
+ SCM_PACK_OP_24 (tail_call, 0),
};
static const uint32_t vm_builtin_values_code[] = {
- SCM_PACK_OP_24 (return_values, 0) /* vals from r1 */
+ SCM_PACK_OP_24 (return_values, 0)
};
static const uint32_t vm_builtin_abort_to_prompt_code[] = {
@@ -355,7 +357,8 @@ static const uint32_t vm_builtin_call_with_values_code[] = {
SCM_PACK_OP_12_12 (mov, 0, 6),
SCM_PACK_OP_24 (call, 7), SCM_PACK_OP_ARG_8_24 (0, 1),
SCM_PACK_OP_24 (long_fmov, 0), SCM_PACK_OP_ARG_8_24 (0, 2),
- SCM_PACK_OP_24 (tail_call_shuffle, 8)
+ SCM_PACK_OP_12_12 (shuffle_down, 8, 1),
+ SCM_PACK_OP_24 (tail_call, 0)
};
static const uint32_t vm_builtin_call_with_current_continuation_code[] = {