(length expressions)
'() false false)))
(make-scfg (cfg-entry-node scfg) '()))
- (with-values
- (lambda ()
- (generate-continuation-entry
- (combination/context combination)))
- (lambda (label setup cleanup)
- (scfg-append!
- (generate-primitive primitive-name
- (length expressions)
- expressions setup label)
- cleanup
- (if error-finish
- (let ((temporary (rtl:make-pseudo-register)))
- (scfg*scfg->scfg!
- (rtl:make-assignment
- temporary
- (rtl:make-fetch register:value))
- (error-finish (rtl:make-fetch temporary))))
- (make-null-cfg)))
- #|
- ;; This code is preferable to the above
- ;; expression in some circumstances. It
- ;; creates a continuation, but the continuation
- ;; is left dangling instead of being hooked
- ;; back into the subsequent code. This avoids
- ;; a merge in the RTL and allows the CSE to do
- ;; a better job -- but the cost is that it
- ;; creates a continuation that, if invoked, has
- ;; unpredictable behavior.
- (let ((scfg
- (scfg*scfg->scfg!
- (generate-primitive primitive-name
- (length expressions)
- expressions setup label)
- cleanup)))
- (make-scfg (cfg-entry-node scfg) '()))
- |#
- )))))
+ (let ((temporary (rtl:make-pseudo-register)))
+ (with-values
+ (lambda ()
+ (generate-continuation-entry
+ (combination/context combination)
+ (rtl:make-assignment
+ temporary
+ (rtl:make-fetch register:value))))
+ (lambda (label setup cleanup)
+ (scfg-append!
+ (generate-primitive primitive-name
+ (length expressions)
+ expressions setup label)
+ cleanup
+ (if error-finish
+ (error-finish (rtl:make-fetch temporary))
+ (make-null-cfg)))
+ #|
+ ;; This code is preferable to the above
+ ;; expression in some circumstances. It
+ ;; creates a continuation, but the continuation
+ ;; is left dangling instead of being hooked
+ ;; back into the subsequent code. This avoids
+ ;; a merge in the RTL and allows the CSE to do
+ ;; a better job -- but the cost is that it
+ ;; creates a continuation that, if invoked, has
+ ;; unpredictable behavior.
+ (let ((scfg
+ (scfg*scfg->scfg!
+ (generate-primitive primitive-name
+ (length expressions)
+ expressions setup label)
+ cleanup)))
+ (make-scfg (cfg-entry-node scfg) '()))
+ |#
+ ))))))
(let loop ((checks checks))
(if (null? checks)
non-error-cfg
(let ((scfg (generate-primitive generic-op (length expressions) '()
false false)))
(make-scfg (cfg-entry-node scfg) '()))
- (with-values
- (lambda ()
- (generate-continuation-entry (combination/context combination)))
- (lambda (label setup cleanup)
- (scfg-append!
- (generate-primitive generic-op (length expressions)
- expressions setup label)
- cleanup
- (let ((temporary (rtl:make-pseudo-register)))
- (scfg*scfg->scfg!
- (rtl:make-assignment temporary (rtl:make-fetch register:value))
- (if predicate?
- (finish (rtl:make-true-test (rtl:make-fetch temporary)))
- (expression-simplify-for-statement
- (rtl:make-fetch temporary)
- finish))))))))))
+ (let* ((temporary (rtl:make-pseudo-register))
+ (preamble
+ (rtl:make-assignment temporary
+ (rtl:make-fetch register:value))))
+ (with-values
+ (lambda ()
+ (generate-continuation-entry (combination/context combination)
+ preamble))
+ (lambda (label setup cleanup)
+ (scfg-append!
+ (generate-primitive generic-op (length expressions)
+ expressions setup label)
+ cleanup
+ (if predicate?
+ (finish (rtl:make-true-test (rtl:make-fetch temporary)))
+ (expression-simplify-for-statement
+ (rtl:make-fetch temporary)
+ finish)))))))))
(define (generic->fixnum-op generic-op)
(case generic-op
(lambda (expression)
(wrap-with-continuation-entry
context
+ (make-null-cfg)
(lambda (cont-label)
(rtl:make-interpreter-call:set!
cont-label
(find-variable/value context lvalue
expression-value/simple
(lambda (environment name)
- (expression-value/temporary
- (load-temporary-register scfg*scfg->scfg! environment
- (lambda (environment)
- (wrap-with-continuation-entry
- context
- (lambda (cont-label)
- (rtl:make-interpreter-call:lookup
- cont-label
- environment
- (intern-scode-variable!
- (reference-context/block context)
- name)
- safe?)))))
- (rtl:interpreter-call-result:lookup)))
+ (let ((temporary (rtl:make-pseudo-register)))
+ (expression-value/temporary
+ (load-temporary-register scfg*scfg->scfg! environment
+ (lambda (environment)
+ (wrap-with-continuation-entry
+ context
+ (rtl:make-assignment
+ temporary
+ (rtl:interpreter-call-result:lookup))
+ (lambda (cont-label)
+ (rtl:make-interpreter-call:lookup
+ cont-label
+ environment
+ (intern-scode-variable!
+ (reference-context/block context)
+ name)
+ safe?)))))
+ (rtl:make-fetch temporary))))
(lambda (name)
(if (memq 'IGNORE-REFERENCE-TRAPS
(variable-declarations lvalue))
(values
(load-temporary-register scfg*scfg->scfg! (rtl:make-variable-cache name)
(lambda (cell)
- (let ((reference (rtl:make-fetch cell)))
+ (let ((reference (rtl:make-fetch cell))
+ (temporary (rtl:make-pseudo-register)))
(let ((n2 (rtl:make-type-test (rtl:make-object->type reference)
(ucode-type reference-trap)))
(n3 (rtl:make-assignment result reference))
(n4
(wrap-with-continuation-entry
context
+ (rtl:make-assignment
+ temporary
+ (rtl:interpreter-call-result:cache-reference))
(lambda (cont-label)
(rtl:make-interpreter-call:cache-reference
cont-label cell safe?))))
(n5
- (rtl:make-assignment
- result
- (rtl:interpreter-call-result:cache-reference))))
+ (rtl:make-assignment result (rtl:make-fetch temporary))))
(pcfg-alternative-connect! n2 n3)
(scfg-next-connect! n4 n5)
(if safe?
(lambda (expression)
(wrap-with-continuation-entry
context
+ (make-null-cfg)
(lambda (cont-label)
(rtl:make-interpreter-call:set!
cont-label
(n5
(wrap-with-continuation-entry
context
+ (make-null-cfg)
(lambda (cont-label)
(rtl:make-interpreter-call:cache-assignment
cont-label cell value))))
(lambda (expression)
(wrap-with-continuation-entry
context
+ (make-null-cfg)
(lambda (cont-label)
(rtl:make-interpreter-call:define
cont-label
(find-variable/value context lvalue
rtl:make-unassigned-test
(lambda (environment name)
- (scfg*pcfg->pcfg!
- (load-temporary-register scfg*scfg->scfg! environment
- (lambda (environment)
- (wrap-with-continuation-entry
- context
- (lambda (cont-label)
- (rtl:make-interpreter-call:unassigned?
- cont-label
- environment
- name)))))
- (rtl:make-true-test
- (rtl:interpreter-call-result:unassigned?))))
+ (let ((temporary (rtl:make-pseudo-register)))
+ (scfg*pcfg->pcfg!
+ (load-temporary-register scfg*scfg->scfg! environment
+ (lambda (environment)
+ (wrap-with-continuation-entry
+ context
+ (rtl:make-assignment
+ temporary
+ (rtl:interpreter-call-result:unassigned?))
+ (lambda (cont-label)
+ (rtl:make-interpreter-call:unassigned?
+ cont-label
+ environment
+ name)))))
+ (rtl:make-true-test (rtl:make-fetch temporary)))))
(lambda (name)
(generate/cached-unassigned? context name)))
(generate/node consequent)
(load-temporary-register scfg*pcfg->pcfg!
(rtl:make-variable-cache name)
(lambda (cell)
- (let ((reference (rtl:make-fetch cell)))
+ (let ((reference (rtl:make-fetch cell))
+ (temporary (rtl:make-pseudo-register)))
(let ((n2 (rtl:make-type-test (rtl:make-object->type reference)
(ucode-type reference-trap)))
(n3 (rtl:make-unassigned-test reference))
(n4
(wrap-with-continuation-entry
context
+ (rtl:make-assignment
+ temporary
+ (rtl:interpreter-call-result:cache-unassigned?))
(lambda (cont-label)
(rtl:make-interpreter-call:cache-unassigned?
cont-label
cell))))
(n5
- (rtl:make-true-test
- (rtl:interpreter-call-result:cache-unassigned?))))
+ (rtl:make-true-test (rtl:make-fetch temporary))))
(pcfg-consequent-connect! n2 n3)
(pcfg-alternative-connect! n3 n4)
(scfg-next-connect! n4 n5)
(and (primitive-procedure? obj)
(special-primitive-handler obj)))))
-(define (wrap-with-continuation-entry context scfg-gen)
- (with-values (lambda () (generate-continuation-entry context))
+(define (wrap-with-continuation-entry context prefix scfg-gen)
+ (with-values (lambda () (generate-continuation-entry context prefix))
(lambda (label setup cleanup)
(scfg-append! setup
(scfg-gen label)
cleanup))))
-(define (generate-continuation-entry context)
+(define (generate-continuation-entry context prefix)
(let ((label (generate-label))
(closing-block (reference-context/block context)))
(let ((setup (push-continuation-extra closing-block))
(cleanup
- (scfg*scfg->scfg!
+ (scfg-append!
(rtl:make-continuation-entry label)
+ prefix
(pop-continuation-extra closing-block))))
(set! *extra-continuations*
(cons (make-rtl-continuation
(scode (syntax&integrate program '() env))
(expr (compile-scode scode))
(map1 (eval expr env)))
- (with-expected-failure
- (if (memq microcode-id/compiled-code-type '(i386 x86-64))
- expect-failure
- #!default)
- (lambda ()
- (assert-equal
- (bind-condition-handler (list condition-type:unassigned-variable)
- (lambda (condition)
- condition
- (use-value '()))
- (lambda ()
- (map1 - '(1 2 3))))
- '(-1 -2 -3)))))))
\ No newline at end of file
+ (assert-equal
+ (bind-condition-handler (list condition-type:unassigned-variable)
+ (lambda (condition)
+ condition
+ (use-value '()))
+ (lambda ()
+ (map1 - '(1 2 3))))
+ '(-1 -2 -3)))))