diff options
author | Andy Wingo <wingo@pobox.com> | 2018-08-17 08:15:04 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-08-17 08:50:33 +0200 |
commit | 3827769aff190a5e155b29d37fe157dd6115ad04 (patch) | |
tree | cca82537cba9073fce356cd75575be82e98e466c /libguile/programs.c | |
parent | e6304fb2425475ddf441439ee3c510060f9464d4 (diff) | |
download | guile-3827769aff190a5e155b29d37fe157dd6115ad04.tar.gz |
Add instrumentation to VM builtins
* libguile/intrinsics.h: Add "intrinsic" for handle-interrupts code.
Unlike the other intrinsics, this one isn't a function.
* libguile/programs.c (try_parse_arity): Add cases for instructions used
in VM builtins.
(scm_primitive_call_ip): Return #f if call-ip not found.
* libguile/vm-engine.c (handle-interrupts): Get code from intrinsics.
* libguile/vm.c
* libguile/vm.c (instrumented_code, define_vm_builtins): Add
instrumentation to the builtins, so that they can be JIT-compiled.
(INIT_BUILTIN): Remove min-arity setting; the fallback min-arity
interpreter should figure it out.
(scm_bootstrap_vm): Call the new define_vm_builtins function.
* libguile/gsubr.c (primitive_call_ip): Return 0 if call IP not found.
(primitive_subr_idx): Interpret call ip == 0 as not-a-subr.
* module/system/vm/program.scm (program-arguments-alist): Allow a #f
call-ip.
Diffstat (limited to 'libguile/programs.c')
-rw-r--r-- | libguile/programs.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libguile/programs.c b/libguile/programs.c index 8d2b04e87..274114762 100644 --- a/libguile/programs.c +++ b/libguile/programs.c @@ -172,9 +172,12 @@ SCM_DEFINE (scm_primitive_call_ip, "primitive-call-ip", 1, 0, 0, "") #define FUNC_NAME s_scm_primitive_call_ip { + uintptr_t ip; + SCM_MAKE_VALIDATE (1, prim, PRIMITIVE_P); - return scm_from_uintptr_t (scm_i_primitive_call_ip (prim)); + ip = scm_i_primitive_call_ip (prim); + return ip ? scm_from_uintptr_t (ip) : SCM_BOOL_F; } #undef FUNC_NAME @@ -312,11 +315,18 @@ try_parse_arity (SCM program, int *req, int *opt, int *rest) *opt = slots - min; *rest = 1; return 1; + case scm_op_shuffle_down: + case scm_op_abort: + *req = min - 1; + *opt = 0; + *rest = 1; + return 1; default: return 0; } case scm_op_continuation_call: case scm_op_compose_continuation: + case scm_op_shuffle_down: *req = 0; *opt = 0; *rest = 1; |