X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fexhaust.lisp;h=25c038e0920434a4988ef72ffaff6421fe5d777f;hb=86210c4e406c1b2ff10cc3bac0e71435867db48b;hp=88f19540967ca54d70d1d2f298de17583e9d6e5c;hpb=fc6400512d98021430dcd7d95c4e5535c6fe9b86;p=sbcl.git diff --git a/src/code/exhaust.lisp b/src/code/exhaust.lisp index 88f1954..25c038e 100644 --- a/src/code/exhaust.lisp +++ b/src/code/exhaust.lisp @@ -30,18 +30,18 @@ (let (;; initial difference between soft limit and hard limit (initial-slack (expt 2 20))) (setf *control-stack-exhaustion-sap* - (int-sap #!+stack-grows-downward (+ sb!vm:control-stack-start - initial-slack) - #!+stack-grows-upward (- sb!vm:control-stack-end - initial-slack))))) + (int-sap #!+stack-grows-downward-not-upward + (+ sb!vm:control-stack-start initial-slack) + #!-stack-grows-downward-not-upward + (- sb!vm:control-stack-end initial-slack))))) ;;; FIXME: Even though this is only called when (> SAFETY (MAX SPEED SPACE)) ;;; it's still annoyingly wasteful for it to be a full function call. ;;; It should probably be a VOP calling an assembly routine or something ;;; like that. (defun %detect-stack-exhaustion () - (when (#!+stack-grows-upward sap>= - #!+stack-grows-downward sap<= + (when (#!-stack-grows-downward-not-upward sap>= + #!+stack-grows-downward-not-upward sap<= (current-sp) *control-stack-exhaustion-sap*) (let ((*control-stack-exhaustion-sap* @@ -60,11 +60,14 @@ ;;; the (continuing) stack overflow. (defun revised-control-stack-exhaustion-sap () (let* ((old-slack - #!+stack-grows-upward (- sb!vm:control-stack-end - (sap-int *control-stack-exhaustion-sap*)) - #!+stack-grows-downward (- (sap-int *control-stack-exhaustion-sap*) - sb!vm:control-stack-start)) + #!-stack-grows-downward-not-upward + (- sb!vm:control-stack-end + (sap-int *control-stack-exhaustion-sap*)) + #!+stack-grows-downward-not-upward + (- (sap-int *control-stack-exhaustion-sap*) + sb!vm:control-stack-start)) (new-slack (ash old-slack -1))) - (int-sap - #!+stack-grows-upward (- sb!vm:control-stack-end new-slack) - #!+stack-grows-downward (+ sb!vm:control-stack-start new-slack)))) + (int-sap #!-stack-grows-downward-not-upward + (- sb!vm:control-stack-end new-slack) + #!+stack-grows-downward-not-upward + (+ sb!vm:control-stack-start new-slack))))