Slightly optimize the memoizer, bootstrap evaluator, and `(ice-9 eval)'.

* libguile/eval.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR): Use
  the macro variants, not the functions.
  (eval)[SCM_M_CALL]: When invoking a VM program, accumulate its
  arguments on the stack rather than on the heap.

* libguile/memoize.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR,
  CADDR): Use the macro variants, not the functions.
  (scm_memoized_expression_typecode): Use `SCM_I_MAKINUM' instead of
  `scm_from_uint16'.
This commit is contained in:
Ludovic Courtès 2010-03-05 00:20:18 +01:00
commit b7ecadca7b
2 changed files with 25 additions and 33 deletions

View file

@ -42,7 +42,6 @@
#if 0
#define CAR(x) SCM_CAR(x)
#define CDR(x) SCM_CDR(x)
#define CAAR(x) SCM_CAAR(x)
@ -51,18 +50,7 @@
#define CDDR(x) SCM_CDDR(x)
#define CADDR(x) SCM_CADDR(x)
#define CDDDR(x) SCM_CDDDR(x)
#define CADDDR(x) SCM_CDDDR(x)
#else
#define CAR(x) scm_car(x)
#define CDR(x) scm_cdr(x)
#define CAAR(x) scm_caar(x)
#define CADR(x) scm_cadr(x)
#define CDAR(x) scm_cdar(x)
#define CDDR(x) scm_cddr(x)
#define CADDR(x) scm_caddr(x)
#define CDDDR(x) scm_cdddr(x)
#define CADDDR(x) scm_cadddr(x)
#endif
#define CADDDR(x) SCM_CADDDR(x)
static const char s_bad_expression[] = "Bad expression";
@ -1211,7 +1199,9 @@ SCM_DEFINE (scm_memoized_expression_typecode, "memoized-expression-typecode", 1,
#define FUNC_NAME s_scm_memoized_expression_typecode
{
SCM_VALIDATE_MEMOIZED (1, m);
return scm_from_uint16 (SCM_MEMOIZED_TAG (m));
/* The tag is a 16-bit integer so it fits in an inum. */
return SCM_I_MAKINUM (SCM_MEMOIZED_TAG (m));
}
#undef FUNC_NAME