Skip to content

Commit

Permalink
Merge branch 'master' into gb/toplevel-root
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored Jul 12, 2024
2 parents c079892 + aba6766 commit 2f06a31
Show file tree
Hide file tree
Showing 245 changed files with 5,577 additions and 3,094 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/LabelCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
with:
# REQUIRED_LABELS_ANY: "bug,enhancement,skip-changelog"
# REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['bug','enhancement','skip-changelog']"
BANNED_LABELS: "needs docs,needs compat annotation,needs more info,needs nanosoldier run,needs news,needs pkgeval,needs tests,DO NOT MERGE"
BANNED_LABELS_DESCRIPTION: "A PR should not be merged with `needs *` or `DO NOT MERGE` labels"
BANNED_LABELS: "needs docs,needs compat annotation,needs more info,needs nanosoldier run,needs news,needs pkgeval,needs tests,needs decision,DO NOT MERGE,status:DO NOT MERGE"
BANNED_LABELS_DESCRIPTION: "A PR should not be merged with `needs *` or `status:DO NOT MERGE` labels"
19 changes: 16 additions & 3 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ Daniel Karrasch <Daniel.Karrasch@gmx.de> <daniel.karrasch@posteo.de>
Roger Luo <rogerluo.rl18@gmail.com> <rogerluo.rl18@gmail.com>
Roger Luo <rogerluo.rl18@gmail.com> <hiroger@qq.com>

Frames Catherine White <me@oxinabox.net> <oxinabox@ucc.asn.au>
Frames Catherine White <me@oxinabox.net> <lyndon.white@invenialabs.co.uk>
Frames Catherine White <me@oxinabox.net> <lyndon.white@research.uwa.edu.au>
Frames White <me@oxinabox.net> <oxinabox@ucc.asn.au>
Frames White <me@oxinabox.net> <lyndon.white@invenialabs.co.uk>
Frames White <me@oxinabox.net> <lyndon.white@research.uwa.edu.au>

Claire Foster <aka.c42f@gmail.com> <chris42f@gmail.com>

Expand All @@ -295,3 +295,16 @@ Jishnu Bhattacharya <jishnub.github@gmail.com> <jishnub@users.noreply.github.com

Shuhei Kadowaki <aviatesk@gmail.com> <aviatesk@gmail.com>
Shuhei Kadowaki <aviatesk@gmail.com> <40514306+aviatesk@users.noreply.github.com>

inky <git@wo-class.cn>
inky <git@wo-class.cn> <inkydragon@users.noreply.github.com>

Lilith Orion Hafner <lilithhafner@gmail.com> <Lilith.Hafner@gmail.com>
Lilith Orion Hafner <lilithhafner@gmail.com> <60898866+LilithHafner@users.noreply.github.com>

Timothy <git@tecosaur.net>

Bhuminjay Soni <soni5happy@gmail.com>
Bhuminjay Soni <soni5happy@gmail.com> <76656712+11happy@users.noreply.github.com>

Florian Atteneder <florian.atteneder@gmail.com>
12 changes: 11 additions & 1 deletion Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,17 @@ export MACOSX_DEPLOYMENT_TARGET=$(MACOSX_VERSION_MIN)
endif
endif

JLDFLAGS :=
# Conditional setting of RELRO flag for enhanced security on Linux builds.
# RELRO (Read-Only Relocations) is a security feature that marks certain sections
# of the binary as read-only to prevent exploitation techniques like
# GOT (Global Offset Table) overwriting attacks.
ifeq ($(OS),Linux)
RELRO_FLAG := -Wl,-z,relro
else
RELRO_FLAG :=
endif

JLDFLAGS := $(RELRO_FLAG)

