diff --git a/base/client.jl b/base/client.jl index f7fe7b2d3fad7..7fa89f73ac5ba 100644 --- a/base/client.jl +++ b/base/client.jl @@ -273,11 +273,14 @@ function exec_options(opts) end # Maybe redefine bounds checking if requested - if JLOptions().check_bounds != 0 - if JLOptions().check_bounds == 1 - Core.eval(Main, :(Core.should_check_bounds(boundscheck::Bool) = true)) - else - Core.eval(Main, :(Core.should_check_bounds(boundscheck::Bool) = false)) + if ccall(:jl_generating_output, Cint, ()) == 0 + # Inoperative during output generation. Determined by mandatory deps mechanism. + if JLOptions().check_bounds != 0 + if JLOptions().check_bounds == 1 + require(PkgId(UUID((0xb3a877e5_8181_4b4a, 0x8173_0b9cb13136fe)),"--check-bounds=yes")) + else + require(PkgId(UUID((0x5ece1bc4_2007_43a8, 0xac47_40059be74678)),"--check-bounds=no")) + end end end diff --git a/base/loading.jl b/base/loading.jl index facc1d4fbd684..1c95b93dc5662 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -2924,7 +2924,7 @@ function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String; stale_age=300) pid, hostname, age = invokelatest(parse_pidfile_hook, pidfile) verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug if isempty(hostname) || hostname == gethostname() - @logmsg verbosity "Waiting for another process (pid: $pid) to finish precompiling $pkg" + @logmsg verbosity "Waiting for another process (pid: $pid) to finish precompiling $pkg (pidfile: $pidfile)" else @logmsg verbosity "Waiting for another machine (hostname: $hostname, pid: $pid) to finish precompiling $pkg" end diff --git a/pkgimage.mk b/pkgimage.mk index c9d1cc826dff1..f0e83101db92f 100644 --- a/pkgimage.mk +++ b/pkgimage.mk @@ -33,18 +33,24 @@ all-release: $(addprefix cache-release-, $(STDLIBS)) all-debug: $(addprefix cache-debug-, $(STDLIBS)) define pkgimg_builder -$1_SRCS := $$(shell find $$(build_datarootdir)/julia/stdlib/$$(VERSDIR)/$1/src -name \*.jl) \ +PKGIMG_SRCS := $$(shell find "$$(build_datarootdir)/julia/stdlib/$$(VERSDIR)/$1/src" -name \*.jl) \ $$(wildcard $$(build_prefix)/manifest/$$(VERSDIR)/$1) -$$(BUILDDIR)/stdlib/$1.release.image: $$($1_SRCS) $$(addsuffix .release.image,$$(addprefix $$(BUILDDIR)/stdlib/,$2)) $(build_private_libdir)/sys.$(SHLIB_EXT) -# @$$(call PRINT_JULIA, $$(call spawn,$$(JULIA_EXECUTABLE)) --startup-file=no --check-bounds=yes -e 'Base.compilecache(Base.identify_package("$1"))') +PKGIMG_SENTINEL_NAME = $(subst =,_EQ_,$1) +$$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).release.image: $$(PKGIMG_SRCS) $$(addsuffix .release.image,$$(addprefix $$(BUILDDIR)/stdlib/,$2)) $(build_private_libdir)/sys.$(SHLIB_EXT) @$$(call PRINT_JULIA, $$(call spawn,$$(JULIA_EXECUTABLE)) --startup-file=no -e 'Base.compilecache(Base.identify_package("$1"))') touch $$@ -cache-release-$1: $$(BUILDDIR)/stdlib/$1.release.image -$$(BUILDDIR)/stdlib/$1.debug.image: $$($1_SRCS) $$(addsuffix .debug.image,$$(addprefix $$(BUILDDIR)/stdlib/,$2)) $(build_private_libdir)/sys-debug.$(SHLIB_EXT) -# @$$(call PRINT_JULIA, $$(call spawn,$$(JULIA_EXECUTABLE)) --startup-file=no --check-bounds=yes -e 'Base.compilecache(Base.identify_package("$1"))') +$$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).release.checkbounds.image: $$(PKGIMG_SRCS) $$(addsuffix .release.checkbounds.image,$$(addprefix $$(BUILDDIR)/stdlib/,$2)) $$(BUILDDIR)/stdlib/--check-bounds_EQ_yes.release.image $(build_private_libdir)/sys.$(SHLIB_EXT) + @$$(call PRINT_JULIA, $$(call spawn,$$(JULIA_EXECUTABLE)) --startup-file=no --check-bounds=yes -e 'Base.compilecache(Base.identify_package("$1"))') + touch $$@ +cache-release-$$(PKGIMG_SENTINEL_NAME): $$(BUILDDIR)/stdlib/$1.release.image $$(BUILDDIR)/stdlib/$1.release.checkbounds.image +$$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).debug.image: $$(PKGIMG_SRCS) $$(addsuffix .debug.image,$$(addprefix $$(BUILDDIR)/stdlib/,$2)) $(build_private_libdir)/sys-debug.$(SHLIB_EXT) @$$(call PRINT_JULIA, $$(call spawn,$$(JULIA_EXECUTABLE)) --startup-file=no -e 'Base.compilecache(Base.identify_package("$1"))') -cache-debug-$1: $$(BUILDDIR)/stdlib/$1.debug.image -.SECONDARY: $$(BUILDDIR)/stdlib/$1.release.image $$(BUILDDIR)/stdlib/$1.debug.image + touch $$@ +$$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).debug.checkbounds.image: $$(PKGIMG_SRCS) $$(addsuffix .debug.checkbounds.image,$$(addprefix $$(BUILDDIR)/stdlib/,$2)) $$(BUILDDIR)/stdlib/--check-bounds_EQ_yes.debug.image $(build_private_libdir)/sys-debug.$(SHLIB_EXT) + @$$(call PRINT_JULIA, $$(call spawn,$$(JULIA_EXECUTABLE)) --startup-file=no --check-bounds=yes -e 'Base.compilecache(Base.identify_package("$1"))') + touch $$@ +cache-debug-$$(PKGIMG_SENTINEL_NAME): $$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).debug.image $$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).debug.checkbounds.image +.SECONDARY: $$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).release.image $$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).release.checkbounds.image $$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).debug.image $$(BUILDDIR)/stdlib/$$(PKGIMG_SENTINEL_NAME).debug.checkbounds.image endef # Used to just define them in the dependency graph @@ -52,14 +58,19 @@ endef define sysimg_builder $$(BUILDDIR)/stdlib/$1.release.image: touch $$@ -cache-release-$1: $$(BUILDDIR)/stdlib/$1.release.image +$$(BUILDDIR)/stdlib/$1.release.checkbounds.image: + touch $$@ +cache-release-$1: $$(BUILDDIR)/stdlib/$1.release.image $$(BUILDDIR)/stdlib/$1.release.checkbounds.image $$(BUILDDIR)/stdlib/$1.debug.image: touch $$@ -cache-debug-$1: $$(BUILDDIR)/stdlib/$1.debug.image -.SECONDARY: $$(BUILDDIR)/stdlib/$1.release.image $$(BUILDDIR)/stdlib/$1.debug.image +$$(BUILDDIR)/stdlib/$1.debug.checkbounds.image: + touch $$@ +cache-debug-$1: $$(BUILDDIR)/stdlib/$1.debug.image $$(BUILDDIR)/stdlib/$1.debug.checkbounds.image +.SECONDARY: $$(BUILDDIR)/stdlib/$1.release.image $$(BUILDDIR)/stdlib/$1.release.checkbounds.image $$(BUILDDIR)/stdlib/$1.debug.image $$(BUILDDIR)/stdlib/$1.debug.checkbounds.image endef # no dependencies +$(eval $(call pkgimg_builder,--check-bounds=yes,)) $(eval $(call pkgimg_builder,MozillaCACerts_jll,)) $(eval $(call sysimg_builder,ArgTools,)) $(eval $(call sysimg_builder,Artifacts,)) diff --git a/stdlib/--check-bounds=no/Project.toml b/stdlib/--check-bounds=no/Project.toml new file mode 100644 index 0000000000000..f5eb68491a096 --- /dev/null +++ b/stdlib/--check-bounds=no/Project.toml @@ -0,0 +1,2 @@ +name = "--check-bounds=no" +uuid = "5ece1bc4-2007-43a8-ac47-40059be74678" diff --git a/stdlib/--check-bounds=no/src/--check-bounds=no.jl b/stdlib/--check-bounds=no/src/--check-bounds=no.jl new file mode 100644 index 0000000000000..161ac88fdded4 --- /dev/null +++ b/stdlib/--check-bounds=no/src/--check-bounds=no.jl @@ -0,0 +1,8 @@ +__precompile__(:mandatory) +module var"--check-bounds=no" + +@Base.recompile_invalidations begin + Core.should_check_bounds(boundscheck::Bool) = false +end + +end diff --git a/stdlib/--check-bounds=yes/Project.toml b/stdlib/--check-bounds=yes/Project.toml new file mode 100644 index 0000000000000..81f1391f1478a --- /dev/null +++ b/stdlib/--check-bounds=yes/Project.toml @@ -0,0 +1,2 @@ +name = "--check-bounds=yes" +uuid = "b3a877e5-8181-4b4a-8173-0b9cb13136fe" \ No newline at end of file diff --git a/stdlib/--check-bounds=yes/src/--check-bounds=yes.jl b/stdlib/--check-bounds=yes/src/--check-bounds=yes.jl new file mode 100644 index 0000000000000..4a8dba504fee5 --- /dev/null +++ b/stdlib/--check-bounds=yes/src/--check-bounds=yes.jl @@ -0,0 +1,8 @@ +__precompile__(:mandatory) +module var"--check-bounds=yes" + +@Base.recompile_invalidations begin + Core.should_check_bounds(boundscheck::Bool) = true +end + +end diff --git a/stdlib/Makefile b/stdlib/Makefile index e42061d593905..5dccd4b628931 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -43,7 +43,7 @@ $(foreach jll,$(JLLS),$(eval $(call download-artifacts-toml,$(jll)))) STDLIBS = Artifacts Base64 CRC32c Dates Distributed FileWatching \ Future InteractiveUtils LazyArtifacts Libdl LibGit2 LinearAlgebra Logging \ Markdown Mmap Printf Profile Random REPL Serialization \ - SharedArrays Sockets Test TOML Unicode UUIDs \ + SharedArrays Sockets Test TOML Unicode UUIDs --check-bounds=yes --check-bounds=no \ $(JLL_NAMES) STDLIBS_EXT = Pkg Statistics LibCURL DelimitedFiles Downloads ArgTools Tar NetworkOptions SuiteSparse SparseArrays SHA