summaryrefslogtreecommitdiff
path: root/libguile/foreign.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-11-17 22:13:53 +0100
committerAndy Wingo <wingo@pobox.com>2016-11-17 22:13:53 +0100
commit4985ef13e68c83adf3e83f2c981205806ed9b621 (patch)
treeb5027ca3f4c0ce3c904c1e015ddae6d924db2c56 /libguile/foreign.c
parentca74e3fae52dd23f8e8f12194d07041e207f68e7 (diff)
downloadguile-4985ef13e68c83adf3e83f2c981205806ed9b621.tar.gz
Explicit interrupt handling in VM
* libguile/foreign.c (CODE, get_foreign_stub_code): Add explicit handle-interrupts and return-values calls, as foreign-call will fall through. * libguile/gsubr.c (A, B, C, AB, AC, BC, ABC, SUBR_STUB_CODE) (scm_i_primitive_call_ip): Same. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline into handle-interrupts. (RETURN_ONE_VALUE, RETURN_VALUE_LIST): Inline into callers, and fall through instead of returning. (BR_BINARY, BR_UNARY, BR_ARITHMETIC, BR_U64_ARITHMETIC): Remove conditional VM_HANDLE_INTERRUPTS, as the compiler already inserted the handle-interrupts calls if needed. (vm_engine): Remove VM_HANDLE_INTERRUPTS invocations except in the handle-interrupts instruction.
Diffstat (limited to 'libguile/foreign.c')
-rw-r--r--libguile/foreign.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libguile/foreign.c b/libguile/foreign.c
index 0992ef4d3..17a3eedb5 100644
--- a/libguile/foreign.c
+++ b/libguile/foreign.c
@@ -767,7 +767,9 @@ SCM_DEFINE (scm_pointer_to_procedure, "pointer->procedure", 3, 0, 0,
#define CODE(nreq) \
SCM_PACK_OP_24 (assert_nargs_ee, nreq + 1), \
- SCM_PACK_OP_12_12 (foreign_call, 0, 1)
+ SCM_PACK_OP_12_12 (foreign_call, 0, 1), \
+ SCM_PACK_OP_24 (handle_interrupts, 0), \
+ SCM_PACK_OP_24 (return_values, 0)
#define CODE_10(n) \
CODE (n + 0), CODE (n + 1), CODE (n + 2), CODE (n + 3), CODE (n + 4), \
@@ -789,7 +791,7 @@ get_foreign_stub_code (unsigned int nargs)
scm_misc_error ("make-foreign-function", "args >= 100 currently unimplemented",
SCM_EOL);
- return &foreign_stub_code[nargs * 2];
+ return &foreign_stub_code[nargs * 4];
}
static SCM