From aaee824f688fec3c6727ab5b9774451456bc684b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 16 Jul 2015 18:12:46 -0600 Subject: [PATCH] optimizer: fix coordinate shift when a `letrec` is split The combination of splitting a `letrec` and optimizing the resulting `(let ([x ]) x)` to just `` used a bad coordinate shift, which made property testing incorrect, etc. For reasons that are not clear, the new expander triggered the problem through an existing test. --- racket/src/racket/src/optimize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/racket/src/racket/src/optimize.c b/racket/src/racket/src/optimize.c index 0239a6f157..f1f9b1b560 100644 --- a/racket/src/racket/src/optimize.c +++ b/racket/src/racket/src/optimize.c @@ -6372,7 +6372,7 @@ scheme_optimize_lets(Scheme_Object *form, Optimize_Info *info, int for_inline, i && (((Scheme_Local *)clv->body)->position == 0)) { if (worth_lifting(clv->value)) { value = clv->value; - extract_depth = 1; + extract_depth = 1 + split_shift; } } } @@ -7500,7 +7500,7 @@ Scheme_Object *scheme_optimize_expr(Scheme_Object *expr, Optimize_Info *info, in delta = optimize_info_get_shift(info, pos); - if (!optimize_is_mutated(info, pos + delta)) { + if (!is_mutated) { Scheme_Object *pred; pred = optimize_get_predicate(pos + delta, info); @@ -8664,7 +8664,7 @@ Scheme_Object *optimize_get_predicate(int pos, Optimize_Info *info) pos -= info->new_frame; if (pos < 0) return NULL; - info = info->next; + info = info->next; } return NULL;