1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

* eval.c (CEVAL): Don't distinguish between short and long

instructions when dispatching - just always dispatch on the
	instruction code, which is common for short and long instructions.
	Further, removed unnecessary goto statements and added comment.
This commit is contained in:
Dirk Herrmann 2004-04-03 16:38:56 +00:00
parent 0e7bb79594
commit dec40cd262
2 changed files with 330 additions and 319 deletions

View file

@ -1,3 +1,10 @@
2004-04-03 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
* eval.c (CEVAL): Don't distinguish between short and long
instructions when dispatching - just always dispatch on the
instruction code, which is common for short and long instructions.
Further, removed unnecessary goto statements and added comment.
2004-04-03 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> 2004-04-03 Dirk Herrmann <dirk@dirk-herrmanns-seiten.de>
* eval.c (scm_unmemocopy): Don't distinguish between short and * eval.c (scm_unmemocopy): Don't distinguish between short and

View file

@ -2925,9 +2925,11 @@ start:
#endif #endif
dispatch: dispatch:
SCM_TICK; SCM_TICK;
switch (SCM_ITAG7 (SCM_CAR (x))) if (SCM_ISYMP (SCM_CAR (x)))
{ {
case SCM_BIT7 (SCM_IM_AND): switch (SCM_ISYMNUM (SCM_CAR (x)))
{
case (SCM_ISYMNUM (SCM_IM_AND)):
x = SCM_CDR (x); x = SCM_CDR (x);
while (!SCM_NULLP (SCM_CDR (x))) while (!SCM_NULLP (SCM_CDR (x)))
{ {
@ -2940,7 +2942,7 @@ dispatch:
PREP_APPLY (SCM_UNDEFINED, SCM_EOL); PREP_APPLY (SCM_UNDEFINED, SCM_EOL);
goto carloop; goto carloop;
case SCM_BIT7 (SCM_IM_BEGIN): case (SCM_ISYMNUM (SCM_IM_BEGIN)):
x = SCM_CDR (x); x = SCM_CDR (x);
if (SCM_NULLP (x)) if (SCM_NULLP (x))
RETURN (SCM_UNSPECIFIED); RETURN (SCM_UNSPECIFIED);
@ -3009,7 +3011,7 @@ dispatch:
} }
case SCM_BIT7 (SCM_IM_CASE): case (SCM_ISYMNUM (SCM_IM_CASE)):
x = SCM_CDR (x); x = SCM_CDR (x);
{ {
SCM key = EVALCAR (x, env); SCM key = EVALCAR (x, env);
@ -3027,7 +3029,8 @@ dispatch:
while (!SCM_NULLP (labels)) while (!SCM_NULLP (labels))
{ {
SCM label = SCM_CAR (labels); SCM label = SCM_CAR (labels);
if (SCM_EQ_P (label, key) || !SCM_FALSEP (scm_eqv_p (label, key))) if (SCM_EQ_P (label, key)
|| !SCM_FALSEP (scm_eqv_p (label, key)))
{ {
x = SCM_CDR (clause); x = SCM_CDR (clause);
PREP_APPLY (SCM_UNDEFINED, SCM_EOL); PREP_APPLY (SCM_UNDEFINED, SCM_EOL);
@ -3041,7 +3044,7 @@ dispatch:
RETURN (SCM_UNSPECIFIED); RETURN (SCM_UNSPECIFIED);
case SCM_BIT7 (SCM_IM_COND): case (SCM_ISYMNUM (SCM_IM_COND)):
x = SCM_CDR (x); x = SCM_CDR (x);
while (!SCM_NULLP (x)) while (!SCM_NULLP (x))
{ {
@ -3080,7 +3083,7 @@ dispatch:
RETURN (SCM_UNSPECIFIED); RETURN (SCM_UNSPECIFIED);
case SCM_BIT7 (SCM_IM_DO): case (SCM_ISYMNUM (SCM_IM_DO)):
x = SCM_CDR (x); x = SCM_CDR (x);
{ {
/* Compute the initialization values and the initial environment. */ /* Compute the initialization values and the initial environment. */
@ -3151,7 +3154,7 @@ dispatch:
goto nontoplevel_begin; goto nontoplevel_begin;
case SCM_BIT7 (SCM_IM_IF): case (SCM_ISYMNUM (SCM_IM_IF)):
x = SCM_CDR (x); x = SCM_CDR (x);
{ {
SCM test_result = EVALCAR (x, env); SCM test_result = EVALCAR (x, env);
@ -3167,7 +3170,7 @@ dispatch:
goto carloop; goto carloop;
case SCM_BIT7 (SCM_IM_LET): case (SCM_ISYMNUM (SCM_IM_LET)):
x = SCM_CDR (x); x = SCM_CDR (x);
{ {
SCM init_forms = SCM_CADR (x); SCM init_forms = SCM_CADR (x);
@ -3185,7 +3188,7 @@ dispatch:
goto nontoplevel_begin; goto nontoplevel_begin;
case SCM_BIT7 (SCM_IM_LETREC): case (SCM_ISYMNUM (SCM_IM_LETREC)):
x = SCM_CDR (x); x = SCM_CDR (x);
env = SCM_EXTEND_ENV (SCM_CAR (x), undefineds, env); env = SCM_EXTEND_ENV (SCM_CAR (x), undefineds, env);
x = SCM_CDR (x); x = SCM_CDR (x);
@ -3205,7 +3208,7 @@ dispatch:
goto nontoplevel_begin; goto nontoplevel_begin;
case SCM_BIT7 (SCM_IM_LETSTAR): case (SCM_ISYMNUM (SCM_IM_LETSTAR)):
x = SCM_CDR (x); x = SCM_CDR (x);
{ {
SCM bindings = SCM_CAR (x); SCM bindings = SCM_CAR (x);
@ -3228,7 +3231,7 @@ dispatch:
goto nontoplevel_begin; goto nontoplevel_begin;
case SCM_BIT7 (SCM_IM_OR): case (SCM_ISYMNUM (SCM_IM_OR)):
x = SCM_CDR (x); x = SCM_CDR (x);
while (!SCM_NULLP (SCM_CDR (x))) while (!SCM_NULLP (SCM_CDR (x)))
{ {
@ -3242,15 +3245,15 @@ dispatch:
goto carloop; goto carloop;
case SCM_BIT7 (SCM_IM_LAMBDA): case (SCM_ISYMNUM (SCM_IM_LAMBDA)):
RETURN (scm_closure (SCM_CDR (x), env)); RETURN (scm_closure (SCM_CDR (x), env));
case SCM_BIT7 (SCM_IM_QUOTE): case (SCM_ISYMNUM (SCM_IM_QUOTE)):
RETURN (SCM_CADR (x)); RETURN (SCM_CADR (x));
case SCM_BIT7 (SCM_IM_SET_X): case (SCM_ISYMNUM (SCM_IM_SET_X)):
x = SCM_CDR (x); x = SCM_CDR (x);
{ {
SCM *location; SCM *location;
@ -3267,13 +3270,6 @@ dispatch:
RETURN (SCM_UNSPECIFIED); RETURN (SCM_UNSPECIFIED);
/* new syntactic forms go here. */
case SCM_BIT7 (SCM_MAKISYM (0)):
proc = SCM_CAR (x);
switch (SCM_ISYMNUM (proc))
{
case (SCM_ISYMNUM (SCM_IM_APPLY)): case (SCM_ISYMNUM (SCM_IM_APPLY)):
/* Evaluate the procedure to be applied. */ /* Evaluate the procedure to be applied. */
x = SCM_CDR (x); x = SCM_CDR (x);
@ -3595,11 +3591,11 @@ dispatch:
default: default:
goto evapply; break;
} }
}
else
default: {
if (SCM_VARIABLEP (SCM_CAR (x))) if (SCM_VARIABLEP (SCM_CAR (x)))
proc = SCM_VARIABLE_REF (SCM_CAR (x)); proc = SCM_VARIABLE_REF (SCM_CAR (x));
else if (SCM_ILOCP (SCM_CAR (x))) else if (SCM_ILOCP (SCM_CAR (x)))
@ -3684,7 +3680,15 @@ dispatch:
} }
evapply: /* inputs: x, proc */ /* When reaching this part of the code, the following is granted: Variable x
* holds the first pair of an expression of the form (<function> arg ...).
* Variable proc holds the object that resulted from the evaluation of
* <function>. In the following, the arguments (if any) will be evaluated,
* and proc will be applied to them. If proc does not really hold a
* function object, this will be signalled as an error on the scheme
* level. If the number of arguments does not match the number of arguments
* that are allowed to be passed to proc, also an error on the scheme level
* will be signalled. */
PREP_APPLY (proc, SCM_EOL); PREP_APPLY (proc, SCM_EOL);
if (SCM_NULLP (SCM_CDR (x))) { if (SCM_NULLP (SCM_CDR (x))) {
ENTER_APPLY; ENTER_APPLY;