mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 14:21:10 +02:00
Correctness fix for vector constructor inlining.
* module/language/tree-il/compile-cps.scm (convert): Don't inline the vector constructor if any arg could capture the current continuation.
This commit is contained in:
parent
be6e40a1df
commit
92afe25d5c
1 changed files with 15 additions and 4 deletions
|
@ -337,13 +337,24 @@
|
||||||
(convert (make-conditional src exp (make-const #f #t)
|
(convert (make-conditional src exp (make-const #f #t)
|
||||||
(make-const #f #f))
|
(make-const #f #f))
|
||||||
k subst))
|
k subst))
|
||||||
((eq? name 'vector)
|
((and (eq? name 'vector)
|
||||||
|
(and-map (match-lambda
|
||||||
|
((or ($ <const>)
|
||||||
|
($ <void>)
|
||||||
|
($ <lambda>)
|
||||||
|
($ <lexical-ref>)) #t)
|
||||||
|
(_ #f))
|
||||||
|
args))
|
||||||
;; Some macros generate calls to "vector" with like 300
|
;; Some macros generate calls to "vector" with like 300
|
||||||
;; arguments. Since we eventually compile to make-vector and
|
;; arguments. Since we eventually compile to make-vector and
|
||||||
;; vector-set!, it reduces live variable pressure to allocate the
|
;; vector-set!, it reduces live variable pressure to allocate the
|
||||||
;; vector first, then set values as they are produced. Normally
|
;; vector first, then set values as they are produced, if we can
|
||||||
;; we would do this transformation in the compiler, but it's
|
;; prove that no value can capture the continuation. (More on
|
||||||
;; quite tricky there and quite easy here, so hold your nose
|
;; that caveat here:
|
||||||
|
;; http://wingolog.org/archives/2013/11/02/scheme-quiz-time).
|
||||||
|
;;
|
||||||
|
;; Normally we would do this transformation in the compiler, but
|
||||||
|
;; it's quite tricky there and quite easy here, so hold your nose
|
||||||
;; while we drop some smelly code.
|
;; while we drop some smelly code.
|
||||||
(convert (let ((len (length args)))
|
(convert (let ((len (length args)))
|
||||||
(let-gensyms (v)
|
(let-gensyms (v)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue