mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
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!
This commit is contained in:
parent
c450b47723
commit
0720f70ed7
5 changed files with 11 additions and 69 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue