Change `(Registers[REGBLOCK_STACK_GUARD])' to be a cache for the C
authorChris Hanson <org/chris-hanson/cph>
Sat, 26 Sep 1992 02:55:06 +0000 (02:55 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 26 Sep 1992 02:55:06 +0000 (02:55 +0000)
variable `Stack_Guard'.  Change COMPILER_SETUP_INTERRUPT so that
compiled code doesn't signal GC or stack-overflow interrupts when the
corresponding interrupt enable bit is not set.  Change compiled-code
interface to assume this, and eliminate back-out code; this eliminates
the _SKIPPED_CHECK_OFFSET constants built into the microcode, allowing
the compiled code more coding flexibility.

22 files changed:
v7/src/microcode/cmpint.c
v7/src/microcode/cmpintmd/alpha.h
v7/src/microcode/cmpintmd/hppa.h
v7/src/microcode/cmpintmd/i386.h
v7/src/microcode/cmpintmd/mc68k.h
v7/src/microcode/cmpintmd/mips.h
v7/src/microcode/cmpintmd/vax.h
v7/src/microcode/default.h
v7/src/microcode/dossig.c
v7/src/microcode/extern.h
v7/src/microcode/gc.h
v7/src/microcode/interp.c
v7/src/microcode/interp.h
v7/src/microcode/intrpt.h
v7/src/microcode/stack.h
v7/src/microcode/storage.c
v7/src/microcode/utils.c
v7/src/microcode/version.h
v8/src/microcode/cmpint.c
v8/src/microcode/cmpintmd/hppa.h
v8/src/microcode/interp.c
v8/src/microcode/version.h

index 2ccfc3829e4acde154b84cc96e820cc126db59f2..2febecfef0746758f1bab67ee83f54d4c0aa496c 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: cmpint.c,v 1.49 1992/09/11 02:04:05 cph Exp $
+$Id: cmpint.c,v 1.50 1992/09/26 02:54:55 cph Exp $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -40,7 +40,6 @@ MIT in each case. */
  *
  */
 \f
-#ifdef HAS_COMPILER_SUPPORT
 /*
  * Procedures in this file belong to the following categories:
  *
@@ -98,6 +97,8 @@ MIT in each case. */
 #include "prim.h"      /* Primitive_Procedure_Table, etc. */
 #define IN_CMPINT_C
 #include "cmpgc.h"      /* Compiled code object relocation */
+
+#ifdef HAS_COMPILER_SUPPORT
 \f
 #ifndef FLUSH_I_CACHE_REGION
 #  define FLUSH_I_CACHE_REGION(addr, nwords) NOP()
@@ -1335,116 +1336,76 @@ DEFUN (comutil_operator_4_0_trap,
 }
 \f
 /* INTERRUPT/GC from Scheme
-   The next four procedures are called from compiled code at the start
-   (respectively) of a closure, continuation, interpreter compatible
-   procedure, or ordinary (not closed) procedure if an interrupt has
-   been detected.  They return to the interpreter if the interrupt is
-   invalid after saving the state necessary to restart the compiled
-   code.
-
-   The code that handles RC_COMP_INTERRUPT_RESTART in interp.c will
-   return control to comp_interrupt_restart (below).  This assumes
-   that the Scheme stack contains a compiled code entry address (start
-   of continuation, procedure, etc.).  The Expression register saved
-   with the continuation is a piece of state that will be returned to
-   Val and Env (both) upon return.
-*/
 
-#define GC_DESIRED_P()         (Free >= MemTop)
+   These procedures are called from compiled code at the start
+   (respectively) of a procedure or continuation if an interrupt has
+   been detected.  They must not be called unless there is an
+   interrupt to be serviced.
 
-#define TEST_GC_NEEDED()                                               \
-{                                                                      \
-  if (GC_DESIRED_P())                                                  \
-  {                                                                    \
-    Request_GC(Free-MemTop);                                           \
-  }                                                                    \
-}
+   The code that handles RC_COMP_INTERRUPT_RESTART in "interp.c" will
+   return control to comp_interrupt_restart (below).  This assumes
+   that the Scheme stack contains a compiled code entry address
+   (start of continuation, procedure, etc.).  The Expression register
+   saved with the continuation is a piece of state that will be
+   returned to Val and Env (both) upon return.
 
-/* Called with no arguments, closure at top of (Scheme) stack.
-   If the interrupt is disabled, the closure is re-invoked.
- */
 
-SCHEME_UTILITY struct utility_result
-DEFUN (comutil_interrupt_closure,
-       (ignore_1, ignore_2, ignore_3, ignore_4),
-       long ignore_1 AND long ignore_2 AND long ignore_3 AND long ignore_4)
-{
-  TEST_GC_NEEDED ();
-  Stack_Check (Stack_Pointer);
-  if ((PENDING_INTERRUPTS()) == 0)
-  {
-    SCHEME_OBJECT entry_point;
+  */
 
-    EXTRACT_CLOSURE_ENTRY_ADDRESS (entry_point,
-                                  (OBJECT_ADDRESS (STACK_REF (0))));
-    ADJUST_CLOSURE_AT_CALL (entry_point, (STACK_REF (0)));
-    RETURN_TO_SCHEME (((instruction *) entry_point) +
-                     CLOSURE_SKIPPED_CHECK_OFFSET);
-  }
-  else
-  {
-    /* Return to interpreter to handle interrupt */
-    
-    STACK_PUSH (SHARP_F);
-    Store_Expression (SHARP_F);
-    Store_Return (RC_COMP_INTERRUPT_RESTART);
-    Save_Cont ();
-    RETURN_TO_C (PRIM_INTERRUPT);
-  }
+#define MAYBE_REQUEST_INTERRUPTS()                                     \
+{                                                                      \
+  if (Free >= MemTop)                                                  \
+    Request_GC (Free - MemTop);                                                \
+  if (Stack_Pointer <= Stack_Guard)                                    \
+    REQUEST_INTERRUPT (INT_Stack_Overflow);                            \
 }
-\f
-/* State is the live data; no entry point on the stack.
- */
 
 static struct utility_result
-DEFUN (compiler_interrupt_common,
-       (entry_point, offset, state),
-       instruction *entry_point AND
-       long offset AND
+DEFUN (compiler_interrupt_common, (entry_point, state),
+       instruction * entry_point AND
        SCHEME_OBJECT state)
 {
-  TEST_GC_NEEDED ();
-  Stack_Check (Stack_Pointer);
-  if ((PENDING_INTERRUPTS()) == 0)
-  {
-    Store_Env (state);
-    Val = state;
-    RETURN_TO_SCHEME (entry_point + offset);
-  }
-  else
-  {
+  MAYBE_REQUEST_INTERRUPTS ();
+  if (entry_point != 0)
     STACK_PUSH (ENTRY_TO_OBJECT (entry_point));
-    STACK_PUSH (state);
-    Store_Expression (SHARP_F);
-    Store_Return (RC_COMP_INTERRUPT_RESTART);
-    Save_Cont ();
-    RETURN_TO_C (PRIM_INTERRUPT);
-  }
+  STACK_PUSH (state);
+  Store_Expression (SHARP_F);
+  Store_Return (RC_COMP_INTERRUPT_RESTART);
+  Save_Cont ();
+  RETURN_TO_C (PRIM_INTERRUPT);
 }
 
 SCHEME_UTILITY struct utility_result
-DEFUN (comutil_interrupt_dlink,
-       (entry_point, dlink, ignore_3, ignore_4),
-       instruction * entry_point
-       AND SCHEME_OBJECT * dlink
-       AND long ignore_3 AND long ignore_4)
+DEFUN (comutil_interrupt_closure, (ignore_1, ignore_2, ignore_3, ignore_4),
+       long ignore_1 AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
+{
+  return (compiler_interrupt_common (0, SHARP_F));
+}
+
+SCHEME_UTILITY struct utility_result
+DEFUN (comutil_interrupt_dlink, (entry_point, dlink, ignore_3, ignore_4),
+       instruction * entry_point AND
+       SCHEME_OBJECT * dlink AND
+       long ignore_3 AND
+       long ignore_4)
 {
   return
-    (compiler_interrupt_common(entry_point,
-                              ENTRY_SKIPPED_CHECK_OFFSET,
-                              MAKE_POINTER_OBJECT(TC_STACK_ENVIRONMENT,
-                                                  dlink)));
+    (compiler_interrupt_common
+     (entry_point, (MAKE_POINTER_OBJECT (TC_STACK_ENVIRONMENT, dlink))));
 }
 
 SCHEME_UTILITY struct utility_result
 DEFUN (comutil_interrupt_procedure,
        (entry_point, ignore_2, ignore_3, ignore_4),
-       instruction * entry_point
-       AND long ignore_2 AND long ignore_3 AND long ignore_4)
+       instruction * entry_point AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
 {
-  return (compiler_interrupt_common(entry_point,
-                                   ENTRY_SKIPPED_CHECK_OFFSET,
-                                   SHARP_F));
+  return (compiler_interrupt_common (entry_point, SHARP_F));
 }
 
 /* Val has live data, and there is no entry address on the stack */
@@ -1452,12 +1413,12 @@ DEFUN (comutil_interrupt_procedure,
 SCHEME_UTILITY struct utility_result
 DEFUN (comutil_interrupt_continuation,
        (return_address, ignore_2, ignore_3, ignore_4),
-       instruction * return_address
-       AND long ignore_2 AND long ignore_3 AND long ignore_4)
+       instruction * return_address AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
 {
-  return (compiler_interrupt_common (return_address,
-                                    ENTRY_SKIPPED_CHECK_OFFSET,
-                                    Val));
+  return (compiler_interrupt_common (return_address, Val));
 }
 
 /* Env has live data; no entry point on the stack */
@@ -1465,12 +1426,12 @@ DEFUN (comutil_interrupt_continuation,
 SCHEME_UTILITY struct utility_result
 DEFUN (comutil_interrupt_ic_procedure,
        (entry_point, ignore_2, ignore_3, ignore_4),
-       instruction * entry_point
-       AND long ignore_2 AND long ignore_3 AND long ignore_4)
+       instruction * entry_point AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
 {
-  return (compiler_interrupt_common (entry_point,
-                                    ENTRY_SKIPPED_CHECK_OFFSET,
-                                    (Fetch_Env())));
+  return (compiler_interrupt_common (entry_point, (Fetch_Env ())));
 }
 
 C_TO_SCHEME long
index ea05e025d2c07bd7bc9a3b135d64a254b5e5d2eb..aa7aadb9705ed5bcac06108aae4bd544cb8527a8 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- C -*-
 
-$Id: alpha.h,v 1.2 1992/08/29 12:53:22 jinx Exp $
+$Id: alpha.h,v 1.3 1992/09/26 02:54:49 cph Exp $
 
 Copyright (c) 1992 Digital Equipment Corporation (D.E.C.)
 
@@ -234,10 +234,6 @@ Code sequence 5 (call interrupt handler):
 
 /* The length of code sequence 1, above */
 #define ENTRY_PREFIX_LENGTH            (2 INSTRUCTIONS)
-/* Skip over this many BYTES to bypass the GC check code (ordinary
-   procedures and continuations differ from closures) */
-#define ENTRY_SKIPPED_CHECK_OFFSET     (3 INSTRUCTIONS) /* Code Seq 2 */
-#define CLOSURE_SKIPPED_CHECK_OFFSET   (6 INSTRUCTIONS) /* Code Seq 3 */
 
 /* Compiled closures */
 
index 69d20b59a97a210ed09f4fb5418949ab610dde06..4416249c54897dce5a9cdde51d6a268919379634 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/hppa.h,v 1.33 1992/05/23 01:18:45 jinx Exp $
+$Id: hppa.h,v 1.34 1992/09/26 02:54:50 cph Exp $
 
 Copyright (c) 1989-1992 Massachusetts Institute of Technology
 
@@ -417,12 +417,6 @@ DEFUN_VOID (flush_i_cache_initialize)
 \f
 /* Interrupt/GC polling. */
 
-/* Skip over this many BYTES to bypass the GC check code (ordinary
-procedures and continuations differ from closures) */
-
-#define ENTRY_SKIPPED_CHECK_OFFSET     4
-#define CLOSURE_SKIPPED_CHECK_OFFSET   16
-
 /* The length of the GC recovery code that precedes an entry.
    On the HP-PA a "ble, ldi" instruction sequence.
  */
index 2273ffcd3d279a9e27e327d21cf3261b013fb152..926de11c0b8c0bc4ad1e53d4b541269759a55969 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: i386.h,v 1.18 1992/09/18 02:03:13 jinx Exp $
+$Id: i386.h,v 1.19 1992/09/26 02:54:51 cph Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -218,11 +218,8 @@ typedef unsigned short format_word;
 
 /* See the encodings above. */
 
-#define ENTRY_SKIPPED_CHECK_OFFSET             4
 #define ENTRY_PREFIX_LENGTH                    3
 
-#define CLOSURE_SKIPPED_CHECK_OFFSET           11
-
 #  define COMPILED_CLOSURE_ENTRY_SIZE                                  \
   ((2 * (sizeof (format_word))) + 6)
 
index 44ae5a8e5185375a32c7670bca659b7ff72a1cb8..2129c182762b856fa9de6305aed9bc12ca62a2e9 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: mc68k.h,v 1.31 1992/09/25 01:19:03 cph Exp $
+$Id: mc68k.h,v 1.32 1992/09/26 02:54:52 cph Exp $
 
 Copyright (c) 1989-1992 Massachusetts Institute of Technology
 
@@ -85,12 +85,6 @@ typedef unsigned short format_word;
 
 #define PC_ZERO_BITS                    1
 
-/* Skip over this many BYTES to bypass the GC check code (ordinary
-procedures and continuations differ from closures) */
-
-#define ENTRY_SKIPPED_CHECK_OFFSET     4
-#define CLOSURE_SKIPPED_CHECK_OFFSET   10
-
 /* The length of the GC recovery code that precedes an entry.
    On the 68K a "jsr n(a6)" instruction.
  */
index 033efad2b15ba2bc8816ebad7a238898ead20126..d55a464a91aaf4f6367acfe3941af3184f52d927 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: mips.h,v 1.15 1992/08/29 13:30:29 jinx Exp $
+$Id: mips.h,v 1.16 1992/09/26 02:54:53 cph Exp $
 
 Copyright (c) 1989-1992 Massachusetts Institute of Technology
 
@@ -198,12 +198,6 @@ typedef unsigned short format_word;
 
 /* Interrupt/GC polling. */
 
-/* Skip over this many BYTES to bypass the GC check code (ordinary
-procedures and continuations differ from closures) */
-
-#define ENTRY_SKIPPED_CHECK_OFFSET     12
-#define CLOSURE_SKIPPED_CHECK_OFFSET   28
-
 /* The length of the GC recovery code that precedes an entry.
    On the MIPS a "addi, jalr, addi" instruction sequence.
  */
index 1384b027fb7cddb62e83cc71062f8535f54b9985..746db0c8be7c1fd63db792a5695acec2ff75e9f7 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/vax.h,v 1.5 1992/02/12 15:27:27 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/vax.h,v 1.6 1992/09/26 02:54:54 cph Exp $
 
 Copyright (c) 1991-1992 Massachusetts Institute of Technology
 
@@ -83,12 +83,6 @@ typedef unsigned short format_word;
 
 #define PC_ZERO_BITS                    0
 \f
-/* Skip over this many BYTES to bypass the GC check code (ordinary
-procedures and continuations differ from closures) */
-
-#define ENTRY_SKIPPED_CHECK_OFFSET     5
-#define CLOSURE_SKIPPED_CHECK_OFFSET   12
-
 /* The length of the GC recovery code that precedes an entry.
    On the Vax a "movl s^code,r0; jsb b^n(r10)" sequence.
  */
index 73cd11af80ebecc42fb4faafbb9401c8457a871e..694de5bea17305f7678123b0ac7c94bcb36de654 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/default.h,v 9.38 1992/02/10 13:52:06 jinx Exp $
+$Id: default.h,v 9.39 1992/09/26 02:54:57 cph Exp $
 
 Copyright (c) 1988-1992 Massachusetts Institute of Technology
 
@@ -88,7 +88,7 @@ do                                                                    \
 {                                                                      \
   Stack_Top = Highest_Allocated_Address;                               \
   Stack_Pointer = Stack_Top;                                           \
-  Set_Stack_Guard (Absolute_Stack_Base + STACK_GUARD_SIZE);            \
+  SET_STACK_GUARD (Absolute_Stack_Base + STACK_GUARD_SIZE);            \
 } while (0)
 #endif
 
index 16cba1becca8dde32e7992996121ed3e8f01eb0a..3b46a66c10257d07fb39e4dae21ddacb9ab9fdf7 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: dossig.c,v 1.9 1992/09/25 21:42:38 jinx Exp $
+$Id: dossig.c,v 1.10 1992/09/26 02:54:57 cph Exp $
 
 Copyright (c) 1992 Massachusetts Institute of Technology
 
@@ -1026,8 +1026,7 @@ DEFUN (install_exception_handlers, (get_vector, set_handler, restore),
       handler = exception_handler;
       if ((under_DPMI_p ())
          && (enable_DPMI_exceptions_p ())
-         && ((DPMI_alloc_scheme_stack (&scheme_ds, &scheme_ss,
-                                       (Regs[REGBLOCK_STACK_GUARD])))
+         && ((DPMI_alloc_scheme_stack (&scheme_ds, &scheme_ss, Stack_Guard))
              == DOS_SUCCESS))
       {
        Scheme_Stack_Segment_Selector = scheme_ss;
index 57695e9befc5339953fa3c561a8b493bf0d7775d..dcc8f35920f74c209118d03d1201e1b58cfa5d63 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: extern.h,v 9.48 1992/09/18 16:54:40 jinx Exp $
+$Id: extern.h,v 9.49 1992/09/26 02:54:58 cph Exp $
 
 Copyright (c) 1987-1992 Massachusetts Institute of Technology
 
@@ -93,6 +93,7 @@ extern SCHEME_OBJECT
  * MemTop,             /* Top of heap space available */
  * Ext_Stack_Pointer,  /* Next available slot in control stack */
  * Stack_Top,          /* Top of control stack */
+ * Stack_Guard,                /* Guard area at end of stack */
  * Free_Stacklets,     /* Free list of stacklets */
  * Constant_Space,     /* Bottom of constant+pure space */
  * Free_Constant,      /* Next free cell in constant+pure area */
index ad044c88302dbd8fb03aacf1f53eceff7e568b5b..68fb530677208430dd87e9517508bf7894e2a602 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/gc.h,v 9.31 1992/07/29 19:54:53 cph Exp $
+$Id: gc.h,v 9.32 1992/09/26 02:54:59 cph Exp $
 
 Copyright (c) 1987-92 Massachusetts Institute of Technology
 
@@ -104,29 +104,30 @@ MIT in each case. */
 \f
 /* Overflow detection, various cases */
 
-#define GC_ENABLED_P()         (INTERRUPT_ENABLED_P(INT_GC))
+#define GC_ENABLED_P() (INTERRUPT_ENABLED_P (INT_GC))
 
 #define GC_Check(Amount)                                               \
-(((Amount + Free) >= MemTop) && (GC_ENABLED_P()))
+  (((Amount + Free) >= MemTop) && (GC_ENABLED_P ()))
 
 #define Space_Before_GC()                                              \
-((GC_ENABLED_P()) ?                                                    \
((Free <= MemTop) ? (MemTop - Free) : 0) :                            \
- (Heap_Top - Free))
+  ((GC_ENABLED_P ())                                                   \
  ? ((Free <= MemTop) ? (MemTop - Free) : 0)                          \
  : (Heap_Top - Free))
 
 #define Request_GC(Amount)                                             \
 {                                                                      \
-  REQUEST_INTERRUPT(INT_GC);                                           \
+  REQUEST_INTERRUPT (INT_GC);                                          \
   GC_Space_Needed = Amount;                                            \
 }
 
-#define SET_MEMTOP(Addr)                                               \
+#define SET_MEMTOP(addr)                                               \
 {                                                                      \
-  MemTop = Addr;                                                       \
-  COMPILER_SET_MEMTOP();                                               \
+  MemTop = (addr);                                                     \
+  COMPILER_SETUP_INTERRUPT ();                                         \
 }
 
-#define Set_Stack_Guard(Addr)                                          \
+#define SET_STACK_GUARD(addr)                                          \
 {                                                                      \
-  (Regs[REGBLOCK_STACK_GUARD]) = ((SCHEME_OBJECT) (Addr));             \
+  Stack_Guard = (addr);                                                        \
+  COMPILER_SETUP_INTERRUPT ();                                         \
 }
index 600666f4b4cda3ee342da639bb162d8a5c0348f2..51272f17b6fef19892208f4c08c3213849204f2f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: interp.c,v 9.68 1992/09/14 20:34:40 cph Exp $
+$Id: interp.c,v 9.69 1992/09/26 02:55:00 cph Exp $
 
 Copyright (c) 1988-92 Massachusetts Institute of Technology
 
@@ -402,10 +402,10 @@ DEFUN (abort_to_interpreter, (argument), int argument)
 {
   interpreter_throw_argument = argument;
   {
-    long old_mask = IntEnb;
-    set_IntEnb (0);
+    long old_mask = (FETCH_INTERRUPT_MASK ());
+    SET_INTERRUPT_MASK (0);
     dstack_set_position (interpreter_catch_dstack_position);
-    set_IntEnb (old_mask);
+    SET_INTERRUPT_MASK (old_mask);
   }
   obstack_free ((&scratch_obstack), 0);
   obstack_init (&scratch_obstack);
index fbe3da5d6ac9cad7edeea73dcf1d1eb1d1279f1b..053cdf828ec2f3f0cc83f05a3fa098a74efd6b56 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.h,v 9.35 1992/07/29 19:54:54 cph Exp $
+$Id: interp.h,v 9.36 1992/09/26 02:55:01 cph Exp $
 
 Copyright (c) 1987-92 Massachusetts Institute of Technology
 
@@ -90,7 +90,6 @@ extern int EXFUN (abort_to_interpreter_argument, (void));
 #define Val            Regs[REGBLOCK_VAL]
 #define Expression     Regs[REGBLOCK_EXPR]
 #define Return         Regs[REGBLOCK_RETURN]
-#define Stack_Guard    ((SCHEME_OBJECT *) (Regs[REGBLOCK_STACK_GUARD]))
 \f
 /* Internal_Will_Push is in stack.h. */
 
index d74748be330fa37032577cf01e1f2210b65df242..2dc62683d971c601cf5fea86fcbf84118637866f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: intrpt.h,v 1.10 1992/09/14 20:34:20 cph Exp $
+$Id: intrpt.h,v 1.11 1992/09/26 02:55:03 cph Exp $
 
 Copyright (c) 1987-92 Massachusetts Institute of Technology
 
@@ -33,18 +33,6 @@ promotional, or sales literature without prior written consent from
 MIT in each case. */
 
 /* Interrupt manipulation utilities. */
-\f
-/* The interrupt control registers. */
-
-/* interrupts requesting */
-#define IntCode ((long) (Registers[REGBLOCK_INT_CODE]))
-#define set_IntCode(code)                                              \
-  (Registers[REGBLOCK_INT_CODE]) = ((SCHEME_OBJECT) (code))
-
-/* interrupts enabled */
-#define IntEnb ((long) (Registers[REGBLOCK_INT_MASK]))
-#define set_IntEnb(mask)                                               \
-  (Registers[REGBLOCK_INT_MASK]) = ((SCHEME_OBJECT) (mask))
 
 /* Interrupt bits -- scanned from LSB (1) to MSB (16) */
 
@@ -70,52 +58,57 @@ MIT in each case. */
 \f
 /* Utility macros. */
 
-#define PENDING_INTERRUPTS() (IntEnb & IntCode)
+#define PENDING_INTERRUPTS()                                           \
+  ((FETCH_INTERRUPT_MASK ()) & (FETCH_INTERRUPT_CODE ()))
 
-#define INTERRUPT_QUEUED_P(mask) ((IntCode & (mask)) != 0)
+#define INTERRUPT_QUEUED_P(mask) (((FETCH_INTERRUPT_CODE ()) & (mask)) != 0)
 
-#define INTERRUPT_ENABLED_P(mask) ((IntEnb & (mask)) != 0)
+#define INTERRUPT_ENABLED_P(mask) (((FETCH_INTERRUPT_MASK ()) & (mask)) != 0)
 
-#define INTERRUPT_PENDING_P(mask) (((PENDING_INTERRUPTS()) & (mask)) != 0)
+#define INTERRUPT_PENDING_P(mask) (((PENDING_INTERRUPTS ()) & (mask)) != 0)
 
 #define COMPILER_SETUP_INTERRUPT()                                     \
 {                                                                      \
-  (Regs [REGBLOCK_MEMTOP]) =                                           \
+  (Registers[REGBLOCK_MEMTOP]) =                                       \
     ((INTERRUPT_PENDING_P (INT_Mask))                                  \
      ? ((SCHEME_OBJECT) -1)                                            \
-     : ((SCHEME_OBJECT) MemTop));                                      \
+     : (INTERRUPT_ENABLED_P (INT_GC))                                  \
+     ? ((SCHEME_OBJECT) MemTop)                                                \
+     : ((SCHEME_OBJECT) Heap_Top));                                    \
+  (Registers[REGBLOCK_STACK_GUARD]) =                                  \
+    ((INTERRUPT_ENABLED_P (INT_Stack_Overflow))                                \
+     ? ((SCHEME_OBJECT) Stack_Guard)                                   \
+     : ((SCHEME_OBJECT) Absolute_Stack_Base));                         \
 }
 
-#define FETCH_INTERRUPT_MASK()         (IntEnb)
+#define FETCH_INTERRUPT_MASK() ((long) (Registers[REGBLOCK_INT_MASK]))
 
 #define SET_INTERRUPT_MASK(mask)                                       \
 {                                                                      \
-  set_IntEnb (mask);                                                   \
+  (Registers[REGBLOCK_INT_MASK]) = ((SCHEME_OBJECT) (mask));           \
   COMPILER_SETUP_INTERRUPT ();                                         \
 }
 
-#define FETCH_INTERRUPT_CODE()         (IntCode)
+#define FETCH_INTERRUPT_CODE() ((long) (Registers[REGBLOCK_INT_CODE]))
 
-#define CLEAR_INTERRUPT(code)                                          \
+#define REQUEST_INTERRUPT(code)                                                \
 {                                                                      \
-  set_IntCode (IntCode &~ (code));                                     \
+  (Registers[REGBLOCK_INT_CODE]) =                                     \
+    ((SCHEME_OBJECT) ((FETCH_INTERRUPT_CODE ()) | (code)));            \
   COMPILER_SETUP_INTERRUPT ();                                         \
 }
 
-#define REQUEST_INTERRUPT(code)                                                \
+#define CLEAR_INTERRUPT(code)                                          \
 {                                                                      \
-  set_IntCode (IntCode | (code));                                      \
+  (Registers[REGBLOCK_INT_CODE]) =                                     \
+    ((SCHEME_OBJECT) ((FETCH_INTERRUPT_CODE ()) &~ (code)));           \
   COMPILER_SETUP_INTERRUPT ();                                         \
 }
 
 #define INITIALIZE_INTERRUPTS()                                                \
 {                                                                      \
-  set_IntEnb (0);                                                      \
-  set_IntCode (0);                                                     \
+  (Registers[REGBLOCK_INT_MASK]) = ((SCHEME_OBJECT) 0);                        \
+  (Registers[REGBLOCK_INT_CODE]) = ((SCHEME_OBJECT) 0);                        \
   SET_INTERRUPT_MASK (INT_Mask);                                       \
   CLEAR_INTERRUPT (INT_Mask);                                          \
 }
-
-/* Compatibility */
-
-#define COMPILER_SET_MEMTOP COMPILER_SETUP_INTERRUPT
index bc09f44eb0ea8b4813a138c92c96f6f9bb998ddd..88a9f35e963270f0c2cfad325938b9eb66a7f26d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: stack.h,v 9.32 1992/09/18 05:53:14 jinx Exp $
+$Id: stack.h,v 9.33 1992/09/26 02:55:03 cph Exp $
 
 Copyright (c) 1987-1992 Massachusetts Institute of Technology
 
@@ -59,7 +59,7 @@ extern void EXFUN (dos386_stack_reset, (void));
   {                                                                    \
     Microcode_Termination(TERM_STACK_ALLOCATION_FAILED);               \
   }                                                                    \
-  Set_Stack_Guard (Free + STACKLET_HEADER_SIZE);                       \
+  SET_STACK_GUARD (Free + STACKLET_HEADER_SIZE);                       \
   *Free =                                                              \
     (MAKE_OBJECT (TC_MANIFEST_VECTOR, (Default_Stacklet_Size - 1)));   \
   Free += Default_Stacklet_Size;                                       \
@@ -140,7 +140,7 @@ extern void EXFUN (dos386_stack_reset, (void));
   SCHEME_OBJECT Our_Where;                                             \
                                                                        \
   Our_Where = (Where);                                                 \
-  Set_Stack_Guard (MEMORY_LOC (Our_Where, STACKLET_HEADER_SIZE));      \
+  SET_STACK_GUARD (MEMORY_LOC (Our_Where, STACKLET_HEADER_SIZE));      \
   Stack_Pointer = Previous_Stack_Pointer(Our_Where);                   \
 }
 
@@ -261,7 +261,7 @@ Pushed()
        MEMORY_SET (Older_Stacklet, STACKLET_REUSE_FLAG, SHARP_F);      \
       }                                                                        \
       temp = Free;                                                     \
-      Set_Stack_Guard (& (temp[STACKLET_HEADER_SIZE]));                        \
+      SET_STACK_GUARD (& (temp[STACKLET_HEADER_SIZE]));                        \
       temp[STACKLET_LENGTH] = Old_Stacklet_Top[STACKLET_LENGTH];       \
       Unused_Length =                                                  \
        OBJECT_DATUM (Old_Stacklet_Top[STACKLET_UNUSED_LENGTH]) +       \
index 4f30ec27fdceb37a07526a3c3da3e020faa59245..e9fa28da22e391afc37b583ba6e1028cf8340d4a 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: storage.c,v 9.51 1992/09/11 21:58:44 cph Exp $
+$Id: storage.c,v 9.52 1992/09/26 02:55:04 cph Exp $
 
 Copyright (c) 1987-92 Massachusetts Institute of Technology
 
@@ -49,6 +49,7 @@ SCHEME_OBJECT
  * Free,               /* Next free word in storage */
  * Ext_Stack_Pointer,  /* Next available slot in control stack */
  * Stack_Top,          /* Top of control stack */
+ * Stack_Guard,                /* Guard area at end of stack */
  * Free_Stacklets,     /* Free list of stacklets */
  * Constant_Space,     /* Bottom of constant+pure space */
  * Free_Constant,      /* Next free cell in constant+pure area */
index 7ece804c8f2dfa58da4ae11175a0003873fef168..698991860eed5954d1a543d4e2ca98d808cac48d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/utils.c,v 9.53 1992/07/29 19:54:56 cph Exp $
+$Id: utils.c,v 9.54 1992/09/26 02:55:05 cph Exp $
 
 Copyright (c) 1987-92 Massachusetts Institute of Technology
 
@@ -828,7 +828,7 @@ DEFUN (Allocate_New_Stacklet, (N), long N)
       }
     }
     Free[STACKLET_LENGTH] = MAKE_OBJECT (TC_MANIFEST_VECTOR, (size - 1));
-    Set_Stack_Guard (& (Free[STACKLET_HEADER_SIZE]));
+    SET_STACK_GUARD (& (Free[STACKLET_HEADER_SIZE]));
     Free += size;
     Stack_Pointer = Free;
   }
@@ -843,7 +843,7 @@ DEFUN (Allocate_New_Stacklet, (N), long N)
       ((SCHEME_OBJECT *) Free_Stacklets[STACKLET_FREE_LIST_LINK]);
     Stack_Pointer =
       &New_Stacklet[1 + (OBJECT_DATUM (New_Stacklet[STACKLET_LENGTH]))];
-    Set_Stack_Guard (& (New_Stacklet[STACKLET_HEADER_SIZE]));
+    SET_STACK_GUARD (& (New_Stacklet[STACKLET_HEADER_SIZE]));
   }
   Old_Expression = Fetch_Expression();
   Old_Return = Fetch_Return();
index ae219d84eb834f45c0f162d492c3201892c3542d..c6ad5a865a3d4738add89fdf7f3c0956ff0348c4 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: version.h,v 11.120 1992/09/12 00:08:33 cph Exp $
+$Id: version.h,v 11.121 1992/09/26 02:55:06 cph Exp $
 
 Copyright (c) 1988-92 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     120
+#define SUBVERSION     121
 #endif
index 2ccfc3829e4acde154b84cc96e820cc126db59f2..2febecfef0746758f1bab67ee83f54d4c0aa496c 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: cmpint.c,v 1.49 1992/09/11 02:04:05 cph Exp $
+$Id: cmpint.c,v 1.50 1992/09/26 02:54:55 cph Exp $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -40,7 +40,6 @@ MIT in each case. */
  *
  */
 \f
-#ifdef HAS_COMPILER_SUPPORT
 /*
  * Procedures in this file belong to the following categories:
  *
@@ -98,6 +97,8 @@ MIT in each case. */
 #include "prim.h"      /* Primitive_Procedure_Table, etc. */
 #define IN_CMPINT_C
 #include "cmpgc.h"      /* Compiled code object relocation */
+
+#ifdef HAS_COMPILER_SUPPORT
 \f
 #ifndef FLUSH_I_CACHE_REGION
 #  define FLUSH_I_CACHE_REGION(addr, nwords) NOP()
@@ -1335,116 +1336,76 @@ DEFUN (comutil_operator_4_0_trap,
 }
 \f
 /* INTERRUPT/GC from Scheme
-   The next four procedures are called from compiled code at the start
-   (respectively) of a closure, continuation, interpreter compatible
-   procedure, or ordinary (not closed) procedure if an interrupt has
-   been detected.  They return to the interpreter if the interrupt is
-   invalid after saving the state necessary to restart the compiled
-   code.
-
-   The code that handles RC_COMP_INTERRUPT_RESTART in interp.c will
-   return control to comp_interrupt_restart (below).  This assumes
-   that the Scheme stack contains a compiled code entry address (start
-   of continuation, procedure, etc.).  The Expression register saved
-   with the continuation is a piece of state that will be returned to
-   Val and Env (both) upon return.
-*/
 
-#define GC_DESIRED_P()         (Free >= MemTop)
+   These procedures are called from compiled code at the start
+   (respectively) of a procedure or continuation if an interrupt has
+   been detected.  They must not be called unless there is an
+   interrupt to be serviced.
 
-#define TEST_GC_NEEDED()                                               \
-{                                                                      \
-  if (GC_DESIRED_P())                                                  \
-  {                                                                    \
-    Request_GC(Free-MemTop);                                           \
-  }                                                                    \
-}
+   The code that handles RC_COMP_INTERRUPT_RESTART in "interp.c" will
+   return control to comp_interrupt_restart (below).  This assumes
+   that the Scheme stack contains a compiled code entry address
+   (start of continuation, procedure, etc.).  The Expression register
+   saved with the continuation is a piece of state that will be
+   returned to Val and Env (both) upon return.
 
-/* Called with no arguments, closure at top of (Scheme) stack.
-   If the interrupt is disabled, the closure is re-invoked.
- */
 
-SCHEME_UTILITY struct utility_result
-DEFUN (comutil_interrupt_closure,
-       (ignore_1, ignore_2, ignore_3, ignore_4),
-       long ignore_1 AND long ignore_2 AND long ignore_3 AND long ignore_4)
-{
-  TEST_GC_NEEDED ();
-  Stack_Check (Stack_Pointer);
-  if ((PENDING_INTERRUPTS()) == 0)
-  {
-    SCHEME_OBJECT entry_point;
+  */
 
-    EXTRACT_CLOSURE_ENTRY_ADDRESS (entry_point,
-                                  (OBJECT_ADDRESS (STACK_REF (0))));
-    ADJUST_CLOSURE_AT_CALL (entry_point, (STACK_REF (0)));
-    RETURN_TO_SCHEME (((instruction *) entry_point) +
-                     CLOSURE_SKIPPED_CHECK_OFFSET);
-  }
-  else
-  {
-    /* Return to interpreter to handle interrupt */
-    
-    STACK_PUSH (SHARP_F);
-    Store_Expression (SHARP_F);
-    Store_Return (RC_COMP_INTERRUPT_RESTART);
-    Save_Cont ();
-    RETURN_TO_C (PRIM_INTERRUPT);
-  }
+#define MAYBE_REQUEST_INTERRUPTS()                                     \
+{                                                                      \
+  if (Free >= MemTop)                                                  \
+    Request_GC (Free - MemTop);                                                \
+  if (Stack_Pointer <= Stack_Guard)                                    \
+    REQUEST_INTERRUPT (INT_Stack_Overflow);                            \
 }
-\f
-/* State is the live data; no entry point on the stack.
- */
 
 static struct utility_result
-DEFUN (compiler_interrupt_common,
-       (entry_point, offset, state),
-       instruction *entry_point AND
-       long offset AND
+DEFUN (compiler_interrupt_common, (entry_point, state),
+       instruction * entry_point AND
        SCHEME_OBJECT state)
 {
-  TEST_GC_NEEDED ();
-  Stack_Check (Stack_Pointer);
-  if ((PENDING_INTERRUPTS()) == 0)
-  {
-    Store_Env (state);
-    Val = state;
-    RETURN_TO_SCHEME (entry_point + offset);
-  }
-  else
-  {
+  MAYBE_REQUEST_INTERRUPTS ();
+  if (entry_point != 0)
     STACK_PUSH (ENTRY_TO_OBJECT (entry_point));
-    STACK_PUSH (state);
-    Store_Expression (SHARP_F);
-    Store_Return (RC_COMP_INTERRUPT_RESTART);
-    Save_Cont ();
-    RETURN_TO_C (PRIM_INTERRUPT);
-  }
+  STACK_PUSH (state);
+  Store_Expression (SHARP_F);
+  Store_Return (RC_COMP_INTERRUPT_RESTART);
+  Save_Cont ();
+  RETURN_TO_C (PRIM_INTERRUPT);
 }
 
 SCHEME_UTILITY struct utility_result
-DEFUN (comutil_interrupt_dlink,
-       (entry_point, dlink, ignore_3, ignore_4),
-       instruction * entry_point
-       AND SCHEME_OBJECT * dlink
-       AND long ignore_3 AND long ignore_4)
+DEFUN (comutil_interrupt_closure, (ignore_1, ignore_2, ignore_3, ignore_4),
+       long ignore_1 AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
+{
+  return (compiler_interrupt_common (0, SHARP_F));
+}
+
+SCHEME_UTILITY struct utility_result
+DEFUN (comutil_interrupt_dlink, (entry_point, dlink, ignore_3, ignore_4),
+       instruction * entry_point AND
+       SCHEME_OBJECT * dlink AND
+       long ignore_3 AND
+       long ignore_4)
 {
   return
-    (compiler_interrupt_common(entry_point,
-                              ENTRY_SKIPPED_CHECK_OFFSET,
-                              MAKE_POINTER_OBJECT(TC_STACK_ENVIRONMENT,
-                                                  dlink)));
+    (compiler_interrupt_common
+     (entry_point, (MAKE_POINTER_OBJECT (TC_STACK_ENVIRONMENT, dlink))));
 }
 
 SCHEME_UTILITY struct utility_result
 DEFUN (comutil_interrupt_procedure,
        (entry_point, ignore_2, ignore_3, ignore_4),
-       instruction * entry_point
-       AND long ignore_2 AND long ignore_3 AND long ignore_4)
+       instruction * entry_point AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
 {
-  return (compiler_interrupt_common(entry_point,
-                                   ENTRY_SKIPPED_CHECK_OFFSET,
-                                   SHARP_F));
+  return (compiler_interrupt_common (entry_point, SHARP_F));
 }
 
 /* Val has live data, and there is no entry address on the stack */
@@ -1452,12 +1413,12 @@ DEFUN (comutil_interrupt_procedure,
 SCHEME_UTILITY struct utility_result
 DEFUN (comutil_interrupt_continuation,
        (return_address, ignore_2, ignore_3, ignore_4),
-       instruction * return_address
-       AND long ignore_2 AND long ignore_3 AND long ignore_4)
+       instruction * return_address AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
 {
-  return (compiler_interrupt_common (return_address,
-                                    ENTRY_SKIPPED_CHECK_OFFSET,
-                                    Val));
+  return (compiler_interrupt_common (return_address, Val));
 }
 
 /* Env has live data; no entry point on the stack */
@@ -1465,12 +1426,12 @@ DEFUN (comutil_interrupt_continuation,
 SCHEME_UTILITY struct utility_result
 DEFUN (comutil_interrupt_ic_procedure,
        (entry_point, ignore_2, ignore_3, ignore_4),
-       instruction * entry_point
-       AND long ignore_2 AND long ignore_3 AND long ignore_4)
+       instruction * entry_point AND
+       long ignore_2 AND
+       long ignore_3 AND
+       long ignore_4)
 {
-  return (compiler_interrupt_common (entry_point,
-                                    ENTRY_SKIPPED_CHECK_OFFSET,
-                                    (Fetch_Env())));
+  return (compiler_interrupt_common (entry_point, (Fetch_Env ())));
 }
 
 C_TO_SCHEME long
index df918e6b7945a7f525be471a42413ce0826da844..4416249c54897dce5a9cdde51d6a268919379634 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpintmd/hppa.h,v 1.33 1992/05/23 01:18:45 jinx Exp $
+$Id: hppa.h,v 1.34 1992/09/26 02:54:50 cph Exp $
 
 Copyright (c) 1989-1992 Massachusetts Institute of Technology
 
@@ -417,12 +417,6 @@ DEFUN_VOID (flush_i_cache_initialize)
 \f
 /* Interrupt/GC polling. */
 
-/* Skip over this many BYTES to bypass the GC check code (ordinary
-procedures and continuations differ from closures) */
-
-#define ENTRY_SKIPPED_CHECK_OFFSET     4
-#define CLOSURE_SKIPPED_CHECK_OFFSET   16
-
 /* The length of the GC recovery code that precedes an entry.
    On the HP-PA a "ble, ldi" instruction sequence.
  */
index 600666f4b4cda3ee342da639bb162d8a5c0348f2..51272f17b6fef19892208f4c08c3213849204f2f 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: interp.c,v 9.68 1992/09/14 20:34:40 cph Exp $
+$Id: interp.c,v 9.69 1992/09/26 02:55:00 cph Exp $
 
 Copyright (c) 1988-92 Massachusetts Institute of Technology
 
@@ -402,10 +402,10 @@ DEFUN (abort_to_interpreter, (argument), int argument)
 {
   interpreter_throw_argument = argument;
   {
-    long old_mask = IntEnb;
-    set_IntEnb (0);
+    long old_mask = (FETCH_INTERRUPT_MASK ());
+    SET_INTERRUPT_MASK (0);
     dstack_set_position (interpreter_catch_dstack_position);
-    set_IntEnb (old_mask);
+    SET_INTERRUPT_MASK (old_mask);
   }
   obstack_free ((&scratch_obstack), 0);
   obstack_init (&scratch_obstack);
index ae219d84eb834f45c0f162d492c3201892c3542d..c6ad5a865a3d4738add89fdf7f3c0956ff0348c4 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: version.h,v 11.120 1992/09/12 00:08:33 cph Exp $
+$Id: version.h,v 11.121 1992/09/26 02:55:06 cph Exp $
 
 Copyright (c) 1988-92 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     120
+#define SUBVERSION     121
 #endif