From ec0ec8e9706cc90d793e27e15ac863e83910a52b Mon Sep 17 00:00:00 2001 From: Dionna Amalie Glaze Date: Tue, 28 Jul 2020 00:03:06 -0700 Subject: [PATCH 1/2] s/comparing with with/comparing it with/ (#3314) Duplicated word in documentation. --- pkgs/racket-doc/scribblings/reference/stx-trans.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl b/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl index 04409e480a..176c1d5bc5 100644 --- a/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl +++ b/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl @@ -1013,7 +1013,7 @@ macro expansion in the current definition context. In a @tech{syntax transformer} that runs in a non-expression context and forces the expansion of subforms with @racket[local-expand], use @racket[syntax-local-identifier-as-binding] on an identifier from the -expansion before moving it into a binding position or comparing with +expansion before moving it into a binding position or comparing it with @racket[bound-identifier=?]. Otherwise, the results can be inconsistent with the way that @racket[define] works in the same definition context. From 89831c01f6f91fcc598d4990a74d2b29dfaca11c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 28 Jul 2020 12:43:39 -0600 Subject: [PATCH 2/2] bc: fix optimizer bug Fix inlining problem when inlining has been explicitly disabled. Closes #3309 --- .../tests/racket/optimize.rktl | 22 +++++++++++++++++++ racket/src/racket/src/optimize.c | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pkgs/racket-test-core/tests/racket/optimize.rktl b/pkgs/racket-test-core/tests/racket/optimize.rktl index fe8a0e9d9a..f192ffc78b 100644 --- a/pkgs/racket-test-core/tests/racket/optimize.rktl +++ b/pkgs/racket-test-core/tests/racket/optimize.rktl @@ -6619,6 +6619,28 @@ n)]) (lambda (x) (h x))))) +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Regression test related to single-use variables +;; and disabled inlining + +(parameterize ([compile-context-preservation-enabled #t] + [current-namespace (make-base-namespace)]) + (void + (compile + '(module m racket/base + (letrec ([f (lambda () 0)] + [g (let ([g2 + (lambda () + (let ([x (f)]) + (list (lambda () x) h)))]) + g2)] + [h (letrec ([loop + (lambda () + (let ([y (g)]) + (list y loop)))]) + loop)]) + h))))) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (report-errs) diff --git a/racket/src/racket/src/optimize.c b/racket/src/racket/src/optimize.c index a933a91fe7..8eb0199421 100644 --- a/racket/src/racket/src/optimize.c +++ b/racket/src/racket/src/optimize.c @@ -9622,7 +9622,7 @@ Scheme_Object *optimize_expr(Scheme_Object *expr, Optimize_Info *info, int conte int save_fuel = info->inline_fuel, save_no_types = info->no_types; int save_vclock, save_aclock, save_kclock, save_sclock; info->size -= 1; - info->inline_fuel = 0; /* no more inlining; o->expr was already optimized */ + info->inline_fuel = -1; /* no more inlining; o->expr was already optimized */ info->no_types = 1; /* cannot used inferred types, in case `val' inferred them */ save_vclock = info->vclock; /* allowed to move => no change to clocks */ save_aclock = info->aclock;