Add optional stack-overflow checks. By default this is disabled.
authorChris Hanson <org/chris-hanson/cph>
Wed, 29 Jul 1992 22:10:37 +0000 (22:10 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 29 Jul 1992 22:10:37 +0000 (22:10 +0000)
v7/src/compiler/machines/bobcat/compiler.pkg
v7/src/compiler/machines/bobcat/lapgen.scm
v7/src/compiler/machines/bobcat/rules3.scm
v7/src/compiler/machines/mips/compiler.pkg
v7/src/compiler/machines/mips/lapgen.scm
v7/src/compiler/machines/mips/rules3.scm

index ae1244193a7042b3efd8fbc0692efe7741908c7e..2566204191b383aa01d543064f467d79e43d18a2 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/compiler.pkg,v 1.36 1992/05/26 20:22:37 mhwu Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/compiler.pkg,v 1.37 1992/07/29 22:04:11 cph Exp $
 
-Copyright (c) 1988-1992 Massachusetts Institute of Technology
+Copyright (c) 1988-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -87,6 +87,7 @@ MIT in each case. |#
          compiler:generate-lap-files?
          compiler:generate-range-checks?
          compiler:generate-rtl-files?
+         compiler:generate-stack-checks?
          compiler:generate-type-checks?
          compiler:implicit-self-static?
          compiler:intersperse-rtl-in-lap?
index cdb1ae81fa35958138f9bd7e5b6ee1a516b56a7a..ff15d54f5c3b6a09840ca95f531617a8d19ebbc7 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/lapgen.scm,v 4.44 1992/07/05 14:20:16 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/lapgen.scm,v 4.45 1992/07/29 22:04:20 cph Exp $
 
-Copyright (c) 1988-1992 Massachusetts Institute of Technology
+Copyright (c) 1988-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -1061,6 +1061,7 @@ MIT in each case. |#
 (define-integrable reg:lexpr-primitive-arity (INST-EA (@AO 6 #x001C)))
 (define-integrable reg:closure-free (INST-EA (@AO 6 #x0024)))
 (define-integrable reg:closure-space (INST-EA (@AO 6 #X0028)))
+(define-integrable reg:stack-guard (INST-EA (@AO 6 #X002C)))
 
 (let-syntax ((define-codes
               (macro (start . names)
index 43b83f48aed9a0a1f9cb728424b21ba7d556455c..e244d42221b0b76740e8f02da21cc2010194d6bd 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/rules3.scm,v 4.32 1992/07/05 14:20:51 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/rules3.scm,v 4.33 1992/07/29 22:04:02 cph Exp $
 
-Copyright (c) 1988-1992 Massachusetts Institute of Technology
+Copyright (c) 1988-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -400,8 +400,15 @@ MIT in each case. |#
     (LAP (LABEL ,gc-label)
         (JSR ,entry)
         ,@(make-external-label code-word label)
-        (CMP L ,reg:compiled-memtop (A 5))
-        (B GE B (@PCR ,gc-label)))))
+        ,@(interrupt-check gc-label))))
+
+(define (interrupt-check gc-label)
+  (LAP (CMP L ,reg:compiled-memtop (A 5))
+       (B GE B (@PCR ,gc-label))
+       ,@(if compiler:generate-stack-checks?
+            (LAP (CMP L ,reg:stack-guard (A 7))
+                 (B LE B (@PCR ,gc-label)))
+            (LAP))))
 
 (define-rule statement
   (CONTINUATION-ENTRY (? internal-label))
@@ -424,8 +431,7 @@ MIT in each case. |#
           (LABEL ,gc-label)
           ,@(invoke-interface-jsr code:compiler-interrupt-ic-procedure)
           ,@(make-external-label expression-code-word internal-label)
-          (CMP L ,reg:compiled-memtop (A 5))
-          (B GE B (@PCR ,gc-label))))))
+          ,@(interrupt-check gc-label)))))
 
 (define-rule statement
   (OPEN-PROCEDURE-HEADER (? internal-label))
@@ -506,8 +512,7 @@ long-word aligned and there is no need for shuffling.
                                      external-label)
               (ADD UL (& ,(MC68020/make-magic-closure-constant entry)) (@A 7))
               (LABEL ,internal-label)
-              (CMP L ,reg:compiled-memtop (A 5))
-              (B GE B (@PCR ,gc-label)))))))
+              ,@(interrupt-check gc-label))))))
 \f
 (define (MC68020/cons-closure target procedure-label min max size)
   (let* ((target (reference-target-alias! target 'ADDRESS))
@@ -588,8 +593,7 @@ long-word aligned and there is no need for shuffling.
                                      external-label)
               (ADD UL (& ,(MC68040/make-magic-closure-constant entry)) (@A 7))
               (LABEL ,internal-label)
-              (CMP L ,reg:compiled-memtop (A 5))
-              (B GE B (@PCR ,gc-label)))))))
+              ,@(interrupt-check gc-label))))))
 
 (define (MC68040/cons-closure target procedure-label min max size)
   (MC68040/with-allocated-closure target 1 size
index a081a0dd5a6cdf8d31dfd7f4ccfa420b5b6bfcc5..efa4ae64bff7abe1caa37771fba77fa742a59024 100644 (file)
@@ -1,9 +1,9 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/compiler.pkg,v 1.6 1992/05/26 20:23:11 mhwu Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/compiler.pkg,v 1.7 1992/07/29 22:04:55 cph Exp $
 $MC68020-Header: /scheme/compiler/bobcat/RCS/comp.pkg,v 1.32 1991/05/06 23:09:24 jinx Exp $
 
-Copyright (c) 1988-1992 Massachusetts Institute of Technology
+Copyright (c) 1988-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -88,6 +88,7 @@ MIT in each case. |#
          compiler:generate-lap-files?
          compiler:generate-range-checks?
          compiler:generate-rtl-files?
+         compiler:generate-stack-checks?
          compiler:generate-type-checks?
          compiler:implicit-self-static?
          compiler:intersperse-rtl-in-lap?
index 38d9e0a89bca601155ba81e9ecb575d5cf9c6a84..a55a7da5646c62f7e7ffd0ddab928fbca462472a 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/lapgen.scm,v 1.9 1992/05/14 03:07:51 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/lapgen.scm,v 1.10 1992/07/29 22:05:50 cph Exp $
 
-Copyright (c) 1988-1992 Massachusetts Institute of Technology
+Copyright (c) 1988-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -558,6 +558,9 @@ MIT in each case. |#
 (define-integrable reg:lexpr-primitive-arity
   (INST-EA (OFFSET #x001C ,regnum:regs-pointer)))
 
+(define-integrable reg:stack-guard
+  (INST-EA (OFFSET #x002C ,regnum:regs-pointer)))
+
 (define (lap:make-label-statement label)
   (LAP (LABEL ,label)))
 
index e0d421c04e51e33a809d046b9410aa657359c06c..366d8c08534affc710c9c799d44d8b3708d29792 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/rules3.scm,v 1.10 1991/10/25 00:13:29 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/rules3.scm,v 1.11 1992/07/29 22:10:37 cph Exp $
 
-Copyright (c) 1988-91 Massachusetts Institute of Technology
+Copyright (c) 1988-92 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -428,7 +428,16 @@ MIT in each case. |#
 (define (interrupt-check gc-label)
   (LAP (SLT ,regnum:assembler-temp ,regnum:memtop ,regnum:free)
        (BNE ,regnum:assembler-temp 0 (@PCR ,gc-label))
-       (LW ,regnum:memtop ,reg:memtop)))
+       (LW ,regnum:memtop ,reg:memtop)
+       ,@(if compiler:generate-stack-checks?
+            (LAP (LW ,regnum:assembler-temp ,reg:stack-guard)
+                 (NOP)
+                 (SLT ,regnum:assembler-temp
+                      ,regnum:stack-pointer
+                      ,regnum:assembler-temp)
+                 (BNE ,regnum:assembler-temp 0 (@PCR ,gc-label))
+                 (NOP))
+            (LAP))))
 
 (define-rule statement
   (CONTINUATION-ENTRY (? internal-label))