From 857950a2b2458d610a583393bb6027a59f76c97c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Jan 2015 12:58:51 -0700 Subject: [PATCH] fix prefix-use flags on a closure that ignores its captured prefix Optimization can cause a `lambda` that was going to refer to a top-level variable or syntax object to not refer to it after all. Ideally, the prefix should be dropped from the closure, but the change here is more conservative: it fixes the `lambda`s annotation that's used by the GC to indicate that nothing will be used from the prefix. --- racket/src/racket/src/resolve.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/racket/src/racket/src/resolve.c b/racket/src/racket/src/resolve.c index 440a711080..4c26880e62 100644 --- a/racket/src/racket/src/resolve.c +++ b/racket/src/racket/src/resolve.c @@ -2151,6 +2151,11 @@ resolve_closure_compilation(Scheme_Object *_data, Resolve_Info *info, + SCHEME_TAIL_COPY_THRESHOLD); data->tl_map = new_info->tl_map; + if (!data->tl_map && has_tl) { + /* Our reason to refer to the top level has apparently gone away; + record that we're not using anything */ + data->tl_map = (void *)0x1; + } /* Add code to box set!ed argument variables: */ for (i = 0; i < num_params; i++) {