guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile eval.c


From: Marius Vollmer
Subject: guile/guile-core/libguile eval.c
Date: Wed, 25 Jul 2001 14:03:28 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/07/25 14:03:28

Modified files:
        guile-core/libguile: eval.c 

Log message:
        Allow variables in memoized code (in addition to glocs).
        (scm_lookupcar): Handle variables in lost races.  Replace symbol
        with variable directly, do not make a gloc.
        (scm_unmemocar): Rewrite variables using a reverse lookup, just
        like glocs.
        (scm_ceval, scm_deval): Deal with variables in SCM_IM_SET and in
        the main switch.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/eval.c.diff?cvsroot=OldCVS&tr1=1.235&tr2=1.236&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/eval.c
diff -u guile/guile-core/libguile/eval.c:1.235 
guile/guile-core/libguile/eval.c:1.236
--- guile/guile-core/libguile/eval.c:1.235      Mon Jul  9 00:36:47 2001
+++ guile/guile-core/libguile/eval.c    Wed Jul 25 14:03:28 2001
@@ -372,6 +372,8 @@
        var = SCM_CAR (vloc);
        if (SCM_ITAG3 (var) == scm_tc3_cons_gloc)
          return SCM_GLOC_VAL_LOC (var);
+       if (SCM_VARIABLEP (var))
+         return SCM_VARIABLE_LOC (var);
 #ifdef MEMOIZE_LOCALS
        if (SCM_ITAG7 (var) == SCM_ITAG7 (SCM_ILOC00))
          return scm_ilookup (var, genv);
@@ -385,7 +387,7 @@
       }
 #endif /* USE_THREADS */
 
-    SCM_SET_CELL_WORD_0 (vloc, SCM_UNPACK (real_var) + scm_tc3_cons_gloc);
+    SCM_SETCAR (vloc, real_var);
     return SCM_VARIABLE_LOC (real_var);
   }
 }
@@ -421,6 +423,14 @@
        sym = sym_three_question_marks;
       SCM_SETCAR (form, sym);
     }
+  else if (SCM_VARIABLEP (c))
+    {
+      SCM sym =
+       scm_module_reverse_lookup (scm_env_module (env), c);
+      if (SCM_EQ_P (sym, SCM_BOOL_F))
+       sym = sym_three_question_marks;
+      SCM_SETCAR (form, sym);
+    }
 #ifdef MEMOIZE_LOCALS
 #ifdef DEBUG_EXTENSIONS
   else if (SCM_ILOCP (c))
@@ -2193,7 +2203,10 @@
       switch (SCM_ITAG3 (proc))
        {
        case scm_tc3_cons:
-         t.lloc = scm_lookupcar (x, env, 1);
+         if (SCM_VARIABLEP (proc))
+           t.lloc = SCM_VARIABLE_LOC (proc);
+         else
+           t.lloc = scm_lookupcar (x, env, 1);
          break;
        case scm_tc3_cons_gloc:
          t.lloc = SCM_GLOC_VAL_LOC (proc);
@@ -2546,6 +2559,9 @@
     case scm_tcs_subrs:
       RETURN (x);
 
+    case scm_tc7_variable:
+      return SCM_VARIABLE_REF(x);
+
 #ifdef MEMOIZE_LOCALS
     case SCM_BIT8(SCM_ILOC00):
       proc = *scm_ilookup (SCM_CAR (x), env);
@@ -2558,7 +2574,7 @@
       break;
 #endif /* ifdef MEMOIZE_LOCALS */
 
-
+      
     case scm_tcs_cons_gloc: {
       scm_t_bits vcell = SCM_STRUCT_VTABLE_DATA (x) [scm_vtable_index_vcell];
       if (vcell == 0) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]