1
Fork 0
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:
Andy Wingo 2013-10-27 09:52:39 +01:00
parent c450b47723
commit 0720f70ed7
5 changed files with 11 additions and 69 deletions

View file

@ -266,11 +266,9 @@ eval (SCM x, SCM env)
loop:
SCM_TICK;
if (!SCM_MEMOIZED_P (x))
abort ();
mx = SCM_MEMOIZED_ARGS (x);
switch (SCM_MEMOIZED_TAG (x))
switch (SCM_I_INUM (SCM_CAR (x)))
{
case SCM_M_SEQ:
eval (CAR (mx), env);