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
This commit is contained in:
Matthew Flatt 2020-12-12 10:30:40 -07:00
parent e7cef677ad
commit 79ccd514c3
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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)