ifeq ($(USECCACHE), 1)
# Expand CC, CXX and FC here already because we want the original definition and not the ccache version.
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,14 @@ endif
@printf $(JULCOLOR)' ==> ./julia binary sizes\n'$(ENDCOLOR)
$(call spawn,$(LLVM_SIZE) -A $(call cygpath_w,$(build_private_libdir)/sys.$(SHLIB_EXT)) \
$(call cygpath_w,$(build_shlibdir)/libjulia.$(SHLIB_EXT)) \
$(call cygpath_w,$(build_shlibdir)/libjulia-internal.$(SHLIB_EXT)) \
$(call cygpath_w,$(build_shlibdir)/libjulia-codegen.$(SHLIB_EXT)) \
$(call cygpath_w,$(build_bindir)/julia$(EXE)))
ifeq ($(OS),Darwin)
$(call spawn,$(LLVM_SIZE) -A $(call cygpath_w,$(build_shlibdir)/libLLVM.$(SHLIB_EXT)))
else
$(call spawn,$(LLVM_SIZE) -A $(call cygpath_w,$(build_shlibdir)/$(LLVM_SHARED_LIB_NAME).$(SHLIB_EXT)))
endif
@printf $(JULCOLOR)' ==> ./julia launch speedtest\n'$(ENDCOLOR)
@time $(call spawn,$(build_bindir)/julia$(EXE) -e '')
@time $(call spawn,$(build_bindir)/julia$(EXE) -e '')
Expand Down
17 changes: 17 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ New language features

