X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Feval-comp.lisp;h=39238fbb5b83495e909d1a06486c5e520b60482e;hb=a1a2c079c7654defb618baad0dddcf0eaf2ce64f;hp=7e7fa0fcefc76fcdc8ac5d651ccf2b7a5084c19d;hpb=ce02ab2ecd9c6ae2e570abd8c93ebf3be55bbdad;p=sbcl.git diff --git a/src/compiler/eval-comp.lisp b/src/compiler/eval-comp.lisp index 7e7fa0f..39238fb 100644 --- a/src/compiler/eval-comp.lisp +++ b/src/compiler/eval-comp.lisp @@ -35,7 +35,7 @@ ;;; Translate form into the compiler's IR1 and perform environment ;;; analysis. This is sort of a combination of COMPILE-FILE, ;;; SUB-COMPILE-FILE, COMPILE-TOP-LEVEL, and COMPILE-COMPONENT. -(defun compile-for-eval (form quietly) +(defun compile-for-eval (form) (with-ir1-namespace (let* ((*block-compile* nil) (*lexenv* (make-null-lexenv)) @@ -109,54 +109,59 @@ (def!method print-object ((obj entry-node-info) str) (print-unreadable-object (obj str :type t))) -;;; Some compiler funny functions have definitions, so the interpreter can -;;; call them. These require special action to coordinate the interpreter, -;;; system call stack, and the environment. The annotation prepass marks the -;;; references to these as :unused, so the interpreter doesn't try to fetch -;;; functions through these undefined symbols. +;;; Some compiler funny functions have definitions, so the interpreter +;;; can call them. These require special action to coordinate the +;;; interpreter, system call stack, and the environment. The +;;; annotation prepass marks the references to these as :UNUSED, so +;;; the interpreter doesn't try to fetch functions through these +;;; undefined symbols. (defconstant undefined-funny-funs '(%special-bind %special-unbind %more-arg-context %unknown-values %catch %unwind-protect %catch-breakup %unwind-protect-breakup %lexical-exit-breakup %continue-unwind %nlx-entry)) -;;; Some kinds of functions are only passed as arguments to funny functions, -;;; and are never actually evaluated at run time. +;;; Some kinds of functions are only passed as arguments to funny +;;; functions, and are never actually evaluated at run time. (defconstant non-closed-function-kinds '(:cleanup :escape)) ;;; This annotates continuations, lambda-vars, and lambdas. For each -;;; continuation, we cache how its destination uses its value. This only buys -;;; efficiency when the code executes more than once, but the overhead of this -;;; part of the prepass for code executed only once should be negligible. +;;; continuation, we cache how its destination uses its value. This +;;; only buys efficiency when the code executes more than once, but +;;; the overhead of this part of the prepass for code executed only +;;; once should be negligible. ;;; -;;; As a special case to aid interpreting local function calls, we sometimes -;;; note the continuation as :unused. This occurs when there is a local call, -;;; and there is no actual function object to call; we mark the continuation as -;;; :unused since there is nothing to push on the interpreter's stack. -;;; Normally we would see a reference to a function that we would push on the -;;; stack to later pop and apply to the arguments on the stack. To determine -;;; when we have a local call with no real function object, we look at the node -;;; to see whether it is a reference with a destination that is a :local -;;; combination whose function is the reference node's continuation. +;;; As a special case to aid interpreting local function calls, we +;;; sometimes note the continuation as :unused. This occurs when there +;;; is a local call, and there is no actual function object to call; +;;; we mark the continuation as :unused since there is nothing to push +;;; on the interpreter's stack. Normally we would see a reference to a +;;; function that we would push on the stack to later pop and apply to +;;; the arguments on the stack. To determine when we have a local call +;;; with no real function object, we look at the node to see whether +;;; it is a reference with a destination that is a :local combination +;;; whose function is the reference node's continuation. ;;; -;;; After checking for virtual local calls, we check for funny functions the -;;; compiler refers to for calling to note certain operations. These functions -;;; are undefined, and if the interpreter tried to reference the function cells -;;; of these symbols, it would get an error. We mark the continuations -;;; delivering the values of these references as :unused, so the reference -;;; never takes place. +;;; After checking for virtual local calls, we check for funny +;;; functions the compiler refers to for calling to note certain +;;; operations. These functions are undefined, and if the interpreter +;;; tried to reference the function cells of these symbols, it would +;;; get an error. We mark the continuations delivering the values of +;;; these references as :unused, so the reference never takes place. ;;; -;;; For each lambda-var, including a lambda's vars and its let's vars, we note -;;; the stack offset used to access and store that variable. Then we note the -;;; lambda with the total number of variables, so we know how big its stack -;;; frame is. Also in the lambda's info is the number of its arguments that it -;;; actually references; the interpreter never pushes or pops an unreferenced -;;; argument, so we can't just use LENGTH on LAMBDA-VARS to know how many args -;;; the caller passed. +;;; For each lambda-var, including a LAMBDA's vars and its LET's vars, +;;; we note the stack offset used to access and store that variable. +;;; Then we note the lambda with the total number of variables, so we +;;; know how big its stack frame is. Also in the lambda's info is the +;;; number of its arguments that it actually references; the +;;; interpreter never pushes or pops an unreferenced argument, so we +;;; can't just use LENGTH on LAMBDA-VARS to know how many args the +;;; caller passed. ;;; -;;; For each entry node in a lambda, we associate in the lambda-eval-info the -;;; entry node with a stack offset. Evaluation code stores the frame pointer -;;; in this slot upon processing the entry node to aid stack cleanup and -;;; correct frame manipulation when processing exit nodes. +;;; For each entry node in a lambda, we associate in the +;;; lambda-eval-info the entry node with a stack offset. Evaluation +;;; code stores the frame pointer in this slot upon processing the +;;; entry node to aid stack cleanup and correct frame manipulation +;;; when processing exit nodes. (defun annotate-component-for-eval (component) (do-blocks (b component) (do-nodes (node cont b) @@ -177,12 +182,12 @@ ((and leaf (typep leaf 'clambda) (member (functional-kind leaf) non-closed-function-kinds)) - (assert (not (eq (functional-kind leaf) :escape))) + (aver (not (eq (functional-kind leaf) :escape))) :unused) (t (typecase dest - ;; Change locations in eval.lisp that think :RETURN - ;; could occur. + ;; Change locations in eval.lisp that think + ;; :RETURN could occur. ((or mv-combination creturn exit) :multiple) (null :unused) (t :single)))))))) @@ -228,8 +233,8 @@ ((:catch :unwind-protect) (return :blow-it-off)))))))) -;;; Sometime consider annotations to exclude processing of exit nodes when -;;; we want to do a tail-p thing. +;;; Sometime consider annotations to exclude processing of exit nodes +;;; when we want to do a tail-p thing. ;;;; defining funny functions for interpreter