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

release-1.6: Backports for 1.6.7 #45319

Merged
merged 34 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
008432c
`base/version_git.sh`: fix the default value for `Base.GIT_VERSION_IN…
DilumAluthge Jan 9, 2022
16944c3
MPFR: Fix `round(Integer, big(Inf))` (#44676)
barucden Mar 21, 2022
c908046
errors: fix handling of `.op` in lowering (#44770)
simeonschaub Mar 28, 2022
89b3c22
fix missing field type initialization vars (#44797)
vtjnash Apr 7, 2022
159ce70
[REPL] Fix a REPL test failure by removing an erroneous space in test…
vtjnash Apr 14, 2022
294b142
Fix embedding with MSVC (#44976)
barche Apr 14, 2022
80ffc2e
Update Example header in admonition to render PDF better, see #44866.…
ViralBShah Apr 19, 2022
9e9879b
gc-ext: only sweep unmarked objects (#45035)
vtjnash Apr 20, 2022
ea8455b
Create a copy while evaluating eigvals(::Diagonal) (#45048)
jishnub May 2, 2022
364d483
Avoid race condition in cleaning up cache files (#45214)
simonbyrne May 8, 2022
1054327
Restore export of jl_options (#45308)
Taaitaaiger May 16, 2022
427daf1
Use `CartesianIndices(Rsrc)` as the shared iterator. (#45289)
N5N3 May 16, 2022
42f7a99
Typo fix. (#45333)
N5N3 May 17, 2022
87a22e4
Use root module when determining UUID in @artifact_str (#45392)
zickgraf May 21, 2022
29559e0
Apply patch for GMP CVE-2021-43618 (#45375)
ViralBShah May 20, 2022
b7e4497
Update PCRE2 to 10.40 (#45398)
fxcoudert May 21, 2022
06d71b8
Fix a concurrency bug in `iterate(::Dict)` (#44534)
tkf Mar 12, 2022
4f793bb
[Zlib_jll] Update to v1.2.12+3 (#44810)
giordano Apr 4, 2022
ede6a24
Zlib: update version number (#45407)
fxcoudert May 21, 2022
ed7fb2a
profile: fix async deadlock (#44781)
vtjnash Mar 29, 2022
e0ecf0e
macOS: workaround a dyld/libunwind deadlock issue since 12.1
vtjnash Jan 7, 2022
5ec2d68
macOS: extend the workaround to cover the dyld/exc_server deadlock is…
vtjnash Jan 12, 2022
1b60be5
avoid using `@sync_add` on remotecalls (#44671)
exaexa Mar 23, 2022
240d427
Fix USE_BINARYBUILDER_OPENBLAS=0 on macOS (#42538)
staticfloat Oct 16, 2021
12719ea
OpenBLAS: Find objconv in its proper path (#45391)
fxcoudert May 21, 2022
dd6f86a
fix `===` when encountering null pointer (#44749)
Moelf Mar 29, 2022
8411f79
Update p7zip to 17.04 (#45435)
fxcoudert May 24, 2022
416a769
[Distributed] Set stdin to devnull before closing it
vtjnash Jan 26, 2022
038c949
Fix #39367, doc for inbounds use each index (#39369)
mbauman Jan 25, 2021
7989b16
Limit some buildkite jobs to run on only x86_64 machines (#45665)
staticfloat Jun 14, 2022
c3116fd
bump Pkg version to latest 1.6
Jun 15, 2022
064fb73
Pass along backlog keyword argument in Sockets.listen (#45737)
quinnj Jun 19, 2022
5c5c85a
Use https for downloading of unicode data from unicode.org (#45750)
ViralBShah Jun 19, 2022
443c321
[release-1.6] Backport MbedTLS security patches (#45848)
staticfloat Jul 4, 2022
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
Prev Previous commit
Next Next commit
Restore export of jl_options (#45308)
Co-authored-by: Jeff Bezanson <[email protected]>
  • Loading branch information
Taaitaaiger and JeffBezanson authored May 16, 2022
commit 1054327770bafcbadccec86f5f8dd7897e020fdc
4 changes: 4 additions & 0 deletions cli/loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#define realloc loader_realloc
#endif

#include <stdint.h>

#ifdef _OS_WINDOWS_
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
Expand Down Expand Up @@ -105,3 +107,5 @@ int wchar_to_utf8(const wchar_t * wstr, char *str, size_t maxlen);
int utf8_to_wchar(const char * str, wchar_t *wstr, size_t maxlen);
void setup_stdio(void);
#endif

#include "../src/jloptions.h"
4 changes: 4 additions & 0 deletions cli/loader_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ __attribute__((constructor)) void jl_load_libjulia_internal(void) {
for (unsigned int symbol_idx=0; jl_exported_func_names[symbol_idx] != NULL; ++symbol_idx) {
(*jl_exported_func_addrs[symbol_idx]) = lookup_symbol(libjulia_internal, jl_exported_func_names[symbol_idx]);
}

// jl_options must be initialized very early, in case an embedder sets some
// values there before calling jl_init
((void (*)(void))jl_init_options_addr)();
}

// Load libjulia and run the REPL with the given arguments (in UTF-8 format)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SRCS += $(RUNTIME_SRCS)
# headers are used for dependency tracking, while public headers will be part of the dist
UV_HEADERS :=
HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,julia.h julia_assert.h julia_threads.h tls.h locks.h atomics.h julia_internal.h options.h timing.h)
PUBLIC_HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,julia.h julia_assert.h julia_threads.h tls.h locks.h atomics.h julia_gcext.h)
PUBLIC_HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,julia.h julia_assert.h julia_threads.h tls.h locks.h atomics.h julia_gcext.h jloptions.h)
ifeq ($(USE_SYSTEM_LIBUV),0)
UV_HEADERS += uv.h
UV_HEADERS += uv/*.h
Expand Down
3 changes: 2 additions & 1 deletion src/jl_exported_data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,5 @@

// Data symbols that are defined inside the public libjulia
#define JL_EXPORTED_DATA_SYMBOLS(XX) \
XX(jl_n_threads, int)
XX(jl_n_threads, int) \
XX(jl_options, jl_options_t)
1 change: 1 addition & 0 deletions src/jl_exported_funcs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
XX(jl_init_restored_modules) \
XX(jl_init__threading) \
XX(jl_init_with_image__threading) \
XX(jl_init_options) \
XX(jl_install_sigint_handler) \
XX(jl_instantiate_type_in_env) \
XX(jl_instantiate_unionall) \
Expand Down
101 changes: 55 additions & 46 deletions src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,55 +28,64 @@ JL_DLLEXPORT const char *jl_get_default_sysimg_path(void)
}


jl_options_t jl_options = { 0, // quiet
-1, // banner
NULL, // julia_bindir
NULL, // julia_bin
NULL, // cmds
NULL, // image_file (will be filled in below)
NULL, // cpu_target ("native", "core2", etc...)
0, // nthreads
0, // nprocs
NULL, // machine_file
NULL, // project
0, // isinteractive
0, // color
JL_OPTIONS_HISTORYFILE_ON, // history file
0, // startup file
JL_OPTIONS_COMPILE_DEFAULT, // compile_enabled
0, // code_coverage
0, // malloc_log
2, // opt_level
static int jl_options_initialized = 0;

JL_DLLEXPORT void jl_init_options(void)
{
if (jl_options_initialized)
return;
jl_options =
(jl_options_t){ 0, // quiet
-1, // banner
NULL, // julia_bindir
NULL, // julia_bin
NULL, // cmds
NULL, // image_file (will be filled in below)
NULL, // cpu_target ("native", "core2", etc...)
0, // nthreads
0, // nprocs
NULL, // machine_file
NULL, // project
0, // isinteractive
0, // color
JL_OPTIONS_HISTORYFILE_ON, // history file
0, // startup file
JL_OPTIONS_COMPILE_DEFAULT, // compile_enabled
0, // code_coverage
0, // malloc_log
2, // opt_level
#ifdef JL_DEBUG_BUILD
2, // debug_level [debug build]
2, // debug_level [debug build]
#else
1, // debug_level [release build]
1, // debug_level [release build]
#endif
JL_OPTIONS_CHECK_BOUNDS_DEFAULT, // check_bounds
JL_OPTIONS_DEPWARN_OFF, // deprecation warning
0, // method overwrite warning
1, // can_inline
JL_OPTIONS_POLLY_ON, // polly
NULL, // trace_compile
JL_OPTIONS_FAST_MATH_DEFAULT,
0, // worker
NULL, // cookie
JL_OPTIONS_HANDLE_SIGNALS_ON,
JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES,
JL_OPTIONS_USE_COMPILED_MODULES_YES,
NULL, // bind-to
NULL, // output-bc
NULL, // output-unopt-bc
NULL, // output-o
NULL, // output-asm
NULL, // output-ji
NULL, // output-code_coverage
0, // incremental
0, // image_file_specified
JL_OPTIONS_WARN_SCOPE_ON, // ambiguous scope warning
0, // image-codegen
0, // rr-detach
};
JL_OPTIONS_CHECK_BOUNDS_DEFAULT, // check_bounds
JL_OPTIONS_DEPWARN_OFF, // deprecation warning
0, // method overwrite warning
1, // can_inline
JL_OPTIONS_POLLY_ON, // polly
NULL, // trace_compile
JL_OPTIONS_FAST_MATH_DEFAULT,
0, // worker
NULL, // cookie
JL_OPTIONS_HANDLE_SIGNALS_ON,
JL_OPTIONS_USE_SYSIMAGE_NATIVE_CODE_YES,
JL_OPTIONS_USE_COMPILED_MODULES_YES,
NULL, // bind-to
NULL, // output-bc
NULL, // output-unopt-bc
NULL, // output-o
NULL, // output-asm
NULL, // output-ji
NULL, // output-code_coverage
0, // incremental
0, // image_file_specified
JL_OPTIONS_WARN_SCOPE_ON, // ambiguous scope warning
0, // image-codegen
0, // rr-detach
};
jl_options_initialized = 1;
}

static const char usage[] = "julia [switches] -- [programfile] [args...]\n";
static const char opts[] =
Expand Down
55 changes: 55 additions & 0 deletions src/jloptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// This file is a part of Julia. License is MIT: https://julialang.org/license

#ifndef JL_JLOPTIONS_H
#define JL_JLOPTIONS_H

// NOTE: This struct needs to be kept in sync with JLOptions type in base/options.jl

typedef struct {
int8_t quiet;
int8_t banner;
const char *julia_bindir;
const char *julia_bin;
const char **cmds;
const char *image_file;
const char *cpu_target;
int32_t nthreads;
int32_t nprocs;
const char *machine_file;
const char *project;
int8_t isinteractive;
int8_t color;
int8_t historyfile;
int8_t startupfile;
int8_t compile_enabled;
int8_t code_coverage;
int8_t malloc_log;
int8_t opt_level;
int8_t debug_level;
int8_t check_bounds;
int8_t depwarn;
int8_t warn_overwrite;
int8_t can_inline;
int8_t polly;
const char *trace_compile;
int8_t fast_math;
int8_t worker;
const char *cookie;
int8_t handle_signals;
int8_t use_sysimage_native_code;
int8_t use_compiled_modules;
const char *bindto;
const char *outputbc;
const char *outputunoptbc;
const char *outputo;
const char *outputasm;
const char *outputji;
const char *output_code_coverage;
int8_t incremental;
int8_t image_file_specified;
int8_t warn_scope;
int8_t image_codegen;
int8_t rr_detach;
} jl_options_t;

#endif
54 changes: 5 additions & 49 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1899,55 +1899,11 @@ JL_DLLEXPORT void jlbacktrace(void) JL_NOTSAFEPOINT;
JL_DLLEXPORT void jl_(void *jl_value) JL_NOTSAFEPOINT;

// julia options -----------------------------------------------------------
// NOTE: This struct needs to be kept in sync with JLOptions type in base/options.jl
typedef struct {
int8_t quiet;
int8_t banner;
const char *julia_bindir;
const char *julia_bin;
const char **cmds;
const char *image_file;
const char *cpu_target;
int32_t nthreads;
int32_t nprocs;
const char *machine_file;
const char *project;
int8_t isinteractive;
int8_t color;
int8_t historyfile;
int8_t startupfile;
int8_t compile_enabled;
int8_t code_coverage;
int8_t malloc_log;
int8_t opt_level;
int8_t debug_level;
int8_t check_bounds;
int8_t depwarn;
int8_t warn_overwrite;
int8_t can_inline;
int8_t polly;
const char *trace_compile;
int8_t fast_math;
int8_t worker;
const char *cookie;
int8_t handle_signals;
int8_t use_sysimage_native_code;
int8_t use_compiled_modules;
const char *bindto;
const char *outputbc;
const char *outputunoptbc;
const char *outputo;
const char *outputasm;
const char *outputji;
const char *output_code_coverage;
int8_t incremental;
int8_t image_file_specified;
int8_t warn_scope;
int8_t image_codegen;
int8_t rr_detach;
} jl_options_t;

extern JL_DLLEXPORT jl_options_t jl_options;

#include "jloptions.h"

extern JL_DLLIMPORT jl_options_t jl_options;

JL_DLLEXPORT ssize_t jl_sizeof_jl_options(void);

// Parse an argc/argv pair to extract general julia options, passing back out
Expand Down
9 changes: 9 additions & 0 deletions test/embedding/embedding.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jl_value_t *checked_eval_string(const char* code)

int main()
{
// check that setting options works
jl_options.opt_level = 1;

jl_init();

{
Expand All @@ -40,6 +43,12 @@ int main()
checked_eval_string("println(sqrt(2.0))");
}

if (jl_options.opt_level != 1) {
jl_printf(jl_stderr_stream(), "setting jl_options didn't work\n");
jl_atexit_hook(1);
exit(1);
}

{
// Accessing the return value

Expand Down