- A new keyword argument `usings::Bool` has been added to `names`. By using this, we can now
find all the names available in module `A` by `names(A; all=true, imported=true, usings=true)`. ([#54609])
- the `@atomic(...)` macro family supports now the reference assignment syntax, e.g.
`@atomic :monotonic v[3] += 4` modifies `v[3]` atomically with monotonic ordering semantics. ([#54707])
The supported syntax allows
- atomic fetch (`x = @atomic v[3]`),
- atomic set (`@atomic v[3] = 4`),
- atomic modify (`@atomic v[3] += 2`),
- atomic set once (`@atomiconce v[3] = 2`),
- atomic swap (`x = @atomicswap v[3] = 2`), and
- atomic replace (`x = @atomicreplace v[3] 2=>5`).

Language changes
----------------
Expand Down Expand Up @@ -34,6 +43,8 @@ Compiler/Runtime improvements
`i32` or `i64`, and remove unneeded `ptrtoint`/`inttoptr` conversions. For compatibility,
IR with integer pointers is still supported, but generates a deprecation warning. ([#53687])

- A new exception `FieldError` is now introduced to raise/handle `getfield` exceptions. Previously `getfield` exception was captured by fallback generic exception `ErrorException`. Now that `FieldError` is more specific `getfield` related exceptions that can occur should use `FieldError` exception instead. ([#54504])

Command-line option changes
---------------------------

Expand All @@ -43,6 +54,8 @@ Command-line option changes
[`NO_COLOR`](https://no-color.org/) or [`FORCE_COLOR`](https://force-color.org/) environment
variables. ([#53742]).
* `--project=@temp` starts Julia with a temporary environment.
* New `--trace-compile-timing` option to report how long each method reported by `--trace-compile` took
to compile, in ms. ([#54662])

Multi-threading changes
-----------------------
Expand All @@ -56,6 +69,7 @@ New library functions
* `logrange(start, stop; length)` makes a range of constant ratio, instead of constant step ([#39071])
* The new `isfull(c::Channel)` function can be used to check if `put!(c, some_value)` will block. ([#53159])
* `waitany(tasks; throw=false)` and `waitall(tasks; failfast=false, throw=false)` which wait multiple tasks at once ([#53341]).
* `uuid7()` creates an RFC 9652 compliant UUID with version 7 ([#54834]).

New library features
--------------------
Expand Down Expand Up @@ -115,6 +129,9 @@ Standard library changes
complete names that have been explicitly `using`-ed. ([#54610])
- REPL completions can now complete input lines like `[import|using] Mod: xxx|` e.g.
complete `using Base.Experimental: @op` to `using Base.Experimental: @opaque`. ([#54719])
- the REPL will now warn if it detects a name is being accessed from a module which does not define it (nor has a submodule which defines it),
and for which the name is not public in that module. For example, `map` is defined in Base, and executing `LinearAlgebra.map`
in the REPL will now issue a warning the first time occurs. ([#54872])

#### SuiteSparse

Expand Down
30 changes: 27 additions & 3 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,28 @@ function strcat(x::String, y::String)
end
return out
end
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl)

BUILDROOT::String = ""

baremodule BuildSettings
end

let i = 1
global BUILDROOT
while i <= length(Core.ARGS)
if Core.ARGS[i] == "--buildsettings"
include(BuildSettings, ARGS[i+1])
i += 1
else
BUILDROOT = Core.ARGS[i]
end
i += 1
end
end

include(strcat(BUILDROOT, "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
include(strcat(BUILDROOT, "version_git.jl")) # include($BUILDROOT/base/version_git.jl)

# Initialize DL_LOAD_PATH as early as possible. We are defining things here in
# a slightly more verbose fashion than usual, because we're running so early.
const DL_LOAD_PATH = String[]
Expand Down Expand Up @@ -562,7 +582,7 @@ include(mapexpr::Function, mod::Module, _path::AbstractString) = _include(mapexp

# External libraries vendored into Base
Core.println("JuliaSyntax/src/JuliaSyntax.jl")
include(@__MODULE__, string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "JuliaSyntax/src/JuliaSyntax.jl")) # include($BUILDROOT/base/JuliaSyntax/JuliaSyntax.jl)
include(@__MODULE__, string(BUILDROOT, "JuliaSyntax/src/JuliaSyntax.jl")) # include($BUILDROOT/base/JuliaSyntax/JuliaSyntax.jl)

end_base_include = time_ns()

Expand Down Expand Up @@ -606,6 +626,10 @@ function __init__()
init_active_project()
append!(empty!(_sysimage_modules), keys(loaded_modules))
empty!(explicit_loaded_modules)
@assert isempty(loaded_precompiles)
for (mod, key) in module_keys
loaded_precompiles[key => module_build_id(mod)] = mod
end
if haskey(ENV, "JULIA_MAX_NUM_PRECOMPILE_FILES")
MAX_NUM_PRECOMPILE_FILES[] = parse(Int, ENV["JULIA_MAX_NUM_PRECOMPILE_FILES"])
end
Expand Down
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3287,7 +3287,7 @@ one *without* a colon in the slice. This is `view(A,:,i,:)`, whereas
`mapslices(f, A; dims=(1,3))` uses `A[:,i,:]`. The function `f` may mutate
values in the slice without affecting `A`.
"""
function mapslices(f, A::AbstractArray; dims)
@constprop :aggressive function mapslices(f, A::AbstractArray; dims)
isempty(dims) && return map(f, A)

for d in dims
Expand Down
27 changes: 19 additions & 8 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export
InterruptException, InexactError, OutOfMemoryError, ReadOnlyMemoryError,
OverflowError, StackOverflowError, SegmentationFault, UndefRefError, UndefVarError,
TypeError, ArgumentError, MethodError, AssertionError, LoadError, InitError,
UndefKeywordError, ConcurrencyViolationError,
UndefKeywordError, ConcurrencyViolationError, FieldError,
# AST representation
Expr, QuoteNode, LineNumberNode, GlobalRef,
# object model functions
Expand Down Expand Up @@ -283,7 +283,8 @@ macro _foldable_meta()
#=:notaskstate=#true,
#=:inaccessiblememonly=#true,
#=:noub=#true,
#=:noub_if_noinbounds=#false))
#=:noub_if_noinbounds=#false,
#=:consistent_overlay=#false))
end

macro inline() Expr(:meta, :inline) end
Expand Down Expand Up @@ -404,6 +405,11 @@ struct AssertionError <: Exception
end
AssertionError() = AssertionError("")

struct FieldError <: Exception
type::DataType
field::Symbol
end

abstract type WrappedException <: Exception end

struct LoadError <: WrappedException
Expand Down Expand Up @@ -503,12 +509,12 @@ end
function CodeInstance(
mi::MethodInstance, owner, @nospecialize(rettype), @nospecialize(exctype), @nospecialize(inferred_const),
@nospecialize(inferred), const_flags::Int32, min_world::UInt, max_world::UInt,
ipo_effects::UInt32, effects::UInt32, @nospecialize(analysis_results),
relocatability::UInt8, edges::DebugInfo)
effects::UInt32, @nospecialize(analysis_results),
relocatability::UInt8, edges::Union{DebugInfo,Nothing})
return ccall(:jl_new_codeinst, Ref{CodeInstance},
(Any, Any, Any, Any, Any, Any, Int32, UInt, UInt, UInt32, UInt32, Any, UInt8, Any),
(Any, Any, Any, Any, Any, Any, Int32, UInt, UInt, UInt32, Any, UInt8, Any),
mi, owner, rettype, exctype, inferred_const, inferred, const_flags, min_world, max_world,
ipo_effects, effects, analysis_results, relocatability, edges)
effects, analysis_results, relocatability, edges)
end
GlobalRef(m::Module, s::Symbol) = ccall(:jl_module_globalref, Ref{GlobalRef}, (Any, Any), m, s)
Module(name::Symbol=:anonymous, std_imports::Bool=true, default_names::Bool=true) = ccall(:jl_f_new_module, Ref{Module}, (Any, Bool, Bool), name, std_imports, default_names)
Expand Down Expand Up @@ -541,8 +547,6 @@ GenericMemoryRef(mem::GenericMemory) = memoryref(mem)
GenericMemoryRef(mem::GenericMemory, i::Integer) = memoryref(mem, i)
GenericMemoryRef(mem::GenericMemoryRef, i::Integer) = memoryref(mem, i)

const Memory{T} = GenericMemory{:not_atomic, T, CPU}
const MemoryRef{T} = GenericMemoryRef{:not_atomic, T, CPU}
const AtomicMemory{T} = GenericMemory{:atomic, T, CPU}
const AtomicMemoryRef{T} = GenericMemoryRef{:atomic, T, CPU}

Expand Down Expand Up @@ -746,6 +750,13 @@ function (g::GeneratedFunctionStub)(world::UInt, source::LineNumberNode, @nospec
end
end

# If the generator is a subtype of this trait, inference caches the generated unoptimized
# code, sacrificing memory space to improve the performance of subsequent inferences.
# This tradeoff is not appropriate in general cases (e.g., for `GeneratedFunctionStub`s
# generated from the front end), but it can be justified for generators involving complex
# code transformations, such as a Cassette-like system.
abstract type CachedGenerator end

NamedTuple() = NamedTuple{(),Tuple{}}(())

eval(Core, :(NamedTuple{names}(args::Tuple) where {names} =
Expand Down
5 changes: 2 additions & 3 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ function incomplete_tag(ex::Expr)
end
incomplete_tag(exc::Meta.ParseError) = incomplete_tag(exc.detail)

cmd_suppresses_program(cmd) = cmd in ('e', 'E')
function exec_options(opts)
startup = (opts.startupfile != 2)
global have_color = colored_text(opts)
Expand Down Expand Up @@ -621,11 +620,11 @@ const main = MyApp.main
"""
macro main(args...)
if !isempty(args)
error("USAGE: `@main` is expected to be used as `(@main)` without macro arguments.")
error("`@main` is expected to be used as `(@main)` without macro arguments.")
end
if isdefined(__module__, :main)
if Base.binding_module(__module__, :main) !== __module__
error("USAGE: Symbol `main` is already a resolved import in module $(__module__). `@main` must be used in the defining module.")
error("Symbol `main` is already a resolved import in module $(__module__). `@main` must be used in the defining module.")
end
end
Core.eval(__module__, quote
Expand Down
47 changes: 25 additions & 22 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ function add_call_backedges!(interp::AbstractInterpreter, @nospecialize(rettype)
# ignore the `:nonoverlayed` property if `interp` doesn't use overlayed method table
# since it will never be tainted anyway
if !isoverlayed(method_table(interp))
all_effects = Effects(all_effects; nonoverlayed=false)
all_effects = Effects(all_effects; nonoverlayed=ALWAYS_FALSE)
end
all_effects === Effects() && return nothing
end
Expand Down Expand Up @@ -692,11 +692,9 @@ function edge_matches_sv(interp::AbstractInterpreter, frame::AbsIntState,
# The other `CodeInfo`s we inspect will already have this field inflated, so we just
# access it directly instead (to avoid regeneration).
world = get_inference_world(interp)
callee_method2 = method_for_inference_heuristics(method, sig, sparams, world) # Union{Method, Nothing}

inf_method2 = method_for_inference_limit_heuristics(frame) # limit only if user token match
inf_method2 isa Method || (inf_method2 = nothing)
if callee_method2 !== inf_method2
callee_method2 = method_for_inference_heuristics(method, sig, sparams, world)
inf_method2 = method_for_inference_limit_heuristics(frame)
if callee_method2 !== inf_method2 # limit only if user token match
return false
end
if isa(frame, InferenceState) && cache_owner(frame.interp) !== cache_owner(interp)
Expand Down Expand Up @@ -733,27 +731,24 @@ end

# This function is used for computing alternate limit heuristics
function method_for_inference_heuristics(method::Method, @nospecialize(sig), sparams::SimpleVector, world::UInt)
if isdefined(method, :generator) && !(method.generator isa Core.GeneratedFunctionStub) && may_invoke_generator(method, sig, sparams)
method_instance = specialize_method(method, sig, sparams)
if isa(method_instance, MethodInstance)
cinfo = get_staged(method_instance, world)
if isa(cinfo, CodeInfo)
method2 = cinfo.method_for_inference_limit_heuristics
if method2 isa Method
return method2
end
if (hasgenerator(method) && !(method.generator isa Core.GeneratedFunctionStub) &&
may_invoke_generator(method, sig, sparams))
mi = specialize_method(method, sig, sparams)
cinfo = get_staged(mi, world)
if isa(cinfo, CodeInfo)
method2 = cinfo.method_for_inference_limit_heuristics
if method2 isa Method
return method2
end
end
end
return nothing
end

function matches_sv(parent::AbsIntState, sv::AbsIntState)
sv_method2 = method_for_inference_limit_heuristics(sv) # limit only if user token match
sv_method2 isa Method || (sv_method2 = nothing)
parent_method2 = method_for_inference_limit_heuristics(parent) # limit only if user token match
parent_method2 isa Method || (parent_method2 = nothing)
return frame_instance(parent).def === frame_instance(sv).def && sv_method2 === parent_method2
# limit only if user token match
return (frame_instance(parent).def === frame_instance(sv).def &&
method_for_inference_limit_heuristics(sv) === method_for_inference_limit_heuristics(parent))
end

function is_edge_recursed(edge::MethodInstance, caller::AbsIntState)
Expand Down Expand Up @@ -903,7 +898,15 @@ function concrete_eval_eligible(interp::AbstractInterpreter,
mi = result.edge
if mi !== nothing && is_foldable(effects)
if f !== nothing && is_all_const_arg(arginfo, #=start=#2)
if is_nonoverlayed(interp) || is_nonoverlayed(effects)
if (is_nonoverlayed(interp) || is_nonoverlayed(effects) ||
# Even if overlay methods are involved, when `:consistent_overlay` is
# explicitly applied, we can still perform concrete evaluation using the
# original methods for executing them.
# While there's a chance that the non-overlayed counterparts may raise
# non-egal exceptions, it will not impact the compilation validity, since:
# - the results of the concrete evaluation will not be inlined
# - the exception types from the concrete evaluation will not be propagated
is_consistent_overlay(effects))
return :concrete_eval
end
# disable concrete-evaluation if this function call is tainted by some overlayed
Expand Down Expand Up @@ -2819,7 +2822,7 @@ function override_effects(effects::Effects, override::EffectsOverride)
notaskstate = override.notaskstate ? true : effects.notaskstate,
inaccessiblememonly = override.inaccessiblememonly ? ALWAYS_TRUE : effects.inaccessiblememonly,
noub = override.noub ? ALWAYS_TRUE :
override.noub_if_noinbounds && effects.noub !== ALWAYS_TRUE ? NOUB_IF_NOINBOUNDS :
(override.noub_if_noinbounds && effects.noub !== ALWAYS_TRUE) ? NOUB_IF_NOINBOUNDS :
effects.noub)
end

Expand Down
Loading

0 comments on commit 2f06a31

Please sign in to comment.