diff options
author | Andy Wingo <wingo@pobox.com> | 2013-10-27 09:52:39 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2013-10-27 09:52:39 +0100 |
commit | 0720f70ed7e9de2685409abfe4e2c0dd01f81b74 (patch) | |
tree | 695650decf699cbb5b544fd9dec881adcfe56e47 /libguile/memoize.h | |
parent | c450b47723438ad9e517b02a45b577b7f7fd848b (diff) | |
download | guile-0720f70ed7e9de2685409abfe4e2c0dd01f81b74.tar.gz |
Memoized expressions are pairs, not SMOBs
* libguile/memoize.c (MAKMEMO): Memoized objects are pairs now, not
SMOBs. This lets eval.scm destructure them more efficiently.
(scm_print_memoized, scm_memoized_p, scm_memoized_expression_typecode)
(scm_memoized_expression_data): Remove these interfaces.
(unmemoize, scm_memoize_variable_access_x): Remove SMOB type checks.
(scm_init_memoize): Remove SMOB type definition.
* libguile/memoize.h (scm_tc16_memoized, SCM_MEMOIZED_P)
(scm_memoized_expression_typecode, scm_memoized_expression_data)
(scm_memoized_p): Remove declarations.
* libguile/validate.h (SCM_VALIDATE_MEMOIZED): Remove declaration.
* libguile/eval.c (eval): Remove memoized type check, and inline the
inum unpacking.
* module/ice-9/eval.scm (memoized-expression-case): Use car and cdr to
destructure memoized expressions. A big win!
Diffstat (limited to 'libguile/memoize.h')
-rw-r--r-- | libguile/memoize.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libguile/memoize.h b/libguile/memoize.h index 7f7624fd3..95e92a3a9 100644 --- a/libguile/memoize.h +++ b/libguile/memoize.h @@ -58,11 +58,8 @@ SCM_API SCM scm_sym_args; /* {Memoized Source} */ -SCM_INTERNAL scm_t_bits scm_tc16_memoized; - -#define SCM_MEMOIZED_P(x) (SCM_SMOB_PREDICATE (scm_tc16_memoized, (x))) -#define SCM_MEMOIZED_TAG(x) (SCM_SMOB_FLAGS (x)) -#define SCM_MEMOIZED_ARGS(x) (SCM_SMOB_OBJECT (x)) +#define SCM_MEMOIZED_TAG(x) (scm_to_uint16 (scm_car (x))) +#define SCM_MEMOIZED_ARGS(x) (scm_cdr (x)) enum { @@ -90,11 +87,8 @@ enum SCM_INTERNAL SCM scm_memoize_expression (SCM exp); SCM_INTERNAL SCM scm_unmemoize_expression (SCM memoized); -SCM_INTERNAL SCM scm_memoized_expression_typecode (SCM memoized); -SCM_INTERNAL SCM scm_memoized_expression_data (SCM memoized); SCM_INTERNAL SCM scm_memoized_typecode (SCM sym); SCM_INTERNAL SCM scm_memoize_variable_access_x (SCM memoized, SCM module); -SCM_API SCM scm_memoized_p (SCM obj); SCM_INTERNAL void scm_init_memoize (void); |