Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ is raised as an exception in the woken tasks.

Return the count of tasks woken up. Return 0 if no tasks are waiting on `condition`.
"""
notify(c::GenericCondition, @nospecialize(arg = nothing); all=true, error=false) = notify(c, arg, all, error)
@constprop :none notify(c::GenericCondition, @nospecialize(arg = nothing); all=true, error=false) = notify(c, arg, all, error)
function notify(c::GenericCondition, @nospecialize(arg), all, error)
assert_havelock(c)
cnt = 0
Expand Down
2 changes: 1 addition & 1 deletion base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ hashindex(key, sz) = (((hash(key)::UInt % Int) & (sz-1)) + 1)::Int
@propagate_inbounds isslotfilled(h::Dict, i::Int) = h.slots[i] == 0x1
@propagate_inbounds isslotmissing(h::Dict, i::Int) = h.slots[i] == 0x2

function rehash!(h::Dict{K,V}, newsz = length(h.keys)) where V where K
@constprop :none function rehash!(h::Dict{K,V}, newsz = length(h.keys)) where V where K
olds = h.slots
oldk = h.keys
oldv = h.vals
Expand Down
10 changes: 5 additions & 5 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ const TIMING_IMPORTS = Threads.Atomic{Int}(0)
# returns `true` if require found a precompile cache for this sourcepath, but couldn't load it
# returns `false` if the module isn't known to be precompilable
# returns the set of modules restored if the cache load succeeded
function _require_search_from_serialized(pkg::PkgId, sourcepath::String, depth::Int = 0)
@constprop :none function _require_search_from_serialized(pkg::PkgId, sourcepath::String, depth::Int = 0)
t_before = time_ns()
paths = find_all_in_cache_path(pkg)
for path_to_try in paths::Vector{String}
Expand Down Expand Up @@ -876,8 +876,8 @@ function _require_search_from_serialized(pkg::PkgId, sourcepath::String, depth::
else
if TIMING_IMPORTS[] > 0
elapsed = round((time_ns() - t_before) / 1e6, digits = 1)
tree_prefix = depth == 0 ? "" : "$(" "^(depth-1))┌ "
print("$(lpad(elapsed, 9)) ms ")
tree_prefix = depth == 0 ? "" : " "^(depth-1)*"┌ "
print(lpad(elapsed, 9), " ms ")
printstyled(tree_prefix, color = :light_black)
println(pkg.name)
end
Expand Down Expand Up @@ -1076,7 +1076,7 @@ const module_keys = IdDict{Module,PkgId}() # the reverse
is_root_module(m::Module) = @lock require_lock haskey(module_keys, m)
root_module_key(m::Module) = @lock require_lock module_keys[m]

function register_root_module(m::Module)
@constprop :none function register_root_module(m::Module)
# n.b. This is called from C after creating a new module in `Base.__toplevel__`,
# instead of adding them to the binding table there.
@lock require_lock begin
Expand Down Expand Up @@ -1859,7 +1859,7 @@ get_compiletime_preferences(::Nothing) = String[]

# returns true if it "cachefile.ji" is stale relative to "modpath.jl"
# otherwise returns the list of dependencies to also check
function stale_cachefile(modpath::String, cachefile::String; ignore_loaded = false)
@constprop :none function stale_cachefile(modpath::String, cachefile::String; ignore_loaded::Bool = false)
io = open(cachefile, "r")
try
if !isvalid_cache_header(io)
Expand Down
6 changes: 3 additions & 3 deletions base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ catch_exceptions(logger) = true

# Prevent invalidation when packages define custom loggers
# Using invoke in combination with @nospecialize eliminates backedges to these methods
function _invoked_shouldlog(logger, level, _module, group, id)
Base.@constprop :none function _invoked_shouldlog(logger, level, _module, group, id)
@nospecialize
return invoke(
shouldlog,
Expand Down Expand Up @@ -494,7 +494,7 @@ function current_logstate()
end

# helper function to get the current logger, if enabled for the specified message type
@noinline function current_logger_for_env(std_level::LogLevel, group, _module)
@noinline Base.@constprop :none function current_logger_for_env(std_level::LogLevel, group, _module)
logstate = current_logstate()
if std_level >= logstate.min_enabled_level || env_override_minlevel(group, _module)
return logstate.logger
Expand Down Expand Up @@ -536,7 +536,7 @@ end
let _debug_groups_include::Vector{Symbol} = Symbol[],
_debug_groups_exclude::Vector{Symbol} = Symbol[],
_debug_str::String = ""
global function env_override_minlevel(group, _module)
global Base.@constprop :none function env_override_minlevel(group, _module)
debug = get(ENV, "JULIA_DEBUG", "")
if !(debug === _debug_str)
_debug_str = debug
Expand Down
6 changes: 3 additions & 3 deletions base/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Given a pointer to an execution context (usually generated by a call to `backtra
up stack frame context information. Returns an array of frame information for all functions
inlined at that point, innermost function first.
"""
function lookup(pointer::Ptr{Cvoid})
Base.@constprop :none function lookup(pointer::Ptr{Cvoid})
infos = ccall(:jl_lookup_code_address, Any, (Ptr{Cvoid}, Cint), pointer, false)::Core.SimpleVector
pointer = convert(UInt64, pointer)
isempty(infos) && return [StackFrame(empty_sym, empty_sym, -1, nothing, true, false, pointer)] # this is equal to UNKNOWN
Expand Down Expand Up @@ -157,7 +157,7 @@ Returns a stack trace in the form of a vector of `StackFrame`s. (By default stac
doesn't return C functions, but this can be enabled.) When called without specifying a
trace, `stacktrace` first calls `backtrace`.
"""
function stacktrace(trace::Vector{<:Union{Base.InterpreterIP,Core.Compiler.InterpreterIP,Ptr{Cvoid}}}, c_funcs::Bool=false)
Base.@constprop :none function stacktrace(trace::Vector{<:Union{Base.InterpreterIP,Core.Compiler.InterpreterIP,Ptr{Cvoid}}}, c_funcs::Bool=false)
stack = StackTrace()
for ip in trace
for frame in lookup(ip)
Expand All @@ -170,7 +170,7 @@ function stacktrace(trace::Vector{<:Union{Base.InterpreterIP,Core.Compiler.Inter
return stack
end

function stacktrace(c_funcs::Bool=false)
Base.@constprop :none function stacktrace(c_funcs::Bool=false)
stack = stacktrace(backtrace(), c_funcs)
# Remove frame for this function (and any functions called by this function).
remove_frames!(stack, :stacktrace)
Expand Down
4 changes: 2 additions & 2 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ See also [`print`](@ref), [`println`](@ref), [`show`](@ref).
!!! compat "Julia 1.7"
Keywords except `color` and `bold` were added in Julia 1.7.
"""
printstyled(io::IO, msg...; bold::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Int,Symbol}=:normal) =
@constprop :none printstyled(io::IO, msg...; bold::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Int,Symbol}=:normal) =
with_output_color(print, color, io, msg...; bold=bold, underline=underline, blink=blink, reverse=reverse, hidden=hidden)
printstyled(msg...; bold::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Int,Symbol}=:normal) =
@constprop :none printstyled(msg...; bold::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Int,Symbol}=:normal) =
printstyled(stdout, msg...; bold=bold, underline=underline, blink=blink, reverse=reverse, hidden=hidden, color=color)

"""
Expand Down
2 changes: 2 additions & 0 deletions contrib/generate_precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ precompile(Tuple{typeof(Base.display_error), Base.ExceptionStack})
precompile(Tuple{Core.kwftype(typeof(Type)), NamedTuple{(:sizehint,), Tuple{Int}}, Type{IOBuffer}})
precompile(Base.CoreLogging.current_logger_for_env, (Base.CoreLogging.LogLevel, String, Module))
precompile(Base.CoreLogging.current_logger_for_env, (Base.CoreLogging.LogLevel, Symbol, Module))
precompile(Base.CoreLogging.env_override_minlevel, (Symbol, Module))
precompile(Base.StackTraces.lookup, (Ptr{Nothing},))
"""

for T in (Float16, Float32, Float64), IO in (IOBuffer, IOContext{IOBuffer}, Base.TTY, IOContext{Base.TTY})
Expand Down