diff options
author | Andy Wingo <wingo@pobox.com> | 2018-07-29 15:36:07 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-07-29 15:47:07 +0200 |
commit | b8a9a666f140282fc3928f1027f235f01bad1ade (patch) | |
tree | 508dd64aae9dd247cf2b7fcd5b14adb380b01cce /libguile/programs.c | |
parent | 5077e6737128b04e840b96775627b000e29c63f1 (diff) | |
download | guile-b8a9a666f140282fc3928f1027f235f01bad1ade.tar.gz |
Rewrite subr implementation
* libguile/gsubr.c: Reimplement to store subr names and procedures in a
side table, and to allocate fresh vcode for each subr. This allows
JIT of subrs, moves to a uniform all-code-starts-with-instrument-entry
regime, and also allows statprof to distinguish between subrs based on
IP.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_NAME): Call out to functions,
now that these are in a side table.
(scm_subr_function, scm_subr_name): New exports.
(scm_i_primitive_name): New internal function, for looking up a
primitive name based on IP.
(scm_apply_subr): Take the subr index.
* libguile/vm-engine.c (subr-call):
* libguile/jit.c (compile_subr_call): Adapt to take index as arg.
* module/statprof.scm (sample-stack-procs, count-call):
(stack-samples->procedure-data): Update to always record IP in stack
samples and call counts.
* module/system/vm/frame.scm (frame-procedure-name): Simplify.
(frame-instruction-pointer-or-primitive-procedure-name): Removed.
* libguile/programs.h:
* libguile/programs.c (scm_primitive_code_name): New function.
* module/system/vm/program.scm (primitive-code-name): New export.
Diffstat (limited to 'libguile/programs.c')
-rw-r--r-- | libguile/programs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libguile/programs.c b/libguile/programs.c index 0dcf04d8b..8d2b04e87 100644 --- a/libguile/programs.c +++ b/libguile/programs.c @@ -178,6 +178,20 @@ SCM_DEFINE (scm_primitive_call_ip, "primitive-call-ip", 1, 0, 0, } #undef FUNC_NAME +SCM_DEFINE (scm_primitive_code_name, "primitive-code-name", 1, 0, 0, + (SCM code), + "") +#define FUNC_NAME s_scm_primitive_code_name +{ + const uint32_t * ptr = (const uint32_t *) scm_to_uintptr_t (code); + + if (scm_i_primitive_code_p (ptr)) + return scm_i_primitive_name (ptr); + + return SCM_BOOL_F; +} +#undef FUNC_NAME + SCM scm_find_source_for_addr (SCM ip) { |