- the source-level optimizer now optimizes (inlining,
constant-folding, etc.) across debug-calls.
This commit is contained in:
parent
b35f5a9e1d
commit
ae136274ed
|
@ -510,6 +510,30 @@
|
||||||
(map (lambda (x) (score-value-visit-operand! x sc))
|
(map (lambda (x) (score-value-visit-operand! x sc))
|
||||||
rand*)))))))
|
rand*)))))))
|
||||||
;;;
|
;;;
|
||||||
|
(define (E-debug-call ctxt ec sc)
|
||||||
|
(let ([rand* (app-rand* ctxt)])
|
||||||
|
(cond
|
||||||
|
[(< (length rand*) 2)
|
||||||
|
(decrement sc 1)
|
||||||
|
(make-primref 'debug-call)]
|
||||||
|
[else
|
||||||
|
(let ([src/expr (car rand*)]
|
||||||
|
[rator (cadr rand*)]
|
||||||
|
[rands (cddr rand*)])
|
||||||
|
(let ([ctxt2 (make-app rands (app-ctxt ctxt))])
|
||||||
|
(let ([rator (E (operand-expr rator)
|
||||||
|
ctxt2
|
||||||
|
(operand-env rator)
|
||||||
|
(operand-ec rator)
|
||||||
|
sc)])
|
||||||
|
(if (app-inlined ctxt2)
|
||||||
|
(begin
|
||||||
|
(set-app-inlined! ctxt #t)
|
||||||
|
(residualize-operands rator (cons src/expr rands) sc))
|
||||||
|
(begin
|
||||||
|
(decrement sc 1)
|
||||||
|
(make-primref 'debug-call))))))])))
|
||||||
|
;;;
|
||||||
(define (E-var x ctxt env ec sc)
|
(define (E-var x ctxt env ec sc)
|
||||||
(ctxt-case ctxt
|
(ctxt-case ctxt
|
||||||
[(e) (make-constant (void))]
|
[(e) (make-constant (void))]
|
||||||
|
@ -768,7 +792,10 @@
|
||||||
(make-forcall name (map (lambda (x) (E x 'v env ec sc)) rand*))]
|
(make-forcall name (map (lambda (x) (E x 'v env ec sc)) rand*))]
|
||||||
[(primref name)
|
[(primref name)
|
||||||
(ctxt-case ctxt
|
(ctxt-case ctxt
|
||||||
[(app) (fold-prim name ctxt ec sc)]
|
[(app)
|
||||||
|
(case name
|
||||||
|
[(debug-call) (E-debug-call ctxt ec sc)]
|
||||||
|
[else (fold-prim name ctxt ec sc)])]
|
||||||
[(v) (decrement sc 1) x]
|
[(v) (decrement sc 1) x]
|
||||||
[else (make-constant #t)])]
|
[else (make-constant #t)])]
|
||||||
[(clambda g cases cp free name)
|
[(clambda g cases cp free name)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1785
|
1786
|
||||||
|
|
Loading…
Reference in New Issue