+2004-05-16 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
+
+ * eval.c (unmemoize_quote): New static function.
+
+ (scm_m_quote, scm_m_atslot_ref, SCM_CEVAL): Changed the byte code
+ representation of 'quote' and '@slot-ref' to an improper list.
+ This reduces execution time, the number of cells used to hold the
+ memoized code, and thus also reduces garbage collection time.
+
+ (scm_unmemocopy): Use unmemoize_quote for quote expressions.
+
+ (SCM_CEVAL): Changed macro handling to also work with macros that
+ return improper lists. Added an assertion, that the code returned
+ by a macro transformer will not lead to cycles in the memoized
+ code.
+
2004-05-15 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
No functional change, just rearrangements of functions within the
# endif
#endif
+#include <assert.h>
#include "libguile/_scm.h"
#include "libguile/alist.h"
#include "libguile/async.h"
quotee = SCM_CAR (cdr_expr);
if (is_self_quoting_p (quotee))
return quotee;
+
SCM_SETCAR (expr, SCM_IM_QUOTE);
+ SCM_SETCDR (expr, quotee);
return expr;
}
+static SCM
+unmemoize_quote (const SCM expr, const SCM env SCM_UNUSED)
+{
+ return scm_list_2 (scm_sym_quote, SCM_CDR (expr));
+}
+
/* Will go into the RnRS module when Guile is factorized.
SCM_SYNTAX (s_set_x, "set!", scm_i_makbimacro, scm_m_set_x); */
ASSERT_SYNTAX_2 (SCM_INUMP (slot_nr), s_bad_slot_number, slot_nr, expr);
SCM_SETCAR (expr, SCM_IM_SLOT_REF);
+ SCM_SETCDR (cdr_expr, slot_nr);
return expr;
}
ls = scm_cons (scm_sym_lambda, z);
env = SCM_EXTEND_ENV (SCM_CAR (x), SCM_EOL, env);
break;
+
case (ISYMNUM (SCM_IM_QUOTE)):
- ls = z = scm_cons (scm_sym_quote, SCM_UNSPECIFIED);
- break;
+ return unmemoize_quote (x, env);
+
case (ISYMNUM (SCM_IM_SET_X)):
ls = z = scm_cons (scm_sym_set_x, SCM_UNSPECIFIED);
break;
case (ISYMNUM (SCM_IM_QUOTE)):
- RETURN (SCM_CADR (x));
+ RETURN (SCM_CDR (x));
case (ISYMNUM (SCM_IM_SET_X)):
x = SCM_CDR (x);
{
SCM instance = EVALCAR (x, env);
- unsigned long int slot = SCM_INUM (SCM_CADR (x));
+ unsigned long int slot = SCM_INUM (SCM_CDR (x));
RETURN (SCM_PACK (SCM_STRUCT_DATA (instance) [slot]));
}
{
case 3:
case 2:
- if (scm_ilength (arg1) <= 0)
+ if (!SCM_CONSP (arg1))
arg1 = scm_list_2 (SCM_IM_BEGIN, arg1);
+
+ assert (!SCM_EQ_P (x, SCM_CAR (arg1))
+ && !SCM_EQ_P (x, SCM_CDR (arg1)));
+
#ifdef DEVAL
if (!SCM_CLOSUREP (SCM_MACRO_CODE (proc)))
{