Skip to content

Commit 4723ce5

Browse files
JeffBezansonKristofferC
authored andcommitted
rename GlobalMethods to methodtable 🚲 🏠 (#59158)
(cherry picked from commit f9b7d27)
1 parent e5faf18 commit 4723ce5

File tree

10 files changed

+14
-14
lines changed

10 files changed

+14
-14
lines changed

Compiler/src/abstractinterpretation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ function find_union_split_method_matches(interp::AbstractInterpreter, argtypes::
369369
end
370370
valid_worlds = intersect(valid_worlds, thismatches.valid_worlds)
371371
thisfullmatch = any(match::MethodMatch->match.fully_covers, thismatches)
372-
mt = Core.GlobalMethods
372+
mt = Core.methodtable
373373
thisinfo = MethodMatchInfo(thismatches, mt, sig_n, thisfullmatch)
374374
push!(infos, thisinfo)
375375
for idx = 1:length(thismatches)
@@ -390,7 +390,7 @@ function find_simple_method_matches(interp::AbstractInterpreter, @nospecialize(a
390390
return FailedMethodMatch("Too many methods matched")
391391
end
392392
fullmatch = any(match::MethodMatch->match.fully_covers, matches)
393-
mt = Core.GlobalMethods
393+
mt = Core.methodtable
394394
info = MethodMatchInfo(matches, mt, atype, fullmatch)
395395
applicable = MethodMatchTarget[MethodMatchTarget(matches[idx], info.edges, idx) for idx = 1:length(matches)]
396396
return MethodMatches(applicable, info, matches.valid_worlds)

Compiler/src/stmtinfo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ function _add_edges_impl(edges::Vector{Any}, info::MethodMatchInfo, mi_edge::Boo
4949
if !fully_covering(info)
5050
exists = false
5151
for i in 2:length(edges)
52-
if edges[i] === Core.GlobalMethods && edges[i-1] == info.atype
52+
if edges[i] === Core.methodtable && edges[i-1] == info.atype
5353
exists = true
5454
break
5555
end
5656
end
5757
if !exists
5858
push!(edges, info.atype)
59-
push!(edges, Core.GlobalMethods)
59+
push!(edges, Core.methodtable)
6060
end
6161
end
6262
nmatches = length(info.results)

Compiler/src/tfuncs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3170,7 +3170,7 @@ function _hasmethod_tfunc(interp::AbstractInterpreter, argtypes::Vector{Any}, sv
31703170
if match === nothing
31713171
rt = Const(false)
31723172
vresults = MethodLookupResult(Any[], valid_worlds, true)
3173-
mt = Core.GlobalMethods
3173+
mt = Core.methodtable
31743174
vinfo = MethodMatchInfo(vresults, mt, types, false) # XXX: this should actually be an info with invoke-type edge
31753175
else
31763176
rt = Const(true)

src/builtins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,7 +2491,7 @@ void jl_init_primitives(void) JL_GC_DISABLED
24912491

24922492
add_builtin("Module", (jl_value_t*)jl_module_type);
24932493
add_builtin("MethodTable", (jl_value_t*)jl_methtable_type);
2494-
add_builtin("GlobalMethods", (jl_value_t*)jl_method_table);
2494+
add_builtin("methodtable", (jl_value_t*)jl_method_table);
24952495
add_builtin("MethodCache", (jl_value_t*)jl_methcache_type);
24962496
add_builtin("Method", (jl_value_t*)jl_method_type);
24972497
add_builtin("CodeInstance", (jl_value_t*)jl_code_instance_type);

src/jltypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2956,7 +2956,7 @@ void jl_init_types(void) JL_GC_DISABLED
29562956
XX(simplevector);
29572957
jl_methcache_type = jl_new_uninitialized_datatype();
29582958
jl_methtable_type = jl_new_uninitialized_datatype();
2959-
jl_method_table = jl_new_method_table(jl_symbol("GlobalMethods"), core);
2959+
jl_method_table = jl_new_method_table(jl_symbol("methodtable"), core);
29602960

29612961
jl_emptysvec = (jl_svec_t*)jl_gc_permobj(sizeof(void*), jl_simplevector_type);
29622962
jl_set_typetagof(jl_emptysvec, jl_simplevector_tag, GC_OLD_MARKED);

src/rtutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt
10811081
n += jl_printf(out, "nothing");
10821082
}
10831083
else if (v == (jl_value_t*)jl_method_table) {
1084-
n += jl_printf(out, "Core.GlobalMethods");
1084+
n += jl_printf(out, "Core.methodtable");
10851085
}
10861086
else if (vt == jl_string_type) {
10871087
n += jl_static_show_string(out, jl_string_data(v), jl_string_len(v), 1, 0);

stdlib/Serialization/src/Serialization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ function deserialize(s::AbstractSerializer, ::Type{Method})
11291129
meth.recursion_relation = recursion_relation
11301130
end
11311131
if !is_for_opaque_closure
1132-
mt = Core.GlobalMethods
1132+
mt = Core.methodtable
11331133
if nothing === ccall(:jl_methtable_lookup, Any, (Any, UInt), sig, Base.get_world_counter()) # XXX: quite sketchy?
11341134
ccall(:jl_method_table_insert, Cvoid, (Any, Any, Ptr{Cvoid}), mt, meth, C_NULL)
11351135
end

stdlib/Test/src/Test.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ function detect_ambiguities(mods::Module...;
21592159
end
21602160
end
21612161
end
2162-
examine(Core.GlobalMethods)
2162+
examine(Core.methodtable)
21632163
return collect(ambs)
21642164
end
21652165

@@ -2207,7 +2207,7 @@ function detect_unbound_args(mods...;
22072207
push!(ambs, m)
22082208
end
22092209
end
2210-
examine(Core.GlobalMethods)
2210+
examine(Core.methodtable)
22112211
return collect(ambs)
22122212
end
22132213

test/misc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,10 +1614,10 @@ end
16141614
let errs = IOBuffer()
16151615
run(`$(Base.julia_cmd()) -e '
16161616
using Test
1617-
@test !isempty(Core.GlobalMethods.backedges)
1617+
@test !isempty(Core.methodtable.backedges)
16181618
Base.Experimental.disable_new_worlds()
16191619
@test_throws "disable_new_worlds" @eval f() = 1
1620-
@test isempty(Core.GlobalMethods.backedges)
1620+
@test isempty(Core.methodtable.backedges)
16211621
@test_throws "disable_new_worlds" Base.delete_method(which(+, (Int, Int)))
16221622
@test 1+1 == 2
16231623
using Dates

test/worlds.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ z26506 = Any["ABC"]
198198
f26506(x::Int) = 2
199199
g26506(z26506) # Places an entry for f26506(::String) in MethodTable cache
200200
w26506 = Base.get_world_counter()
201-
cache26506 = ccall(:jl_mt_find_cache_entry, Any, (Any, Any, UInt), Core.GlobalMethods.cache, Tuple{typeof(f26506),String}, w26506)::Core.TypeMapEntry
201+
cache26506 = ccall(:jl_mt_find_cache_entry, Any, (Any, Any, UInt), Core.methodtable.cache, Tuple{typeof(f26506),String}, w26506)::Core.TypeMapEntry
202202
@test cache26506.max_world === typemax(UInt)
203203
w26506 = Base.get_world_counter()
204204
f26506(x::String) = 3

0 commit comments

Comments
 (0)