diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index a688be130711c..0000000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM julia:latest - -RUN apt-get update && apt-get install -y build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config git diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a3747ca019694..455f8bea3e952 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,8 +1,12 @@ { - "extensions": [ - "julialang.language-julia", - "ms-vscode.cpptools" - ], - - "dockerFile": "Dockerfile" + "image": "docker.io/library/julia:latest", + "customizations": { + "vscode": { + "extensions": [ + "julialang.language-julia", + "ms-vscode.cpptools" + ] + } + }, + "onCreateCommand": "apt-get update && apt-get install -y build-essential libatomic1 python3 gfortran perl wget m4 cmake pkg-config git" } diff --git a/.github/workflows/LabelCheck.yml b/.github/workflows/LabelCheck.yml index 194b0c92065c9..84bdb74150e6c 100644 --- a/.github/workflows/LabelCheck.yml +++ b/.github/workflows/LabelCheck.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 2 steps: - - uses: yogevbd/enforce-label-action@2.2.2 + - uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 # 2.2.2 with: # REQUIRED_LABELS_ANY: "bug,enhancement,skip-changelog" # REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['bug','enhancement','skip-changelog']" diff --git a/.github/workflows/Typos.yml b/.github/workflows/Typos.yml index da5a6a550abe8..67a05f23ef58d 100644 --- a/.github/workflows/Typos.yml +++ b/.github/workflows/Typos.yml @@ -11,7 +11,7 @@ jobs: timeout-minutes: 5 steps: - name: Checkout the JuliaLang/julia repository - uses: actions/checkout@v4 + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: persist-credentials: false - name: Check spelling with typos diff --git a/base/lock.jl b/base/lock.jl index 1d63e51f08b15..9335c3dbad2f1 100644 --- a/base/lock.jl +++ b/base/lock.jl @@ -263,7 +263,7 @@ This is similar to using [`lock`](@ref) with a `do` block, but avoids creating a and thus can improve the performance. !!! compat - `@lock` was added in Julia 1.3, and exported in Julia 1.10. + `@lock` was added in Julia 1.3, and exported in Julia 1.7. """ macro lock(l, expr) quote diff --git a/base/logging/logging.jl b/base/logging/logging.jl index cf0c89b46f07f..5149aa69ed1f3 100644 --- a/base/logging/logging.jl +++ b/base/logging/logging.jl @@ -129,6 +129,8 @@ end LogLevel(level::LogLevel) = level isless(a::LogLevel, b::LogLevel) = isless(a.level, b.level) +isless(a::LogLevel, b::Integer) = isless(a.level, b) +isless(a::Integer, b::LogLevel) = isless(a, b.level) +(level::LogLevel, inc::Integer) = LogLevel(level.level+inc) -(level::LogLevel, inc::Integer) = LogLevel(level.level-inc) convert(::Type{LogLevel}, level::Integer) = LogLevel(level) diff --git a/base/stream.jl b/base/stream.jl index a31469af27e53..2435c3b1b186c 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -1249,7 +1249,15 @@ function _redirect_io_libc(stream, unix_fd::Int) -10 - unix_fd, Libc._get_osfhandle(posix_fd)) end end - dup(posix_fd, RawFD(unix_fd)) + GC.@preserve stream dup(posix_fd, RawFD(unix_fd)) + nothing +end +function _redirect_io_cglobal(handle::Union{LibuvStream, IOStream, Nothing}, unix_fd::Int) + c_sym = unix_fd == 0 ? cglobal(:jl_uv_stdin, Ptr{Cvoid}) : + unix_fd == 1 ? cglobal(:jl_uv_stdout, Ptr{Cvoid}) : + unix_fd == 2 ? cglobal(:jl_uv_stderr, Ptr{Cvoid}) : + C_NULL + c_sym == C_NULL || unsafe_store!(c_sym, handle === nothing ? Ptr{Cvoid}(unix_fd) : handle.handle) nothing end function _redirect_io_global(io, unix_fd::Int) @@ -1260,11 +1268,7 @@ function _redirect_io_global(io, unix_fd::Int) end function (f::RedirectStdStream)(handle::Union{LibuvStream, IOStream}) _redirect_io_libc(handle, f.unix_fd) - c_sym = f.unix_fd == 0 ? cglobal(:jl_uv_stdin, Ptr{Cvoid}) : - f.unix_fd == 1 ? cglobal(:jl_uv_stdout, Ptr{Cvoid}) : - f.unix_fd == 2 ? cglobal(:jl_uv_stderr, Ptr{Cvoid}) : - C_NULL - c_sym == C_NULL || unsafe_store!(c_sym, handle.handle) + _redirect_io_cglobal(handle, f.unix_fd) _redirect_io_global(handle, f.unix_fd) return handle end @@ -1273,6 +1277,7 @@ function (f::RedirectStdStream)(::DevNull) handle = open(nulldev, write=f.writable) _redirect_io_libc(handle, f.unix_fd) close(handle) # handle has been dup'ed in _redirect_io_libc + _redirect_io_cglobal(nothing, f.unix_fd) _redirect_io_global(devnull, f.unix_fd) return devnull end diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl index 43b6f89712d2b..2fcbf905b05b5 100644 --- a/contrib/generate_precompile.jl +++ b/contrib/generate_precompile.jl @@ -315,8 +315,8 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe uuid = "$pkguuid" """) touch(joinpath(pkgpath, "Manifest.toml")) - tmp_prec = tempname(prec_path) - tmp_proc = tempname(prec_path) + tmp_prec = tempname(prec_path; cleanup=false) + tmp_proc = tempname(prec_path; cleanup=false) s = """ pushfirst!(DEPOT_PATH, $(repr(joinpath(prec_path,"depot")))); Base.PRECOMPILE_TRACE_COMPILE[] = $(repr(tmp_prec)); diff --git a/deps/checksums/SparseArrays-242035184c0d539bdb5e64bf26eb7726b123db14.tar.gz/md5 b/deps/checksums/SparseArrays-242035184c0d539bdb5e64bf26eb7726b123db14.tar.gz/md5 deleted file mode 100644 index 2f95a7d6f3947..0000000000000 --- a/deps/checksums/SparseArrays-242035184c0d539bdb5e64bf26eb7726b123db14.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -eb9ce9d568c5ff313c09c4f2caf26d13 diff --git a/deps/checksums/SparseArrays-242035184c0d539bdb5e64bf26eb7726b123db14.tar.gz/sha512 b/deps/checksums/SparseArrays-242035184c0d539bdb5e64bf26eb7726b123db14.tar.gz/sha512 deleted file mode 100644 index c55bbe86e3e24..0000000000000 --- a/deps/checksums/SparseArrays-242035184c0d539bdb5e64bf26eb7726b123db14.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -fbd3876eab248aee95b34e09fff4366db42fd2e1692e063ef8362256dccbc9b1548ea8f3106065e7310834edbe0ed176466ad2bb64a91af3386d0e9d0db1f929 diff --git a/deps/checksums/SparseArrays-e4ffd9f08f891103cf59f2ad32fcf38d75812f86.tar.gz/md5 b/deps/checksums/SparseArrays-e4ffd9f08f891103cf59f2ad32fcf38d75812f86.tar.gz/md5 new file mode 100644 index 0000000000000..8a07a9862643c --- /dev/null +++ b/deps/checksums/SparseArrays-e4ffd9f08f891103cf59f2ad32fcf38d75812f86.tar.gz/md5 @@ -0,0 +1 @@ +3ae2eebb167edd93aa2b67aef56f1764 diff --git a/deps/checksums/SparseArrays-e4ffd9f08f891103cf59f2ad32fcf38d75812f86.tar.gz/sha512 b/deps/checksums/SparseArrays-e4ffd9f08f891103cf59f2ad32fcf38d75812f86.tar.gz/sha512 new file mode 100644 index 0000000000000..4781a7c699523 --- /dev/null +++ b/deps/checksums/SparseArrays-e4ffd9f08f891103cf59f2ad32fcf38d75812f86.tar.gz/sha512 @@ -0,0 +1 @@ +bb8e24a95e84e59aa296b5b3d584e35dddf6cace926afb919c03c5d560aefbb7f6ad1442d0b2bf104212c62d8f578f5fb4e2c6dfdea196a0fae9bdf61527d8fa diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp index 94fe3e65c4d6e..ffb5d528ae704 100644 --- a/src/aotcompile.cpp +++ b/src/aotcompile.cpp @@ -115,6 +115,15 @@ void jl_get_llvm_gvs_impl(void *native_code, arraylist_t *gvs) memcpy(gvs->items, data->jl_value_to_llvm.data(), gvs->len * sizeof(void*)); } +extern "C" JL_DLLEXPORT_CODEGEN +void jl_get_llvm_gvs_globals_impl(void *native_code, arraylist_t *gvs) +{ + // map a memory location (jl_value_t or jl_binding_t) to a GlobalVariable + jl_native_code_desc_t *data = (jl_native_code_desc_t*)native_code; + arraylist_grow(gvs, data->jl_sysimg_gvars.size()); + memcpy(gvs->items, data->jl_sysimg_gvars.data(), gvs->len * sizeof(void*)); +} + extern "C" JL_DLLEXPORT_CODEGEN void jl_get_llvm_external_fns_impl(void *native_code, arraylist_t *external_fns) { @@ -715,7 +724,6 @@ static FunctionInfo getFunctionWeight(const Function &F) } struct ModuleInfo { - Triple triple; size_t globals; size_t funcs; size_t bbs; @@ -726,7 +734,6 @@ struct ModuleInfo { ModuleInfo compute_module_info(Module &M) { ModuleInfo info; - info.triple = Triple(M.getTargetTriple()); info.globals = 0; info.funcs = 0; info.bbs = 0; @@ -1519,12 +1526,6 @@ static unsigned compute_image_thread_count(const ModuleInfo &info) { #endif if (jl_is_timing_passes) // LLVM isn't thread safe when timing the passes https://github.com/llvm/llvm-project/issues/44417 return 1; - // COFF has limits on external symbols (even hidden) up to 65536. We reserve the last few - // for any of our other symbols that we insert during compilation. - if (info.triple.isOSBinFormatCOFF() && info.globals > 64000) { - LLVM_DEBUG(dbgs() << "COFF is restricted to a single thread for large images\n"); - return 1; - } // This is not overridable because empty modules do occasionally appear, but they'll be very small and thus exit early to // known easy behavior. Plus they really don't warrant multiple threads if (info.weight < 1000) { diff --git a/src/codegen-stubs.c b/src/codegen-stubs.c index e81c66a8d5d44..7dfe469e8dff4 100644 --- a/src/codegen-stubs.c +++ b/src/codegen-stubs.c @@ -14,6 +14,7 @@ JL_DLLEXPORT void jl_dump_native_fallback(void *native_code, const char *bc_fname, const char *unopt_bc_fname, const char *obj_fname, const char *asm_fname, ios_t *z, ios_t *s) UNAVAILABLE JL_DLLEXPORT void jl_get_llvm_gvs_fallback(void *native_code, arraylist_t *gvs) UNAVAILABLE +JL_DLLEXPORT void jl_get_llvm_gvs_globals_fallback(void *native_code, arraylist_t *gvs) UNAVAILABLE JL_DLLEXPORT void jl_get_llvm_external_fns_fallback(void *native_code, arraylist_t *gvs) UNAVAILABLE JL_DLLEXPORT void jl_extern_c_fallback(jl_function_t *f, jl_value_t *rt, jl_value_t *argt, char *name) UNAVAILABLE diff --git a/src/gf.c b/src/gf.c index 8c660cb744fcf..5235479ac3cc3 100644 --- a/src/gf.c +++ b/src/gf.c @@ -1503,7 +1503,7 @@ static jl_method_instance_t *jl_mt_assoc_by_type(jl_methtable_t *mt JL_PROPAGATE if (!mi) { size_t min_valid = 0; size_t max_valid = ~(size_t)0; - matc = _gf_invoke_lookup((jl_value_t*)tt, jl_nothing, world, &min_valid, &max_valid); + matc = _gf_invoke_lookup((jl_value_t*)tt, (jl_value_t*)mt, world, &min_valid, &max_valid); if (matc) { jl_method_t *m = matc->method; jl_svec_t *env = matc->sparams; diff --git a/src/jl_exported_funcs.inc b/src/jl_exported_funcs.inc index e5a4f55a069ee..442720c784623 100644 --- a/src/jl_exported_funcs.inc +++ b/src/jl_exported_funcs.inc @@ -531,6 +531,7 @@ YY(jl_get_LLVM_VERSION) \ YY(jl_dump_native) \ YY(jl_get_llvm_gvs) \ + YY(jl_get_llvm_gvs_globals) \ YY(jl_get_llvm_external_fns) \ YY(jl_dump_function_asm) \ YY(jl_LLVMCreateDisasm) \ diff --git a/src/julia_internal.h b/src/julia_internal.h index dff769e7e0f66..7ba1b6e7e8b63 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -1738,6 +1738,7 @@ JL_DLLIMPORT void jl_dump_native(void *native_code, const char *bc_fname, const char *unopt_bc_fname, const char *obj_fname, const char *asm_fname, ios_t *z, ios_t *s, jl_emission_params_t *params); JL_DLLIMPORT void jl_get_llvm_gvs(void *native_code, arraylist_t *gvs); +JL_DLLIMPORT void jl_get_llvm_gvs_globals(void *native_code, arraylist_t *gvs); JL_DLLIMPORT void jl_get_llvm_external_fns(void *native_code, arraylist_t *gvs); JL_DLLIMPORT void jl_get_function_id(void *native_code, jl_code_instance_t *ncode, int32_t *func_idx, int32_t *specfunc_idx); diff --git a/src/llvm-alloc-opt.cpp b/src/llvm-alloc-opt.cpp index c343912b385f9..428be4e47b88a 100644 --- a/src/llvm-alloc-opt.cpp +++ b/src/llvm-alloc-opt.cpp @@ -681,6 +681,7 @@ void Optimizer::moveToStack(CallInst *orig_inst, size_t sz, bool has_ref, AllocF IRBuilder<> builder(orig_inst); initializeAlloca(builder, buff, allockind); } + buff->copyMetadata(*orig_inst); Instruction *new_inst = cast(prolog_builder.CreateBitCast(ptr, JuliaType::get_pjlvalue_ty(prolog_builder.getContext(), buff->getType()->getPointerAddressSpace()))); new_inst->takeName(orig_inst); diff --git a/src/task.c b/src/task.c index 0934f83e20a88..46e16e8795672 100644 --- a/src/task.c +++ b/src/task.c @@ -227,10 +227,6 @@ static void NOINLINE save_stack(jl_ptls_t ptls, jl_task_t *lastt, jl_task_t **pt lastt->copy_stack = nb; lastt->sticky = 1; memcpy_stack_a16((uint64_t*)buf, (uint64_t*)frame_addr, nb); - // this task's stack could have been modified after - // it was marked by an incremental collection - // move the barrier back instead of walking it again here - jl_gc_wb_back(lastt); } JL_NO_ASAN static void NOINLINE JL_NORETURN restore_stack(jl_task_t *t, jl_ptls_t ptls, char *p) @@ -493,6 +489,12 @@ JL_NO_ASAN static void ctx_switch(jl_task_t *lastt) #endif *pt = NULL; // can't fail after here: clear the gc-root for the target task now } + // this task's stack or scope field could have been modified after + // it was marked by an incremental collection + // move the barrier back instead of walking the shadow stack again here to check if that is required + // even if killed (dropping the stack) and just the scope field matters, + // let the gc figure that out next time it does a quick mark + jl_gc_wb_back(lastt); // set up global state for new task and clear global state for old task t->ptls = ptls; diff --git a/stdlib/Logging/test/runtests.jl b/stdlib/Logging/test/runtests.jl index 7250fc62d058e..b27ca0439b806 100644 --- a/stdlib/Logging/test/runtests.jl +++ b/stdlib/Logging/test/runtests.jl @@ -19,6 +19,13 @@ macro customlog(exs...) Base.CoreLogging.logmsg_code((Base.CoreLogging.@_sourcei @test :handle_message in names(Logging, all=true) # non-exported public function end +@testset "LogLevel compatibility with integers" begin + @test Logging.Debug + 1000 == Logging.Info + @test Logging.Warn - 1000 == Logging.Info + @test Logging.Info < 500 + @test 500 < Logging.Warn +end + @testset "ConsoleLogger" begin # First pass log limiting @test min_enabled_level(ConsoleLogger(devnull, Logging.Debug)) == Logging.Debug diff --git a/stdlib/Makefile b/stdlib/Makefile index d478d2ad4c188..8705f8438bd0f 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -15,6 +15,7 @@ include $(JULIAHOME)/deps/*.version VERSDIR := v$(shell cut -d. -f1-2 < $(JULIAHOME)/VERSION) DIRS := $(build_datarootdir)/julia/stdlib/$(VERSDIR) $(build_prefix)/manifest/$(VERSDIR) + $(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir)))) JLLS = DSFMT GMP CURL LIBGIT2 LLVM LIBSSH2 LIBUV MBEDTLS MPFR NGHTTP2 \ @@ -61,8 +62,19 @@ $(foreach module, $(STDLIBS), $(eval $(call symlink_target,$$(JULIAHOME)/stdlib/ STDLIBS_LINK_TARGETS := $(addprefix $(build_datarootdir)/julia/stdlib/$(VERSDIR)/,$(STDLIBS)) +remove-gpl-libs: +ifeq ($(USE_GPL_LIBS),0) + @echo Removing GPL libs... + -rm -f $(build_private_libdir)/libcholmod* + -rm -f $(build_private_libdir)/libklu_cholmod* + -rm -f $(build_private_libdir)/librbio* + -rm -f $(build_private_libdir)/libspqr* + -rm -f $(build_private_libdir)/libumfpack* +endif + getall get: $(addprefix get-, $(STDLIBS_EXT) $(JLL_NAMES)) -install: version-check $(addprefix install-, $(STDLIBS_EXT) $(JLL_NAMES)) $(STDLIBS_LINK_TARGETS) + +install: version-check $(addprefix install-, $(STDLIBS_EXT) $(JLL_NAMES)) $(STDLIBS_LINK_TARGETS) remove-gpl-libs version-check: $(addprefix version-check-, $(STDLIBS_EXT)) uninstall: $(addprefix uninstall-, $(STDLIBS_EXT)) extstdlibclean: diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index cb91d38d0cadd..0442002a4b508 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -1690,25 +1690,10 @@ function repl_eval_counter(hp) end function out_transform(@nospecialize(x), n::Ref{Int}) - return Expr(:toplevel, get_usings!([], x)..., quote - let __temp_val_a72df459 = $x - $capture_result($n, __temp_val_a72df459) - __temp_val_a72df459 - end - end) -end - -function get_usings!(usings, ex) - ex isa Expr || return usings - # get all `using` and `import` statements which are at the top level - for (i, arg) in enumerate(ex.args) - if Base.isexpr(arg, :toplevel) - get_usings!(usings, arg) - elseif Base.isexpr(arg, [:using, :import]) - push!(usings, popat!(ex.args, i)) - end - end - return usings + return Expr(:block, # avoid line numbers or scope that would leak into the output and change the meaning of x + :(local __temp_val_a72df459 = $x), + Expr(:call, capture_result, n, :__temp_val_a72df459), + :__temp_val_a72df459) end function capture_result(n::Ref{Int}, @nospecialize(x)) diff --git a/stdlib/Random/src/RNGs.jl b/stdlib/Random/src/RNGs.jl index 2ea2fb3a684df..6c8fc684d8e53 100644 --- a/stdlib/Random/src/RNGs.jl +++ b/stdlib/Random/src/RNGs.jl @@ -287,7 +287,7 @@ function random_seed() # almost surely always getting distinct seeds, while having them printed reasonably tersely return rand(RandomDevice(), UInt128) catch ex - ex isa IOError || rethrow() + ex isa Base.IOError || rethrow() @warn "Entropy pool not available to seed RNG; using ad-hoc entropy sources." return Libc.rand() end diff --git a/stdlib/SparseArrays.version b/stdlib/SparseArrays.version index 41c5d6b42479d..44a339e4c63a5 100644 --- a/stdlib/SparseArrays.version +++ b/stdlib/SparseArrays.version @@ -1,4 +1,4 @@ SPARSEARRAYS_BRANCH = release-1.11 -SPARSEARRAYS_SHA1 = 242035184c0d539bdb5e64bf26eb7726b123db14 +SPARSEARRAYS_SHA1 = e4ffd9f08f891103cf59f2ad32fcf38d75812f86 SPARSEARRAYS_GIT_URL := https://github.com/JuliaSparse/SparseArrays.jl.git SPARSEARRAYS_TAR_URL = https://api.github.com/repos/JuliaSparse/SparseArrays.jl/tarball/$1 diff --git a/test/compiler/contextual.jl b/test/compiler/contextual.jl index bbcf7b0dfb959..7f25a922ff4fa 100644 --- a/test/compiler/contextual.jl +++ b/test/compiler/contextual.jl @@ -150,6 +150,32 @@ methods = Base._methods_by_ftype(Tuple{typeof(sin), Float64}, OverlayModule.mt, methods = Base._methods_by_ftype(Tuple{typeof(sin), Int}, OverlayModule.mt, 1, Base.get_world_counter()) @test isempty(methods) +# fresh module to ensure uncached methods +module OverlayMTTest + using Base.Experimental: @MethodTable, @overlay + @MethodTable(mt) + + function overlay_only end + @overlay mt overlay_only(x::Int) = x * 2 +end + +# #60702 & #60716: Overlay methods must be found without prior cache population +let world = Base.get_world_counter() + mi = Base.method_instance(OverlayMTTest.overlay_only, Tuple{Int}; + world, method_table=OverlayMTTest.mt) + @test mi isa Core.MethodInstance + @test mi.def.module === OverlayMTTest +end + +# #60712: Global-only methods must NOT be found via custom MT +let + @eval global_only_func(x::Int) = x + 1 + world = Base.get_world_counter() + mi = Base.method_instance(global_only_func, Tuple{Int}; + world, method_table=OverlayMTTest.mt) + @test mi === nothing +end + # precompilation load_path = mktempdir()