Changes to make fast variable reference in compiled code work:
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 29 May 1987 02:25:04 +0000 (02:25 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 29 May 1987 02:25:04 +0000 (02:25 +0000)
- New traps (TRAP_COMPILER_CACHED and dangerous).
- Support in lookup and interpret.
- Change to fasdump to generalize the fixed utility kludge.

16 files changed:
v7/src/microcode/bchdmp.c
v7/src/microcode/boot.c
v7/src/microcode/extern.h
v7/src/microcode/fasdump.c
v7/src/microcode/fasload.c
v7/src/microcode/fhooks.c
v7/src/microcode/interp.c
v7/src/microcode/lookup.h
v7/src/microcode/sdata.h
v7/src/microcode/storage.c
v7/src/microcode/trap.h
v7/src/microcode/version.h
v8/src/microcode/interp.c
v8/src/microcode/lookup.h
v8/src/microcode/trap.h
v8/src/microcode/version.h

index 7696af55812554b75bcf50604d749919d00cfc5e..b3a11ca9c860940ff2be670217eb3c695b53610e 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bchdmp.c,v 9.28 1987/04/16 14:35:15 jinx Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bchdmp.c,v 9.29 1987/05/29 02:20:58 jinx Exp $ */
 
 /* bchgcl, bchmmg, bchpur, and bchdmp can replace gcloop, memmag,
    purify, and fasdump, respectively, to provide garbage collection
@@ -64,6 +64,7 @@ Built_In_Primitive(Prim_Prim_Fasdump, 3, "PRIMITIVE-FASDUMP", 0x56)
 */
 Built_In_Primitive(Prim_Band_Dump, 2, "DUMP-BAND", 0xB7)
 {
+  extern Pointer compiler_utilities;
   Pointer Combination, Ext_Prims;
   long Arg1Type;
   Primitive_2_Args();
@@ -86,7 +87,7 @@ Built_In_Primitive(Prim_Band_Dump, 2, "DUMP-BAND", 0xB7)
   Free[COMB_1_ARG_1] = NIL;
   Free += 2;
   *Free++ = Combination;
-  *Free++ = return_to_interpreter;
+  *Free++ = compiler_utilities;
   *Free = Make_Pointer(TC_LIST, Free-2);
   Free++;  /* Some compilers are TOO clever about this and increment Free
              before calculating Free-2! */
index c40901a39e6d95429aabbe1bc73ae9e9d29cf7d6..bf8abc19d50c487276818f2e4f4ee5ce07e39dad 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.33 1987/05/28 00:45:29 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.34 1987/05/29 02:21:09 jinx Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -535,7 +535,8 @@ long Err, Micro_Error;
     case TERM_BROKEN_HEART:
       printf("Broken heart encountered.\n"); break;
     case TERM_COMPILER_DEATH:
-      printf("Compiled code entered without compiler support.\n"); break;
+      printf("Mismatch between compiled code and compiled code support.\n");
+      break;
     case TERM_DISK_RESTORE:
       printf("DISK restore.\n"); break;
     case TERM_EOF:
index c779eabbcb8c5337bcc290729c8280cd604a0f70..e291801c19672f8fc20c333cc98d3af7c1f288dd 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/extern.h,v 9.24 1987/04/16 02:21:28 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/extern.h,v 9.25 1987/05/29 02:22:08 jinx Exp $
  *
  * External declarations.
  *
@@ -89,12 +89,14 @@ extern Pointer
  *Heap,                        /* Bottom of all heap space */
   Current_State_Point, /* Dynamic state point */
   Fluid_Bindings,      /* Fluid bindings AList */
-  return_to_interpreter, /* Return address/code left by interpreter
-                           when calling compiled code */
- *last_return_code;    /* Address of the most recent return code in the stack.
+ *last_return_code,    /* Address of the most recent return code in the stack.
                           This is only meaningful while in compiled code.
                           *** This must be changed when stacklets are used. ***
                         */
+  return_to_interpreter;/* Return code/address used by the compiled code
+                          interface to make compiled code return to the
+                          interpreter.
+                        */
 
 extern Declare_Fixed_Objects();
 \f              
index 8643b6233aee45a9cfb0d870a2e03a6afb8b4a9b..5f778b5c61ecf0290dcb4fe715017324abd0b2c2 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fasdump.c,v 9.25 1987/04/16 14:34:02 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fasdump.c,v 9.26 1987/05/29 02:22:19 jinx Exp $
 
    This file contains code for fasdump and dump-band.
 */
@@ -300,6 +300,7 @@ Built_In_Primitive(Prim_Prim_Fasdump, 3, "PRIMITIVE-FASDUMP", 0x56)
 */
 Built_In_Primitive(Prim_Band_Dump, 2, "DUMP-BAND", 0xB7)
 {
+  extern Pointer compiler_utilities;
   Pointer Combination, Ext_Prims;
   long Arg1Type;
   Primitive_2_Args();
@@ -322,7 +323,7 @@ Built_In_Primitive(Prim_Band_Dump, 2, "DUMP-BAND", 0xB7)
   Free[COMB_1_ARG_1] = NIL;
   Free += 2;
   *Free++ = Combination;
-  *Free++ = return_to_interpreter;
+  *Free++ = compiler_utilities;
   *Free = Make_Pointer(TC_LIST, Free-2);
   Free++;  /* Some compilers are TOO clever about this and increment Free
              before calculating Free-2! */
index fb4988f3804453220b9cb53546a658c591ed666a..c0ac9d04d021edb995204eb546a53788ea1ee764 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fasload.c,v 9.25 1987/04/16 02:21:50 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/fasload.c,v 9.26 1987/05/29 02:22:32 jinx Exp $
 
    The "fast loader" which reads in and relocates binary files and then
    interns symbols.  It is called with one argument: the (character
@@ -464,6 +464,18 @@ Built_In_Primitive(Prim_reload_band_name, 0, "RELOAD-BAND-NAME", 0x1A3)
   return C_String_To_Scheme_String(reload_band_name);
 }
 
+extern void compiler_reset_error();
+
+void 
+compiler_reset_error()
+{
+  fprintf(stderr,
+         "\ncompiler_restart_error: The band being restored and\n");
+  fprintf(stderr,
+         "the compiled code interface in this microcode are inconsistent.\n");
+  Microcode_Termination(TERM_COMPILER_DEATH);
+}
+
 /* (LOAD-BAND FILE-NAME)
    Restores the heap and pure space from the contents of FILE-NAME,
    which is typically a file created by DUMP-BAND.  The file can,
@@ -471,9 +483,10 @@ Built_In_Primitive(Prim_reload_band_name, 0, "RELOAD-BAND-NAME", 0x1A3)
 */
 Built_In_Primitive(Prim_Band_Load, 1, "LOAD-BAND", 0xB9)
 {
+  extern Pointer compiler_utilities;
   Pointer Save_FO, *Save_Free, *Save_Free_Constant,
           Save_Undefined, *Save_Stack_Pointer,
-         *Save_Stack_Guard, Result;
+         *Save_Stack_Guard, saved_utilities, Result;
 
   long Jump_Value;
   jmp_buf  Swapped_Buf, *Saved_Buf;
@@ -492,6 +505,7 @@ Built_In_Primitive(Prim_Band_Load, 1, "LOAD-BAND", 0xB9)
   Free_Constant = Constant_Space;
   Save_Stack_Pointer = Stack_Pointer;
   Save_Stack_Guard = Stack_Guard;
+  saved_utilities = compiler_utilities;
 
 /* Prim_Band_Load continues on next page */
 \f
@@ -504,15 +518,17 @@ Built_In_Primitive(Prim_Band_Load, 1, "LOAD-BAND", 0xB9)
   Saved_Buf = Back_To_Eval;
   Jump_Value = setjmp(Swapped_Buf);
   if (Jump_Value == 0)
-  { extern char *malloc();
+  {
+    extern char *malloc();
     extern strcpy(), free();
+    extern void compiler_reset();
 
     length = Get_Integer(Fast_Vector_Ref(Arg1, STRING_LENGTH));
     band_name = malloc(length);
     if (band_name != ((char *) NULL))
       strcpy(band_name, Scheme_String_To_C_String(Arg1));
 
-    Back_To_Eval = (jmp_buf *) Swapped_Buf;
+    Back_To_Eval = ((jmp_buf *) Swapped_Buf);
     Result = Fasload(Arg1, false);
     Back_To_Eval = Saved_Buf;
 
@@ -526,15 +542,18 @@ Built_In_Primitive(Prim_Band_Load, 1, "LOAD-BAND", 0xB9)
     Save_Cont();
     Store_Expression(Vector_Ref(Result,0));
     /* Primitive externals handled by Fasload */
-    return_to_interpreter = Vector_Ref(Result, 1);
+    compiler_utilities = Vector_Ref(Result, 1);
+    compiler_reset(compiler_utilities);
     Store_Env(Make_Non_Pointer(GLOBAL_ENV, GO_TO_GLOBAL));
     Set_Pure_Top();
     Band_Load_Hook();
-    longjmp(*Back_To_Eval, PRIM_DO_EXPRESSION);
+    PRIMITIVE_ABORT(PRIM_DO_EXPRESSION);
   }
   else
-  { if (band_name != ((char *) NULL))
+  {
+    if (band_name != ((char *) NULL))
       free(band_name);
+    compiler_utilities = saved_utilities;
     Back_To_Eval = Saved_Buf;
     Free = Save_Free;
     Free_Constant = Save_Free_Constant;
@@ -543,7 +562,8 @@ Built_In_Primitive(Prim_Band_Load, 1, "LOAD-BAND", 0xB9)
     Undefined_Externals = Save_Undefined;
     Restore_Fixed_Obj(Save_FO);
     if (Jump_Value == PRIM_INTERRUPT)
-    { printf("\nFile too large for memory.\n");
+    {
+      fprintf(stderr, "\nFile too large for memory.\n");
       Jump_Value = ERR_FASL_FILE_BAD_DATA;
     }
     Primitive_Error(Jump_Value);
index 3a606bc0dd06eddd321d71f30555a9aec01c3edb..0feedde5d09b4cf90b4da25d238708f4a987744d 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/fhooks.c,v 9.22 1987/04/03 00:43:16 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/fhooks.c,v 9.23 1987/05/29 02:22:51 jinx Exp $
  *
  * This file contains hooks and handles for the new fluid bindings
  * scheme for multiprocessors.
@@ -56,7 +56,7 @@ Define_Primitive(Prim_Set_Fluid_Bindings, 1, "SET-FLUID-BINDINGS!")
 
   Result = Fluid_Bindings;
   Fluid_Bindings = Arg1;
-  return Result;
+  PRIMITIVE_RETURN(Result);
 }
 
 /* (GET-FLUID-BINDINGS NEW-BINDINGS)
@@ -67,7 +67,7 @@ Define_Primitive(Prim_Get_Fluid_Bindings, 0, "GET-FLUID-BINDINGS")
 {
   Primitive_0_Args();
 
-  return Fluid_Bindings;
+  PRIMITIVE_RETURN(Fluid_Bindings);
 }
 
 /* (WITH-SAVED-FLUID-BINDINGS THUNK)
@@ -89,7 +89,7 @@ Define_Primitive(Prim_With_Saved_Fluid_Bindings,1,"WITH-SAVED-FLUID-BINDINGS")
   Push(Arg1);
   Push(STACK_FRAME_HEADER);
  Pushed();
-  longjmp(*Back_To_Eval, PRIM_APPLY);
+  PRIMITIVE_ABORT(PRIM_APPLY);
 }
 \f
 /* Utilities for the primitives below. */
@@ -117,13 +117,18 @@ Pointer
     case TRAP_UNBOUND_DANGEROUS:
     case TRAP_UNASSIGNED_DANGEROUS:
     case TRAP_FLUID_DANGEROUS:
-      return deep_lookup(env, hunk[VARIABLE_SYMBOL], hunk);
+    case TRAP_COMPILER_CACHED_DANGEROUS:
+      return deep_lookup(env, hunk[VARIABLE_SYMBOL], hunk, false);
 
+    case TRAP_COMPILER_CACHED:
     case TRAP_FLUID:
     case TRAP_UNBOUND:
     case TRAP_UNASSIGNED:
       return cell;
 
+    case TRAP_NOP:
+      Primitive_Error(ERR_BAD_FRAME);
+
     default:
       Primitive_Error(ERR_BROKEN_COMPILED_VARIABLE);
   }
@@ -140,9 +145,11 @@ new_fluid_binding(cell, value, force)
   Pointer new_trap_value;
   long new_trap_kind, trap_kind;
 
+  new_trap_kind = TRAP_FLUID;
   setup_lock(set_serializer, cell);
 
-  new_trap_kind = TRAP_FLUID;
+new_fluid_binding_restart:
+
   trap = *cell;
   new_trap_value = trap;
 
@@ -151,17 +158,18 @@ new_fluid_binding(cell, value, force)
     get_trap_kind(trap_kind, trap);
     switch(trap_kind)
     {
+      case TRAP_NOP:
       case TRAP_DANGEROUS:
         Vector_Set(trap,
                   TRAP_TAG,
-                  Make_Unsigned_Fixnum(TRAP_FLUID_DANGEROUS));
+                  Make_Unsigned_Fixnum(TRAP_FLUID | (trap_kind & 1)));
 
        /* Fall through */
       case TRAP_FLUID:
       case TRAP_FLUID_DANGEROUS:
-       new_trap_kind = TRAP_NOP;
+       new_trap_kind = -1;
        break;
-\f
+
       case TRAP_UNBOUND:
       case TRAP_UNBOUND_DANGEROUS:
        if (!force)
@@ -172,9 +180,15 @@ new_fluid_binding(cell, value, force)
        /* Fall through */
       case TRAP_UNASSIGNED:
       case TRAP_UNASSIGNED_DANGEROUS:
-       new_trap_kind = Make_Unsigned_Fixnum((TRAP_FLUID | (trap_kind & 1)));
+       new_trap_kind = (TRAP_FLUID | (trap_kind & 1));
        new_trap_value = UNASSIGNED_OBJECT;
        break;
+\f
+      case TRAP_COMPILER_CACHED:
+      case TRAP_COMPILED_CACHED_DANGEROUS:
+       cell = Nth_Vector_Loc(Fast_Vector_Ref(*cell, TRAP_EXTRA),
+                             TRAP_EXTENSION_CELL);
+       goto new_fluid_binding_restart;
 
       default:
        remove_lock(set_serializer);
@@ -182,7 +196,7 @@ new_fluid_binding(cell, value, force)
     }
   }
 
-  if (new_trap_kind != TRAP_NOP)
+  if (new_trap_kind != -1)
   {
     if (GC_allocate_test(2))
     {
@@ -190,7 +204,7 @@ new_fluid_binding(cell, value, force)
       Primitive_GC(2);
     }
     trap = Make_Pointer(TC_REFERENCE_TRAP, Free);
-    *Free++ = new_trap_kind;
+    *Free++ = Make_Unsigned_Fixnum(new_trap_kind);
     *Free++ = new_trap_value;
     *cell = trap;
   }
@@ -232,14 +246,14 @@ Define_Primitive(Prim_Add_Fluid_Binding, 3, "ADD-FLUID-BINDING!")
 
     case TC_INTERNED_SYMBOL:
     case TC_UNINTERNED_SYMBOL:
-      cell = deep_lookup(Arg1, Arg2, fake_variable_object);
+      cell = deep_lookup(Arg1, Arg2, fake_variable_object, false);
       break;
 
     default:
       Primitive_Error(ERR_ARG_2_WRONG_TYPE);
   }
 
-  return new_fluid_binding(cell, Arg3, false);
+  PRIMITIVE_RETURN(new_fluid_binding(cell, Arg3, false));
 }
 \f
 /* (MAKE-FLUID-BINDING! ENVIRONMENT SYMBOL-OR-VARIABLE VALUE)
@@ -257,8 +271,8 @@ Define_Primitive(Prim_Add_Fluid_Binding, 3, "ADD-FLUID-BINDING!")
 
 Define_Primitive(Prim_Make_Fluid_Binding, 3, "MAKE-FLUID-BINDING!")
 {
+  extern Pointer *force_definition();
   Pointer *cell;
-  fast Pointer env, previous;
   Primitive_3_Args();
 
   if (Arg1 != GLOBAL_ENV)
@@ -272,48 +286,35 @@ Define_Primitive(Prim_Make_Fluid_Binding, 3, "MAKE-FLUID-BINDING!")
 
     case TC_INTERNED_SYMBOL:
     case TC_UNINTERNED_SYMBOL:
-      cell = deep_lookup(Arg1, Arg2, fake_variable_object);
+      cell = deep_lookup(Arg1, Arg2, fake_variable_object, false);
       break;
 
     default:
       Primitive_Error(ERR_ARG_2_WRONG_TYPE);
   }
-\f
-  /* This only happens when global is not allowed,
-     it's expensive and will not be used, but is
-     provided for completeness.
-   */
 
   if (cell == unbound_trap_object)
   {
-    long result;
-    Pointer symbol;
+    long message;
 
-    env = Arg1;
-    if (Type_Code(env) == GLOBAL_ENV)
-      Primitive_Error(ERR_BAD_FRAME);
-           
-    do
-    {
-      previous = env;
-      env = Fast_Vector_Ref(Vector_Ref(env, ENVIRONMENT_FUNCTION),
-                           PROCEDURE_ENVIRONMENT);
-    } while (Type_Code(env) != GLOBAL_ENV);
+    /* This only happens when global is not allowed,
+       only provided for completeness.
+     */
 
-    symbol = ((Type_Code(Arg2) == TC_VARIABLE) ?
-             Vector_Ref(Arg2, VARIABLE_SYMBOL) :
-             Arg2);
+    cell = force_definition(Arg1,
+                           ((Type_Code(Arg2) == TC_VARIABLE) ?
+                            Vector_Ref(Arg2, VARIABLE_SYMBOL) :
+                            Arg2)
+                           &message);
 
-    result = Local_Set(previous, symbol, UNASSIGNED_OBJECT);
-    if (result != PRIM_DONE)
+    if (message != PRIM_DONE)
     {
-      if (result == PRIM_INTERRUPT)
+      if (message == PRIM_INTERRUPT)
        Primitive_Interrupt();
-
-      Primitive_Error(result);
+      else
+       Primitive_Error(message);
     }
-    cell = deep_lookup(previous, symbol, fake_variable_object);
   }
 
-  return new_fluid_binding(cell, Arg3, true);
+  PRIMITIVE_RETURN(new_fluid_binding(cell, Arg3, true));
 }
index f72416df7dc95d674e0bf70e9ccd015bc6498631..d1110351976025af268ec6c91a0f5a68060ffdb5 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.c,v 9.24 1987/04/21 15:02:02 cph Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.c,v 9.25 1987/05/29 02:23:02 jinx Exp $
  *
  * This file contains the heart of the Scheme Scode
  * interpreter
@@ -652,7 +652,10 @@ Prim_No_Trap_Apply:
       Set_Time_Zone(Zone_Lookup);
       cell = Get_Pointer(Fetch_Expression());
       lookup(cell, Fetch_Env(), cell, repeat_variable_lookup);
-      Val = *cell;
+
+lookup_end_restart:
+
+      Val = Fetch(cell[0]);
       if (Type_Code(Val) != TC_REFERENCE_TRAP)
       {
        Set_Time_Zone(Zone_Working);
@@ -666,23 +669,37 @@ Prim_No_Trap_Apply:
        case TRAP_UNBOUND_DANGEROUS:
        case TRAP_UNASSIGNED_DANGEROUS:
        case TRAP_FLUID_DANGEROUS:
+       case TRAP_COMPILER_CACHED_DANGEROUS:
          cell = Get_Pointer(Fetch_Expression());
          temp =
-           deep_lookup_end(deep_lookup(Fetch_Env(), cell[VARIABLE_SYMBOL], cell),
+           deep_lookup_end(deep_lookup(Fetch_Env(),
+                                       cell[VARIABLE_SYMBOL],
+                                       cell),
                            cell);
-         goto external_lookup_return;
-
-       /* No need to recompile, pass the fake variable. */
-       case TRAP_FLUID:
-         temp = deep_lookup_end(lookup_fluid(Val), fake_variable_object);
-
-       external_lookup_return:
          Import_Val();
          if (temp != PRIM_DONE)
            break;
          Set_Time_Zone(Zone_Working);
          goto Pop_Return;
 
+       case TRAP_COMPILER_CACHED:
+         cell = Nth_Vector_Loc(Fast_Vector_Ref(Val, TRAP_EXTRA),
+                               TRAP_EXTENSION_CELL);
+         goto lookup_end_restart;
+
+       case TRAP_FLUID:
+         cell = lookup_fluid(Val);
+         goto lookup_end_restart;
+
+/* Interpret() continues on the next page */
+\f
+/* Interpret(), continued */
+
+       case TRAP_NOP:
+         Val = Vector_Ref(Val, TRAP_EXTRA);
+         Set_Time_Zone(Zone_Working);
+         goto Pop_Return;
+
        case TRAP_UNBOUND:
          temp = ERR_UNBOUND_VARIABLE;
          break;
@@ -691,10 +708,6 @@ Prim_No_Trap_Apply:
          temp = ERR_UNASSIGNED_VARIABLE;
          break;
 
-/* Interpret() continues on the next page */
-\f
-/* Interpret(), continued */
-
        default:
          temp = ERR_BROKEN_COMPILED_VARIABLE;
          break;
@@ -706,7 +719,7 @@ Prim_No_Trap_Apply:
       temp = Lex_Ref(Fetch_Env(), Fetch_Expression());
       Import_Val();
       if (temp == PRIM_DONE)
-       break;
+       goto Pop_Return;
 
 #endif No_In_Line_Lookup
 
@@ -811,48 +824,65 @@ Pop_Return:
 \f
 /* Interpret(), continued */
 
-#define define_compiler_restart( return_code, entry)                   \
+#define define_compiler_restart(return_code, entry)                    \
     case return_code:                                                  \
-      { extern long entry();                                           \
+      {                                                                        \
+       extern long entry();                                            \
        compiled_code_restart();                                        \
        Export_Registers();                                             \
        Which_Way = entry();                                            \
        goto return_from_compiled_code;                                 \
       }
 
-      define_compiler_restart( RC_COMP_INTERRUPT_RESTART,
-                             comp_interrupt_restart)
+      define_compiler_restart (RC_COMP_INTERRUPT_RESTART,
+                              comp_interrupt_restart)
+
+      define_compiler_restart (RC_COMP_LEXPR_INTERRUPT_RESTART,
+                              comp_lexpr_interrupt_restart)
+
+      define_compiler_restart (RC_COMP_LOOKUP_APPLY_RESTART,
+                              comp_lookup_apply_restart)
 
-      define_compiler_restart( RC_COMP_LEXPR_INTERRUPT_RESTART,
-                             comp_lexpr_interrupt_restart)
+      define_compiler_restart (RC_COMP_REFERENCE_RESTART,
+                              comp_reference_restart)
 
-      define_compiler_restart( RC_COMP_LOOKUP_APPLY_RESTART,
-                             comp_lookup_apply_restart)
+      define_compiler_restart (RC_COMP_ACCESS_RESTART, comp_access_restart)
 
-      define_compiler_restart( RC_COMP_REFERENCE_RESTART,
-                             comp_reference_restart)
+      define_compiler_restart (RC_COMP_UNASSIGNED_P_RESTART,
+                              comp_unassigned_p_restart)
 
-      define_compiler_restart( RC_COMP_ACCESS_RESTART,
-                             comp_access_restart)
+      define_compiler_restart (RC_COMP_UNBOUND_P_RESTART,
+                              comp_unbound_p_restart)
 
-      define_compiler_restart( RC_COMP_UNASSIGNED_P_RESTART,
-                             comp_unassigned_p_restart)
+      define_compiler_restart (RC_COMP_ASSIGNMENT_RESTART,
+                              comp_assignment_restart)
 
-      define_compiler_restart( RC_COMP_UNBOUND_P_RESTART,
-                             comp_unbound_p_restart)
+      define_compiler_restart (RC_COMP_DEFINITION_RESTART,
+                              comp_definition_restart)
 
-      define_compiler_restart( RC_COMP_ASSIGNMENT_RESTART,
-                             comp_assignment_restart)
+      define_compiler_restart (RC_COMP_SAFE_REFERENCE_RESTART,
+                              comp_safe_reference_restart)
 
-      define_compiler_restart( RC_COMP_DEFINITION_RESTART,
-                             comp_definition_restart)
+      define_compiler_restart (RC_COMP_CACHE_VARIABLE_RESTART,
+                              comp_cache_variable_restart)
 
+      define_compiler_restart (RC_COMP_REFERENCE_TRAP_RESTART,
+                              comp_reference_trap_restart)
+
+      define_compiler_restart (RC_COMP_ASSIGNMENT_TRAP_RESTART,
+                              comp_assignment_trap_restart)
+
+      define_compiler_restart (RC_COMP_UUO_LINK_RESTART, comp_uuo_link_restart)
+
+      define_compiler_restart (RC_COMP_UUO_LINK_TRAP_RESTART,
+                              comp_uuo_link_trap_restart)
+\f
     case RC_REENTER_COMPILED_CODE:
       compiled_code_restart();
       Export_Registers();
       Which_Way = return_to_compiled_code();
       goto return_from_compiled_code;
-\f
+
     case RC_CONDITIONAL_DECIDE:
       Pop_Return_Val_Check();
       End_Subproblem();
@@ -876,7 +906,7 @@ Pop_Return:
       /* Should be called RC_REDO_EVALUATION. */
       Store_Env(Pop());
       Reduces_To(Fetch_Expression());
-
+\f
     case RC_EXECUTE_ACCESS_FINISH:
     {
       long Result;
@@ -926,13 +956,18 @@ Pop_Return:
       Restore_Env();
       cell = Get_Pointer(Vector_Ref(Fetch_Expression(), ASSIGN_NAME));
       lookup(cell, Fetch_Env(), cell, repeat_assignment_lookup);
-      setup_lock(set_serializer, cell);
 
       value = Val;
       bogus_unassigned = Get_Fixed_Obj_Slot(Non_Object);
       if (value == bogus_unassigned)
        value = UNASSIGNED_OBJECT;
 
+assignment_end_before_lock:
+
+      setup_lock(set_serializer, cell);
+
+assignment_end_after_lock:
+
       if (Type_Code(*cell) != TC_REFERENCE_TRAP)
       {
        Val = *cell;
@@ -956,6 +991,7 @@ Pop_Return:
        case TRAP_UNBOUND_DANGEROUS:
        case TRAP_UNASSIGNED_DANGEROUS:
        case TRAP_FLUID_DANGEROUS:
+       case TRAP_COMPILER_CACHED_DANGEROUS:
          remove_lock(set_serializer);
          cell = Get_Pointer(Vector_Ref(Fetch_Expression(), ASSIGN_NAME));
          temp =
@@ -965,21 +1001,7 @@ Pop_Return:
                                cell,
                                value,
                                false);
-         goto external_assignment_return;
-
-       case TRAP_UNASSIGNED:
-         Val = bogus_unassigned;
-         goto normal_assignment_done;
-
-       case TRAP_FLUID:
-         /* No need to recompile, pass the fake variable. */
-         remove_lock(set_serializer);
-         temp = deep_assignment_end(lookup_fluid(*cell),
-                                    fake_variable_object,
-                                    value,
-                                    false);
-
-       external_assignment_return:
+external_assignment_return:
          Import_Val();
          if (temp != PRIM_DONE)
            break;
@@ -987,23 +1009,64 @@ Pop_Return:
          End_Subproblem();
          goto Pop_Return;
 
+       case TRAP_COMPILER_CACHED:
+       {
+         Pointer extension;
+
+         extension = Fast_Vector_Ref(Val, TRAP_EXTRA);
+         if (Fast_Vector_Ref(extension, TRAP_EXTENSION_UUO_LIST) != NIL)
+         {
+           /* No need to recompile, pass the fake variable. */
+           remove_lock(set_serializer);
+           temp = deep_assignment_end(cell,
+                                      fake_variable_object,
+                                      value,
+                                      false);
+           goto external_assignment_return;
+         }
+         cell = Nth_Vector_Loc(extension, TRAP_EXTENSION_CELL);
+         goto assignment_end_after_lock;
+       }         
+
+/* Interpret() continues on the next page */
+\f
+/* Interpret(), continued */
+
+       case TRAP_FLUID:
+         remove_lock(set_serializer);
+         cell = lookup_fluid(Val);
+         goto assignment_end_before_lock;
+
        case TRAP_UNBOUND:
          remove_lock(set_serializer);
          temp = ERR_UNBOUND_VARIABLE;
          break;
 
+       case TRAP_UNASSIGNED:
+         Val = bogus_unassigned;
+         goto normal_assignment_done;
+
+       case TRAP_NOP:
+         remove_lock(set_serializer);
+         temp = ERR_BAD_FRAME;
+         break;
+
        default:
          remove_lock(set_serializer);
          temp = ERR_BROKEN_COMPILED_VARIABLE;
          break;
       }
 
+      if (value == UNASSIGNED_OBJECT)
+       value = bogus_unassigned;
+       
 /* Interpret() continues on the next page */
 \f
 /* Interpret(), continued */
 
-#else
+#else No_In_Line_Lookup
 
+      value = Val;
       Set_Time_Zone(Zone_Lookup);
       Restore_Env();
       temp = Lex_Set(Fetch_Env(),
@@ -1011,12 +1074,13 @@ Pop_Return:
                     value);
       Import_Val();
       if (temp == PRIM_DONE) 
-      { End_Subproblem();
+      {
+       End_Subproblem();
        Set_Time_Zone(Zone_Working);
        break;
       }
 
-#endif
+#endif No_In_Line_Lookup
 
       Set_Time_Zone(Zone_Working);
       Save_Env();
index 46c3ab9a779884beae49caa943215902a4c971f3..45024df8e4598baf105e5905a29a236f1660208e 100644 (file)
@@ -30,13 +30,14 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/lookup.h,v 9.36 1987/04/16 02:26:04 jinx Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/lookup.h,v 9.37 1987/05/29 02:24:06 jinx Exp $ */
 
 /* Macros and declarations for the variable lookup code. */
 
 extern Pointer
   *deep_lookup(),
-  *lookup_fluid();
+  *lookup_fluid(),
+  *force_definition();
 
 extern long
   deep_lookup_end(),
@@ -225,7 +226,8 @@ label:                                                                      \
 \f
 #define lookup_primitive_type_test()                                   \
 {                                                                      \
-  if (Type_Code(Arg1) != GLOBAL_ENV) Arg_1_Type(TC_ENVIRONMENT);       \
+  if (Type_Code(Arg1) != GLOBAL_ENV)                                   \
+    Arg_1_Type(TC_ENVIRONMENT);                                                \
   if (Type_Code(Arg2) != TC_INTERNED_SYMBOL)                           \
     Arg_2_Type(TC_UNINTERNED_SYMBOL);                                  \
 }
@@ -233,7 +235,7 @@ label:                                                                      \
 #define lookup_primitive_end(Result)                                   \
 {                                                                      \
   if (Result == PRIM_DONE)                                             \
-    return Val;                                                                \
+    PRIMITIVE_RETURN(Val);                                             \
   if (Result == PRIM_INTERRUPT)                                                \
     Primitive_Interrupt();                                             \
   Primitive_Error(Result);                                             \
index 03f0c0274c3657f3d92a1e8ad75739ee1b337a2b..bc44964e12065bce9c49a6bef10873c4fabb9e76 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/sdata.h,v 9.23 1987/04/16 02:29:06 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/sdata.h,v 9.24 1987/05/29 02:24:18 jinx Rel $
  *
  * Description of the user data objects.  This should parallel the
  * file SDATA.SCM in the runtime system.
@@ -322,6 +322,15 @@ MIT in each case. */
 #define PROCEDURE_LAMBDA_EXPR  0
 #define PROCEDURE_ENVIRONMENT  1
 \f
+/* QUAD or HUNK4
+ * Like a pair but with 4 components.
+ */
+
+#define HUNK4_CXR0                             0
+#define HUNK4_CXR1                             1
+#define HUNK4_CXR2                             2
+#define HUNK4_CXR3                             3
+
 /* REFERENCE_TRAP
  * Causes the variable lookup code to trap.
  * Used to implement a variety of features.
@@ -333,6 +342,19 @@ MIT in each case. */
 #define TRAP_TAG                               0
 #define TRAP_EXTRA                             1
 
+/* Traps can be extended for the use of the fast variable reference mechanism in
+ * compiled code.  The following is the format of a trap extension object.
+ */
+
+#define TRAP_EXTENSION_CELL                    HUNK4_CXR0
+#define TRAP_EXTENSION_CACHE_LIST              HUNK4_CXR1
+#define TRAP_EXTENSION_UUO_LIST                        HUNK4_CXR2
+#define TRAP_EXTENSION_NAME                    HUNK4_CXR3
+
+/* Aliases */
+#define TRAP_EXTENSION_BLOCK                   TRAP_EXTENSION_CACHE_LIST
+#define TRAP_EXTENSION_OFFSET                  TRAP_EXTENSION_UUO_LIST
+\f
 /* RETURN_CODE
  * Represents an address where computation is to continue.  These can be
  * thought of as states in a finite state machine, labels in an assembly
@@ -365,7 +387,7 @@ MIT in each case. */
 #define STATE_SPACE_TAG                        1
 #define STATE_SPACE_NEAREST_POINT      2
 #define STATE_SPACE_SIZE               3
-
+\f
 /* When in RC_MOVE_TO_ADJACENT_POINT in the interpreter, the following
    information is available on the stack (placed there by
    Translate_To_Point
@@ -374,7 +396,7 @@ MIT in each case. */
 #define TRANSLATE_FROM_DISTANCE                1
 #define TRANSLATE_TO_POINT             2
 #define TRANSLATE_TO_DISTANCE          3
-\f
+
 /* TRUE
  * The initial binding of the variable T is to an object of this type.
  * This type is the beginnings of a possible move toward a system where
index e2b18c82f958c06d8d4946c45ded6448884bef6a..69df3ad33dd08d9e2ce9de7f215e1dc426c46f51 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/storage.c,v 9.31 1987/05/28 16:07:58 cph Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/storage.c,v 9.32 1987/05/29 02:24:33 jinx Exp $
 
 This file defines the storage for global variables for
 the Scheme Interpreter. */
@@ -60,14 +60,12 @@ Pointer
  *Heap,                        /* Bottom of entire heap */
   Current_State_Point = NIL, /* Used by dynamic winder */
   Fluid_Bindings = NIL,        /* Fluid bindings AList */
-  return_to_interpreter, /* Return address/code left by interpreter
-                           when calling compiled code */
-  uuo_link_trap,       /* Entry address for uuo links needing
-                          special attention */
  *last_return_code,    /* Address of the most recent return code in the stack.
                           This is only meaningful while in compiled code.
                           *** This must be changed when stacklets are used. ***
                         */
+  compiler_utilities,  /* Utility block in constant space needed by the compiled
+                          code interface. */
  Swap_Temp;            /* Used by Swap_Pointers in default.h */
 \f
 long IntCode,          /* Interrupts requesting */
index 1fe98def2ce49f1ae378f750d0a1ffa2020d78a1..e8fcdb33b5c6f208c7342a3a7cb4fc7b01d08fa0 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/trap.h,v 9.37 1987/04/16 02:30:49 jinx Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/trap.h,v 9.38 1987/05/29 02:24:53 jinx Rel $ */
 \f
 /* Kinds of traps:
 
@@ -41,7 +41,6 @@ MIT in each case. */
    For efficiency, some traps are immediate, while some are
    pointer objects.  The type code is multiplexed, and the
    garbage collector handles it specially.
-
  */
 
 /* The following are immediate traps: */
@@ -51,16 +50,20 @@ MIT in each case. */
 #define TRAP_UNBOUND                           2
 #define TRAP_UNBOUND_DANGEROUS                 3
 #define TRAP_ILLEGAL                           4
-#define TRAP_ILLEGAL_DANGEROUS                 5       /* Unused. */
+#define TRAP_ILLEGAL_DANGEROUS                 5
 
 /* TRAP_MAX_IMMEDIATE is defined in const.h */
 
 /* The following are not: */
 
-#define TRAP_NOP                               10      /* Unused. */
+#define TRAP_NOP                               10
 #define TRAP_DANGEROUS                         11
 #define TRAP_FLUID                             12
 #define TRAP_FLUID_DANGEROUS                   13
+#define TRAP_COMPILER_CACHED                   14
+#define TRAP_COMPILER_CACHED_DANGEROUS         15
+
+#define TRAP_EXTENSION_TYPE                    TC_QUAD
 
 /* Trap utilities */
 
@@ -89,7 +92,9 @@ MIT in each case. */
 #define DANGEROUS_ILLEGAL_OBJECT       0x32000005
 #endif
 
+#define NOP_OBJECT                     Make_Unsigned_Fixnum(TRAP_NOP)
 #define DANGEROUS_OBJECT               Make_Unsigned_Fixnum(TRAP_DANGEROUS)
+#define REQUEST_RECACHE_OBJECT         DANGEROUS_ILLEGAL_OBJECT
 
 #if (TC_REFERENCE_TRAP != 0x32)
 #include "error: trap.h and types.h are inconsistent"
index 89931f80898762a5ec8d6cf8f6caf1ce001c9ff3..2ee22d6d75bd0b20a79dc40c9bc0e6124b748e57 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 9.55 1987/05/28 00:49:25 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 9.56 1987/05/29 02:25:04 jinx Exp $
 
 This file contains version information for the microcode. */
 \f
@@ -46,7 +46,7 @@ This file contains version information for the microcode. */
 #define VERSION                9
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     55
+#define SUBVERSION     56
 #endif
 
 #ifndef UCODE_TABLES_FILENAME
index 808857373d5916f0365eb693ca754a0f1eb4d37a..2bea20e6befc84de3da8c8ec6fb57d66eb91032a 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/interp.c,v 9.24 1987/04/21 15:02:02 cph Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/interp.c,v 9.25 1987/05/29 02:23:02 jinx Exp $
  *
  * This file contains the heart of the Scheme Scode
  * interpreter
@@ -652,7 +652,10 @@ Prim_No_Trap_Apply:
       Set_Time_Zone(Zone_Lookup);
       cell = Get_Pointer(Fetch_Expression());
       lookup(cell, Fetch_Env(), cell, repeat_variable_lookup);
-      Val = *cell;
+
+lookup_end_restart:
+
+      Val = Fetch(cell[0]);
       if (Type_Code(Val) != TC_REFERENCE_TRAP)
       {
        Set_Time_Zone(Zone_Working);
@@ -666,23 +669,37 @@ Prim_No_Trap_Apply:
        case TRAP_UNBOUND_DANGEROUS:
        case TRAP_UNASSIGNED_DANGEROUS:
        case TRAP_FLUID_DANGEROUS:
+       case TRAP_COMPILER_CACHED_DANGEROUS:
          cell = Get_Pointer(Fetch_Expression());
          temp =
-           deep_lookup_end(deep_lookup(Fetch_Env(), cell[VARIABLE_SYMBOL], cell),
+           deep_lookup_end(deep_lookup(Fetch_Env(),
+                                       cell[VARIABLE_SYMBOL],
+                                       cell),
                            cell);
-         goto external_lookup_return;
-
-       /* No need to recompile, pass the fake variable. */
-       case TRAP_FLUID:
-         temp = deep_lookup_end(lookup_fluid(Val), fake_variable_object);
-
-       external_lookup_return:
          Import_Val();
          if (temp != PRIM_DONE)
            break;
          Set_Time_Zone(Zone_Working);
          goto Pop_Return;
 
+       case TRAP_COMPILER_CACHED:
+         cell = Nth_Vector_Loc(Fast_Vector_Ref(Val, TRAP_EXTRA),
+                               TRAP_EXTENSION_CELL);
+         goto lookup_end_restart;
+
+       case TRAP_FLUID:
+         cell = lookup_fluid(Val);
+         goto lookup_end_restart;
+
+/* Interpret() continues on the next page */
+\f
+/* Interpret(), continued */
+
+       case TRAP_NOP:
+         Val = Vector_Ref(Val, TRAP_EXTRA);
+         Set_Time_Zone(Zone_Working);
+         goto Pop_Return;
+
        case TRAP_UNBOUND:
          temp = ERR_UNBOUND_VARIABLE;
          break;
@@ -691,10 +708,6 @@ Prim_No_Trap_Apply:
          temp = ERR_UNASSIGNED_VARIABLE;
          break;
 
-/* Interpret() continues on the next page */
-\f
-/* Interpret(), continued */
-
        default:
          temp = ERR_BROKEN_COMPILED_VARIABLE;
          break;
@@ -706,7 +719,7 @@ Prim_No_Trap_Apply:
       temp = Lex_Ref(Fetch_Env(), Fetch_Expression());
       Import_Val();
       if (temp == PRIM_DONE)
-       break;
+       goto Pop_Return;
 
 #endif No_In_Line_Lookup
 
@@ -811,48 +824,65 @@ Pop_Return:
 \f
 /* Interpret(), continued */
 
-#define define_compiler_restart( return_code, entry)                   \
+#define define_compiler_restart(return_code, entry)                    \
     case return_code:                                                  \
-      { extern long entry();                                           \
+      {                                                                        \
+       extern long entry();                                            \
        compiled_code_restart();                                        \
        Export_Registers();                                             \
        Which_Way = entry();                                            \
        goto return_from_compiled_code;                                 \
       }
 
-      define_compiler_restart( RC_COMP_INTERRUPT_RESTART,
-                             comp_interrupt_restart)
+      define_compiler_restart (RC_COMP_INTERRUPT_RESTART,
+                              comp_interrupt_restart)
+
+      define_compiler_restart (RC_COMP_LEXPR_INTERRUPT_RESTART,
+                              comp_lexpr_interrupt_restart)
+
+      define_compiler_restart (RC_COMP_LOOKUP_APPLY_RESTART,
+                              comp_lookup_apply_restart)
 
-      define_compiler_restart( RC_COMP_LEXPR_INTERRUPT_RESTART,
-                             comp_lexpr_interrupt_restart)
+      define_compiler_restart (RC_COMP_REFERENCE_RESTART,
+                              comp_reference_restart)
 
-      define_compiler_restart( RC_COMP_LOOKUP_APPLY_RESTART,
-                             comp_lookup_apply_restart)
+      define_compiler_restart (RC_COMP_ACCESS_RESTART, comp_access_restart)
 
-      define_compiler_restart( RC_COMP_REFERENCE_RESTART,
-                             comp_reference_restart)
+      define_compiler_restart (RC_COMP_UNASSIGNED_P_RESTART,
+                              comp_unassigned_p_restart)
 
-      define_compiler_restart( RC_COMP_ACCESS_RESTART,
-                             comp_access_restart)
+      define_compiler_restart (RC_COMP_UNBOUND_P_RESTART,
+                              comp_unbound_p_restart)
 
-      define_compiler_restart( RC_COMP_UNASSIGNED_P_RESTART,
-                             comp_unassigned_p_restart)
+      define_compiler_restart (RC_COMP_ASSIGNMENT_RESTART,
+                              comp_assignment_restart)
 
-      define_compiler_restart( RC_COMP_UNBOUND_P_RESTART,
-                             comp_unbound_p_restart)
+      define_compiler_restart (RC_COMP_DEFINITION_RESTART,
+                              comp_definition_restart)
 
-      define_compiler_restart( RC_COMP_ASSIGNMENT_RESTART,
-                             comp_assignment_restart)
+      define_compiler_restart (RC_COMP_SAFE_REFERENCE_RESTART,
+                              comp_safe_reference_restart)
 
-      define_compiler_restart( RC_COMP_DEFINITION_RESTART,
-                             comp_definition_restart)
+      define_compiler_restart (RC_COMP_CACHE_VARIABLE_RESTART,
+                              comp_cache_variable_restart)
 
+      define_compiler_restart (RC_COMP_REFERENCE_TRAP_RESTART,
+                              comp_reference_trap_restart)
+
+      define_compiler_restart (RC_COMP_ASSIGNMENT_TRAP_RESTART,
+                              comp_assignment_trap_restart)
+
+      define_compiler_restart (RC_COMP_UUO_LINK_RESTART, comp_uuo_link_restart)
+
+      define_compiler_restart (RC_COMP_UUO_LINK_TRAP_RESTART,
+                              comp_uuo_link_trap_restart)
+\f
     case RC_REENTER_COMPILED_CODE:
       compiled_code_restart();
       Export_Registers();
       Which_Way = return_to_compiled_code();
       goto return_from_compiled_code;
-\f
+
     case RC_CONDITIONAL_DECIDE:
       Pop_Return_Val_Check();
       End_Subproblem();
@@ -876,7 +906,7 @@ Pop_Return:
       /* Should be called RC_REDO_EVALUATION. */
       Store_Env(Pop());
       Reduces_To(Fetch_Expression());
-
+\f
     case RC_EXECUTE_ACCESS_FINISH:
     {
       long Result;
@@ -926,13 +956,18 @@ Pop_Return:
       Restore_Env();
       cell = Get_Pointer(Vector_Ref(Fetch_Expression(), ASSIGN_NAME));
       lookup(cell, Fetch_Env(), cell, repeat_assignment_lookup);
-      setup_lock(set_serializer, cell);
 
       value = Val;
       bogus_unassigned = Get_Fixed_Obj_Slot(Non_Object);
       if (value == bogus_unassigned)
        value = UNASSIGNED_OBJECT;
 
+assignment_end_before_lock:
+
+      setup_lock(set_serializer, cell);
+
+assignment_end_after_lock:
+
       if (Type_Code(*cell) != TC_REFERENCE_TRAP)
       {
        Val = *cell;
@@ -956,6 +991,7 @@ Pop_Return:
        case TRAP_UNBOUND_DANGEROUS:
        case TRAP_UNASSIGNED_DANGEROUS:
        case TRAP_FLUID_DANGEROUS:
+       case TRAP_COMPILER_CACHED_DANGEROUS:
          remove_lock(set_serializer);
          cell = Get_Pointer(Vector_Ref(Fetch_Expression(), ASSIGN_NAME));
          temp =
@@ -965,21 +1001,7 @@ Pop_Return:
                                cell,
                                value,
                                false);
-         goto external_assignment_return;
-
-       case TRAP_UNASSIGNED:
-         Val = bogus_unassigned;
-         goto normal_assignment_done;
-
-       case TRAP_FLUID:
-         /* No need to recompile, pass the fake variable. */
-         remove_lock(set_serializer);
-         temp = deep_assignment_end(lookup_fluid(*cell),
-                                    fake_variable_object,
-                                    value,
-                                    false);
-
-       external_assignment_return:
+external_assignment_return:
          Import_Val();
          if (temp != PRIM_DONE)
            break;
@@ -987,23 +1009,64 @@ Pop_Return:
          End_Subproblem();
          goto Pop_Return;
 
+       case TRAP_COMPILER_CACHED:
+       {
+         Pointer extension;
+
+         extension = Fast_Vector_Ref(Val, TRAP_EXTRA);
+         if (Fast_Vector_Ref(extension, TRAP_EXTENSION_UUO_LIST) != NIL)
+         {
+           /* No need to recompile, pass the fake variable. */
+           remove_lock(set_serializer);
+           temp = deep_assignment_end(cell,
+                                      fake_variable_object,
+                                      value,
+                                      false);
+           goto external_assignment_return;
+         }
+         cell = Nth_Vector_Loc(extension, TRAP_EXTENSION_CELL);
+         goto assignment_end_after_lock;
+       }         
+
+/* Interpret() continues on the next page */
+\f
+/* Interpret(), continued */
+
+       case TRAP_FLUID:
+         remove_lock(set_serializer);
+         cell = lookup_fluid(Val);
+         goto assignment_end_before_lock;
+
        case TRAP_UNBOUND:
          remove_lock(set_serializer);
          temp = ERR_UNBOUND_VARIABLE;
          break;
 
+       case TRAP_UNASSIGNED:
+         Val = bogus_unassigned;
+         goto normal_assignment_done;
+
+       case TRAP_NOP:
+         remove_lock(set_serializer);
+         temp = ERR_BAD_FRAME;
+         break;
+
        default:
          remove_lock(set_serializer);
          temp = ERR_BROKEN_COMPILED_VARIABLE;
          break;
       }
 
+      if (value == UNASSIGNED_OBJECT)
+       value = bogus_unassigned;
+       
 /* Interpret() continues on the next page */
 \f
 /* Interpret(), continued */
 
-#else
+#else No_In_Line_Lookup
 
+      value = Val;
       Set_Time_Zone(Zone_Lookup);
       Restore_Env();
       temp = Lex_Set(Fetch_Env(),
@@ -1011,12 +1074,13 @@ Pop_Return:
                     value);
       Import_Val();
       if (temp == PRIM_DONE) 
-      { End_Subproblem();
+      {
+       End_Subproblem();
        Set_Time_Zone(Zone_Working);
        break;
       }
 
-#endif
+#endif No_In_Line_Lookup
 
       Set_Time_Zone(Zone_Working);
       Save_Env();
index a1898b0d67166375a9805b86dddb28f1fbfcd3f1..4dc4375adf56afa3b4294b2f5f448202622b58d1 100644 (file)
@@ -30,13 +30,14 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/lookup.h,v 9.36 1987/04/16 02:26:04 jinx Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/lookup.h,v 9.37 1987/05/29 02:24:06 jinx Exp $ */
 
 /* Macros and declarations for the variable lookup code. */
 
 extern Pointer
   *deep_lookup(),
-  *lookup_fluid();
+  *lookup_fluid(),
+  *force_definition();
 
 extern long
   deep_lookup_end(),
@@ -225,7 +226,8 @@ label:                                                                      \
 \f
 #define lookup_primitive_type_test()                                   \
 {                                                                      \
-  if (Type_Code(Arg1) != GLOBAL_ENV) Arg_1_Type(TC_ENVIRONMENT);       \
+  if (Type_Code(Arg1) != GLOBAL_ENV)                                   \
+    Arg_1_Type(TC_ENVIRONMENT);                                                \
   if (Type_Code(Arg2) != TC_INTERNED_SYMBOL)                           \
     Arg_2_Type(TC_UNINTERNED_SYMBOL);                                  \
 }
@@ -233,7 +235,7 @@ label:                                                                      \
 #define lookup_primitive_end(Result)                                   \
 {                                                                      \
   if (Result == PRIM_DONE)                                             \
-    return Val;                                                                \
+    PRIMITIVE_RETURN(Val);                                             \
   if (Result == PRIM_INTERRUPT)                                                \
     Primitive_Interrupt();                                             \
   Primitive_Error(Result);                                             \
index c6634e1f44482b73bcc4c7c0090a434d5716430d..61e9ff221f436439a6875a9043fb28fb6c4f461e 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/trap.h,v 9.37 1987/04/16 02:30:49 jinx Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/trap.h,v 9.38 1987/05/29 02:24:53 jinx Rel $ */
 \f
 /* Kinds of traps:
 
@@ -41,7 +41,6 @@ MIT in each case. */
    For efficiency, some traps are immediate, while some are
    pointer objects.  The type code is multiplexed, and the
    garbage collector handles it specially.
-
  */
 
 /* The following are immediate traps: */
@@ -51,16 +50,20 @@ MIT in each case. */
 #define TRAP_UNBOUND                           2
 #define TRAP_UNBOUND_DANGEROUS                 3
 #define TRAP_ILLEGAL                           4
-#define TRAP_ILLEGAL_DANGEROUS                 5       /* Unused. */
+#define TRAP_ILLEGAL_DANGEROUS                 5
 
 /* TRAP_MAX_IMMEDIATE is defined in const.h */
 
 /* The following are not: */
 
-#define TRAP_NOP                               10      /* Unused. */
+#define TRAP_NOP                               10
 #define TRAP_DANGEROUS                         11
 #define TRAP_FLUID                             12
 #define TRAP_FLUID_DANGEROUS                   13
+#define TRAP_COMPILER_CACHED                   14
+#define TRAP_COMPILER_CACHED_DANGEROUS         15
+
+#define TRAP_EXTENSION_TYPE                    TC_QUAD
 
 /* Trap utilities */
 
@@ -89,7 +92,9 @@ MIT in each case. */
 #define DANGEROUS_ILLEGAL_OBJECT       0x32000005
 #endif
 
+#define NOP_OBJECT                     Make_Unsigned_Fixnum(TRAP_NOP)
 #define DANGEROUS_OBJECT               Make_Unsigned_Fixnum(TRAP_DANGEROUS)
+#define REQUEST_RECACHE_OBJECT         DANGEROUS_ILLEGAL_OBJECT
 
 #if (TC_REFERENCE_TRAP != 0x32)
 #include "error: trap.h and types.h are inconsistent"
index 7e3b63e6f11a586f4b491366fef74397af2323c0..ed417459ad2c6d8e7b59f9bf07f597a5ea2cf087 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 9.55 1987/05/28 00:49:25 jinx Exp $
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 9.56 1987/05/29 02:25:04 jinx Exp $
 
 This file contains version information for the microcode. */
 \f
@@ -46,7 +46,7 @@ This file contains version information for the microcode. */
 #define VERSION                9
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     55
+#define SUBVERSION     56
 #endif
 
 #ifndef UCODE_TABLES_FILENAME