fix bug in shifting of types during inlining

During inlining, the type information gathered in
code that was inside the lambda is copied to the outer
context. But the coordinates of the type information
were shifted in the wrong direction, so the type was
assigned to the wrong variable.

This bug is difficult to trigger, so the test is convoluted.

Merge to v6.4
This commit is contained in:
Gustavo Massaccesi 2016-01-04 14:30:37 -03:00
parent 0fb11e61e6
commit be82c27db3
2 changed files with 29 additions and 5 deletions

View File

@ -3629,6 +3629,30 @@
(set! f 0))
#f)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that the type information is shifted in the
;; right direction while inlining.
;; The first example triggered a bug in 6.3.
(test-comp '(let ([zz (lambda (x) (lambda (y) 0))])
(lambda (a b c)
((zz (let ([loop (lambda () 0)]) loop)) (car a))
(list c (pair? c))))
'(let ([zz (lambda (x) (lambda (y) 0))])
(lambda (a b c)
((zz (let ([loop (lambda () 0)]) loop)) (car a))
(list c #t)))
#f)
(test-comp '(let ([zz (lambda (x) (lambda (y) 0))])
(lambda (a b c)
((zz (let ([loop (lambda () 0)]) loop)) (car a))
(list a (pair? a))))
'(let ([zz (lambda (x) (lambda (y) 0))])
(lambda (a b c)
((zz (let ([loop (lambda () 0)]) loop)) (car a))
(list a #t))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that the unused continuations are removed
@ -4179,9 +4203,9 @@
(test-values '(-100001.0t0 100001.0t0) tail)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check for corect fixpoint calculation when lifting
;; Check for correct fixpoint calculation when lifting
;; This test is especilly fragile. It's a minimized(?) variant
;; This test is especially fragile. It's a minimized(?) variant
;; of PR 12910, where just enbought `with-continuation-mark's
;; are needed to thwart inlining, and enough functions are
;; present in the right order to require enough fixpoint

View File

@ -1959,7 +1959,7 @@ Scheme_Object *optimize_for_inline(Optimize_Info *info, Scheme_Object *le, int a
id_offset, orig_le, prev);
if (id_offset) {
optimize_info_done(sub_info, NULL);
merge_types(sub_info, info, id_offset);
merge_types(sub_info, info, -id_offset);
}
return le;
} else {
@ -5922,7 +5922,7 @@ scheme_optimize_lets(Scheme_Object *form, Optimize_Info *info, int for_inline, i
info->single_result = sub_info->single_result;
info->preserves_marks = sub_info->preserves_marks;
optimize_info_done(sub_info, NULL);
merge_types(sub_info, info, 1);
merge_types(sub_info, info, -1);
}
return form;
@ -5948,7 +5948,7 @@ scheme_optimize_lets(Scheme_Object *form, Optimize_Info *info, int for_inline, i
info->single_result = sub_info->single_result;
info->preserves_marks = sub_info->preserves_marks;
optimize_info_done(sub_info, NULL);
merge_types(sub_info, info, 1);
merge_types(sub_info, info, -1);
return body;
}
}