Fix "infinite" GC bug when a bad type code is encountered in the gc.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 2 Jun 1989 21:43:13 +0000 (21:43 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 2 Jun 1989 21:43:13 +0000 (21:43 +0000)
Split a part of Microcode_Termination off into
attempt_termination_backout.

v7/src/microcode/boot.c
v7/src/microcode/version.h
v8/src/microcode/version.h

index 44517ba425c29d9917f665c8eab5062dcfe4b927..4af0f3940ee7989f42be972f53c56f7c0f306880 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.54 1989/03/27 23:14:13 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/boot.c,v 9.55 1989/06/02 21:43:13 jinx Exp $
 
 Copyright (c) 1988 Massachusetts Institute of Technology
 
@@ -532,59 +532,80 @@ Enter_Interpreter()
   /*NOTREACHED*/
 }
 \f
+void
+attempt_termination_backout(code)
+     long code;
+{
+  extern long death_blow;
+  Pointer Term_Vector, Handler;
+
+  if ((WITHIN_CRITICAL_SECTION_P())    ||
+      (code == TERM_HALT)              ||
+      (!(Valid_Fixed_Obj_Vector())))
+  {
+    return;
+  }
+
+  Term_Vector = Get_Fixed_Obj_Slot(Termination_Proc_Vector);
+
+  if ((OBJECT_TYPE(Term_Vector) != TC_VECTOR) ||
+      (Vector_Length(Term_Vector) <= code))
+  {
+    return;
+  }
+
+  Handler = User_Vector_Ref(Term_Vector, code);
+
+  if (Handler == NIL)
+  {
+    return;
+  }
+
+ Will_Push(CONTINUATION_SIZE + STACK_ENV_EXTRA_SLOTS +
+          ((code == TERM_NO_ERROR_HANDLER) ? 5 : 4));
+  Store_Return(RC_HALT);
+  Store_Expression(Make_Unsigned_Fixnum(code));
+  Save_Cont();
+  if (code == TERM_NO_ERROR_HANDLER)
+  {
+    Push(MAKE_UNSIGNED_FIXNUM(death_blow));
+  }
+  Push(Val);                   /* Arg 3 */
+  Push(Fetch_Env());           /* Arg 2 */
+  Push(Fetch_Expression());            /* Arg 1 */
+  Push(Handler);                       /* The handler function */
+  Push(STACK_FRAME_HEADER + ((code == TERM_NO_ERROR_HANDLER) ? 4 : 3));
+ Pushed();
+  longjmp(*Back_To_Eval, PRIM_NO_TRAP_APPLY);
+  /*NOTREACHED*/
+}
+\f
 term_type
 Microcode_Termination(code)
      long code;
 {
   extern long death_blow;
   extern char *Term_Messages[];
-  Pointer Term_Vector;
   Boolean abnormal_p;
   long value;
 
-  if ((code != TERM_HALT) &&
-      (Valid_Fixed_Obj_Vector()) &&
-      (Type_Code(Term_Vector =
-                Get_Fixed_Obj_Slot(Termination_Proc_Vector)) ==
-       TC_VECTOR) &&
-      (Vector_Length(Term_Vector) > code))
-  { 
-    Pointer Handler;
-
-    Handler = User_Vector_Ref(Term_Vector, code);
-    if (Handler != NIL)
-    {
-     Will_Push(CONTINUATION_SIZE + STACK_ENV_EXTRA_SLOTS +
-              ((code == TERM_NO_ERROR_HANDLER) ? 5 : 4));
-      Store_Return(RC_HALT);
-      Store_Expression(Make_Unsigned_Fixnum(code));
-      Save_Cont();
-      if (code == TERM_NO_ERROR_HANDLER)
-      {
-       Push(MAKE_UNSIGNED_FIXNUM(death_blow));
-      }
-      Push(Val);                       /* Arg 3 */
-      Push(Fetch_Env());               /* Arg 2 */
-      Push(Fetch_Expression());                /* Arg 1 */
-      Push(Handler);                   /* The handler function */
-      Push(STACK_FRAME_HEADER + ((code == TERM_NO_ERROR_HANDLER) ? 4 : 3));
-     Pushed();
-      longjmp(*Back_To_Eval, PRIM_NO_TRAP_APPLY);
-    }
-  }
+  attempt_termination_backout(code);
 
   if (! inhibit_termination_messages)
+  {
+    putchar('\n');
+    if ((code < 0) || (code > MAX_TERMINATION))
+      printf ("Unknown termination code 0x%x", code);
+    else
+      printf("%s", Term_Messages [code]);
+
+    if (WITHIN_CRITICAL_SECTION_P())
     {
-      putchar('\n');
-      if ((code < 0) || (code > MAX_TERMINATION))
-       printf ("Unknown termination code 0x%x\n", code);
-      else
-       printf("%s.\n", Term_Messages [code]);
+      printf(" within critical section \"%s\"",
+            CRITICAL_SECTION_NAME());
     }
-
-/* Microcode_Termination continues on the next page */
-\f
-/* Microcode_Termination, continued */
+    printf(".\n");
+  }
 
   switch(code)
   {
@@ -599,7 +620,7 @@ Microcode_Termination(code)
       value = 0;
       abnormal_p = false;
       break;
-
+\f
 #ifdef unix
     case TERM_SIGNAL:
     {
index 535b4494b8376b0090e4ffbcdc59870dea3a5532..ebb449a9c2ddb7b0c4a4ef2a15b02851bbfced74 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.79 1989/05/31 01:51:15 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.80 1989/06/02 21:43:02 jinx Exp $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -46,7 +46,7 @@ MIT in each case. */
 #define VERSION                10
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     79
+#define SUBVERSION     80
 #endif
 
 #ifndef UCODE_TABLES_FILENAME
index f4f076d026872ce1c65d8bd40b309fb0b15b915f..6da974803de8ef62f400b2968dbe57ba066d378f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.79 1989/05/31 01:51:15 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.80 1989/06/02 21:43:02 jinx Exp $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -46,7 +46,7 @@ MIT in each case. */
 #define VERSION                10
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     79
+#define SUBVERSION     80
 #endif
 
 #ifndef UCODE_TABLES_FILENAME