mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 14:50:19 +02:00
* Move all real functionality from scm_eval into inner_eval.
* Avoid to copy the evaluated expression twice.
This commit is contained in:
parent
9d7748147e
commit
312ae976ad
2 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2001-01-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
|
* eval.c (inner_eval, scm_eval): Move all real functionality into
|
||||||
|
inner_eval. Avoid to copy the expression twice by inlining some
|
||||||
|
code from scm_i_eval.
|
||||||
|
|
||||||
2001-01-19 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
2001-01-19 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||||
|
|
||||||
* eval.c (scm_m_case): The 'else' clause of a 'case' statement
|
* eval.c (scm_m_case): The 'else' clause of a 'case' statement
|
||||||
|
|
|
@ -3827,8 +3827,13 @@ inner_eval (void *data)
|
||||||
SCM pair = SCM_PACK (data);
|
SCM pair = SCM_PACK (data);
|
||||||
SCM exp = SCM_CAR (pair);
|
SCM exp = SCM_CAR (pair);
|
||||||
SCM env = SCM_CDR (pair);
|
SCM env = SCM_CDR (pair);
|
||||||
SCM result = scm_i_eval (exp, env);
|
SCM transformer = scm_fluid_ref (SCM_CDR (scm_system_transformer));
|
||||||
return result;
|
|
||||||
|
exp = scm_copy_tree (exp);
|
||||||
|
if (SCM_NIMP (transformer))
|
||||||
|
exp = scm_apply (transformer, exp, scm_listofnull);
|
||||||
|
|
||||||
|
return SCM_XEVAL (exp, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3849,17 +3854,15 @@ SCM_DEFINE (scm_eval, "eval", 2, 0, 0,
|
||||||
"environment given by @var{environment specifier}.")
|
"environment given by @var{environment specifier}.")
|
||||||
#define FUNC_NAME s_scm_eval
|
#define FUNC_NAME s_scm_eval
|
||||||
{
|
{
|
||||||
SCM copied_exp;
|
|
||||||
SCM env_closure;
|
SCM env_closure;
|
||||||
|
|
||||||
SCM_VALIDATE_MODULE (2, environment);
|
SCM_VALIDATE_MODULE (2, environment);
|
||||||
|
|
||||||
copied_exp = scm_copy_tree (exp);
|
|
||||||
env_closure = scm_top_level_env (SCM_MODULE_EVAL_CLOSURE (environment));
|
env_closure = scm_top_level_env (SCM_MODULE_EVAL_CLOSURE (environment));
|
||||||
|
|
||||||
return scm_internal_dynamic_wind
|
return scm_internal_dynamic_wind
|
||||||
(change_environment, inner_eval, restore_environment,
|
(change_environment, inner_eval, restore_environment,
|
||||||
(void *) SCM_UNPACK (scm_cons (copied_exp, env_closure)),
|
(void *) SCM_UNPACK (scm_cons (exp, env_closure)),
|
||||||
(void *) SCM_UNPACK (scm_cons (environment, SCM_BOOL_F)));
|
(void *) SCM_UNPACK (scm_cons (environment, SCM_BOOL_F)));
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue