cs: mark some internal representations as sealed

This change makes a small but measurable difference for mpairs, at
least (about 5% on the mpair-intensive "lists.rkt" benchmark).
This commit is contained in:
Matthew Flatt 2019-12-30 08:15:23 -07:00
parent ce4ad668b6
commit af3c22dd11
10 changed files with 22 additions and 9 deletions

View File

@ -12,7 +12,7 @@
(define collection 'multi) (define collection 'multi)
(define version "7.5.0.15") (define version "7.5.0.16")
(define deps `("racket-lib" (define deps `("racket-lib"
["racket" #:version ,version])) ["racket" #:version ,version]))

View File

@ -1,6 +1,7 @@
(define-record-type keyword (define-record-type keyword
(fields symbol) (fields symbol)
(sealed #t)
(nongenerative #{keyword dhghafpy3v03qbye1a9lwf-0})) (nongenerative #{keyword dhghafpy3v03qbye1a9lwf-0}))
(define keywords (make-weak-eq-hashtable)) (define keywords (make-weak-eq-hashtable))

View File

@ -368,7 +368,8 @@
;; ---------------------------------------- ;; ----------------------------------------
(define-record-type (phantom-bytes create-phantom-bytes phantom-bytes?) (define-record-type (phantom-bytes create-phantom-bytes phantom-bytes?)
(fields pbv)) (fields pbv)
(sealed #t))
(define/who (make-phantom-bytes k) (define/who (make-phantom-bytes k)
(check who exact-nonnegative-integer? k) (check who exact-nonnegative-integer? k)

View File

@ -1,4 +1,7 @@
(define-record mpair (car cdr)) (define-record-type mpair
(fields (mutable car mpair-car set-mpair-car!)
(mutable cdr mpair-cdr set-mpair-cdr!))
(sealed #t))
(define (mcons a b) (define (mcons a b)
(make-mpair a b)) (make-mpair a b))

View File

@ -2,7 +2,9 @@
;; Continuation-mark key: ;; Continuation-mark key:
(define parameterization-key '#{parameterization n1kcvqw4c9hh8t3fi3659ci94-1}) (define parameterization-key '#{parameterization n1kcvqw4c9hh8t3fi3659ci94-1})
(define-record parameterization (ht)) (define-record-type parameterization
(fields ht)
(sealed #t))
(define empty-parameterization (make-parameterization empty-hasheq)) (define empty-parameterization (make-parameterization empty-hasheq))

View File

@ -140,7 +140,9 @@
;; ---------------------------------------- ;; ----------------------------------------
(define-record-type (inspector new-inspector inspector?) (fields parent)) (define-record-type (inspector new-inspector inspector?)
(fields parent)
(sealed #t))
(define root-inspector (new-inspector #f)) (define root-inspector (new-inspector #f))

View File

@ -4,7 +4,8 @@
(define-record-type (thread-cell create-thread-cell thread-cell?) (define-record-type (thread-cell create-thread-cell thread-cell?)
(fields default-value (fields default-value
preserved? preserved?
(mutable mutated?))) (mutable mutated?))
(sealed #t))
(define make-thread-cell (define make-thread-cell
(case-lambda (case-lambda

View File

@ -2,7 +2,9 @@
(define undefined '#{undefined bjjxts6iq4xqtw8kz4eb1jxbs-0}) (define undefined '#{undefined bjjxts6iq4xqtw8kz4eb1jxbs-0})
(define-record-type variable (fields (mutable val) name)) (define-record-type variable
(fields (mutable val) name)
(sealed #t))
(define (variable-set! var val) (define (variable-set! var val)
(variable-val-set! var val)) (variable-val-set! var val))

View File

@ -16,7 +16,8 @@
(define-thread-local late-will-executors-with-pending (make-eq-hashtable)) (define-thread-local late-will-executors-with-pending (make-eq-hashtable))
(define-record-type (will-executor create-will-executor will-executor?) (define-record-type (will-executor create-will-executor will-executor?)
(fields guardian will-stacks (mutable ready) notify keep?)) (fields guardian will-stacks (mutable ready) notify keep?)
(sealed #t))
(define (make-will-executor notify) (define (make-will-executor notify)
(create-will-executor the-will-guardian the-will-stacks '() notify #f)) (create-will-executor the-will-guardian the-will-stacks '() notify #f))

View File

@ -16,7 +16,7 @@
#define MZSCHEME_VERSION_X 7 #define MZSCHEME_VERSION_X 7
#define MZSCHEME_VERSION_Y 5 #define MZSCHEME_VERSION_Y 5
#define MZSCHEME_VERSION_Z 0 #define MZSCHEME_VERSION_Z 0
#define MZSCHEME_VERSION_W 15 #define MZSCHEME_VERSION_W 16
/* A level of indirection makes `#` work as needed: */ /* A level of indirection makes `#` work as needed: */
#define AS_a_STR_HELPER(x) #x #define AS_a_STR_HELPER(x) #x