Skip to content

Commit 61c7386

Browse files
authored
Merge pull request #23616 from JuliaLang/jb/cli1
rename `--precompiled` and `--compilecache` command line options
2 parents fa2298f + d204150 commit 61c7386

File tree

13 files changed

+82
-64
lines changed

13 files changed

+82
-64
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ Command-line option changes
433433
The `--quiet` option implies `--banner=no` even in REPL mode but can be overridden by
434434
passing `--quiet` together with `--banner=yes` ([#23342]).
435435

436+
* The option `--precompiled` has been renamed to `--sysimage-native-code` ([#23054]).
437+
438+
* The option `--compilecache` has been renamed to `--compiled-modules` ([#23054]).
439+
436440
Julia v0.6.0 Release Notes
437441
==========================
438442

base/loading.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ order to throw an error if Julia attempts to precompile it.
269269
using `__precompile__()`. Failure to do so can result in a runtime error when loading the module.
270270
"""
271271
function __precompile__(isprecompilable::Bool=true)
272-
if (JLOptions().use_compilecache != 0 &&
272+
if (JLOptions().use_compiled_modules != 0 &&
273273
isprecompilable != (0 != ccall(:jl_generating_output, Cint, ())) &&
274274
!(isprecompilable && toplevel_load[]))
275275
throw(PrecompilableError(isprecompilable))
@@ -361,7 +361,7 @@ function _require(mod::Symbol)
361361

362362
# attempt to load the module file via the precompile cache locations
363363
doneprecompile = false
364-
if JLOptions().use_compilecache != 0
364+
if JLOptions().use_compiled_modules != 0
365365
doneprecompile = _require_search_from_serialized(mod, path)
366366
if !isa(doneprecompile, Bool)
367367
return # success
@@ -400,7 +400,7 @@ function _require(mod::Symbol)
400400
try
401401
Base.include_relative(Main, path)
402402
catch ex
403-
if doneprecompile === true || JLOptions().use_compilecache == 0 || !precompilableerror(ex, true)
403+
if doneprecompile === true || JLOptions().use_compiled_modules == 0 || !precompilableerror(ex, true)
404404
rethrow() # rethrow non-precompilable=true errors
405405
end
406406
# the file requested `__precompile__`, so try to build a cache file and use that

base/options.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ struct JLOptions
3131
worker::Int8
3232
cookie::Ptr{UInt8}
3333
handle_signals::Int8
34-
use_precompiled::Int8
35-
use_compilecache::Int8
34+
use_sysimage_native_code::Int8
35+
use_compiled_modules::Int8
3636
bindto::Ptr{UInt8}
3737
outputbc::Ptr{UInt8}
3838
outputunoptbc::Ptr{UInt8}

base/pkg/entry.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ function build(pkg::AbstractString, build_file::AbstractString, errfile::Abstrac
608608
cmd = ```
609609
$(Base.julia_cmd()) -O0
610610
--color=$(Base.have_color ? "yes" : "no")
611-
--compilecache=$(Bool(Base.JLOptions().use_compilecache) ? "yes" : "no")
611+
--compiled-modules=$(Bool(Base.JLOptions().use_compiled_modules) ? "yes" : "no")
612612
--history-file=no
613613
--startup-file=$(Base.JLOptions().startupfile != 2 ? "yes" : "no")
614614
--eval $code
@@ -716,7 +716,7 @@ function test!(pkg::AbstractString,
716716
$(Base.julia_cmd())
717717
--code-coverage=$(coverage ? "user" : "none")
718718
--color=$(Base.have_color ? "yes" : "no")
719-
--compilecache=$(Bool(Base.JLOptions().use_compilecache) ? "yes" : "no")
719+
--compiled-modules=$(Bool(Base.JLOptions().use_compiled_modules) ? "yes" : "no")
720720
--check-bounds=yes
721721
--warn-overwrite=yes
722722
--startup-file=$(Base.JLOptions().startupfile != 2 ? "yes" : "no")

doc/src/manual/getting-started.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ julia [switches] -- [programfile] [args...]
9999
-h, --help Print this message
100100
101101
-J, --sysimage <file> Start up with the given system image file
102-
--precompiled={yes|no} Use precompiled code from system image if available
103-
--compilecache={yes|no} Enable/disable incremental precompilation of modules
104102
-H, --home <dir> Set location of `julia` executable
105103
--startup-file={yes|no} Load ~/.juliarc.jl
106104
--handle-signals={yes|no} Enable or disable Julia's default signal handlers
105+
--sysimage-native-code={yes|no}
106+
Use native code from system image if available
107+
--compiled-modules={yes|no}
108+
Enable or disable incremental precompilation of modules
107109
108110
-e, --eval <expr> Evaluate <expr>
109111
-E, --print <expr> Evaluate and show <expr>
@@ -118,6 +120,9 @@ julia [switches] -- [programfile] [args...]
118120
--color={yes|no} Enable or disable color text
119121
--history-file={yes|no} Load or save history
120122
123+
--depwarn={yes|no|error} Enable or disable syntax and method deprecation warnings ("error" turns warnings into errors)
124+
--warn-overwrite={yes|no} Enable or disable method overwrite warnings
125+
121126
--compile={yes|no|all|min}Enable or disable JIT compiler, or request exhaustive compilation
122127
-C, --cpu-target <target> Limit usage of cpu features up to <target>
123128
-O, --optimize={0,1,2,3} Set the optimization level (default is 2 if unspecified or 3 if specified as -O)
@@ -126,9 +131,6 @@ julia [switches] -- [programfile] [args...]
126131
--check-bounds={yes|no} Emit bounds checks always or never (ignoring declarations)
127132
--math-mode={ieee,fast} Disallow or enable unsafe floating point optimizations (overrides @fastmath declaration)
128133
129-
--depwarn={yes|no|error} Enable or disable syntax and method deprecation warnings ("error" turns warnings into errors)
130-
--warn-overwrite={yes|no} Enable or disable method overwrite warnings
131-
132134
--output-o name Generate an object file (including system image data)
133135
--output-ji name Generate a system image data file (.ji)
134136
--output-bc name Generate LLVM bitcode (.bc)

doc/src/manual/modules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ A few other points to be aware of:
382382
of these and to create a single unique instance of others.
383383

384384
It is sometimes helpful during module development to turn off incremental precompilation. The
385-
command line flag `--compilecache={yes|no}` enables you to toggle module precompilation on and
386-
off. When Julia is started with `--compilecache=no` the serialized modules in the compile cache
385+
command line flag `--compiled-modules={yes|no}` enables you to toggle module precompilation on and
386+
off. When Julia is started with `--compiled-modules=no` the serialized modules in the compile cache
387387
are ignored when loading modules and module dependencies. `Base.compilecache` can still be called
388388
manually and it will respect `__precompile__()` directives for the module. The state of this command
389389
line flag is passed to [`Pkg.build`](@ref) to disable automatic precompilation triggering when installing,

src/jloptions.c

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jl_options_t jl_options = { 0, // quiet
6767
0, // worker
6868
NULL, // cookie
6969
JL_OPTIONS_HANDLE_SIGNALS_ON,
70-
JL_OPTIONS_USE_PRECOMPILED_YES,
71-
JL_OPTIONS_USE_COMPILECACHE_YES,
70+
JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES,
71+
JL_OPTIONS_USE_COMPILED_MODULES_YES,
7272
NULL, // bind-to
7373
NULL, // output-bc
7474
NULL, // output-unopt-bc
@@ -86,11 +86,13 @@ static const char opts[] =
8686

8787
// startup options
8888
" -J, --sysimage <file> Start up with the given system image file\n"
89-
" --precompiled={yes|no} Use precompiled code from system image if available\n"
90-
" --compilecache={yes|no} Enable/disable incremental precompilation of modules\n"
9189
" -H, --home <dir> Set location of `julia` executable\n"
9290
" --startup-file={yes|no} Load ~/.juliarc.jl\n"
93-
" --handle-signals={yes|no} Enable or disable Julia's default signal handlers\n\n"
91+
" --handle-signals={yes|no} Enable or disable Julia's default signal handlers\n"
92+
" --sysimage-native-code={yes|no}\n"
93+
" Use native code from system image if available\n"
94+
" --compiled-modules={yes|no}\n"
95+
" Enable or disable incremental precompilation of modules\n\n"
9496

9597
// actions
9698
" -e, --eval <expr> Evaluate <expr>\n"
@@ -109,6 +111,10 @@ static const char opts[] =
109111
" --color={yes|no} Enable or disable color text\n"
110112
" --history-file={yes|no} Load or save history\n\n"
111113

114+
// error and warning options
115+
" --depwarn={yes|no|error} Enable or disable syntax and method deprecation warnings (\"error\" turns warnings into errors)\n"
116+
" --warn-overwrite={yes|no} Enable or disable method overwrite warnings\n\n"
117+
112118
// code generation options
113119
" --compile={yes|no|all|min}Enable or disable JIT compiler, or request exhaustive compilation\n"
114120
" -C, --cpu-target <target> Limit usage of cpu features up to <target>; set to \"help\" to see the available options\n"
@@ -126,10 +132,6 @@ static const char opts[] =
126132
#endif
127133
" --math-mode={ieee,fast} Disallow or enable unsafe floating point optimizations (overrides @fastmath declaration)\n\n"
128134

129-
// error and warning options
130-
" --depwarn={yes|no|error} Enable or disable syntax and method deprecation warnings (\"error\" turns warnings into errors)\n\n"
131-
" --warn-overwrite={yes|no} Enable or disable method overwrite warnings"
132-
133135
// compiler output options
134136
" --output-o name Generate an object file (including system image data)\n"
135137
" --output-ji name Generate a system image data file (.ji)\n"
@@ -174,7 +176,9 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
174176
opt_use_precompiled,
175177
opt_use_compilecache,
176178
opt_incremental,
177-
opt_banner
179+
opt_banner,
180+
opt_sysimage_native_code,
181+
opt_compiled_modules
178182
};
179183
static const char* const shortopts = "+vhqH:e:E:L:J:C:ip:O:g:";
180184
static const struct option longopts[] = {
@@ -190,8 +194,10 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
190194
{ "print", required_argument, 0, 'E' },
191195
{ "load", required_argument, 0, 'L' },
192196
{ "sysimage", required_argument, 0, 'J' },
193-
{ "precompiled", required_argument, 0, opt_use_precompiled },
194-
{ "compilecache", required_argument, 0, opt_use_compilecache },
197+
{ "precompiled", required_argument, 0, opt_use_precompiled }, // deprecated
198+
{ "sysimage-native-code", required_argument, 0, opt_sysimage_native_code },
199+
{ "compilecache", required_argument, 0, opt_use_compilecache }, // deprecated
200+
{ "compiled-modules", required_argument, 0, opt_compiled_modules },
195201
{ "cpu-target", required_argument, 0, 'C' },
196202
{ "procs", required_argument, 0, 'p' },
197203
{ "machinefile", required_argument, 0, opt_machinefile },
@@ -331,20 +337,26 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
331337
jl_errorf("julia: invalid argument to --banner={yes|no} (%s)", optarg);
332338
break;
333339
case opt_use_precompiled:
340+
jl_printf(JL_STDOUT, "WARNING: julia --precompiled option is deprecated, use --sysimage-native-code instead.\n");
341+
// fall through
342+
case opt_sysimage_native_code:
334343
if (!strcmp(optarg,"yes"))
335-
jl_options.use_precompiled = JL_OPTIONS_USE_PRECOMPILED_YES;
344+
jl_options.use_sysimage_native_code = JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES;
336345
else if (!strcmp(optarg,"no"))
337-
jl_options.use_precompiled = JL_OPTIONS_USE_PRECOMPILED_NO;
346+
jl_options.use_sysimage_native_code = JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_NO;
338347
else
339-
jl_errorf("julia: invalid argument to --precompiled={yes|no} (%s)", optarg);
348+
jl_errorf("julia: invalid argument to --sysimage-native-code={yes|no} (%s)", optarg);
340349
break;
341350
case opt_use_compilecache:
351+
jl_printf(JL_STDOUT, "WARNING: julia --compilecache option is deprecated, use --compiled-modules instead.\n");
352+
// fall through
353+
case opt_compiled_modules:
342354
if (!strcmp(optarg,"yes"))
343-
jl_options.use_compilecache = JL_OPTIONS_USE_COMPILECACHE_YES;
355+
jl_options.use_compiled_modules = JL_OPTIONS_USE_COMPILED_MODULES_YES;
344356
else if (!strcmp(optarg,"no"))
345-
jl_options.use_compilecache = JL_OPTIONS_USE_COMPILECACHE_NO;
357+
jl_options.use_compiled_modules = JL_OPTIONS_USE_COMPILED_MODULES_NO;
346358
else
347-
jl_errorf("julia: invalid argument to --compilecache={yes|no} (%s)", optarg);
359+
jl_errorf("julia: invalid argument to --compiled-modules={yes|no} (%s)", optarg);
348360
break;
349361
case 'C': // cpu-target
350362
jl_options.cpu_target = strdup(optarg);

src/julia.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,8 @@ typedef struct {
17021702
int8_t worker;
17031703
const char *cookie;
17041704
int8_t handle_signals;
1705-
int8_t use_precompiled;
1706-
int8_t use_compilecache;
1705+
int8_t use_sysimage_native_code;
1706+
int8_t use_compiled_modules;
17071707
const char *bindto;
17081708
const char *outputbc;
17091709
const char *outputunoptbc;
@@ -1769,11 +1769,11 @@ JL_DLLEXPORT int jl_generating_output(void);
17691769
#define JL_OPTIONS_HANDLE_SIGNALS_ON 1
17701770
#define JL_OPTIONS_HANDLE_SIGNALS_OFF 0
17711771

1772-
#define JL_OPTIONS_USE_PRECOMPILED_YES 1
1773-
#define JL_OPTIONS_USE_PRECOMPILED_NO 0
1772+
#define JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES 1
1773+
#define JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_NO 0
17741774

1775-
#define JL_OPTIONS_USE_COMPILECACHE_YES 1
1776-
#define JL_OPTIONS_USE_COMPILECACHE_NO 0
1775+
#define JL_OPTIONS_USE_COMPILED_MODULES_YES 1
1776+
#define JL_OPTIONS_USE_COMPILED_MODULES_NO 0
17771777

17781778
// Version information
17791779
#include "julia_version.h"

src/staticdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static void jl_load_sysimg_so(void)
163163
#endif
164164
int imaging_mode = jl_generating_output() && !jl_options.incremental;
165165
// in --build mode only use sysimg data, not precompiled native code
166-
if (!imaging_mode && jl_options.use_precompiled==JL_OPTIONS_USE_PRECOMPILED_YES) {
166+
if (!imaging_mode && jl_options.use_sysimage_native_code==JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES) {
167167
sysimg_gvars_base = (uintptr_t*)jl_dlsym(jl_sysimg_handle, "jl_sysimg_gvars_base");
168168
sysimg_gvars_offsets = (const int32_t*)jl_dlsym(jl_sysimg_handle,
169169
"jl_sysimg_gvars_offsets");

test/cmdlineargs.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if Sys.iswindows()
99
end
1010
end
1111

12-
let exename = `$(Base.julia_cmd()) --precompiled=yes --startup-file=no`
12+
let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes --startup-file=no`
1313
# --version
1414
let v = split(read(`$exename -v`, String), "julia version ")[end]
1515
@test Base.VERSION_STRING == chomp(v)
@@ -75,8 +75,8 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes --startup-file=no`
7575
# --cpu-target
7676
# NOTE: this test only holds true if image_file is a shared library.
7777
if Libdl.dlopen_e(unsafe_string(Base.JLOptions().image_file)) != C_NULL
78-
@test !success(`$exename -C invalidtarget --precompiled=yes`)
79-
@test !success(`$exename --cpu-target=invalidtarget --precompiled=yes`)
78+
@test !success(`$exename -C invalidtarget --sysimage-native-code=yes`)
79+
@test !success(`$exename --cpu-target=invalidtarget --sysimage-native-code=yes`)
8080
else
8181
warn("--cpu-target test not runnable")
8282
end
@@ -342,13 +342,13 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes --startup-file=no`
342342
@test readchomp(pipeline(ignorestatus(`$exename --startup-file=no -e "@show ARGS" -now -- julia RUN.jl`),
343343
stderr=catcmd)) == "ERROR: unknown option `-n`"
344344

345-
# --compilecache={yes|no}
346-
@test readchomp(`$exename -E "Bool(Base.JLOptions().use_compilecache)"`) == "true"
347-
@test readchomp(`$exename --compilecache=yes -E
348-
"Bool(Base.JLOptions().use_compilecache)"`) == "true"
349-
@test readchomp(`$exename --compilecache=no -E
350-
"Bool(Base.JLOptions().use_compilecache)"`) == "false"
351-
@test !success(`$exename --compilecache=foo -e "exit(0)"`)
345+
# --compiled-modules={yes|no}
346+
@test readchomp(`$exename -E "Bool(Base.JLOptions().use_compiled_modules)"`) == "true"
347+
@test readchomp(`$exename --compiled-modules=yes -E
348+
"Bool(Base.JLOptions().use_compiled_modules)"`) == "true"
349+
@test readchomp(`$exename --compiled-modules=no -E
350+
"Bool(Base.JLOptions().use_compiled_modules)"`) == "false"
351+
@test !success(`$exename --compiled-modules=foo -e "exit(0)"`)
352352

353353
# issue #12671, starting from a non-directory
354354
# rm(dir) fails on windows with Permission denied
@@ -399,7 +399,7 @@ let exename = joinpath(JULIA_HOME, Base.julia_exename()),
399399
end
400400
end
401401

402-
let exename = `$(Base.julia_cmd()) --precompiled=yes`
402+
let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes`
403403
# --startup-file
404404
let JL_OPTIONS_STARTUPFILE_ON = 1,
405405
JL_OPTIONS_STARTUPFILE_OFF = 2
@@ -422,17 +422,17 @@ run(pipeline(DevNull, `$(joinpath(JULIA_HOME, Base.julia_exename())) --lisp`, De
422422
@test_throws ErrorException run(pipeline(DevNull, pipeline(`$(joinpath(JULIA_HOME,
423423
Base.julia_exename())) -Cnative --lisp`, stderr=DevNull), DevNull))
424424

425-
# --precompiled={yes|no}
425+
# --sysimage-native-code={yes|no}
426426
let exename = `$(Base.julia_cmd()) --startup-file=no`
427-
@test readchomp(`$exename --precompiled=yes -E
428-
"Bool(Base.JLOptions().use_precompiled)"`) == "true"
429-
@test readchomp(`$exename --precompiled=no -E
430-
"Bool(Base.JLOptions().use_precompiled)"`) == "false"
427+
@test readchomp(`$exename --sysimage-native-code=yes -E
428+
"Bool(Base.JLOptions().use_sysimage_native_code)"`) == "true"
429+
@test readchomp(`$exename --sysimage-native-code=no -E
430+
"Bool(Base.JLOptions().use_sysimage_native_code)"`) == "false"
431431
end
432432

433433
# backtrace contains type and line number info (esp. on windows #17179)
434434
for precomp in ("yes", "no")
435-
bt = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --precompiled=$precomp
435+
bt = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --sysimage-native-code=$precomp
436436
-E 'include("____nonexistent_file")'`), stderr=catcmd), String)
437437
@test contains(bt, "include_relative(::Module, ::String) at $(joinpath(".", "loading.jl"))")
438438
lno = match(r"at \.[\/\\]loading\.jl:(\d+)", bt)

0 commit comments

Comments
 (0)