From 79ccd514c3be9a5219c27beef2914ba10f30827b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 12 Dec 2020 10:30:40 -0700 Subject: [PATCH] Chez Scheme: allow some extra inlining of system primitives Cross-library inlining is willing to inline a procedure body that refers to a system primitive, but wasn't willing to propagate a system primitive directly. Enable that, and use it to simplify `unsafe-struct` inlining. Related to #3546 --- racket/src/ChezScheme/s/cp0.ss | 4 +++- racket/src/cs/rumble/struct.ss | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/racket/src/ChezScheme/s/cp0.ss b/racket/src/ChezScheme/s/cp0.ss index de67ee8e4a..4f1c8b1546 100644 --- a/racket/src/ChezScheme/s/cp0.ss +++ b/racket/src/ChezScheme/s/cp0.ss @@ -1979,7 +1979,9 @@ [,pr (context-case ctxt [(value tail) - (if (all-set? (prim-mask (or primitive proc)) (primref-flags pr)) + ;; formerly constrained to functions marked as `primitive`, + ;; which does not include `system` procedures: + (if (all-set? (prim-mask proc) (primref-flags pr)) rhs (residualize-ref maybe-src id sc))] [(test) diff --git a/racket/src/cs/rumble/struct.ss b/racket/src/cs/rumble/struct.ss index 984c4f4069..44c2b102e8 100644 --- a/racket/src/cs/rumble/struct.ss +++ b/racket/src/cs/rumble/struct.ss @@ -1079,8 +1079,8 @@ (define (unsafe-struct? v r) (#3%record? v r)) -(define (unsafe-struct r . args) - (#%apply #%$record r args)) +;; internal use only, so doesn't need to have 'unsafe-struct as it's name, etc.: +(define unsafe-struct #%$record) (define (unsafe-struct-ref s i) (if (impersonator? s)