Skip to content

Commit

Permalink
Merge pull request JuliaLang#11954 from JuliaLang/jb/noprecompiled
Browse files Browse the repository at this point in the history
add --precompiled option to control whether precompiled code is used
  • Loading branch information
JeffBezanson committed Jun 30, 2015
2 parents e2b78df + 6337ab9 commit 81b5064
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ let reqarg = Set(UTF8String["--home", "-H",
"--output-o",
"--output-ji",
"--output-bc",
"--bind-to"])
"--bind-to",
"--precompiled"])
global process_options
function process_options(opts::JLOptions, args::Vector{UTF8String})
if !isempty(args)
Expand Down
1 change: 1 addition & 0 deletions base/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ immutable JLOptions
fast_math::Int8
worker::Int8
handle_signals::Int8
use_precompiled::Int8
bindto::Ptr{UInt8}
outputbc::Ptr{UInt8}
outputo::Ptr{UInt8}
Expand Down
2 changes: 1 addition & 1 deletion src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static int jl_load_sysimg_so()
if (jl_is_debugbuild()) imaging_mode = 1;
#endif
// in --build mode only use sysimg data, not precompiled native code
if (!imaging_mode) {
if (!imaging_mode && jl_options.use_precompiled==JL_OPTIONS_USE_PRECOMPILED_YES) {
sysimg_gvars = (jl_value_t***)jl_dlsym(jl_sysimg_handle, "jl_sysimg_gvars");
globalUnique = *(size_t*)jl_dlsym(jl_sysimg_handle, "jl_globalUnique");
const char *cpu_target = (const char*)jl_dlsym(jl_sysimg_handle, "jl_sysimg_cpu_target");
Expand Down
1 change: 1 addition & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jl_options_t jl_options = { 0, // quiet
JL_OPTIONS_FAST_MATH_DEFAULT,
0, // worker
JL_OPTIONS_HANDLE_SIGNALS_ON,
JL_OPTIONS_USE_PRECOMPILED_YES,
NULL, // bindto
NULL, // outputbc
NULL, // outputo
Expand Down
4 changes: 4 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,7 @@ typedef struct {
int8_t fast_math;
int8_t worker;
int8_t handle_signals;
int8_t use_precompiled;
const char *bindto;
const char *outputbc;
const char *outputo;
Expand Down Expand Up @@ -1553,6 +1554,9 @@ DLLEXPORT int jl_generating_output();
#define JL_OPTIONS_HANDLE_SIGNALS_ON 1
#define JL_OPTIONS_HANDLE_SIGNALS_OFF 0

#define JL_OPTIONS_USE_PRECOMPILED_YES 1
#define JL_OPTIONS_USE_PRECOMPILED_NO 0

// Version information
#include "julia_version.h"

Expand Down
13 changes: 12 additions & 1 deletion ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static const char opts[] =

// startup options
" -J, --sysimage <file> Start up with the given system image file\n"
" --precompiled={yes|no} Use precompiled code from system image if available\n"
" -H, --home <dir> Set location of julia executable\n"
" --startup-file={yes|no} Load ~/.juliarc.jl\n"
" -f, --no-startup Don't load ~/.juliarc (deprecated, use --startup-file=no)\n"
Expand Down Expand Up @@ -115,7 +116,8 @@ void parse_opts(int *argcp, char ***argvp)
opt_bind_to,
opt_handle_signals,
opt_output_o,
opt_output_ji
opt_output_ji,
opt_use_precompiled
};
static char* shortopts = "+vhqFfH:e:E:P:L:J:C:ip:Ob:";
static struct option longopts[] = {
Expand All @@ -131,6 +133,7 @@ void parse_opts(int *argcp, char ***argvp)
{ "post-boot", required_argument, 0, 'P' },
{ "load", required_argument, 0, 'L' },
{ "sysimage", required_argument, 0, 'J' },
{ "precompiled", required_argument, 0, opt_use_precompiled },
{ "cpu-target", required_argument, 0, 'C' },
{ "procs", required_argument, 0, 'p' },
{ "machinefile", required_argument, 0, opt_machinefile },
Expand Down Expand Up @@ -208,6 +211,14 @@ void parse_opts(int *argcp, char ***argvp)
jl_options.image_file = strdup(optarg);
imagepathspecified = 1;
break;
case opt_use_precompiled:
if (!strcmp(optarg,"yes"))
jl_options.use_precompiled = JL_OPTIONS_USE_PRECOMPILED_YES;
else if (!strcmp(optarg,"no"))
jl_options.use_precompiled = JL_OPTIONS_USE_PRECOMPILED_NO;
else
jl_errorf("julia: invalid argument to --precompiled={yes|no} (%s)\n", optarg);
break;
case 'C': // cpu-target
jl_options.cpu_target = strdup(optarg);
break;
Expand Down

0 comments on commit 81b5064

Please sign in to comment.