Skip to content

Commit

Permalink
update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
fatteneder committed Oct 17, 2024
1 parent 88b18a9 commit e1232bc
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions base/runtime_internals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,19 @@ typeintersect(@nospecialize(a), @nospecialize(b)) = (@_total_meta; ccall(:jl_typ
morespecific(@nospecialize(a), @nospecialize(b)) = (@_total_meta; ccall(:jl_type_morespecific, Cint, (Any, Any), a::Type, b::Type) != 0)
morespecific(a::Method, b::Method) = ccall(:jl_method_morespecific, Cint, (Any, Any), a, b) != 0

"""
morespecific!(m::Method)
Disallow adding methods more specific than `m`.
"""
function morespecific!(m::Method)
mt = get_methodtable(m)
# check that all Methods in this table are morespecific than m
# so we might avoid disabling a table that might get used for more than just subsets of m
all(m2 -> m === m2 || morespecific(m2, m), MethodList(mt)) || error("unsupported Method to disable")
setfield!(mt, nfields(mt), 0x1)
end

"""
fieldoffset(type, i)
Expand Down Expand Up @@ -1182,21 +1195,6 @@ function signature_type(@nospecialize(f), @nospecialize(argtypes))
return rewrap_unionall(Tuple{ft, u.parameters...}, argtypes)
end

"""
freeze!(mt::Core.MethodTable)
Disallow adding or modifying methods of `mt`.
See also [`unfreeze!(mt)`](@ref unfreeze!).
"""
function morespecific!(m::Method)
mt = get_methodtable(m)
# check that all Methods in this table are morespecific than m
# so we might avoid disabling a table that might get used for more than just subsets of m
all(m2 -> m === m2 || morespecific(m2, m), MethodList(mt)) || error("unsupported Method to disable")
setfield!(mt, nfields(mt), 0x1)
end

function get_methodtable(m::Method)
mt = ccall(:jl_method_get_table, Any, (Any,), m)
if mt === nothing
Expand Down

0 comments on commit e1232bc

Please sign in to comment.