X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fstack.lisp;h=1f4d546b1fab181bcda4865aae3be4393a2e55c1;hb=98a76d4426660876dec6649b1e228d2e5b47f579;hp=00dd5a6e30860a1ffa412cc5586c48d9a76ed791;hpb=7fd2eb4b1bc68e8aaec233c4a39bdfc40225bda2;p=sbcl.git diff --git a/src/compiler/stack.lisp b/src/compiler/stack.lisp index 00dd5a6..1f4d546 100644 --- a/src/compiler/stack.lisp +++ b/src/compiler/stack.lisp @@ -14,9 +14,9 @@ (in-package "SB!C") -;;; Scan through Block looking for uses of :Unknown continuations that have -;;; their Dest outside of the block. We do some checking to verify the -;;; invariant that all pushes come after the last pop. +;;; Scan through BLOCK looking for uses of :UNKNOWN continuations that +;;; have their DEST outside of the block. We do some checking to +;;; verify the invariant that all pushes come after the last pop. (defun find-pushed-continuations (block) (let* ((2block (block-info block)) (popped (ir2-block-popped 2block)) @@ -43,44 +43,47 @@ ;;;; annotation graph walk -;;; Do a backward walk in the flow graph simulating the run-time stack of -;;; unknown-values continuations and annotating the blocks with the result. +;;; Do a backward walk in the flow graph simulating the run-time stack +;;; of unknown-values continuations and annotating the blocks with the +;;; result. ;;; -;;; Block is the block that is currently being walked and Stack is the stack -;;; of unknown-values continuations in effect immediately after block. We -;;; simulate the stack by popping off the unknown-values generated by this -;;; block (if any) and pushing the continuations for values received by this -;;; block. (The role of push and pop are interchanged because we are doing a -;;; backward walk.) +;;; BLOCK is the block that is currently being walked and STACK is the +;;; stack of unknown-values continuations in effect immediately after +;;; block. We simulate the stack by popping off the unknown-values +;;; generated by this block (if any) and pushing the continuations for +;;; values received by this block. (The role of push and pop are +;;; interchanged because we are doing a backward walk.) ;;; -;;; If we run into a values generator whose continuation isn't on stack top, -;;; then the receiver hasn't yet been reached on any walk to this use. In this -;;; case, we ignore the push for now, counting on Annotate-Dead-Values to clean -;;; it up if we discover that it isn't reachable at all. +;;; If we run into a values generator whose continuation isn't on +;;; stack top, then the receiver hasn't yet been reached on any walk +;;; to this use. In this case, we ignore the push for now, counting on +;;; Annotate-Dead-Values to clean it up if we discover that it isn't +;;; reachable at all. ;;; -;;; If our final stack isn't empty, then we walk all the predecessor blocks -;;; that don't have all the continuations that we have on our Start-Stack on -;;; their End-Stack. This is our termination condition for the graph walk. We -;;; put the test around the recursive call so that the initial call to this -;;; function will do something even though there isn't initially anything on -;;; the stack. +;;; If our final stack isn't empty, then we walk all the predecessor +;;; blocks that don't have all the continuations that we have on our +;;; START-STACK on their END-STACK. This is our termination condition +;;; for the graph walk. We put the test around the recursive call so +;;; that the initial call to this function will do something even +;;; though there isn't initially anything on the stack. ;;; -;;; We can use the tailp test, since the only time we want to bottom out -;;; with a non-empty stack is when we intersect with another path from the same -;;; top-level call to this function that has more values receivers on that -;;; path. When we bottom out in this way, we are counting on -;;; DISCARD-UNUSED-VALUES doing its thing. +;;; We can use the tailp test, since the only time we want to bottom +;;; out with a non-empty stack is when we intersect with another path +;;; from the same top level call to this function that has more values +;;; receivers on that path. When we bottom out in this way, we are +;;; counting on DISCARD-UNUSED-VALUES doing its thing. ;;; ;;; When we do recurse, we check that predecessor's END-STACK is a -;;; subsequence of our START-STACK. There may be extra stuff on the top -;;; of our stack because the last path to the predecessor may have discarded -;;; some values that we use. There may be extra stuff on the bottom of our -;;; stack because this walk may be from a values receiver whose lifetime -;;; encloses that of the previous walk. +;;; subsequence of our START-STACK. There may be extra stuff on the +;;; top of our stack because the last path to the predecessor may have +;;; discarded some values that we use. There may be extra stuff on the +;;; bottom of our stack because this walk may be from a values +;;; receiver whose lifetime encloses that of the previous walk. ;;; -;;; If a predecessor block is the component head, then it must be the case -;;; that this is a NLX entry stub. If so, we just stop our walk, since the -;;; stack at the exit point doesn't have anything to do with our stack. +;;; If a predecessor block is the component head, then it must be the +;;; case that this is a NLX entry stub. If so, we just stop our walk, +;;; since the stack at the exit point doesn't have anything to do with +;;; our stack. (defun stack-simulation-walk (block stack) (declare (type cblock block) (list stack)) (let ((2block (block-info block))) @@ -181,7 +184,7 @@ ;;;; stack analysis ;;; Return a list of all the blocks containing genuine uses of one of the -;;; Receivers. Exits are excluded, since they don't drop through to the +;;; RECEIVERS. Exits are excluded, since they don't drop through to the ;;; receiver. (defun find-values-generators (receivers) (declare (list receivers)) @@ -193,15 +196,17 @@ (res (node-block use)))))) (res))) -;;; Analyze the use of unknown-values continuations in Component, inserting -;;; cleanup code to discard values that are generated but never received. This -;;; phase doesn't need to be run when Values-Receivers is null, i.e. there are -;;; no unknown-values continuations used across block boundaries. +;;; Analyze the use of unknown-values continuations in COMPONENT, +;;; inserting cleanup code to discard values that are generated but +;;; never received. This phase doesn't need to be run when +;;; Values-Receivers is null, i.e. there are no unknown-values +;;; continuations used across block boundaries. ;;; -;;; Do the backward graph walk, starting at each values receiver. We ignore -;;; receivers that already have a non-null Start-Stack. These are nested -;;; values receivers that have already been reached on another walk. We don't -;;; want to clobber that result with our null initial stack. +;;; Do the backward graph walk, starting at each values receiver. We +;;; ignore receivers that already have a non-null START-STACK. These +;;; are nested values receivers that have already been reached on +;;; another walk. We don't want to clobber that result with our null +;;; initial stack. (defun stack-analyze (component) (declare (type component component)) (let* ((2comp (component-info component))