From 0bfe685e0222511e8a4dcebd411dc516b957b079 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 30 Oct 2018 18:55:51 -0400 Subject: [PATCH] call to `rethrow` should be qualified in exception stack lowering (#29853) --- src/gc.h | 2 +- src/julia-syntax.scm | 3 +-- src/julia_internal.h | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gc.h b/src/gc.h index e99e6b9b8cfd6..2be22aa782408 100644 --- a/src/gc.h +++ b/src/gc.h @@ -153,7 +153,7 @@ typedef struct { // Exception stack data typedef struct { - jl_excstack_t *s; // Stack of exceptions + jl_excstack_t *s; // Stack of exceptions size_t itr; // Iterator into exception stack size_t i; // Iterator into backtrace data for exception } gc_mark_excstack_t; diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 080b75f8973a0..904ad0164cdc6 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -3744,7 +3744,6 @@ f(x) = yt(x) (endl (make-label)) (last-finally-handler finally-handler) (finally (if (eq? (car e) 'tryfinally) (new-mutable-var) #f)) - (finally-exception (if (eq? (car e) 'tryfinally) (new-mutable-var) #f)) (my-finally-handler #f)) ;; handler block entry (emit `(= ,handler-token (enter ,catch))) @@ -3767,7 +3766,7 @@ f(x) = yt(x) (mark-label catch) (emit `(leave 1)) (if finally - (begin (leave-finally-block '(call rethrow) #f) + (begin (leave-finally-block '(call (top rethrow)) #f) (if endl (mark-label endl)) (set! finally-handler last-finally-handler) (compile (caddr e) break-labels #f #f) diff --git a/src/julia_internal.h b/src/julia_internal.h index dba4610fbb54e..4d2f68d61f7c1 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -670,14 +670,14 @@ typedef struct _jl_excstack_t { // uintptr_t data[]; // Access with jl_excstack_raw } jl_excstack_t; -STATIC_INLINE uintptr_t *jl_excstack_raw(jl_excstack_t* stack) JL_NOTSAFEPOINT +STATIC_INLINE uintptr_t *jl_excstack_raw(jl_excstack_t *stack) JL_NOTSAFEPOINT { return (uintptr_t*)(stack + 1); } // Exception stack access STATIC_INLINE jl_value_t *jl_excstack_exception(jl_excstack_t *stack JL_PROPAGATES_ROOT, - size_t itr) JL_NOTSAFEPOINT + size_t itr) JL_NOTSAFEPOINT { return (jl_value_t*)(jl_excstack_raw(stack)[itr-1]); } @@ -696,10 +696,10 @@ STATIC_INLINE size_t jl_excstack_next(jl_excstack_t *stack, size_t itr) JL_NOTSA } // Exception stack manipulation void jl_reserve_excstack(jl_excstack_t **stack JL_REQUIRE_ROOTED_SLOT, - size_t reserved_size); + size_t reserved_size); void jl_push_excstack(jl_excstack_t **stack JL_REQUIRE_ROOTED_SLOT JL_ROOTING_ARGUMENT, - jl_value_t *exception JL_ROOTED_ARGUMENT, - uintptr_t *bt_data, size_t bt_size); + jl_value_t *exception JL_ROOTED_ARGUMENT, + uintptr_t *bt_data, size_t bt_size); void jl_copy_excstack(jl_excstack_t *dest, jl_excstack_t *src) JL_NOTSAFEPOINT; // timers