From c9eaaa6827b92ac7f7c4295480e5144b4d917619 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 6 May 2020 13:26:16 -0500 Subject: [PATCH] Keep trying gc --- src/dump.c | 4 ++-- src/gf.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dump.c b/src/dump.c index fb8eed60af9a7..5cef3e08c54ab 100644 --- a/src/dump.c +++ b/src/dump.c @@ -2294,7 +2294,7 @@ static void jl_insert_methods(jl_array_t *list) } } -extern jl_array_t *_jl_debug_method_invalidation; +extern jl_array_t *_jl_debug_method_invalidation JL_GLOBALLY_ROOTED; // verify that these edges intersect with the same methods as before static void jl_verify_edges(jl_array_t *targets, jl_array_t **pvalids) @@ -2349,7 +2349,7 @@ static void jl_insert_backedges(jl_array_t *list, jl_array_t *targets) size_t i, l = jl_array_len(list); jl_array_t *valids = NULL; jl_value_t *loctag = NULL; - JL_GC_PUSH3(&valids, &_jl_debug_method_invalidation, &loctag); + JL_GC_PUSH2(&valids, &loctag); jl_verify_edges(targets, &valids); for (i = 0; i < l; i += 2) { jl_method_instance_t *caller = (jl_method_instance_t*)jl_array_ptr_ref(list, i); diff --git a/src/gf.c b/src/gf.c index 8583a75837630..e7d2d133f70e7 100644 --- a/src/gf.c +++ b/src/gf.c @@ -1488,6 +1488,9 @@ static void update_max_args(jl_methtable_t *mt, jl_value_t *type) jl_array_t *_jl_debug_method_invalidation JL_GLOBALLY_ROOTED = NULL; JL_DLLEXPORT jl_value_t *jl_debug_method_invalidation(int state) { + /* After calling with `state = 1`, caller is responsible for + holding a reference to the returned array until this is called + again with `state = 0`. */ if (state) { if (_jl_debug_method_invalidation) return (jl_value_t*) _jl_debug_method_invalidation; @@ -1503,7 +1506,7 @@ static void invalidate_method_instance(jl_method_instance_t *replaced, size_t ma { if (_jl_debug_method_invalidation) { jl_value_t *boxeddepth = NULL; - JL_GC_PUSH2(&_jl_debug_method_invalidation, boxeddepth); + JL_GC_PUSH1(&boxeddepth); jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)replaced); boxeddepth = jl_box_int32(depth); jl_array_ptr_1d_push(_jl_debug_method_invalidation, boxeddepth); @@ -1637,7 +1640,7 @@ static int invalidate_mt_cache(jl_typemap_entry_t *oldentry, void *closure0) if (intersects) { if (_jl_debug_method_invalidation) { jl_value_t *loctag = NULL; - JL_GC_PUSH2(&_jl_debug_method_invalidation, &loctag); + JL_GC_PUSH1(&loctag); jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)mi); loctag = jl_cstr_to_string("mt"); jl_gc_wb(_jl_debug_method_invalidation, loctag); @@ -1710,7 +1713,7 @@ JL_DLLEXPORT void jl_method_table_insert(jl_methtable_t *mt, jl_method_t *method method->primary_world = ++jl_world_counter; size_t max_world = method->primary_world - 1; int invalidated = 0; - JL_GC_PUSH2(&oldvalue, &_jl_debug_method_invalidation); + JL_GC_PUSH1(&oldvalue); JL_LOCK(&mt->writelock); // first delete the existing entry (we'll disable it later) struct jl_typemap_assoc search = {(jl_value_t*)type, method->primary_world, NULL, 0, ~(size_t)0};