cs: constant tokens

Instead of allocating tokens like `undefined` or `parameter-key`
with `gensym` on startup, allocate them once for all eternity.
This commit is contained in:
Matthew Flatt 2019-09-05 11:03:57 -06:00
parent 8284dfa1b1
commit 12a2cd75a8
6 changed files with 11 additions and 7 deletions

View File

@ -727,8 +727,9 @@
record-field-accessor
record-field-mutator))
(define/no-lift none (chez:gensym "none"))
(define/no-lift none2 (chez:gensym "none2")) ; never put this in an emphemeron
;; Internal tokens that are different from all possible user-level values:
(define/no-lift none '#{none kwcju864gpycc2h151s9atbmo-1})
(define/no-lift none2 '#{none kwcju864gpycc2h151s9atbmo-2}) ; never put this in an emphemeron
(include "rumble/define.ss")
(include "rumble/virtual-register.ss")

View File

@ -140,7 +140,7 @@
;; To support special treatment of break parameterizations, and also
;; to initialize disabled breaks for `dynamic-wind` pre and post
;; thunks:
(define break-enabled-key (gensym 'break-enabled))
(define break-enabled-key '#{break-enabled n1kcvqw4c9hh8t3fi3659ci94-2})
(define/who (continuation-prompt-available? tag)
(check who continuation-prompt-tag? tag)

View File

@ -195,7 +195,7 @@
;; continuation maps `key-equality-wrap-key` to a key-wrapping
;; function.
(define key-equality-wrap-key (gensym))
(define key-equality-wrap-key '#{equality n1kcvqw4c9hh8t3fi3659ci94-0})
;; Looking in the continaution is expensive relative to `equal?`, so
;; look in a box as a quick pre-test. Multiple threads may increment

View File

@ -1,6 +1,6 @@
;; Continuation-mark key:
(define parameterization-key (gensym "parameterization-key"))
(define parameterization-key '#{parameterization n1kcvqw4c9hh8t3fi3659ci94-1})
(define-record parameterization (ht))
@ -94,7 +94,7 @@
[()
(let ([c (or (parameter-cell data)
default-c)])
(thread-cell-ref c))]
(unsafe-thread-cell-ref c))]
[(v)
(let ([c (or (parameter-cell data)
default-c)])

View File

@ -11,6 +11,9 @@
(define/who (thread-cell-ref c)
(check who thread-cell? c)
(unsafe-thread-cell-ref c))
(define (unsafe-thread-cell-ref c)
(let* ([t (current-engine-thread-cell-values)]
[v (if t
(hashtable-ref t c none)

View File

@ -1,6 +1,6 @@
;; A "variable" is a linklet import or export
(define undefined (gensym "undefined"))
(define undefined '#{undefined bjjxts6iq4xqtw8kz4eb1jxbs-0})
(define-record-type variable (fields (mutable val) name))