From 67b699cc77d5e2f74daca77aa26b1ba8af0d0808 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 10 May 2012 12:43:33 +0200 Subject: refactor vm application of non-programs; boot continuation refactor * libguile/frames.c (scm_frame_instruction_pointer): * module/system/vm/frame.scm (frame-bindings): (frame-next-source, frame-call-representation): Fix a few locations that thought that the frame-procedure will always be a VM procedure. This will not not be the case when traversing the stack of an application of a non-procedure. * libguile/vm-i-system.c (call, tail-call, mv-call): Instead of special-casing structs and smobs at these call sites, just set up the stack, and jump to a generic apply loop if the proc is not a program. * libguile/vm-engine.c: The generic apply loop is here. Also, the boot program is now simply a boot continuation, and can handle any number of arguments. * libguile/vm.c (make_boot_program): Update the code that makes the boot continuation. --- libguile/frames.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libguile/frames.c') diff --git a/libguile/frames.c b/libguile/frames.c index c7505b262..45f1c8d92 100644 --- a/libguile/frames.c +++ b/libguile/frames.c @@ -237,11 +237,16 @@ SCM_DEFINE (scm_frame_instruction_pointer, "frame-instruction-pointer", 1, 0, 0, "") #define FUNC_NAME s_scm_frame_instruction_pointer { + SCM program; const struct scm_objcode *c_objcode; SCM_VALIDATE_VM_FRAME (1, frame); + program = scm_frame_procedure (frame); - c_objcode = SCM_PROGRAM_DATA (scm_frame_procedure (frame)); + if (!SCM_PROGRAM_P (program)) + return SCM_INUM0; + + c_objcode = SCM_PROGRAM_DATA (program); return scm_from_unsigned_integer ((SCM_VM_FRAME_IP (frame) - SCM_C_OBJCODE_BASE (c_objcode))); } -- cgit v1.2.3