Skip to content

Commit

Permalink
typemap: simplify code structure a bit
Browse files Browse the repository at this point in the history
Move Type{Union{}} handling to be more explicit, in preparation for
future changes. Fix a issue with handling of array scan, where we might
pass T instead of Type{T}, but were handling it wrong anyways so the
bugs largely canceled out.
  • Loading branch information
vtjnash committed Apr 13, 2023
1 parent 0892093 commit 1a0db80
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 93 deletions.
7 changes: 4 additions & 3 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3218,9 +3218,10 @@ static int ml_matches_visitor(jl_typemap_entry_t *ml, struct typemap_intersectio
return 1;
}

static int ml_mtable_visitor(jl_methtable_t *mt, void *env)
static int ml_mtable_visitor(jl_methtable_t *mt, void *closure0)
{
return jl_typemap_intersection_visitor(jl_atomic_load_relaxed(&mt->defs), jl_cachearg_offset(mt), (struct typemap_intersection_env*)env);
struct typemap_intersection_env* env = (struct typemap_intersection_env*)closure0;
return jl_typemap_intersection_visitor(jl_atomic_load_relaxed(&mt->defs), jl_cachearg_offset(mt), env);
}

// This is the collect form of calling jl_typemap_intersection_visitor
Expand Down Expand Up @@ -3318,7 +3319,7 @@ static jl_value_t *ml_matches(jl_methtable_t *mt,
return env.t;
}
}
if (!jl_typemap_intersection_visitor(jl_atomic_load_relaxed(&mt->defs), jl_cachearg_offset(mt), &env.match)) {
if (!ml_mtable_visitor(mt, &env.match)) {
JL_GC_POP();
return jl_nothing;
}
Expand Down
2 changes: 1 addition & 1 deletion src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ static void check_datatype_parameters(jl_typename_t *tn, jl_value_t **params, si
JL_GC_POP();
}

static jl_value_t *extract_wrapper(jl_value_t *t JL_PROPAGATES_ROOT) JL_GLOBALLY_ROOTED
jl_value_t *extract_wrapper(jl_value_t *t JL_PROPAGATES_ROOT) JL_GLOBALLY_ROOTED
{
t = jl_unwrap_unionall(t);
if (jl_is_datatype(t))
Expand Down
Loading

0 comments on commit 1a0db80

Please sign in to comment.