* Switched order of two compiler passes: specify-representation and

insert-stack-overflow-check.  This will make it easier to remove 
   unnecessary stack checks and to add some that we *may* be
   missing.
* Added a $stack-overflow-check primitive that takes care of checking
  and calling ikrt_stack_overflow if we did detect an overflow.
This commit is contained in:
Abdulaziz Ghuloum 2007-11-05 15:30:42 -05:00
parent 90a243ee63
commit 8e85c3303b
5 changed files with 19 additions and 23 deletions

Binary file not shown.

View File

@ -1790,7 +1790,7 @@ syntax, shared graphs, fasl objects, etc.) can be enabled/disabled as needed.
The following procedures are missing from \texttt{(rnrs base)}: The following procedures are missing from \texttt{(rnrs base)}:
\begin{Verbatim} \begin{Verbatim}
angle imag-part magnitude make-polar make-rectangular real-part angle magnitude make-polar make-rectangular
\end{Verbatim} \end{Verbatim}
The following procedures are missing form \texttt{(rnrs bytevectors)}: The following procedures are missing form \texttt{(rnrs bytevectors)}:

View File

@ -203,11 +203,6 @@
[(_ e* ... e) [(_ e* ... e)
(make-seq (seq* e* ...) e)])) (make-seq (seq* e* ...) e)]))
(include "pass-specify-rep.ss")
(define (insert-engine-checks x) (define (insert-engine-checks x)
(define (Tail x) (define (Tail x)
(make-seq (make-seq
@ -227,23 +222,16 @@
(make-codes (map CodeExpr list) (Tail body))])) (make-codes (map CodeExpr list) (Tail body))]))
(CodesExpr x)) (CodesExpr x))
(define (insert-stack-overflow-check x) (define (insert-stack-overflow-check x)
(define who 'insert-stack-overflow-check) (define who 'insert-stack-overflow-check)
(define (Tail x) #t) (define (Tail x) #t)
(define (insert-check x) (define (insert-check x)
(make-seq (make-seq (make-primcall '$stack-overflow-check '()) x))
(make-shortcut
(make-conditional
(make-primcall '<
(list esp (make-primcall 'mref (list pcr (make-constant 16)))))
(make-primcall 'interrupt '())
(make-primcall 'nop '()))
(make-forcall "ik_stack_overflow" '()))
x))
(define (ClambdaCase x) (define (ClambdaCase x)
(struct-case x (struct-case x
[(clambda-case info body) [(clambda-case info body)
(make-clambda-case info (Main body))])) (make-clambda-case info (Main body))]))
@ -265,7 +253,7 @@
;;; ;;;
(Program x)) (Program x))
(include "pass-specify-rep.ss")
(define parameter-registers '(%edi)) (define parameter-registers '(%edi))
(define return-value-register '%eax) (define return-value-register '%eax)
@ -2831,8 +2819,8 @@
(let* ([x (introduce-primcalls x)] (let* ([x (introduce-primcalls x)]
[x (eliminate-fix x)] [x (eliminate-fix x)]
[x (insert-engine-checks x)] [x (insert-engine-checks x)]
[x (specify-representation x)]
[x (insert-stack-overflow-check x)] [x (insert-stack-overflow-check x)]
[x (specify-representation x)]
[x (impose-calling-convention/evaluation-order x)] [x (impose-calling-convention/evaluation-order x)]
[x (time-it "frame" (lambda () (assign-frame-sizes x)))] [x (time-it "frame" (lambda () (assign-frame-sizes x)))]
[x (time-it "register" (lambda () (color-by-chaitin x)))] [x (time-it "register" (lambda () (color-by-chaitin x)))]

View File

@ -1127,8 +1127,6 @@
/section) /section)
(section ;;; characters (section ;;; characters
(define-primop char? safe (define-primop char? safe
@ -1530,6 +1528,16 @@
(interrupt) (interrupt)
(prm 'incr/zero? pcr (K 36)))]) (prm 'incr/zero? pcr (K 36)))])
(define-primop $stack-overflow-check unsafe
[(E)
(make-shortcut
(make-conditional
(make-primcall '<
(list esp (make-primcall 'mref (list pcr (make-constant 16)))))
(make-primcall 'interrupt '())
(make-primcall 'nop '()))
(make-forcall "ik_stack_overflow" '()))])
/section) /section)
(section ;;; control operations (section ;;; control operations

View File

@ -145,7 +145,7 @@
[char>=? C ba se] [char>=? C ba se]
[char>? C ba se] [char>? C ba se]
[char? C ba se] [char? C ba se]
[complex? D ba se] [complex? C ba se]
[cons C ba se] [cons C ba se]
[cos C ba se] [cos C ba se]
[denominator C ba se] [denominator C ba se]
@ -170,7 +170,7 @@
[floor C ba se] [floor C ba se]
[for-each C ba se] [for-each C ba se]
[gcd C ba se] [gcd C ba se]
[imag-part D ba se] [imag-part C ba se]
[inexact C ba] [inexact C ba]
[inexact? C ba se] [inexact? C ba se]
[infinite? C ba] [infinite? C ba]
@ -208,7 +208,7 @@
[rational-valued? C ba] [rational-valued? C ba]
[rational? C ba se] [rational? C ba se]
[rationalize C ba se] [rationalize C ba se]
[real-part D ba se] [real-part C ba se]
[real-valued? C ba] [real-valued? C ba]
[real? C ba se] [real? C ba se]
[reverse C ba se] [reverse C ba se]