From 3b350f114d2a6065c45565b379a3b58d440bd135 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Sat, 3 Jan 2015 20:25:54 -0500 Subject: [PATCH] fix JL_GC_PUSH calls in the new BoundsError calls. should fix those pesky intermittent CI errors that have occurred recently. --- src/builtins.c | 14 +++++++++----- test/core.jl | 8 +++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/builtins.c b/src/builtins.c index a8e6b30dcef89..114b59ac239ec 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -102,27 +102,31 @@ DLLEXPORT void NORETURN jl_undefined_var_error(jl_sym_t *var) DLLEXPORT void NORETURN jl_bounds_error(jl_value_t *v, jl_value_t *t) { - JL_GC_PUSH2(v, t); // root arguments so the caller doesn't need to + JL_GC_PUSH2(&v, &t); // root arguments so the caller doesn't need to jl_throw(jl_new_struct((jl_datatype_t*)jl_boundserror_type, v, t)); } DLLEXPORT void NORETURN jl_bounds_error_v(jl_value_t *v, jl_value_t **idxs, size_t nidxs) { jl_tuple_t *t = NULL; - JL_GC_PUSH2(v, t); // root arguments so the caller doesn't need to + // items in idxs are assumed to already be rooted + JL_GC_PUSH2(&v, &t); // root v so the caller doesn't need to t = jl_tuplev(nidxs, idxs); jl_throw(jl_new_struct((jl_datatype_t*)jl_boundserror_type, v, t)); } DLLEXPORT void NORETURN jl_bounds_error_tuple_int(jl_value_t **v, size_t nv, size_t i) { + // values in v are expected to already be gc-rooted jl_bounds_error_int((jl_value_t*)jl_tuplev(nv, v), i); } DLLEXPORT void NORETURN jl_bounds_error_unboxed_int(void *data, jl_value_t *vt, size_t i) { jl_value_t *t = NULL, *v = NULL; - JL_GC_PUSH2(v, t); + // data is expected to be gc-safe (either gc-rooted, or alloca) + // vt is expected to be gc-rooted (in a linfo-root probably) + JL_GC_PUSH2(&v, &t); v = jl_new_bits(vt, data); t = jl_box_long(i); jl_throw(jl_new_struct((jl_datatype_t*)jl_boundserror_type, v, t)); @@ -131,7 +135,7 @@ DLLEXPORT void NORETURN jl_bounds_error_unboxed_int(void *data, jl_value_t *vt, DLLEXPORT void NORETURN jl_bounds_error_int(jl_value_t *v, size_t i) { jl_value_t *t = NULL; - JL_GC_PUSH2(v, t); // root arguments so the caller doesn't need to + JL_GC_PUSH2(&v, &t); // root arguments so the caller doesn't need to t = jl_box_long(i); jl_throw(jl_new_struct((jl_datatype_t*)jl_boundserror_type, v, t)); } @@ -140,7 +144,7 @@ DLLEXPORT void NORETURN jl_bounds_error_ints(jl_value_t *v, size_t *idxs, size_t { size_t i; jl_tuple_t *t = NULL; - JL_GC_PUSH2(v, t); // root arguments so the caller doesn't need to + JL_GC_PUSH2(&v, &t); // root arguments so the caller doesn't need to t = jl_alloc_tuple(nidxs); for (i = 0; i < nidxs; i++) { jl_tupleset(t, i, jl_box_long(idxs[i])); diff --git a/test/core.jl b/test/core.jl index 051538412a9b9..4fc849ea3eae3 100644 --- a/test/core.jl +++ b/test/core.jl @@ -2022,11 +2022,9 @@ let x = [1,2,3] end # sig 2 is SIGINT per the POSIX.1-1990 standard -if Base.is_unix(OS_NAME) - ccall(:jl_exit_on_sigint, Void, (Cint,), 0) - @test_throws InterruptException ccall(:raise, Void, (Cint,), 2) - ccall(:jl_exit_on_sigint, Void, (Cint,), 1) -end +ccall(:jl_exit_on_sigint, Void, (Cint,), 0) +@test_throws InterruptException ccall(:raise, Void, (Cint,), 2) +ccall(:jl_exit_on_sigint, Void, (Cint,), 1) # pull request #9534 @test try; a,b,c = 1,2; catch ex; (ex::BoundsError).a === (1,2) && ex.i == 3; end