Merge branch 'exception-handling-and-continuation'

This commit is contained in:
Yuichi Nishiwaki 2014-07-27 18:33:50 +09:00
commit 9e56142331
2 changed files with 33 additions and 33 deletions

View File

@ -495,14 +495,14 @@ vm_push_env(pic_state *pic)
} }
static void static void
vm_tear_off(pic_state *pic) vm_tear_off(pic_callinfo *ci)
{ {
struct pic_env *env; struct pic_env *env;
int i; int i;
assert(pic->ci->env != NULL); assert(ci->env != NULL);
env = pic->ci->env; env = ci->env;
if (env->regs == env->storage) { if (env->regs == env->storage) {
return; /* is torn off */ return; /* is torn off */
@ -519,8 +519,8 @@ pic_vm_tear_off(pic_state *pic)
pic_callinfo *ci; pic_callinfo *ci;
for (ci = pic->ci; ci > pic->cibase; ci--) { for (ci = pic->ci; ci > pic->cibase; ci--) {
if (pic->ci->env != NULL) { if (ci->env != NULL) {
vm_tear_off(pic); vm_tear_off(ci);
} }
} }
} }
@ -844,7 +844,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
pic_callinfo *ci; pic_callinfo *ci;
if (pic->ci->env != NULL) { if (pic->ci->env != NULL) {
vm_tear_off(pic); vm_tear_off(pic->ci);
} }
if (c.u.i == -1) { if (c.u.i == -1) {
@ -870,7 +870,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv)
pic_callinfo *ci; pic_callinfo *ci;
if (pic->ci->env != NULL) { if (pic->ci->env != NULL) {
vm_tear_off(pic); vm_tear_off(pic->ci);
} }
pic->ci->retc = c.u.i; pic->ci->retc = c.u.i;

View File

@ -1627,10 +1627,10 @@
(test #t (test #t
(error-object? (guard (exn (else exn)) (error "BOOM!" 1 2 3)))) (error-object? (guard (exn (else exn)) (error "BOOM!" 1 2 3))))
;; (test "BOOM!" (test "BOOM!"
;; (error-object-message (guard (exn (else exn)) (error "BOOM!" 1 2 3)))) (error-object-message (guard (exn (else exn)) (error "BOOM!" 1 2 3))))
;; (test '(1 2 3) (test '(1 2 3)
;; (error-object-irritants (guard (exn (else exn)) (error "BOOM!" 1 2 3)))) (error-object-irritants (guard (exn (else exn)) (error "BOOM!" 1 2 3))))
(test #f (test #f
(file-error? (guard (exn (else exn)) (error "BOOM!")))) (file-error? (guard (exn (else exn)) (error "BOOM!"))))
@ -1737,30 +1737,30 @@
(test "reraised 0!" (get-output-string out)) (test "reraised 0!" (get-output-string out))
(test 'zero value)) (test 'zero value))
;; ;; From SRFI-34 "Examples" section - #8 ;; From SRFI-34 "Examples" section - #8
;; (test 42 (test 42
;; (guard (condition (guard (condition
;; ((assq 'a condition) => cdr) ((assq 'a condition) => cdr)
;; ((assq 'b condition))) ((assq 'b condition)))
;; (raise (list (cons 'a 42))))) (raise (list (cons 'a 42)))))
;; ;; From SRFI-34 "Examples" section - #9 ;; From SRFI-34 "Examples" section - #9
;; (test '(b . 23) (test '(b . 23)
;; (guard (condition (guard (condition
;; ((assq 'a condition) => cdr) ((assq 'a condition) => cdr)
;; ((assq 'b condition))) ((assq 'b condition)))
;; (raise (list (cons 'b 23))))) (raise (list (cons 'b 23)))))
;; (test 'caught-d (test 'caught-d
;; (guard (condition (guard (condition
;; ((assq 'c condition) 'caught-c) ((assq 'c condition) 'caught-c)
;; ((assq 'd condition) 'caught-d)) ((assq 'd condition) 'caught-d))
;; (list (list
;; (sqrt 8) (sqrt 8)
;; (guard (condition (guard (condition
;; ((assq 'a condition) => cdr) ((assq 'a condition) => cdr)
;; ((assq 'b condition))) ((assq 'b condition)))
;; (raise (list (cons 'd 24))))))) (raise (list (cons 'd 24)))))))
(test-end) (test-end)