diff --git a/base/loading.jl b/base/loading.jl index 1ea4412ecc68f..3c672d075523d 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1948,7 +1948,7 @@ function _require(pkg::PkgId, env=nothing) end end - if JLOptions().use_compiled_modules != 0 + if JLOptions().use_compiled_modules == 1 if (0 == ccall(:jl_generating_output, Cint, ())) || (JLOptions().incremental != 0) if !pkg_precompile_attempted && isinteractive() && isassigned(PKG_PRECOMPILE_HOOK) pkg_precompile_attempted = true diff --git a/base/util.jl b/base/util.jl index 3ccdd0a37ae68..0a983d454b795 100644 --- a/base/util.jl +++ b/base/util.jl @@ -205,6 +205,7 @@ function julia_cmd(julia=joinpath(Sys.BINDIR, julia_exename()); cpu_target::Unio end opts.can_inline == 0 && push!(addflags, "--inline=no") opts.use_compiled_modules == 0 && push!(addflags, "--compiled-modules=no") + opts.use_compiled_modules == 2 && push!(addflags, "--compiled-modules=existing") opts.opt_level == 2 || push!(addflags, "-O$(opts.opt_level)") opts.opt_level_min == 0 || push!(addflags, "--min-optlevel=$(opts.opt_level_min)") push!(addflags, "-g$(opts.debug_level)") diff --git a/doc/src/manual/command-line-interface.md b/doc/src/manual/command-line-interface.md index 01e2863f56e64..d52ff1bd499f7 100644 --- a/doc/src/manual/command-line-interface.md +++ b/doc/src/manual/command-line-interface.md @@ -101,7 +101,7 @@ The following is a complete list of command-line switches available when launchi |`--startup-file={yes*\|no}` |Load `JULIA_DEPOT_PATH/config/startup.jl`; if `JULIA_DEPOT_PATH` environment variable is unset, load `~/.julia/config/startup.jl`| |`--handle-signals={yes*\|no}` |Enable or disable Julia's default signal handlers| |`--sysimage-native-code={yes*\|no}` |Use native code from system image if available| -|`--compiled-modules={yes*\|no}` |Enable or disable incremental precompilation of modules| +|`--compiled-modules={yes*\|no|existing}` |Enable or disable incremental precompilation of modules. The `existing` option allows use of existing compiled modules that were previously precompiled, but disallows creation of new precompile files.| |`--pkgimages={yes*\|no}` |Enable or disable usage of native code caching in the form of pkgimages| |`-e`, `--eval ` |Evaluate ``| |`-E`, `--print ` |Evaluate `` and display the result| diff --git a/src/jloptions.c b/src/jloptions.c index b520305a4bdfe..21a7e81bb9743 100644 --- a/src/jloptions.c +++ b/src/jloptions.c @@ -110,7 +110,7 @@ static const char opts[] = " --handle-signals={yes*|no} Enable or disable Julia's default signal handlers\n" " --sysimage-native-code={yes*|no}\n" " Use native code from system image if available\n" - " --compiled-modules={yes*|no}\n" + " --compiled-modules={yes*|no|existing}\n" " Enable or disable incremental precompilation of modules\n" " --pkgimages={yes*|no}\n" " Enable or disable usage of native code caching in the form of pkgimages ($)\n\n" @@ -460,8 +460,10 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp) jl_options.use_compiled_modules = JL_OPTIONS_USE_COMPILED_MODULES_YES; else if (!strcmp(optarg,"no")) jl_options.use_compiled_modules = JL_OPTIONS_USE_COMPILED_MODULES_NO; + else if (!strcmp(optarg,"existing")) + jl_options.use_compiled_modules = JL_OPTIONS_USE_COMPILED_MODULES_EXISTING; else - jl_errorf("julia: invalid argument to --compiled-modules={yes|no} (%s)", optarg); + jl_errorf("julia: invalid argument to --compiled-modules={yes|no|existing} (%s)", optarg); break; case opt_pkgimages: pkgimage_explicit = 1; diff --git a/src/julia.h b/src/julia.h index 5af8a5bc1a170..9c5f0d519de0f 100644 --- a/src/julia.h +++ b/src/julia.h @@ -2295,6 +2295,7 @@ JL_DLLEXPORT int jl_generating_output(void) JL_NOTSAFEPOINT; #define JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES 1 #define JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_NO 0 +#define JL_OPTIONS_USE_COMPILED_MODULES_EXISTING 2 #define JL_OPTIONS_USE_COMPILED_MODULES_YES 1 #define JL_OPTIONS_USE_COMPILED_MODULES_NO 0