bc: fix optimizer bug
Local-variable type information was not properly removed from information threaded through optimization. Closes #3081
This commit is contained in:
parent
9222a135c3
commit
4a2cb6f577
|
@ -6589,6 +6589,22 @@
|
|||
(letrec ([recursion (f x)])
|
||||
(+ x y)))))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Regression test provided by @formalizm
|
||||
|
||||
(parameterize ([compile-context-preservation-enabled #t])
|
||||
(eval
|
||||
'(module raises-should-be-reached-error racket/base
|
||||
(define (return-false) #f)
|
||||
(define foo
|
||||
(let ([bar (return-false)])
|
||||
(if bar
|
||||
(string-append "bar: " bar)
|
||||
(error "bar is false, so this error is reached")))))))
|
||||
(err/rt-test/once (dynamic-require ''raises-should-be-reached-error #f)
|
||||
exn:fail?
|
||||
#rx"this error is reached")
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -5692,8 +5692,8 @@ static void merge_types(Optimize_Info *src_info, Optimize_Info *info, Scheme_Has
|
|||
/* Remove variables from `types` that we're supposed to skip */
|
||||
i = scheme_hash_tree_next(skip_vars, -1);
|
||||
while (i != -1) {
|
||||
scheme_hash_tree_index(types, i, &var, NULL);
|
||||
scheme_hash_tree_set(types, var, NULL);
|
||||
scheme_hash_tree_index(skip_vars, i, &var, NULL);
|
||||
types = scheme_hash_tree_set(types, var, NULL);
|
||||
i = scheme_hash_tree_next(skip_vars, i);
|
||||
}
|
||||
}
|
||||
|
@ -6135,7 +6135,7 @@ static Scheme_Object *optimize_branch(Scheme_Object *o, Optimize_Info *info, int
|
|||
info->single_result = 1;
|
||||
info->kclock = init_kclock;
|
||||
|
||||
} else if (info->escapes) {
|
||||
} else if (else_info->escapes) {
|
||||
info->preserves_marks = then_info->preserves_marks;
|
||||
info->single_result = then_info->single_result;
|
||||
info->kclock = then_info->kclock;
|
||||
|
@ -6143,10 +6143,10 @@ static Scheme_Object *optimize_branch(Scheme_Object *o, Optimize_Info *info, int
|
|||
info->escapes = 0;
|
||||
|
||||
} else if (then_info->escapes) {
|
||||
info->preserves_marks = else_info->preserves_marks;
|
||||
info->single_result = else_info->single_result;
|
||||
merge_types(else_info, info, NULL);
|
||||
info->escapes = 0;
|
||||
info->preserves_marks = else_info->preserves_marks;
|
||||
info->single_result = else_info->single_result;
|
||||
merge_types(else_info, info, NULL);
|
||||
info->escapes = 0;
|
||||
|
||||
} else {
|
||||
int new_preserves_marks, new_single_result;
|
||||
|
|
Loading…
Reference in New Issue
Block a user