fix propagation of "multiple result" flag when optimizing `begin0'
This commit is contained in:
parent
68dd17bf08
commit
25f142299b
|
@ -2450,6 +2450,17 @@
|
|||
[read-accept-compiled #t])
|
||||
(eval (read (open-input-bytes (get-output-bytes o2)))))
|
||||
exn:fail:read?))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; make sure `begin0' propertly propagates "multiple results" flags
|
||||
|
||||
(test '(1 2 3) (lambda ()
|
||||
(call-with-values
|
||||
(lambda () (begin0
|
||||
(values 1 2 3)
|
||||
(newline)))
|
||||
list)))
|
||||
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
|
|
@ -3318,7 +3318,7 @@ case_lambda_shift(Scheme_Object *data, int delta, int after_depth)
|
|||
static Scheme_Object *
|
||||
begin0_optimize(Scheme_Object *obj, Optimize_Info *info, int context)
|
||||
{
|
||||
int i, count, drop = 0, prev_size;
|
||||
int i, count, drop = 0, prev_size, single_result = 0;
|
||||
Scheme_Sequence *s = (Scheme_Sequence *)obj;
|
||||
Scheme_Object *le;
|
||||
|
||||
|
@ -3333,6 +3333,9 @@ begin0_optimize(Scheme_Object *obj, Optimize_Info *info, int context)
|
|||
? scheme_optimize_result_context(context)
|
||||
: 0));
|
||||
|
||||
if (!i)
|
||||
single_result = info->single_result;
|
||||
|
||||
/* Inlining and constant propagation can expose
|
||||
omittable expressions. */
|
||||
if (i && scheme_omittable_expr(le, -1, -1, 0, info, NULL, -1, 0)) {
|
||||
|
@ -3367,8 +3370,8 @@ begin0_optimize(Scheme_Object *obj, Optimize_Info *info, int context)
|
|||
obj = (Scheme_Object *)s2;
|
||||
}
|
||||
|
||||
/* Optimization of expression 0 has already set single_result */
|
||||
info->preserves_marks = 1;
|
||||
info->single_result = single_result;
|
||||
|
||||
info->size += 1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user