/[cmucl]/src/compiler/ir1opt.lisp
ViewVC logotype

Contents of /src/compiler/ir1opt.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (hide annotations)
Sun Oct 14 21:43:19 1990 UTC (23 years, 6 months ago) by ram
Branch: MAIN
Changes since 1.17: +4 -2 lines
Fixed REOPTIMIZE-CONTINUATION to set BLOCK-TEST-MODIFIED if the 
continuation goes to an IF.
1 wlott 1.1 ;;; -*- Package: C; Log: C.Log -*-
2     ;;;
3     ;;; **********************************************************************
4     ;;; This code was written as part of the Spice Lisp project at
5     ;;; Carnegie-Mellon University, and has been placed in the public domain.
6     ;;; If you want to use this code or any part of Spice Lisp, please contact
7     ;;; Scott Fahlman (FAHLMAN@CMUC).
8     ;;; **********************************************************************
9     ;;;
10     ;;; This file implements the IR1 optimization phase of the compiler. IR1
11     ;;; optimization is a grab-bag of optimizations that don't make major changes
12     ;;; to the block-level control flow and don't use flow analysis. These
13     ;;; optimizations can mostly be classified as "meta-evaluation", but there is a
14     ;;; sizable top-down component as well.
15     ;;;
16     ;;; Written by Rob MacLachlan
17     ;;;
18     (in-package 'c)
19    
20    
21     ;;;; Interface for obtaining results of constant folding:
22    
23     ;;; Constant-Continuation-P -- Interface
24     ;;;
25     ;;; Return true if the sole use of Cont is a reference to a constant leaf.
26     ;;;
27     (proclaim '(function constant-continuation-p (continuation) boolean))
28     (defun constant-continuation-p (cont)
29     (let ((use (continuation-use cont)))
30     (and (ref-p use)
31     (constant-p (ref-leaf use)))))
32    
33    
34     ;;; Continuation-Value -- Interface
35     ;;;
36     ;;; Return the constant value for a continuation whose only use is a
37     ;;; constant node.
38     ;;;
39     (proclaim '(function continuation-value (continuation) t))
40     (defun continuation-value (cont)
41 ram 1.10 (assert (constant-continuation-p cont))
42 wlott 1.1 (constant-value (ref-leaf (continuation-use cont))))
43    
44    
45     ;;;; Interface for obtaining results of type inference:
46    
47     ;;; CONTINUATION-PROVEN-TYPE -- Interface
48     ;;;
49     ;;; Return a (possibly values) type that describes what we have proven about
50     ;;; the type of Cont without taking any type assertions into consideration.
51     ;;; This is just the union of the NODE-DERIVED-TYPE of all the uses. Most
52     ;;; often people use CONTINUATION-DERIVED-TYPE or CONTINUATION-TYPE instead of
53     ;;; using this function directly.
54     ;;;
55     (defun continuation-proven-type (cont)
56     (declare (type continuation cont))
57     (ecase (continuation-kind cont)
58     ((:block-start :deleted-block-start)
59     (let ((uses (block-start-uses (continuation-block cont))))
60     (if uses
61     (do ((res (node-derived-type (first uses))
62     (values-type-union (node-derived-type (first current))
63     res))
64     (current (rest uses) (rest current)))
65     ((null current) res))
66     *empty-type*)))
67     (:inside-block
68     (node-derived-type (continuation-use cont)))))
69    
70    
71     ;;; Continuation-Derived-Type -- Interface
72     ;;;
73     ;;; Our best guess for the type of this continuation's value. Note that
74     ;;; this may be Values or Function type, which cannot be passed as an argument
75     ;;; to the normal type operations. See Continuation-Type. This may be called
76     ;;; on deleted continuations, always returning *.
77     ;;;
78     ;;; What we do is call CONTINUATION-PROVEN-TYPE and check whether the result
79     ;;; is a subtype of the assertion. If so, return the proven type and set
80     ;;; TYPE-CHECK to nil. Otherwise, return the intersection of the asserted and
81     ;;; proven types, and set TYPE-CHECK T. If TYPE-CHECK already has a non-null
82     ;;; value, then preserve it. Only in the somewhat unusual circumstance of
83     ;;; a newly discovered assertion will we change TYPE-CHECK from NIL to T.
84     ;;;
85     ;;; The result value is cached in the Continuation-%Derived-Type. If the
86     ;;; slot is true, just return that value, otherwise recompute and stash the
87     ;;; value there.
88     ;;;
89     (proclaim '(inline continuation-derived-type))
90     (defun continuation-derived-type (cont)
91     (declare (type continuation cont))
92     (or (continuation-%derived-type cont)
93     (%continuation-derived-type cont)))
94     ;;;
95     (defun %continuation-derived-type (cont)
96     (declare (type continuation cont))
97     (let ((proven (continuation-proven-type cont))
98     (asserted (continuation-asserted-type cont)))
99     (cond ((values-subtypep proven asserted)
100     (setf (continuation-%type-check cont) nil)
101     (setf (continuation-%derived-type cont) proven))
102     (t
103     (unless (or (continuation-%type-check cont)
104     (not (continuation-dest cont))
105     (eq asserted *universal-type*))
106     (setf (continuation-%type-check cont) t))
107    
108     (setf (continuation-%derived-type cont)
109     (values-type-intersection asserted proven))))))
110    
111    
112     ;;; CONTINUATION-TYPE-CHECK -- Interface
113     ;;;
114     ;;; Call CONTINUATION-DERIVED-TYPE to make sure the slot is up to date, then
115     ;;; return it.
116     ;;;
117     (proclaim '(inline continuation-type-check))
118     (defun continuation-type-check (cont)
119     (declare (type continuation cont))
120     (continuation-derived-type cont)
121     (continuation-%type-check cont))
122    
123    
124     ;;; Continuation-Type -- Interface
125     ;;;
126     ;;; Return the derived type for Cont's first value. This is guaranteed not
127     ;;; to be a Values or Function type.
128     ;;;
129 wlott 1.14 (proclaim '(function continuation-type (continuation) ctype))
130 wlott 1.1 (defun continuation-type (cont)
131     (single-value-type (continuation-derived-type cont)))
132    
133    
134     ;;;; Interface routines used by optimizers:
135    
136     ;;; Reoptimize-Continuation -- Interface
137     ;;;
138     ;;; This function is called by optimizers to indicate that something
139     ;;; interesting has happened to the value of Cont. Optimizers must make sure
140     ;;; that they don't call for reoptimization when nothing has happened, since
141     ;;; optimization will fail to terminate.
142     ;;;
143     ;;; We clear any cached type for the continuation and set the reoptimize
144     ;;; flags on everything in sight, unless the continuation is deleted (in which
145     ;;; case we do nothing.)
146     ;;;
147     ;;; Since this can get called curing IR1 conversion, we have to be careful
148     ;;; not to fly into space when the Dest's Prev is missing.
149     ;;;
150     (defun reoptimize-continuation (cont)
151     (declare (type continuation cont))
152     (unless (eq (continuation-kind cont) :deleted)
153     (setf (continuation-%derived-type cont) nil)
154     (let ((dest (continuation-dest cont)))
155     (when dest
156     (setf (continuation-reoptimize cont) t)
157     (setf (node-reoptimize dest) t)
158     (let ((prev (node-prev dest)))
159     (when prev
160     (let* ((block (continuation-block prev))
161     (component (block-component block)))
162 ram 1.18 (when (typep dest 'cif)
163     (setf (block-test-modified block) t))
164 wlott 1.1 (setf (block-reoptimize block) t)
165     (setf (component-reoptimize component) t))))))
166     (do-uses (node cont)
167     (setf (block-type-check (node-block node)) t)))
168     (undefined-value))
169    
170    
171     ;;; Derive-Node-Type -- Interface
172     ;;;
173     ;;; Annotate Node to indicate that its result has been proven to be typep to
174     ;;; RType. After IR1 conversion has happened, this is the only correct way to
175     ;;; supply information discovered about a node's type. If you fuck with the
176     ;;; Node-Derived-Type directly, then information may be lost and reoptimization
177     ;;; may not happen.
178     ;;;
179     ;;; What we do is intersect Rtype with Node's Derived-Type. If the
180     ;;; intersection is different from the old type, then we do a
181     ;;; Reoptimize-Continuation on the Node-Cont.
182     ;;;
183     (defun derive-node-type (node rtype)
184     (declare (type node node) (type ctype rtype))
185     (let ((node-type (node-derived-type node)))
186     (unless (eq node-type rtype)
187     (let ((int (values-type-intersection node-type rtype)))
188     (when (type/= node-type int)
189     (setf (node-derived-type node) int)
190     (reoptimize-continuation (node-cont node))))))
191     (undefined-value))
192    
193    
194     ;;; Assert-Continuation-Type -- Interface
195     ;;;
196     ;;; Similar to Derive-Node-Type, but asserts that it is an error for Cont's
197     ;;; value not to be typep to Type. If we improve the assertion, we set
198 ram 1.11 ;;; TYPE-CHECK and TYPE-ASSERTED to guarantee that the new assertion will be
199     ;;; checked.
200 wlott 1.1 ;;;
201     (defun assert-continuation-type (cont type)
202     (declare (type continuation cont) (type ctype type))
203     (let ((cont-type (continuation-asserted-type cont)))
204     (unless (eq cont-type type)
205     (let ((int (values-type-intersection cont-type type)))
206     (when (type/= cont-type int)
207     (setf (continuation-asserted-type cont) int)
208     (do-uses (node cont)
209 ram 1.11 (setf (block-attributep (block-flags (node-block node))
210     type-check type-asserted)
211     t))
212 wlott 1.1 (reoptimize-continuation cont)))))
213     (undefined-value))
214    
215    
216     ;;; Assert-Call-Type -- Interface
217     ;;;
218     ;;; Assert that Call is to a function of the specified Type. It is assumed
219     ;;; that the call is legal and has only constants in the keyword positions.
220     ;;;
221     (defun assert-call-type (call type)
222     (declare (type combination call) (type function-type type))
223     (derive-node-type call (function-type-returns type))
224     (let ((args (combination-args call)))
225     (dolist (req (function-type-required type))
226     (when (null args) (return-from assert-call-type))
227     (let ((arg (pop args)))
228     (assert-continuation-type arg req)))
229     (dolist (opt (function-type-optional type))
230     (when (null args) (return-from assert-call-type))
231     (let ((arg (pop args)))
232     (assert-continuation-type arg opt)))
233    
234     (let ((rest (function-type-rest type)))
235     (when rest
236     (dolist (arg args)
237     (assert-continuation-type arg rest))))
238    
239     (dolist (key (function-type-keywords type))
240     (let ((name (key-info-name key)))
241     (do ((arg args (cddr arg)))
242     ((null arg))
243     (when (eq (continuation-value (first arg)) name)
244     (assert-continuation-type
245     (second arg) (key-info-type key)))))))
246     (undefined-value))
247    
248    
249     ;;; IR1-Optimize -- Interface
250     ;;;
251     ;;; Do one forward pass over Component, deleting unreachable blocks and
252 ram 1.11 ;;; doing IR1 optimizations. We can ignore all blocks that don't have the
253     ;;; Reoptimize flag set. If Component-Reoptimize is true when we are done,
254 wlott 1.1 ;;; then another iteration would be beneficial.
255     ;;;
256     ;;; We delete blocks when there is either no predecessor or the block is in
257     ;;; a lambda that has been deleted. These blocks would eventually be deleted
258     ;;; by DFO recomputation, but doing it here immediately makes the effect
259     ;;; avaliable to IR1 optimization.
260     ;;;
261     (defun ir1-optimize (component)
262     (declare (type component component))
263     (setf (component-reoptimize component) nil)
264     (do-blocks (block component)
265     (cond
266     ((or (block-delete-p block)
267     (null (block-pred block))
268 ram 1.11 (eq (functional-kind (block-home-lambda block)) :deleted))
269 wlott 1.1 (delete-block block))
270     (t
271     (loop
272     (let ((succ (block-succ block)))
273     (unless (and succ (null (rest succ)))
274     (return)))
275    
276     (let ((last (block-last block)))
277     (typecase last
278     (cif
279     (flush-dest (if-test last))
280     (when (unlink-node last) (return)))
281     (exit
282     (when (maybe-delete-exit last) (return)))))
283    
284     (unless (join-successor-if-possible block)
285     (return)))
286    
287 ram 1.11 (when (and (block-reoptimize block) (block-component block))
288 wlott 1.1 (assert (not (block-delete-p block)))
289     (ir1-optimize-block block))
290    
291 ram 1.11 (when (and (block-flush-p block) (block-component block))
292 wlott 1.1 (assert (not (block-delete-p block)))
293     (flush-dead-code block)))))
294    
295     (undefined-value))
296    
297    
298     ;;; IR1-Optimize-Block -- Internal
299     ;;;
300     ;;; Loop over the nodes in Block, looking for stuff that needs to be
301     ;;; optimized. We dispatch off of the type of each node with its reoptimize
302     ;;; flag set:
303     ;;; -- With a combination, we call Propagate-Function-Change whenever the
304     ;;; function changes, and call IR1-Optimize-Combination if any argument
305     ;;; changes.
306     ;;; -- With an Exit, we derive the node's type from the Value's type. We don't
307     ;;; propagate Cont's assertion to the Value, since if we did, this would
308     ;;; move the checking of Cont's assertion to the exit. This wouldn't work
309     ;;; with Catch and UWP, where the Exit node is just a placeholder for the
310     ;;; actual unknown exit.
311     ;;;
312     ;;; Note that we clear the node & block reoptimize flags *before* doing the
313     ;;; optimization. This ensures that the node or block will be reoptimized if
314     ;;; necessary. We leave the NODE-OPTIMIZE flag set doing into
315     ;;; IR1-OPTIMIZE-RETURN, since it wants to clear the flag itself.
316     ;;;
317     (defun ir1-optimize-block (block)
318     (declare (type cblock block))
319     (setf (block-reoptimize block) nil)
320     (do-nodes (node cont block)
321     (when (node-reoptimize node)
322     (setf (node-reoptimize node) nil)
323     (typecase node
324     (ref)
325     (combination
326     (when (continuation-reoptimize (basic-combination-fun node))
327     (propagate-function-change node))
328     (when (dolist (arg (basic-combination-args node) nil)
329     (when (and arg (continuation-reoptimize arg))
330     (return t)))
331     (ir1-optimize-combination node)))
332     (cif
333     (ir1-optimize-if node))
334     (creturn
335     (setf (node-reoptimize node) t)
336     (ir1-optimize-return node))
337 ram 1.6 (mv-combination
338     (when (and (eq (basic-combination-kind node) :local)
339     (continuation-reoptimize
340     (first (basic-combination-args node))))
341     (ir1-optimize-mv-bind node)))
342 wlott 1.1 (exit
343     (let ((value (exit-value node)))
344     (when value
345     (derive-node-type node (continuation-derived-type value)))))
346     (cset
347     (ir1-optimize-set node)))))
348     (undefined-value))
349    
350    
351     ;;; Join-Successor-If-Possible -- Internal
352     ;;;
353     ;;; We cannot combine with a successor block if:
354     ;;; 1] The successor has more than one predecessor.
355     ;;; 2] The last node's Cont is also used somewhere else.
356     ;;; 3] The successor is the current block (infinite loop).
357     ;;; 4] The next block has a different cleanup, and thus we may want to insert
358     ;;; cleanup code between the two blocks at some point.
359     ;;; 5] The next block has a different home lambda, and thus the control
360     ;;; transfer is a non-local exit.
361     ;;;
362     ;;; If we succeed, we return true, otherwise false.
363     ;;;
364     ;;; Joining is easy when the successor's Start continuation is the same from
365     ;;; our Last's Cont. If they differ, then we can still join when the last
366     ;;; continuation has no next and the next continuation has no uses. In this
367 ram 1.5 ;;; case, we replace the next continuation with the last before joining the
368 wlott 1.1 ;;; blocks.
369     ;;;
370     (defun join-successor-if-possible (block)
371     (declare (type cblock block))
372     (let ((next (first (block-succ block))))
373 ram 1.11 (when (block-start next)
374 wlott 1.1 (let* ((last (block-last block))
375     (last-cont (node-cont last))
376 ram 1.11 (next-cont (block-start next)))
377 wlott 1.1 (cond ((or (rest (block-pred next))
378 ram 1.5 (not (eq (continuation-use last-cont) last))
379 wlott 1.1 (eq next block)
380 ram 1.11 (not (eq (block-end-cleanup block)
381     (block-start-cleanup next)))
382     (not (eq (block-home-lambda block)
383     (block-home-lambda next))))
384 wlott 1.1 nil)
385 ram 1.5 ((eq last-cont next-cont)
386 wlott 1.1 (join-blocks block next)
387     t)
388 ram 1.5 ((and (null (block-start-uses next))
389     (eq (continuation-kind last-cont) :inside-block))
390     (let ((next-node (continuation-next next-cont)))
391     (assert (not (continuation-dest next-cont)))
392     (delete-continuation next-cont)
393     (setf (node-prev next-node) last-cont)
394     (setf (continuation-next last-cont) next-node)
395     (setf (block-start next) last-cont)
396     (join-blocks block next))
397 wlott 1.1 t)
398     (t
399     nil))))))
400    
401    
402     ;;; Join-Blocks -- Internal
403     ;;;
404     ;;; Join together two blocks which have the same ending/starting
405     ;;; continuation. The code in Block2 is moved into Block1 and Block2 is
406 ram 1.11 ;;; deleted from the DFO. We combine the optimize flags for the two blocks so
407     ;;; that any indicated optimization gets done.
408 wlott 1.1 ;;;
409     (defun join-blocks (block1 block2)
410     (declare (type cblock block1 block2))
411     (let* ((last (block-last block2))
412     (last-cont (node-cont last))
413     (succ (block-succ block2))
414     (start2 (block-start block2)))
415     (do ((cont start2 (node-cont (continuation-next cont))))
416     ((eq cont last-cont)
417     (when (eq (continuation-kind last-cont) :inside-block)
418     (setf (continuation-block last-cont) block1)))
419     (setf (continuation-block cont) block1))
420    
421     (unlink-blocks block1 block2)
422     (dolist (block succ)
423     (unlink-blocks block2 block)
424     (link-blocks block1 block))
425    
426     (setf (block-last block1) last)
427     (setf (continuation-kind start2) :inside-block))
428    
429 ram 1.11 (setf (block-flags block1)
430     (attributes-union (block-flags block1)
431     (block-flags block2)
432     (block-attributes type-asserted test-modified)))
433 wlott 1.1
434     (let ((next (block-next block2))
435     (prev (block-prev block2)))
436     (setf (block-next prev) next)
437     (setf (block-prev next) prev))
438    
439     (undefined-value))
440    
441    
442     ;;;; Local call return type propagation:
443    
444     ;;; Find-Result-Type -- Internal
445     ;;;
446     ;;; This function is called on RETURN nodes that have their REOPTIMIZE flag
447     ;;; set. It iterates over the uses of the RESULT, looking for interesting
448     ;;; stuff to update the TAIL-SET:
449     ;;; -- If a use is a local call, then we check that the called function has
450     ;;; the tail set Tails. If we encounter any different tail set, we return
451     ;;; the second value true.
452     ;;; -- If a use isn't a local call, then we union its type together with the
453     ;;; types of other such uses. We assign to the RETURN-RESULT-TYPE the
454     ;;; intersection of this type with the RESULT's asserted type. We can make
455     ;;; this intersection now (potentially before type checking) because this
456     ;;; assertion on the result will eventually be checked (if appropriate.)
457     ;;;
458     (defun find-result-type (node tails)
459     (declare (type creturn node))
460     (let ((result (return-result node))
461     (retry nil))
462     (collect ((use-union *empty-type* values-type-union))
463     (do-uses (use result)
464     (if (and (basic-combination-p use)
465     (eq (basic-combination-kind use) :local))
466     (when (merge-tail-sets use tails)
467     (setq retry t))
468     (use-union (node-derived-type use))))
469     (let ((int (values-type-intersection
470     (continuation-asserted-type result)
471     (use-union))))
472     (setf (return-result-type node) int)))
473     retry))
474    
475    
476     ;;; Merge-Tail-Sets -- Internal
477     ;;;
478     ;;; This function handles merging the tail sets if Call is a call to a
479     ;;; function with a different TAIL-SET than Ret-Set. We return true if we do
480     ;;; anything.
481     ;;;
482     ;;; It is assumed that Call sends its value to a RETURN node. We
483     ;;; destructively modify the set for the returning function to represent both,
484     ;;; and then change all the functions in callee's set to reference the first.
485     ;;;
486     ;;; If the called function has no tail set, then do nothing; if it doesn't
487     ;;; return, then it can't affect the callers value.
488     ;;;
489     (defun merge-tail-sets (call ret-set)
490     (declare (type basic-combination call) (type tail-set ret-set))
491     (let ((fun-set (lambda-tail-set (combination-lambda call))))
492     (when (and fun-set (not (eq ret-set fun-set)))
493     (let ((funs (tail-set-functions fun-set)))
494     (dolist (fun funs)
495     (setf (lambda-tail-set fun) ret-set))
496     (setf (tail-set-functions ret-set)
497     (nconc (tail-set-functions ret-set) funs)))
498     t)))
499    
500    
501     ;;; IR1-Optimize-Return -- Internal
502     ;;;
503     ;;; Do stuff to realize that something has changed about the value delivered
504     ;;; to a return node. Since we consider the return values of all functions in
505     ;;; the tail set to be equivalent, this amounts to bringing the entire tail set
506     ;;; up to date. We iterate over the returns for all the functions in the tail
507     ;;; set, reanalyzing them all (not treating Node specially.)
508     ;;;
509     ;;; During this iteration, we may discover new functions that should be
510     ;;; added to the tail set. If this happens, we restart the iteration over the
511     ;;; TAIL-SET-FUNCTIONS. Note that this really doesn't duplicate much work, as
512     ;;; we clear the NODE-REOPTIMIZE flags in the return nodes as we go, thus we
513     ;;; don't call FIND-RESULT-TYPE on any given return more than once.
514     ;;;
515     ;;; Restarting the iteration doesn't disturb the computation of the result
516     ;;; type RES, since we will just be adding more types to the union. (or when
517     ;;; we iterate over a return multiple times, unioning in the same type more
518     ;;; than once.)
519     ;;;
520     ;;; When we are done, we check if the new type is different from the old
521     ;;; TAIL-SET-TYPE. If so, we set the type and also reoptimize all the
522     ;;; continuations for references to functions in the tail set. This will
523     ;;; cause IR1-OPTIMIZE-COMBINATION to derive the new type as the results of the
524     ;;; calls.
525     ;;;
526     (defun ir1-optimize-return (node)
527     (declare (type creturn node))
528     (let ((tails (lambda-tail-set (return-lambda node))))
529     (collect ((res *empty-type* values-type-union))
530     (loop
531     (block RETRY
532     (let ((funs (tail-set-functions tails)))
533     (dolist (fun funs)
534     (let ((return (lambda-return fun)))
535     (when (node-reoptimize return)
536     (setf (node-reoptimize node) nil)
537     (when (find-result-type return tails) (return-from RETRY)))
538     (res (return-result-type return)))))
539     (return)))
540    
541     (when (type/= (res) (tail-set-type tails))
542     (setf (tail-set-type tails) (res))
543     (dolist (fun (tail-set-functions tails))
544     (dolist (ref (leaf-refs fun))
545     (reoptimize-continuation (node-cont ref)))))))
546    
547     (undefined-value))
548    
549    
550     ;;; IR1-Optimize-If -- Internal
551     ;;;
552     ;;; If the test has multiple uses, replicate the node when possible. Also
553     ;;; check if the predicate is known to be true or false, deleting the IF node
554     ;;; in favor of the appropriate branch when this is the case.
555     ;;;
556     (defun ir1-optimize-if (node)
557     (declare (type cif node))
558     (let ((test (if-test node))
559     (block (node-block node)))
560    
561     (when (and (eq (block-start block) test)
562     (eq (continuation-next test) node)
563     (rest (block-start-uses block)))
564     (do-uses (use test)
565     (when (immediately-used-p test use)
566     (convert-if-if use node)
567     (when (continuation-use test) (return)))))
568    
569     (let* ((type (continuation-type test))
570     (victim
571     (cond ((constant-continuation-p test)
572     (if (continuation-value test)
573     (if-alternative node)
574     (if-consequent node)))
575     ((not (types-intersect type *null-type*))
576     (if-alternative node))
577     ((type= type *null-type*)
578     (if-consequent node)))))
579     (when victim
580     (flush-dest test)
581     (when (rest (block-succ block))
582     (unlink-blocks block victim))
583     (setf (component-reanalyze (block-component (node-block node))) t)
584     (unlink-node node))))
585     (undefined-value))
586    
587    
588     ;;; Convert-If-If -- Internal
589     ;;;
590     ;;; Create a new copy of an IF Node that tests the value of the node Use.
591     ;;; The test must have >1 use, and must be immediately used by Use. Node must
592     ;;; be the only node in its block (implying that block-start = if-test).
593     ;;;
594     ;;; This optimization has an effect semantically similar to the
595     ;;; source-to-source transformation:
596     ;;; (IF (IF A B C) D E) ==>
597     ;;; (IF A (IF B D E) (IF C D E))
598     ;;;
599     (defun convert-if-if (use node)
600     (declare (type node use) (type cif node))
601     (with-ir1-environment node
602     (let* ((block (node-block node))
603     (test (if-test node))
604     (cblock (if-consequent node))
605     (ablock (if-alternative node))
606     (use-block (node-block use))
607     (dummy-cont (make-continuation))
608     (new-cont (make-continuation))
609 ram 1.11 (new-node (make-if :test new-cont
610 wlott 1.1 :consequent cblock :alternative ablock))
611     (new-block (continuation-starts-block new-cont)))
612     (prev-link new-node new-cont)
613     (setf (continuation-dest new-cont) new-node)
614     (add-continuation-use new-node dummy-cont)
615     (setf (block-last new-block) new-node)
616    
617     (unlink-blocks use-block block)
618     (delete-continuation-use use)
619     (add-continuation-use use new-cont)
620     (link-blocks use-block new-block)
621    
622     (link-blocks new-block cblock)
623     (link-blocks new-block ablock)
624    
625     (reoptimize-continuation test)
626     (reoptimize-continuation new-cont)
627     (setf (component-reanalyze *current-component*) t)))
628     (undefined-value))
629    
630    
631     ;;;; Exit IR1 optimization:
632    
633     ;;; Maybe-Delete-Exit -- Interface
634     ;;;
635     ;;; This function attempts to delete an exit node, returning true if it
636     ;;; deletes the block as a consequence:
637     ;;; -- If the exit is degenerate (has no Entry), then we don't do anything,
638     ;;; since there is nothing to be done.
639     ;;; -- If the exit node and its Entry have the same home lambda then we know
640     ;;; the exit is local, and can delete the exit. We change uses of the
641     ;;; Exit-Value to be uses of the original continuation, then unlink the
642     ;;; node.
643     ;;; -- If there is no value (as in a GO), then we skip the value semantics.
644     ;;;
645     ;;; This function is also called by environment analysis, since it wants all
646     ;;; exits to be optimized even if normal optimization was omitted.
647     ;;;
648     (defun maybe-delete-exit (node)
649     (declare (type exit node))
650     (let ((value (exit-value node))
651     (entry (exit-entry node))
652     (cont (node-cont node)))
653     (when (and entry
654 ram 1.11 (eq (node-home-lambda node) (node-home-lambda entry)))
655     (setf (entry-exits entry) (delete node (entry-exits entry)))
656 wlott 1.1 (prog1
657     (unlink-node node)
658     (when value
659     (substitute-continuation-uses cont value))))))
660    
661    
662     ;;;; Combination IR1 optimization:
663    
664     ;;; Ir1-Optimize-Combination -- Internal
665     ;;;
666     ;;; Do IR1 optimizations on a Combination node.
667     ;;;
668     (proclaim '(function ir1-optimize-combination (combination) void))
669     (defun ir1-optimize-combination (node)
670     (let ((args (basic-combination-args node))
671     (kind (basic-combination-kind node)))
672     (case kind
673     (:local
674     (let ((fun (combination-lambda node)))
675     (if (eq (functional-kind fun) :let)
676     (propagate-let-args node fun)
677     (propagate-local-call-args node fun))))
678     (:full
679     (dolist (arg args)
680     (when arg
681     (setf (continuation-reoptimize arg) nil))))
682     (t
683     (dolist (arg args)
684     (when arg
685     (setf (continuation-reoptimize arg) nil)))
686    
687     (let ((attr (function-info-attributes kind)))
688     (when (and (ir1-attributep attr foldable)
689     (not (ir1-attributep attr call))
690     (every #'constant-continuation-p args)
691     (continuation-dest (node-cont node)))
692     (constant-fold-call node)
693     (return-from ir1-optimize-combination)))
694 ram 1.18
695 wlott 1.1 (let ((fun (function-info-derive-type kind)))
696     (when fun
697     (let ((res (funcall fun node)))
698     (when res
699     (derive-node-type node res)))))
700 ram 1.18
701 wlott 1.1 (let ((fun (function-info-optimizer kind)))
702     (unless (and fun (funcall fun node))
703     (dolist (x (function-info-transforms kind))
704 wlott 1.2 (unless (ir1-transform node (car x) (cdr x))
705     (return))))))))
706 wlott 1.1
707     (undefined-value))
708    
709    
710     ;;; Recognize-Known-Call -- Interface
711     ;;;
712     ;;; If Call is a call to a known function, mark it as such by setting the
713     ;;; Kind. In addition to a direct check for the function name in the table, we
714     ;;; also must check for slot accessors. If the function is a slot accessor,
715     ;;; then we set the combination kind to the function info of %Slot-Setter or
716     ;;; %Slot-Accessor, as appropriate.
717     ;;;
718     (defun recognize-known-call (call)
719     (declare (type combination call))
720     (let* ((fun (basic-combination-fun call))
721     (name (continuation-function-name fun)))
722     (when name
723     (let ((info (info function info name)))
724     (cond (info
725     (setf (basic-combination-kind call) info))
726     ((slot-accessor-p (ref-leaf (continuation-use fun)))
727     (setf (basic-combination-kind call)
728     (info function info
729     (if (consp name)
730     '%slot-setter
731     '%slot-accessor))))))))
732     (undefined-value))
733    
734    
735     ;;; Propagate-Function-Change -- Internal
736     ;;;
737     ;;; Called by Ir1-Optimize when the function for a call has changed.
738     ;;; If the call is to a functional, then we attempt to convert it to a local
739     ;;; call, otherwise we check the call for legality with respect to the new
740     ;;; type; if it is illegal, we mark the Ref as :Notline and punt.
741     ;;;
742     ;;; If we do have a good type for the call, we propagate type information from
743     ;;; the type to the arg and result continuations. If we discover that the call
744     ;;; is to a known global function, then we mark the combination as known.
745     ;;;
746     (defun propagate-function-change (call)
747     (declare (type combination call))
748     (let* ((fun (combination-fun call))
749     (use (continuation-use fun))
750     (type (continuation-derived-type fun))
751     (*compiler-error-context* call))
752     (setf (continuation-reoptimize fun) nil)
753     (cond ((or (not (ref-p use))
754     (eq (ref-inlinep use) :notinline)))
755     ((functional-p (ref-leaf use))
756     (let ((leaf (ref-leaf use)))
757     (cond ((eq (combination-kind call) :local)
758     (let ((tail-set (lambda-tail-set leaf)))
759     (when tail-set
760     (derive-node-type
761     call (tail-set-type tail-set)))))
762     ((not (eq (ref-inlinep use) :notinline))
763     (convert-call-if-possible use call)
764     (maybe-let-convert leaf)))))
765     ((not (function-type-p type)))
766     ((valid-function-use call type
767     :argument-test #'always-subtypep
768     :result-test #'always-subtypep
769     :error-function #'compiler-warning
770     :warning-function #'compiler-note)
771     (assert-call-type call type)
772     (recognize-known-call call))
773     (t
774     (setf (ref-inlinep use) :notinline))))
775    
776     (undefined-value))
777    
778    
779     ;;;; Known function optimization:
780    
781 ram 1.15 ;;;
782     ;;; A hashtable from combination nodes to things describing how an
783     ;;; optimization of the node failed. The value is an alist
784     ;;; (Fun . Args), where Fun is the transformation function that failed and Args
785     ;;; is either a list for format arguments for the note or the FUNCTION-TYPE
786     ;;; that would have enabled the transformation but failed to match.
787     ;;;
788     (defvar *failed-optimizations* (make-hash-table :test #'eq))
789    
790    
791     ;;; RECORD-OPTIMIZATION-FAILURE -- Internal
792     ;;;
793     ;;; Add a failed optimization note to *FAILED-OPTIMZATIONS* for Node, Fun
794     ;;; and Args. If there is already a note for Node and Fun, replace it,
795     ;;; otherwise add a new one.
796     ;;;
797     (defun record-optimization-failure (node fun args)
798     (declare (type combination node) (type function fun)
799     (type (or function-type list) args))
800     (let ((found (assoc fun (gethash node *failed-optimizations*))))
801     (if found
802     (setf (cdr found) args)
803     (push (cons fun args)
804     (gethash node *failed-optimizations*))))
805     (undefined-value))
806    
807    
808 wlott 1.1 ;;; IR1-Transform -- Internal
809     ;;;
810     ;;; Attempt to transform Node using Function, subject to the call type
811     ;;; constraint Type. If we are inhibited from doing the transform for some
812     ;;; reason and Flame is true, then we make a note of the message in
813 wlott 1.2 ;;; *failed-optimizations* for IR1 finalize to pick up. We return true if
814     ;;; the transform failed, and thus further transformation should be
815     ;;; attempted. We return false if either the transform suceeded or was
816     ;;; aborted.
817 wlott 1.1 ;;;
818     (defun ir1-transform (node type fun)
819 wlott 1.2 (declare (type combination node) (type ctype type) (type function fun))
820 wlott 1.1 (let ((constrained (function-type-p type))
821     (flame (policy node (> speed brevity)))
822     (*compiler-error-context* node))
823     (cond ((or (not constrained)
824     (valid-function-use node type))
825     (multiple-value-bind
826     (severity args)
827     (catch 'give-up
828     (transform-call node (funcall fun node))
829     (values :none nil))
830     (ecase severity
831 ram 1.15 (:none
832     (remhash node *failed-optimizations*)
833     nil)
834 wlott 1.1 (:aborted
835     (setf (combination-kind node) :full)
836     (setf (ref-inlinep (continuation-use (combination-fun node)))
837     :notinline)
838     (when args
839 wlott 1.2 (apply #'compiler-warning args))
840 ram 1.15 (remhash node *failed-optimizations*)
841 wlott 1.2 nil)
842 wlott 1.1 (:failure
843 ram 1.15 (if args
844     (when flame
845     (record-optimization-failure node fun args))
846     (setf (gethash node *failed-optimizations*)
847     (remove fun (gethash node *failed-optimizations*)
848     :key #'car)))
849 wlott 1.2 t))))
850 wlott 1.1 ((and flame
851     (valid-function-use node type
852     :argument-test #'types-intersect
853     :result-test #'values-types-intersect))
854 ram 1.15 (record-optimization-failure node fun type)
855 wlott 1.13 t)
856     (t
857 wlott 1.2 t))))
858 wlott 1.1
859    
860     ;;; GIVE-UP, ABORT-TRANSFORM -- Interface
861     ;;;
862     ;;; Just throw the severity and args...
863     ;;;
864     (proclaim '(function give-up (&rest t) nil))
865     (defun give-up (&rest args)
866     "This function is used to throw out of an IR1 transform, aborting this
867     attempt to transform the call, but admitting the possibility that this or
868     some other transform will later suceed. If arguments are supplied, they are
869     format arguments for an efficiency note."
870     (throw 'give-up (values :failure args)))
871     ;;;
872     (defun abort-transform (&rest args)
873     "This function is used to throw out of an IR1 transform and force a normal
874     call to the function at run time. No further optimizations will be
875     attempted."
876     (throw 'give-up (values :aborted args)))
877    
878    
879     ;;; Transform-Call -- Internal
880     ;;;
881     ;;; Take the lambda-expression Res, IR1 convert it in the proper
882     ;;; environment, and then install it as the function for the call Node. We do
883     ;;; local call analysis so that the new function is integrated into the control
884     ;;; flow. We set the Reanalyze flag in the component to cause the DFO to be
885     ;;; recomputed at soonest convenience.
886     ;;;
887     (defun transform-call (node res)
888     (declare (type combination node) (list res))
889     (with-ir1-environment node
890 ram 1.11 (let ((new-fun (ir1-convert-global-lambda res))
891 wlott 1.1 (ref (continuation-use (combination-fun node))))
892     (change-ref-leaf ref new-fun)
893     (setf (combination-kind node) :full)
894     (local-call-analyze *current-component*)))
895     (undefined-value))
896    
897    
898     ;;; Constant-Fold-Call -- Internal
899     ;;;
900     ;;; Replace a call to a foldable function of constant arguments with the
901     ;;; result of evaluating the form. We insert the resulting constant node after
902     ;;; the call, stealing the call's continuation. We give the call a
903     ;;; continuation with no Dest, which should cause it and its arguments to go
904     ;;; away. If there is an error during the evaluation, we give a warning and
905     ;;; leave the call alone, making the call a full call and marking it as
906     ;;; :notinline to make sure that it stays that way.
907     ;;;
908     ;;; For now, if the result is other than one value, we don't fold it.
909     ;;;
910     (defun constant-fold-call (call)
911     (declare (type combination call))
912     (let* ((args (mapcar #'continuation-value (combination-args call)))
913     (ref (continuation-use (combination-fun call)))
914     (fun (leaf-name (ref-leaf ref))))
915    
916     (multiple-value-bind (values win)
917     (careful-call fun args call "constant folding")
918     (cond
919     ((not win)
920     (setf (ref-inlinep ref) :notinline)
921     (setf (combination-kind call) :full))
922     ((= (length values) 1)
923     (with-ir1-environment call
924     (let* ((leaf (find-constant (first values)))
925     (node (make-ref (leaf-type leaf)
926     leaf
927     nil))
928     (dummy (make-continuation))
929     (cont (node-cont call))
930     (block (node-block call))
931     (next (continuation-next cont)))
932     (push node (leaf-refs leaf))
933     (setf (leaf-ever-used leaf) t)
934    
935     (delete-continuation-use call)
936     (add-continuation-use call dummy)
937     (prev-link node dummy)
938     (add-continuation-use node cont)
939     (setf (continuation-next cont) next)
940     (when (eq call (block-last block))
941     (setf (block-last block) node))
942     (reoptimize-continuation cont)))))))
943    
944     (undefined-value))
945    
946    
947     ;;;; Local call optimization:
948    
949     ;;; Propagate-To-Refs -- Internal
950     ;;;
951     ;;; Propagate Type to Leaf and its Refs, marking things changed. If the
952     ;;; leaf type is a function type, then just leave it alone, since TYPE is never
953     ;;; going to be more specific than that (and TYPE-INTERSECTION would choke.)
954     ;;;
955     (defun propagate-to-refs (leaf type)
956     (declare (type leaf leaf) (type ctype type))
957     (let ((var-type (leaf-type leaf)))
958     (unless (function-type-p var-type)
959     (let ((int (type-intersection var-type type)))
960     (when (type/= int var-type)
961     (setf (leaf-type leaf) int)
962     (dolist (ref (leaf-refs leaf))
963     (derive-node-type ref int))))
964     (undefined-value))))
965    
966    
967     ;;; PROPAGATE-FROM-SETS -- Internal
968     ;;;
969     ;;; Figure out the type of a LET variable that has sets. We compute the
970     ;;; union of the initial value Type and the types of all the set values and to
971     ;;; a PROPAGATE-TO-REFS with this type.
972     ;;;
973     (defun propagate-from-sets (var type)
974 ram 1.6 (collect ((res type type-union))
975 wlott 1.1 (dolist (set (basic-var-sets var))
976     (res (continuation-type (set-value set)))
977     (setf (node-reoptimize set) nil))
978     (propagate-to-refs var (res)))
979     (undefined-value))
980    
981    
982     ;;; IR1-OPTIMIZE-SET -- Internal
983     ;;;
984     ;;; If a let variable, find the initial value's type and do
985     ;;; PROPAGATE-FROM-SETS. We also derive the VALUE's type as the node's type.
986     ;;;
987     (defun ir1-optimize-set (node)
988     (declare (type cset node))
989     (let ((var (set-var node)))
990     (when (and (lambda-var-p var) (leaf-refs var))
991     (let ((home (lambda-var-home var)))
992     (when (eq (functional-kind home) :let)
993     (let ((iv (let-var-initial-value var)))
994     (setf (continuation-reoptimize iv) nil)
995     (propagate-from-sets var (continuation-type iv)))))))
996    
997     (derive-node-type node (continuation-type (set-value node)))
998     (undefined-value))
999    
1000    
1001 ram 1.17 ;;; CONSTANT-REFERENCE-P -- Interface
1002 ram 1.7 ;;;
1003     ;;; Return true if the value of Ref will always be the same (and is thus
1004     ;;; legal to substitute.)
1005     ;;;
1006     (defun constant-reference-p (ref)
1007     (declare (type ref ref))
1008     (let ((leaf (ref-leaf ref)))
1009     (typecase leaf
1010     (constant t)
1011     (functional t)
1012     (lambda-var
1013     (null (lambda-var-sets leaf)))
1014     (global-var
1015     (case (global-var-kind leaf)
1016     (:global-function
1017     (not (eq (ref-inlinep ref) :notinline)))
1018     (:constant t))))))
1019    
1020    
1021     ;;; SUBSTITUTE-SINGLE-USE-CONTINUATION -- Internal
1022     ;;;
1023     ;;; If we have a non-set let var with a single use, then (if possible)
1024     ;;; replace the variable reference's CONT with the arg continuation. This is
1025     ;;; inhibited when:
1026     ;;; -- CONT has other uses, or
1027     ;;; -- CONT receives multiple values, or
1028 ram 1.9 ;;; -- the reference is in a different environment from the variable, or
1029     ;;; -- either continuation has a funky TYPE-CHECK annotation.
1030 ram 1.7 ;;;
1031     ;;; We change the Ref to be a reference to NIL with unused value, and let it
1032     ;;; be flushed as dead code. A side-effect of this substitution is to delete
1033     ;;; the variable.
1034     ;;;
1035     (defun substitute-single-use-continuation (arg var)
1036     (declare (type continuation arg) (type lambda-var var))
1037     (let* ((ref (first (leaf-refs var)))
1038     (cont (node-cont ref))
1039     (dest (continuation-dest cont)))
1040     (when (and (eq (continuation-use cont) ref)
1041     dest
1042     (not (typep dest '(or creturn exit mv-combination)))
1043 ram 1.11 (eq (node-home-lambda ref)
1044 ram 1.9 (lambda-home (lambda-var-home var)))
1045     (member (continuation-type-check arg) '(t nil))
1046     (member (continuation-type-check cont) '(t nil)))
1047 ram 1.7 (assert-continuation-type arg (continuation-asserted-type cont))
1048     (change-ref-leaf ref (find-constant nil))
1049     (substitute-continuation arg cont)
1050     (reoptimize-continuation arg)
1051     t)))
1052    
1053    
1054 wlott 1.1 ;;; Propagate-Let-Args -- Internal
1055     ;;;
1056     ;;; This function is called when one of the arguments to a LET changes. We
1057     ;;; look at each changed argument. If the corresponding variable is set, then
1058     ;;; we call PROPAGATE-FROM-SETS. Otherwise, we consider substituting for the
1059     ;;; variable, and also propagate derived-type information for the arg to all
1060     ;;; the Var's refs.
1061     ;;;
1062 ram 1.16 ;;; Substitution is inhibited when the arg leaf's derived type isn't a
1063     ;;; subtype of the argument's asserted type. This prevents type checking from
1064     ;;; being defeated, and also ensures that the best representation for the
1065     ;;; variable can be used.
1066 wlott 1.1 ;;;
1067     ;;; Note that we are responsible for clearing the Continuation-Reoptimize
1068     ;;; flags.
1069     ;;;
1070     (defun propagate-let-args (call fun)
1071     (declare (type combination call) (type clambda fun))
1072     (mapc #'(lambda (arg var)
1073     (when (and arg
1074     (continuation-reoptimize arg))
1075     (setf (continuation-reoptimize arg) nil)
1076     (cond
1077     ((lambda-var-sets var)
1078     (propagate-from-sets var (continuation-type arg)))
1079 ram 1.7 ((let ((use (continuation-use arg)))
1080 wlott 1.1 (when (ref-p use)
1081     (let ((leaf (ref-leaf use)))
1082 ram 1.7 (when (and (constant-reference-p use)
1083 wlott 1.1 (values-subtypep
1084 ram 1.16 (leaf-type leaf)
1085 wlott 1.1 (continuation-asserted-type arg)))
1086 ram 1.12 (propagate-to-refs var (continuation-type arg))
1087 ram 1.7 (substitute-leaf leaf var)
1088     t)))))
1089     ((and (null (rest (leaf-refs var)))
1090     (substitute-single-use-continuation arg var)))
1091     (t
1092 wlott 1.1 (propagate-to-refs var (continuation-type arg))))))
1093     (basic-combination-args call)
1094     (lambda-vars fun))
1095     (undefined-value))
1096    
1097    
1098     ;;; Propagate-Local-Call-Args -- Internal
1099     ;;;
1100     ;;; This function is called when one of the args to a non-let local call
1101     ;;; changes. For each changed argument corresponding to an unset variable, we
1102     ;;; compute the union of the types across all calls and propagate this type
1103     ;;; information to the var's refs.
1104     ;;;
1105     ;;; If the function has an XEP, then we don't do anything, since we won't
1106     ;;; discover anything.
1107     ;;;
1108     ;;; We can clear the Continuation-Reoptimize flags for arguments in all calls
1109     ;;; corresponding to changed arguments in Call, since the only use in IR1
1110     ;;; optimization of the Reoptimize flag for local call args is right here.
1111     ;;;
1112     (defun propagate-local-call-args (call fun)
1113     (declare (type combination call) (type clambda fun))
1114    
1115     (unless (functional-entry-function fun)
1116     (let* ((vars (lambda-vars fun))
1117     (union (mapcar #'(lambda (arg var)
1118     (when (and arg
1119     (continuation-reoptimize arg)
1120     (null (basic-var-sets var)))
1121     (continuation-type arg)))
1122     (basic-combination-args call)
1123     vars))
1124     (this-ref (continuation-use (basic-combination-fun call))))
1125    
1126     (dolist (arg (basic-combination-args call))
1127     (when arg
1128     (setf (continuation-reoptimize arg) nil)))
1129    
1130     (dolist (ref (leaf-refs fun))
1131     (unless (eq ref this-ref)
1132     (setq union
1133     (mapcar #'(lambda (this-arg old)
1134     (when old
1135     (setf (continuation-reoptimize this-arg) nil)
1136     (type-union (continuation-type this-arg) old)))
1137     (basic-combination-args
1138     (continuation-dest (node-cont ref)))
1139     union))))
1140    
1141     (mapc #'(lambda (var type)
1142     (when type
1143     (propagate-to-refs var type)))
1144     vars union)))
1145    
1146 ram 1.6 (undefined-value))
1147    
1148    
1149     ;;; IR1-OPTIMIZE-MV-BIND -- Internal
1150     ;;;
1151     ;;; Propagate derived type info from the values continuation to the vars.
1152     ;;;
1153     (defun ir1-optimize-mv-bind (node)
1154     (declare (type mv-combination node))
1155     (let ((arg (first (basic-combination-args node)))
1156     (vars (lambda-vars (combination-lambda node))))
1157     (multiple-value-bind (types nvals)
1158     (values-types (continuation-derived-type arg))
1159     (unless (eq nvals :unknown)
1160     (mapc #'(lambda (var type)
1161     (if (basic-var-sets var)
1162     (propagate-from-sets var type)
1163     (propagate-to-refs var type)))
1164     vars
1165     (append types
1166     (make-list (max (- (length vars) nvals) 0)
1167     :initial-element *null-type*)))))
1168    
1169     (setf (continuation-reoptimize arg) nil))
1170 wlott 1.1 (undefined-value))
1171    
1172    
1173     ;;; Flush-Dead-Code -- Internal
1174     ;;;
1175     ;;; Delete any nodes in Block whose value is unused and have no
1176     ;;; side-effects. We can delete sets of lexical variables when the set
1177     ;;; variable has no references.
1178     ;;;
1179     ;;; [### For now, don't delete potentially flushable calls when they have the
1180     ;;; Call attribute. Someday we should look at the funcitonal args to determine
1181     ;;; if they have any side-effects.]
1182     ;;;
1183     (defun flush-dead-code (block)
1184     (declare (type cblock block))
1185     (do-nodes-backwards (node cont block)
1186     (unless (continuation-dest cont)
1187     (typecase node
1188     (ref
1189     (delete-ref node)
1190     (unlink-node node))
1191     (combination
1192     (let ((info (combination-kind node)))
1193     (when (function-info-p info)
1194     (let ((attr (function-info-attributes info)))
1195     (when (and (ir1-attributep attr flushable)
1196     (not (ir1-attributep attr call)))
1197     (flush-dest (combination-fun node))
1198     (dolist (arg (combination-args node))
1199     (flush-dest arg))
1200     (unlink-node node))))))
1201     (exit
1202     (let ((value (exit-value node)))
1203     (when value
1204     (flush-dest value)
1205     (setf (exit-value node) nil))))
1206     (cset
1207     (let ((var (set-var node)))
1208     (when (and (lambda-var-p var)
1209     (null (leaf-refs var)))
1210     (flush-dest (set-value node))
1211     (setf (basic-var-sets var)
1212     (delete node (basic-var-sets var)))
1213     (unlink-node node)))))))
1214    
1215     (setf (block-flush-p block) nil)
1216     (undefined-value))

  ViewVC Help
Powered by ViewVC 1.1.5