(case context
((tail) (emit-code src (make-glil-call 'goto/args len)))
((push) (emit-code src (make-glil-call 'call len)))
- ((drop) (emit-code src (make-glil-call 'call len))
- (emit-code src (make-glil-call 'drop 1))))))))
+ ((drop)
+ (let ((MV (make-label)))
+ (emit-code src (make-glil-mv-call len MV))
+ (emit-code #f (make-glil-const 1))
+ (emit-label MV)
+ (emit-code #f (make-glil-mv-bind '() #f))
+ (emit-code #f (make-glil-unbind)))))))))
((<conditional> src test then else)
;; TEST
(define (wrap thunk)
(lambda (continuation)
(with-exception-handler (lambda (obj)
- (apply (current-exception-handler) (list obj))
- (apply continuation (list)))
+ ((current-exception-handler) obj)
+ (continuation))
thunk)))
;; A pass-thru to cancel-thread that first installs a handler that throws
(define-module (test-suite test-srfi-18)
#:use-module (test-suite lib))
-(and (provided? 'threads)
- (use-modules (srfi srfi-18))
+;; two expressions so that the srfi-18 import is in effect for expansion
+;; of the rest
+(if (provided? 'threads)
+ (use-modules (srfi srfi-18)))
+
+(and
+ (provided? 'threads)
(with-test-prefix "current-thread"
(assert-tree-il->glil
(apply (toplevel foo) (const 1))
(program 0 0 0 0 () (toplevel ref foo) (const 1) (call goto/args 1)))
- (assert-tree-il->glil
+ (assert-tree-il->glil/pmatch
(begin (apply (toplevel foo) (const 1)) (void))
- (program 0 0 0 0 () (toplevel ref foo) (const 1) (call call 1)
- (call drop 1) (void) (call return 1)))
+ (program 0 0 0 0 () (toplevel ref foo) (const 1) (mv-call 1 ,l1)
+ (const 1) (label ,l2) (mv-bind () #f) (unbind)
+ (void) (call return 1))
+ (eq? l1 l2))
(assert-tree-il->glil
(apply (toplevel foo) (apply (toplevel bar)))
(program 0 0 0 0 () (toplevel ref foo) (toplevel ref bar) (call call 0)