optimizer: don't move expressions into a with-continuation-mark

... unless the optimizer can prove that the expression doesn't
inspect continuation marks.
This commit is contained in:
Matthew Flatt 2014-04-19 10:11:00 -06:00
parent 6112d337b3
commit a01b12e5ef
2 changed files with 16 additions and 1 deletions

View File

@ -2248,7 +2248,17 @@
(list (c? (c-q (c 1 2 3))))
5)))
(test-comp `(lambda (b)
(let ([v (unbox b)])
(with-continuation-mark 'x 'y (unbox v))))
`(lambda (b)
(with-continuation-mark 'x 'y (unbox (unbox b))))
#f)
(test-comp `(lambda (b)
(let ([v (box b)])
(with-continuation-mark 'x 'y (box v))))
`(lambda (b)
(with-continuation-mark 'x 'y (box (box b)))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check splitting of definitions

View File

@ -3252,6 +3252,11 @@ static Scheme_Object *optimize_wcm(Scheme_Object *o, Optimize_Info *info, int co
v = scheme_optimize_expr(wcm->val, info, 0);
/* The presence of a key can be detected by other expressions,
to increment vclock to prevent expressions incorrectly
moving under the mark: */
info->vclock++;
b = scheme_optimize_expr(wcm->body, info, scheme_optimize_tail_context(context));
if (omittable_key(k, info)