mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 17:20:29 +02:00
* __scm.h, eval.c, eval.h: Removed compile time option
MEMOIZE_LOCALS to clean up the code. Now, caching of local variable positions during memoization is mandatory. However, the option to disable the caching has most probably not been used anyway.
This commit is contained in:
parent
23de7b97e9
commit
c136c9205e
5 changed files with 14 additions and 30 deletions
6
NEWS
6
NEWS
|
@ -167,6 +167,12 @@ used instead, obtained from scm_current_input_port () etc. If an
|
||||||
application needs to retain earlier ports, it should save them in a
|
application needs to retain earlier ports, it should save them in a
|
||||||
gc-protected location.
|
gc-protected location.
|
||||||
|
|
||||||
|
** Removed compile time option MEMOIZE_LOCALS
|
||||||
|
|
||||||
|
Now, caching of local variable positions during memoization is mandatory.
|
||||||
|
However, the option to disable the caching has most probably not been used
|
||||||
|
anyway.
|
||||||
|
|
||||||
** Removed definitions: scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify,
|
** Removed definitions: scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify,
|
||||||
s_t_ify, scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
|
s_t_ify, scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
|
||||||
scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2, scm_tc16_allocated,
|
scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2, scm_tc16_allocated,
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2002-06-28 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
|
* __scm.h, eval.c, eval.h: Removed compile time option
|
||||||
|
MEMOIZE_LOCALS to clean up the code. Now, caching of local
|
||||||
|
variable positions during memoization is mandatory. However, the
|
||||||
|
option to disable the caching has most probably not been used
|
||||||
|
anyway.
|
||||||
|
|
||||||
2002-06-18 Marius Vollmer <mvo@zagadka.ping.de>
|
2002-06-18 Marius Vollmer <mvo@zagadka.ping.de>
|
||||||
|
|
||||||
* print.c (scm_simple_format): Print missing part of format before
|
* print.c (scm_simple_format): Print missing part of format before
|
||||||
|
|
|
@ -112,11 +112,6 @@
|
||||||
#undef SCM_RECKLESS
|
#undef SCM_RECKLESS
|
||||||
#define SCM_CAUTIOUS
|
#define SCM_CAUTIOUS
|
||||||
|
|
||||||
/* After looking up a local for the first time, rewrite the
|
|
||||||
* code graph, caching its position.
|
|
||||||
*/
|
|
||||||
#define MEMOIZE_LOCALS
|
|
||||||
|
|
||||||
/* All the number support there is.
|
/* All the number support there is.
|
||||||
*/
|
*/
|
||||||
#define BIGNUMS
|
#define BIGNUMS
|
||||||
|
|
|
@ -152,8 +152,6 @@ char *alloca ();
|
||||||
|
|
||||||
#define EXTEND_ENV SCM_EXTEND_ENV
|
#define EXTEND_ENV SCM_EXTEND_ENV
|
||||||
|
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
|
|
||||||
SCM *
|
SCM *
|
||||||
scm_ilookup (SCM iloc, SCM env)
|
scm_ilookup (SCM iloc, SCM env)
|
||||||
{
|
{
|
||||||
|
@ -168,7 +166,6 @@ scm_ilookup (SCM iloc, SCM env)
|
||||||
return SCM_CDRLOC (er);
|
return SCM_CDRLOC (er);
|
||||||
return SCM_CARLOC (SCM_CDR (er));
|
return SCM_CARLOC (SCM_CDR (er));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef USE_THREADS
|
||||||
|
|
||||||
|
@ -259,9 +256,7 @@ scm_lookupcar (SCM vloc, SCM genv, int check)
|
||||||
{
|
{
|
||||||
SCM env = genv;
|
SCM env = genv;
|
||||||
register SCM *al, fl, var = SCM_CAR (vloc);
|
register SCM *al, fl, var = SCM_CAR (vloc);
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
register SCM iloc = SCM_ILOC00;
|
register SCM iloc = SCM_ILOC00;
|
||||||
#endif
|
|
||||||
for (; SCM_NIMP (env); env = SCM_CDR (env))
|
for (; SCM_NIMP (env); env = SCM_CDR (env))
|
||||||
{
|
{
|
||||||
if (!SCM_CONSP (SCM_CAR (env)))
|
if (!SCM_CONSP (SCM_CAR (env)))
|
||||||
|
@ -273,13 +268,11 @@ scm_lookupcar (SCM vloc, SCM genv, int check)
|
||||||
{
|
{
|
||||||
if (SCM_EQ_P (fl, var))
|
if (SCM_EQ_P (fl, var))
|
||||||
{
|
{
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
#ifdef USE_THREADS
|
#ifdef USE_THREADS
|
||||||
if (! SCM_EQ_P (SCM_CAR (vloc), var))
|
if (! SCM_EQ_P (SCM_CAR (vloc), var))
|
||||||
goto race;
|
goto race;
|
||||||
#endif
|
#endif
|
||||||
SCM_SET_CELL_WORD_0 (vloc, SCM_UNPACK (iloc) + SCM_ICDR);
|
SCM_SET_CELL_WORD_0 (vloc, SCM_UNPACK (iloc) + SCM_ICDR);
|
||||||
#endif
|
|
||||||
return SCM_CDRLOC (*al);
|
return SCM_CDRLOC (*al);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -288,7 +281,6 @@ scm_lookupcar (SCM vloc, SCM genv, int check)
|
||||||
al = SCM_CDRLOC (*al);
|
al = SCM_CDRLOC (*al);
|
||||||
if (SCM_EQ_P (SCM_CAR (fl), var))
|
if (SCM_EQ_P (SCM_CAR (fl), var))
|
||||||
{
|
{
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
#ifndef SCM_RECKLESS /* letrec inits to SCM_UNDEFINED */
|
#ifndef SCM_RECKLESS /* letrec inits to SCM_UNDEFINED */
|
||||||
if (SCM_UNBNDP (SCM_CAR (*al)))
|
if (SCM_UNBNDP (SCM_CAR (*al)))
|
||||||
{
|
{
|
||||||
|
@ -301,16 +293,11 @@ scm_lookupcar (SCM vloc, SCM genv, int check)
|
||||||
goto race;
|
goto race;
|
||||||
#endif
|
#endif
|
||||||
SCM_SETCAR (vloc, iloc);
|
SCM_SETCAR (vloc, iloc);
|
||||||
#endif
|
|
||||||
return SCM_CARLOC (*al);
|
return SCM_CARLOC (*al);
|
||||||
}
|
}
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
iloc = SCM_PACK (SCM_UNPACK (iloc) + SCM_IDINC);
|
iloc = SCM_PACK (SCM_UNPACK (iloc) + SCM_IDINC);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
iloc = SCM_PACK ((~SCM_IDSTMSK) & (SCM_UNPACK(iloc) + SCM_IFRINC));
|
iloc = SCM_PACK ((~SCM_IDSTMSK) & (SCM_UNPACK(iloc) + SCM_IFRINC));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SCM top_thunk, real_var;
|
SCM top_thunk, real_var;
|
||||||
|
@ -360,10 +347,8 @@ scm_lookupcar (SCM vloc, SCM genv, int check)
|
||||||
var = SCM_CAR (vloc);
|
var = SCM_CAR (vloc);
|
||||||
if (SCM_VARIABLEP (var))
|
if (SCM_VARIABLEP (var))
|
||||||
return SCM_VARIABLE_LOC (var);
|
return SCM_VARIABLE_LOC (var);
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
if (SCM_ITAG7 (var) == SCM_ITAG7 (SCM_ILOC00))
|
if (SCM_ITAG7 (var) == SCM_ITAG7 (SCM_ILOC00))
|
||||||
return scm_ilookup (var, genv);
|
return scm_ilookup (var, genv);
|
||||||
#endif
|
|
||||||
/* We can't cope with anything else than variables and ilocs. When
|
/* We can't cope with anything else than variables and ilocs. When
|
||||||
a special form has been memoized (i.e. `let' into `#@let') we
|
a special form has been memoized (i.e. `let' into `#@let') we
|
||||||
return NULL and expect the calling function to do the right
|
return NULL and expect the calling function to do the right
|
||||||
|
@ -408,7 +393,6 @@ scm_unmemocar (SCM form, SCM env)
|
||||||
sym = sym_three_question_marks;
|
sym = sym_three_question_marks;
|
||||||
SCM_SETCAR (form, sym);
|
SCM_SETCAR (form, sym);
|
||||||
}
|
}
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
else if (SCM_ILOCP (c))
|
else if (SCM_ILOCP (c))
|
||||||
{
|
{
|
||||||
unsigned long int ir;
|
unsigned long int ir;
|
||||||
|
@ -420,7 +404,6 @@ scm_unmemocar (SCM form, SCM env)
|
||||||
env = SCM_CDR (env);
|
env = SCM_CDR (env);
|
||||||
SCM_SETCAR (form, SCM_ICDRP (c) ? env : SCM_CAR (env));
|
SCM_SETCAR (form, SCM_ICDRP (c) ? env : SCM_CAR (env));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2313,11 +2296,9 @@ dispatch:
|
||||||
{
|
{
|
||||||
SCM *location;
|
SCM *location;
|
||||||
SCM variable = SCM_CAR (x);
|
SCM variable = SCM_CAR (x);
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
if (SCM_ILOCP (variable))
|
if (SCM_ILOCP (variable))
|
||||||
location = scm_ilookup (variable, env);
|
location = scm_ilookup (variable, env);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
if (SCM_VARIABLEP (variable))
|
if (SCM_VARIABLEP (variable))
|
||||||
location = SCM_VARIABLE_LOC (variable);
|
location = SCM_VARIABLE_LOC (variable);
|
||||||
else /* (SCM_SYMBOLP (variable)) is known to be true */
|
else /* (SCM_SYMBOLP (variable)) is known to be true */
|
||||||
|
@ -2713,7 +2694,6 @@ dispatch:
|
||||||
case scm_tc7_variable:
|
case scm_tc7_variable:
|
||||||
RETURN (SCM_VARIABLE_REF(x));
|
RETURN (SCM_VARIABLE_REF(x));
|
||||||
|
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
case SCM_BIT8(SCM_ILOC00):
|
case SCM_BIT8(SCM_ILOC00):
|
||||||
proc = *scm_ilookup (SCM_CAR (x), env);
|
proc = *scm_ilookup (SCM_CAR (x), env);
|
||||||
SCM_ASRTGO (SCM_NIMP (proc), badfun);
|
SCM_ASRTGO (SCM_NIMP (proc), badfun);
|
||||||
|
@ -2723,7 +2703,6 @@ dispatch:
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif /* ifdef MEMOIZE_LOCALS */
|
|
||||||
|
|
||||||
case scm_tcs_cons_nimcar:
|
case scm_tcs_cons_nimcar:
|
||||||
if (SCM_SYMBOLP (SCM_CAR (x)))
|
if (SCM_SYMBOLP (SCM_CAR (x)))
|
||||||
|
|
|
@ -105,13 +105,9 @@ SCM_API SCM scm_eval_options_interface (SCM setting);
|
||||||
? scm_misc_error (NULL, scm_s_expression, SCM_EOL), 0 \
|
? scm_misc_error (NULL, scm_s_expression, SCM_EOL), 0 \
|
||||||
: 0), \
|
: 0), \
|
||||||
(x))
|
(x))
|
||||||
#ifdef MEMOIZE_LOCALS
|
|
||||||
#define SCM_EVALIM(x, env) (SCM_ILOCP (x) \
|
#define SCM_EVALIM(x, env) (SCM_ILOCP (x) \
|
||||||
? *scm_ilookup ((x), env) \
|
? *scm_ilookup ((x), env) \
|
||||||
: SCM_EVALIM2(x))
|
: SCM_EVALIM2(x))
|
||||||
#else
|
|
||||||
#define SCM_EVALIM(x, env) SCM_EVALIM2(x)
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG_EXTENSIONS
|
#ifdef DEBUG_EXTENSIONS
|
||||||
#define SCM_XEVAL(x, env) (SCM_IMP (x) \
|
#define SCM_XEVAL(x, env) (SCM_IMP (x) \
|
||||||
? SCM_EVALIM2(x) \
|
? SCM_EVALIM2(x) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue