Skip to content

Commit

Permalink
Keep trying gc
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed May 6, 2020
1 parent a737d28 commit c9eaaa6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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};
Expand Down

0 comments on commit c9eaaa6

Please sign in to comment.