Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --compiled-modules=existing command line option #50586

Merged
merged 2 commits into from
Jul 19, 2023
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/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <expr>` |Evaluate `<expr>`|
|`-E`, `--print <expr>` |Evaluate `<expr>` and display the result|
Expand Down
6 changes: 4 additions & 2 deletions src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down