diff options
author | Andy Wingo <wingo@pobox.com> | 2016-06-24 14:15:38 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-06-24 14:15:38 +0200 |
commit | d848af9a161b0c37964d582dfb8b52ed5112355f (patch) | |
tree | 6a5fb67950693dca72b61e0ed6872ec14b6fe47a /libguile/foreign.c | |
parent | 5ca24b6ba1bc617e60a0a9b2ecad7f112e99ef9c (diff) | |
download | guile-d848af9a161b0c37964d582dfb8b52ed5112355f.tar.gz |
Parse bytecode to determine minimum arity
* libguile/programs.c (try_parse_arity): New helper, to parse bytecode
to determine the minimum arity of a function in a cheaper way than
grovelling through the debug info. Should speed up all thunk? checks
and similar.
(scm_i_program_arity): Simplify.
* libguile/gsubr.h:
* libguile/gsubr.c (scm_i_primitive_arity):
* libguile/foreign.h:
* libguile/foreign.c (scm_i_foreign_arity):
Diffstat (limited to 'libguile/foreign.c')
-rw-r--r-- | libguile/foreign.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/libguile/foreign.c b/libguile/foreign.c index 936f3419c..0992ef4d3 100644 --- a/libguile/foreign.c +++ b/libguile/foreign.c @@ -792,25 +792,6 @@ get_foreign_stub_code (unsigned int nargs) return &foreign_stub_code[nargs * 2]; } -/* Given a foreign procedure, determine its minimum arity. */ -int -scm_i_foreign_arity (SCM foreign, int *req, int *opt, int *rest) -{ - const scm_t_uint32 *code = SCM_PROGRAM_CODE (foreign); - - if (code < foreign_stub_code) - return 0; - if (code > (foreign_stub_code - + (sizeof(foreign_stub_code) / sizeof(scm_t_uint32)))) - return 0; - - *req = (code - foreign_stub_code) / 2; - *opt = 0; - *rest = 0; - - return 1; -} - static SCM cif_to_procedure (SCM cif, SCM func_ptr) { |