cs: use call-consuming-continuation-attachment
Use `call-consuming-continuation-attachment` to implement `with-continuation-marks`, because that avoids duplicating a set of checks when in tail position.
This commit is contained in:
parent
5bcf7eb19d
commit
72852c7b75
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
(define collection 'multi)
|
(define collection 'multi)
|
||||||
|
|
||||||
(define version "7.4.0.7")
|
(define version "7.4.0.8")
|
||||||
|
|
||||||
(define deps `("racket-lib"
|
(define deps `("racket-lib"
|
||||||
["racket" #:version ,version]))
|
["racket" #:version ,version]))
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
(check-defined '#%$record-cas!)
|
(check-defined '#%$record-cas!)
|
||||||
(check-defined 'eq-hashtable-try-atomic-cell)
|
(check-defined 'eq-hashtable-try-atomic-cell)
|
||||||
(check-defined 'hashtable-ref-cell)
|
(check-defined 'hashtable-ref-cell)
|
||||||
|
(check-defined 'call-consuming-continuation-attachment)
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,7 @@
|
||||||
(define jit-demand-on? (getenv "PLT_LINKLET_SHOW_JIT_DEMAND"))
|
(define jit-demand-on? (getenv "PLT_LINKLET_SHOW_JIT_DEMAND"))
|
||||||
(define known-on? (getenv "PLT_LINKLET_SHOW_KNOWN"))
|
(define known-on? (getenv "PLT_LINKLET_SHOW_KNOWN"))
|
||||||
(define cp0-on? (getenv "PLT_LINKLET_SHOW_CP0"))
|
(define cp0-on? (getenv "PLT_LINKLET_SHOW_CP0"))
|
||||||
|
(define assembly-on? (getenv "PLT_LINKLET_SHOW_ASSEMBLY"))
|
||||||
(define show-on? (or gensym-on?
|
(define show-on? (or gensym-on?
|
||||||
pre-jit-on?
|
pre-jit-on?
|
||||||
pre-lift-on?
|
pre-lift-on?
|
||||||
|
@ -179,6 +180,7 @@
|
||||||
jit-demand-on?
|
jit-demand-on?
|
||||||
known-on?
|
known-on?
|
||||||
cp0-on?
|
cp0-on?
|
||||||
|
assembly-on?
|
||||||
(getenv "PLT_LINKLET_SHOW")))
|
(getenv "PLT_LINKLET_SHOW")))
|
||||||
(define show
|
(define show
|
||||||
(case-lambda
|
(case-lambda
|
||||||
|
@ -207,7 +209,12 @@
|
||||||
;; that need to be managed correctly when swapping Racket
|
;; that need to be managed correctly when swapping Racket
|
||||||
;; engines/threads.
|
;; engines/threads.
|
||||||
(define (compile* e)
|
(define (compile* e)
|
||||||
(call-with-system-wind (lambda () (compile e))))
|
(call-with-system-wind (lambda ()
|
||||||
|
(if assembly-on?
|
||||||
|
(parameterize ([#%$assembly-output (#%current-output-port)])
|
||||||
|
(printf ";; assembly ---------------------\n")
|
||||||
|
(compile e))
|
||||||
|
(compile e)))))
|
||||||
(define (interpret* e)
|
(define (interpret* e)
|
||||||
(call-with-system-wind (lambda () (interpret e))))
|
(call-with-system-wind (lambda () (interpret e))))
|
||||||
(define (fasl-write* s o)
|
(define (fasl-write* s o)
|
||||||
|
|
|
@ -259,7 +259,7 @@
|
||||||
;; current metacontinuation frame is already empty, don't push more
|
;; current metacontinuation frame is already empty, don't push more
|
||||||
(assert-in-uninterrupted)
|
(assert-in-uninterrupted)
|
||||||
(assert-not-in-system-wind)
|
(assert-not-in-system-wind)
|
||||||
(call-with-current-continuation-attachment
|
(call-getting-continuation-attachment
|
||||||
'none
|
'none
|
||||||
(lambda (at)
|
(lambda (at)
|
||||||
(cond
|
(cond
|
||||||
|
@ -930,13 +930,15 @@
|
||||||
(define-syntax with-continuation-mark
|
(define-syntax with-continuation-mark
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
[(_ key val body)
|
[(_ key val body)
|
||||||
(call-with-current-continuation-attachment
|
(let* ([k key]
|
||||||
empty-mark-frame
|
[v val])
|
||||||
(lambda (a)
|
(call-consuming-continuation-attachment
|
||||||
(call-setting-continuation-attachment
|
empty-mark-frame
|
||||||
(mark-frame-update a key val)
|
(lambda (a)
|
||||||
(lambda ()
|
(call-setting-continuation-attachment
|
||||||
body))))]))
|
(mark-frame-update a k v)
|
||||||
|
(lambda ()
|
||||||
|
body)))))]))
|
||||||
|
|
||||||
;; Return a continuation that expects a thunk to resume. That way, we
|
;; Return a continuation that expects a thunk to resume. That way, we
|
||||||
;; can can an `(end-uninterrupted)` and check for breaks in the
|
;; can can an `(end-uninterrupted)` and check for breaks in the
|
||||||
|
@ -1030,14 +1032,14 @@
|
||||||
(define (elem+cache-strip t) (if (elem+cache? t) (elem+cache-elem t) t))
|
(define (elem+cache-strip t) (if (elem+cache? t) (elem+cache-elem t) t))
|
||||||
|
|
||||||
;; Export this form renamed to `call-with-immediate-continuation-mark`.
|
;; Export this form renamed to `call-with-immediate-continuation-mark`.
|
||||||
;; It's a macro to ensure that the underlying `call-with-current-continuation-attachment`
|
;; It's a macro to ensure that the underlying `call-getting-continuation-attachment`
|
||||||
;; is exposed.
|
;; is exposed.
|
||||||
(define-syntax (call-with-immediate-continuation-mark/inline stx)
|
(define-syntax (call-with-immediate-continuation-mark/inline stx)
|
||||||
(syntax-case stx (lambda)
|
(syntax-case stx (lambda)
|
||||||
[(_ key-expr proc-expr)
|
[(_ key-expr proc-expr)
|
||||||
#'(call-with-immediate-continuation-mark/inline key-expr proc-expr #f)]
|
#'(call-with-immediate-continuation-mark/inline key-expr proc-expr #f)]
|
||||||
[(_ key-expr (lambda (arg) body ...) default-v-expr)
|
[(_ key-expr (lambda (arg) body ...) default-v-expr)
|
||||||
#'(call-with-current-continuation-attachment
|
#'(call-getting-continuation-attachment
|
||||||
empty-mark-frame
|
empty-mark-frame
|
||||||
(lambda (a)
|
(lambda (a)
|
||||||
(let* ([key key-expr]
|
(let* ([key key-expr]
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define MZSCHEME_VERSION_X 7
|
#define MZSCHEME_VERSION_X 7
|
||||||
#define MZSCHEME_VERSION_Y 4
|
#define MZSCHEME_VERSION_Y 4
|
||||||
#define MZSCHEME_VERSION_Z 0
|
#define MZSCHEME_VERSION_Z 0
|
||||||
#define MZSCHEME_VERSION_W 7
|
#define MZSCHEME_VERSION_W 8
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user