Skip to content

Commit b3e1a0c

Browse files
vtjnashKristofferC
authored andcommitted
batch some binding changes (#57765)
For model simplicity (and eventually for better unspecialized compilation), try to backdate initial module operations back to world 0 if nobody could have observed them before (no using statements depend on the module yet), rather than putting each incremental operation in a separate, but unobserved (and unobservable) world increment. (cherry picked from commit 3e063f6)
1 parent a5bbb91 commit b3e1a0c

File tree

11 files changed

+123
-113
lines changed

11 files changed

+123
-113
lines changed

base/Base_compiler.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
baremodule Base
3+
module Base
44

5-
using Core
6-
using Core.Intrinsics, Core.IR
5+
using .Core.Intrinsics, .Core.IR
76

87
# to start, we're going to use a very simple definition of `include`
98
# that doesn't require any function (except what we can get from the `Core` top-module)
@@ -381,5 +380,5 @@ Core._setparser!(fl_parse)
381380

382381
# Further definition of Base will happen in Base.jl if loaded.
383382

384-
end # baremodule Base
383+
end # module Base
385384
using .Base

base/sysimg.jl

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
# Can be loaded on top of either an existing system image built from
4-
# `Base_compiler.jl` or standalone, in which case we will build it now.
5-
let had_compiler = isdefined(Main, :Base)
6-
if had_compiler; else
7-
include("Base_compiler.jl")
8-
end
9-
10-
Core.include(Base, "Base.jl")
3+
Base.Core.include(Base, "Base.jl") # finish populating Base (currently just has the Compiler)
114

12-
had_compiler && ccall(:jl_init_restored_module, Cvoid, (Any,), Base)
13-
end
5+
# Set up Main module by importing from Base
6+
using .Base
7+
using .Base.MainInclude # ans, err, and sometimes Out
148

15-
# Set up Main module
16-
using Base.MainInclude # ans, err, and sometimes Out
9+
ccall(:jl_init_restored_module, Cvoid, (Any,), Base)
1710

1811
# These definitions calls Base._include rather than Base.include to get
1912
# one-frame stacktraces for the common case of using include(fname) in Main.
@@ -59,7 +52,7 @@ definition of `eval`, which evaluates expressions in that module.
5952
const eval = Core.EvalInto(Main)
6053

6154
# Ensure this file is also tracked
62-
pushfirst!(Base._included_files, (@__MODULE__, abspath(@__FILE__)))
55+
pushfirst!(Base._included_files, (Main, abspath(@__FILE__)))
6356

6457
# set up depot & load paths to be able to find stdlib packages
6558
Base.init_depot_path()

doc/src/devdocs/init.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ the [LLVM library](https://llvm.org).
6363
If there is no sysimg file (`!jl_options.image_file`) then the `Core` and `Main` modules are
6464
created and `boot.jl` is evaluated:
6565

66-
`jl_core_module = jl_new_module(jl_symbol("Core"))` creates the Julia `Core` module.
66+
`jl_core_module = jl_new_module(jl_symbol("Core"), NULL)` creates the Julia `Core` module.
6767

6868
[`jl_init_intrinsic_functions()`](https://github.com/JuliaLang/julia/blob/master/src/intrinsics.cpp)
6969
creates a new Julia module `Intrinsics` containing constant `jl_intrinsic_type` symbols. These define

src/builtins.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,8 +2397,7 @@ static void add_intrinsic(jl_module_t *inm, const char *name, enum intrinsic f)
23972397
{
23982398
jl_value_t *i = jl_permbox32(jl_intrinsic_type, 0, (int32_t)f);
23992399
jl_sym_t *sym = jl_symbol(name);
2400-
jl_set_const(inm, sym, i);
2401-
jl_module_public(inm, sym, 1);
2400+
jl_set_initial_const(inm, sym, i, 1);
24022401
}
24032402

24042403
void jl_init_intrinsic_properties(void) JL_GC_DISABLED
@@ -2414,9 +2413,8 @@ void jl_init_intrinsic_properties(void) JL_GC_DISABLED
24142413

24152414
void jl_init_intrinsic_functions(void) JL_GC_DISABLED
24162415
{
2417-
jl_module_t *inm = jl_new_module(jl_symbol("Intrinsics"), NULL);
2418-
inm->parent = jl_core_module;
2419-
jl_set_const(jl_core_module, jl_symbol("Intrinsics"), (jl_value_t*)inm);
2416+
jl_module_t *inm = jl_new_module_(jl_symbol("Intrinsics"), jl_core_module, 0, 1);
2417+
jl_set_initial_const(jl_core_module, jl_symbol("Intrinsics"), (jl_value_t*)inm, 0);
24202418
jl_mk_builtin_func(jl_intrinsic_type, "IntrinsicFunction", jl_f_intrinsic_call);
24212419
jl_mk_builtin_func(
24222420
(jl_datatype_t*)jl_unwrap_unionall((jl_value_t*)jl_opaque_closure_type),
@@ -2438,7 +2436,7 @@ void jl_init_intrinsic_functions(void) JL_GC_DISABLED
24382436

24392437
static void add_builtin(const char *name, jl_value_t *v)
24402438
{
2441-
jl_set_const(jl_core_module, jl_symbol(name), v);
2439+
jl_set_initial_const(jl_core_module, jl_symbol(name), v, 0);
24422440
}
24432441

24442442
jl_fptr_args_t jl_get_builtin_fptr(jl_datatype_t *dt)

src/gf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ jl_datatype_t *jl_mk_builtin_func(jl_datatype_t *dt, const char *name, jl_fptr_a
294294
if (dt == NULL) {
295295
// Builtins are specially considered available from world 0
296296
jl_value_t *f = jl_new_generic_function_with_supertype(sname, jl_core_module, jl_builtin_type, 0);
297-
jl_set_const(jl_core_module, sname, f);
297+
jl_set_initial_const(jl_core_module, sname, f, 0);
298298
dt = (jl_datatype_t*)jl_typeof(f);
299299
}
300300

src/jl_exported_funcs.inc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#define JL_RUNTIME_EXPORTED_FUNCS(XX) \
44
XX(jl_active_task_stack) \
5-
XX(jl_add_standard_imports) \
65
XX(jl_adopt_thread) \
76
XX(jl_alignment) \
87
XX(jl_alloc_array_1d) \
@@ -97,7 +96,6 @@
9796
XX(jl_cstr_to_string) \
9897
XX(jl_current_exception) \
9998
XX(jl_debug_method_invalidation) \
100-
XX(jl_defines_or_exports_p) \
10199
XX(jl_deprecate_binding) \
102100
XX(jl_dlclose) \
103101
XX(jl_dlopen) \
@@ -314,7 +312,6 @@
314312
XX(jl_module_names) \
315313
XX(jl_module_parent) \
316314
XX(jl_module_getloc) \
317-
XX(jl_module_public) \
318315
XX(jl_module_public_p) \
319316
XX(jl_module_use) \
320317
XX(jl_module_using) \

src/jltypes.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,10 +3287,9 @@ void jl_init_types(void) JL_GC_DISABLED
32873287
jl_emptysvec, 0, 0, 3);
32883288

32893289
core = jl_new_module(jl_symbol("Core"), NULL);
3290-
core->parent = core;
32913290
jl_type_typename->mt->module = core;
32923291
jl_core_module = core;
3293-
core = NULL; // not ready yet to use
3292+
core = NULL; // not actually ready yet to use
32943293

32953294
tv = jl_svec1(tvar("Backend"));
32963295
jl_addrspace_typename =
@@ -3381,9 +3380,8 @@ void jl_init_types(void) JL_GC_DISABLED
33813380
core = jl_core_module;
33823381
jl_atomic_store_relaxed(&core->bindingkeyset, (jl_genericmemory_t*)jl_an_empty_memory_any);
33833382
// export own name, so "using Foo" makes "Foo" itself visible
3384-
jl_set_const(core, core->name, (jl_value_t*)core);
3385-
jl_module_public(core, core->name, 1);
3386-
jl_set_const(core, jl_symbol("CPU"), (jl_value_t*)cpumem);
3383+
jl_set_initial_const(core, core->name, (jl_value_t*)core, 1);
3384+
jl_set_initial_const(core, jl_symbol("CPU"), (jl_value_t*)cpumem, 0);
33873385
core = NULL;
33883386

33893387
jl_expr_type =

src/julia.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,13 +2109,13 @@ JL_DLLEXPORT void jl_check_binding_currently_writable(jl_binding_t *b, jl_module
21092109
JL_DLLEXPORT jl_binding_t *jl_get_binding_wr(jl_module_t *m JL_PROPAGATES_ROOT, jl_sym_t *var);
21102110
JL_DLLEXPORT jl_value_t *jl_get_existing_strong_gf(jl_binding_t *b JL_PROPAGATES_ROOT, size_t new_world);
21112111
JL_DLLEXPORT int jl_boundp(jl_module_t *m, jl_sym_t *var, int allow_import);
2112-
JL_DLLEXPORT int jl_defines_or_exports_p(jl_module_t *m, jl_sym_t *var);
21132112
JL_DLLEXPORT int jl_is_const(jl_module_t *m, jl_sym_t *var);
21142113
JL_DLLEXPORT int jl_globalref_is_const(jl_globalref_t *gr);
21152114
JL_DLLEXPORT jl_value_t *jl_get_globalref_value(jl_globalref_t *gr);
21162115
JL_DLLEXPORT jl_value_t *jl_get_global(jl_module_t *m JL_PROPAGATES_ROOT, jl_sym_t *var);
21172116
JL_DLLEXPORT void jl_set_global(jl_module_t *m JL_ROOTING_ARGUMENT, jl_sym_t *var, jl_value_t *val JL_ROOTED_ARGUMENT);
21182117
JL_DLLEXPORT void jl_set_const(jl_module_t *m JL_ROOTING_ARGUMENT, jl_sym_t *var, jl_value_t *val JL_ROOTED_ARGUMENT);
2118+
void jl_set_initial_const(jl_module_t *m JL_ROOTING_ARGUMENT, jl_sym_t *var, jl_value_t *val JL_ROOTED_ARGUMENT, int exported);
21192119
JL_DLLEXPORT void jl_checked_assignment(jl_binding_t *b, jl_module_t *mod, jl_sym_t *var, jl_value_t *rhs JL_MAYBE_UNROOTED);
21202120
JL_DLLEXPORT jl_value_t *jl_checked_swap(jl_binding_t *b, jl_module_t *mod, jl_sym_t *var, jl_value_t *rhs JL_MAYBE_UNROOTED);
21212121
JL_DLLEXPORT jl_value_t *jl_checked_replace(jl_binding_t *b, jl_module_t *mod, jl_sym_t *var, jl_value_t *expected, jl_value_t *rhs);
@@ -2128,10 +2128,9 @@ JL_DLLEXPORT void jl_module_use(jl_task_t *ct, jl_module_t *to, jl_module_t *fro
21282128
JL_DLLEXPORT void jl_module_use_as(jl_task_t *ct, jl_module_t *to, jl_module_t *from, jl_sym_t *s, jl_sym_t *asname);
21292129
JL_DLLEXPORT void jl_module_import(jl_task_t *ct, jl_module_t *to, jl_module_t *from, jl_sym_t *s);
21302130
JL_DLLEXPORT void jl_module_import_as(jl_task_t *ct, jl_module_t *to, jl_module_t *from, jl_sym_t *s, jl_sym_t *asname);
2131-
JL_DLLEXPORT void jl_module_public(jl_module_t *from, jl_sym_t *s, int exported);
2131+
int jl_module_public_(jl_module_t *from, jl_sym_t *s, int exported, size_t new_world);
21322132
JL_DLLEXPORT int jl_is_imported(jl_module_t *m, jl_sym_t *s);
21332133
JL_DLLEXPORT int jl_module_exports_p(jl_module_t *m, jl_sym_t *var);
2134-
JL_DLLEXPORT void jl_add_standard_imports(jl_module_t *m);
21352134

21362135
// eq hash tables
21372136
JL_DLLEXPORT jl_genericmemory_t *jl_eqtable_put(jl_genericmemory_t *h JL_ROOTING_ARGUMENT, jl_value_t *key, jl_value_t *val JL_ROOTED_ARGUMENT, int *inserted);

src/julia_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ JL_DLLEXPORT void jl_declare_global(jl_module_t *m, jl_value_t *arg, jl_value_t
869869
JL_DLLEXPORT jl_binding_partition_t *jl_declare_constant_val3(jl_binding_t *b JL_ROOTING_ARGUMENT, jl_module_t *mod, jl_sym_t *var, jl_value_t *val JL_ROOTED_ARGUMENT JL_MAYBE_UNROOTED, enum jl_partition_kind, size_t new_world) JL_GLOBALLY_ROOTED;
870870
JL_DLLEXPORT jl_value_t *jl_toplevel_eval_flex(jl_module_t *m, jl_value_t *e, int fast, int expanded, const char **toplevel_filename, int *toplevel_lineno);
871871

872+
void jl_module_initial_using(jl_module_t *to, jl_module_t *from);
872873
STATIC_INLINE struct _jl_module_using *module_usings_getidx(jl_module_t *m JL_PROPAGATES_ROOT, size_t i) JL_NOTSAFEPOINT;
873874
STATIC_INLINE jl_module_t *module_usings_getmod(jl_module_t *m JL_PROPAGATES_ROOT, size_t i) JL_NOTSAFEPOINT;
874875
void jl_add_usings_backedge(jl_module_t *from, jl_module_t *to);
@@ -941,7 +942,7 @@ JL_DLLEXPORT jl_binding_partition_t *jl_replace_binding_locked2(jl_binding_t *b
941942
JL_DLLEXPORT void jl_update_loaded_bpart(jl_binding_t *b, jl_binding_partition_t *bpart);
942943
extern jl_array_t *jl_module_init_order JL_GLOBALLY_ROOTED;
943944
extern htable_t jl_current_modules JL_GLOBALLY_ROOTED;
944-
extern JL_DLLEXPORT jl_module_t *jl_precompile_toplevel_module JL_GLOBALLY_ROOTED;
945+
extern jl_module_t *jl_precompile_toplevel_module JL_GLOBALLY_ROOTED;
945946
extern jl_genericmemory_t *jl_global_roots_list JL_GLOBALLY_ROOTED;
946947
extern jl_genericmemory_t *jl_global_roots_keyset JL_GLOBALLY_ROOTED;
947948
extern arraylist_t *jl_entrypoint_mis;
@@ -1275,9 +1276,8 @@ _Atomic(jl_value_t*) *jl_table_peek_bp(jl_genericmemory_t *a, jl_value_t *key) J
12751276

12761277
JL_DLLEXPORT jl_method_t *jl_new_method_uninit(jl_module_t*);
12771278

1278-
JL_DLLEXPORT jl_module_t *jl_new_module__(jl_sym_t *name, jl_module_t *parent);
1279-
JL_DLLEXPORT jl_module_t *jl_new_module_(jl_sym_t *name, jl_module_t *parent, uint8_t default_using_core, uint8_t self_name);
1280-
JL_DLLEXPORT void jl_add_default_names(jl_module_t *m, uint8_t default_using_core, uint8_t self_name);
1279+
jl_module_t *jl_new_module_(jl_sym_t *name, jl_module_t *parent, uint8_t default_using_core, uint8_t self_name);
1280+
jl_module_t *jl_add_standard_imports(jl_module_t *m);
12811281
JL_DLLEXPORT jl_methtable_t *jl_new_method_table(jl_sym_t *name, jl_module_t *module);
12821282
JL_DLLEXPORT jl_method_instance_t *jl_get_specialization1(jl_tupletype_t *types JL_PROPAGATES_ROOT, size_t world, int mt_cache);
12831283
jl_method_instance_t *jl_get_specialized(jl_method_t *m, jl_value_t *types, jl_svec_t *sp) JL_PROPAGATES_ROOT;

src/module.c

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ JL_DLLEXPORT jl_value_t *jl_get_binding_leaf_partitions_value_if_const(jl_bindin
401401
return NULL;
402402
}
403403

404-
JL_DLLEXPORT jl_module_t *jl_new_module__(jl_sym_t *name, jl_module_t *parent)
404+
static jl_module_t *jl_new_module__(jl_sym_t *name, jl_module_t *parent)
405405
{
406406
jl_task_t *ct = jl_current_task;
407407
const jl_uuid_t uuid_zero = {0, 0};
@@ -410,7 +410,7 @@ JL_DLLEXPORT jl_module_t *jl_new_module__(jl_sym_t *name, jl_module_t *parent)
410410
jl_set_typetagof(m, jl_module_tag, 0);
411411
assert(jl_is_symbol(name));
412412
m->name = name;
413-
m->parent = parent;
413+
m->parent = parent ? parent : m;
414414
m->istopmod = 0;
415415
m->uuid = uuid_zero;
416416
static unsigned int mcounter; // simple counter backup, in case hrtime is not incrementing
@@ -437,23 +437,22 @@ JL_DLLEXPORT jl_module_t *jl_new_module__(jl_sym_t *name, jl_module_t *parent)
437437
return m;
438438
}
439439

440-
JL_DLLEXPORT void jl_add_default_names(jl_module_t *m, uint8_t default_using_core, uint8_t self_name)
440+
static void jl_add_default_names(jl_module_t *m, uint8_t default_using_core, uint8_t self_name)
441441
{
442442
if (jl_core_module) {
443443
// Bootstrap: Before jl_core_module is defined, we don't have enough infrastructure
444444
// for bindings, so Core itself gets special handling in jltypes.c
445445
if (default_using_core) {
446-
jl_module_using(m, jl_core_module);
446+
jl_module_initial_using(m, jl_core_module);
447447
}
448448
if (self_name) {
449449
// export own name, so "using Foo" makes "Foo" itself visible
450-
jl_set_const(m, m->name, (jl_value_t*)m);
451-
jl_module_public(m, m->name, 1);
450+
jl_set_initial_const(m, m->name, (jl_value_t*)m, 1);
452451
}
453452
}
454453
}
455454

456-
JL_DLLEXPORT jl_module_t *jl_new_module_(jl_sym_t *name, jl_module_t *parent, uint8_t default_using_core, uint8_t self_name)
455+
jl_module_t *jl_new_module_(jl_sym_t *name, jl_module_t *parent, uint8_t default_using_core, uint8_t self_name)
457456
{
458457
jl_module_t *m = jl_new_module__(name, parent);
459458
JL_GC_PUSH1(&m);
@@ -1231,6 +1230,19 @@ void jl_add_usings_backedge(jl_module_t *from, jl_module_t *to)
12311230
JL_UNLOCK(&from->lock);
12321231
}
12331232

1233+
void jl_module_initial_using(jl_module_t *to, jl_module_t *from)
1234+
{
1235+
struct _jl_module_using new_item = {
1236+
.mod = from,
1237+
.min_world = 0,
1238+
.max_world = ~(size_t)0
1239+
};
1240+
arraylist_grow(&to->usings, sizeof(struct _jl_module_using)/sizeof(void*));
1241+
memcpy(&to->usings.items[to->usings.len-3], &new_item, sizeof(struct _jl_module_using));
1242+
jl_gc_wb(to, from);
1243+
jl_add_usings_backedge(from, to);
1244+
}
1245+
12341246
JL_DLLEXPORT void jl_module_using(jl_module_t *to, jl_module_t *from)
12351247
{
12361248
if (to == from)
@@ -1323,11 +1335,10 @@ JL_DLLEXPORT jl_value_t *jl_get_module_binding_or_nothing(jl_module_t *m, jl_sym
13231335
return (jl_value_t*)b;
13241336
}
13251337

1326-
JL_DLLEXPORT void jl_module_public(jl_module_t *from, jl_sym_t *s, int exported)
1338+
int jl_module_public_(jl_module_t *from, jl_sym_t *s, int exported, size_t new_world)
13271339
{
1340+
// caller must hold world_counter_lock
13281341
jl_binding_t *b = jl_get_module_binding(from, s, 1);
1329-
JL_LOCK(&world_counter_lock);
1330-
size_t new_world = jl_atomic_load_acquire(&jl_world_counter)+1;
13311342
jl_binding_partition_t *bpart = jl_get_binding_partition(b, new_world);
13321343
int was_exported = (bpart->kind & PARTITION_FLAG_EXPORTED) != 0;
13331344
if (jl_atomic_load_relaxed(&b->flags) & BINDING_FLAG_PUBLICP) {
@@ -1342,9 +1353,9 @@ JL_DLLEXPORT void jl_module_public(jl_module_t *from, jl_sym_t *s, int exported)
13421353
jl_atomic_fetch_or_relaxed(&b->flags, BINDING_FLAG_PUBLICP);
13431354
if (was_exported != exported) {
13441355
jl_replace_binding_locked2(b, bpart, bpart->restriction, bpart->kind | PARTITION_FLAG_EXPORTED, new_world);
1345-
jl_atomic_store_release(&jl_world_counter, new_world);
1356+
return 1;
13461357
}
1347-
JL_UNLOCK(&world_counter_lock);
1358+
return 0;
13481359
}
13491360

13501361
JL_DLLEXPORT int jl_boundp(jl_module_t *m, jl_sym_t *var, int allow_import) // unlike most queries here, this is currently seq_cst
@@ -1370,13 +1381,6 @@ JL_DLLEXPORT int jl_boundp(jl_module_t *m, jl_sym_t *var, int allow_import) // u
13701381
return jl_atomic_load(&b->value) != NULL;
13711382
}
13721383

1373-
JL_DLLEXPORT int jl_defines_or_exports_p(jl_module_t *m, jl_sym_t *var)
1374-
{
1375-
jl_binding_t *b = jl_get_module_binding(m, var, 0);
1376-
jl_binding_partition_t *bpart = jl_get_binding_partition(b, jl_current_task->world_age);
1377-
return b && ((bpart->kind & PARTITION_FLAG_EXPORTED) || jl_binding_kind(bpart) == PARTITION_KIND_GLOBAL);
1378-
}
1379-
13801384
JL_DLLEXPORT int jl_module_exports_p(jl_module_t *m, jl_sym_t *var)
13811385
{
13821386
jl_binding_t *b = jl_get_module_binding(m, var, 0);
@@ -1475,9 +1479,25 @@ JL_DLLEXPORT void jl_set_global(jl_module_t *m JL_ROOTING_ARGUMENT, jl_sym_t *va
14751479
jl_checked_assignment(bp, m, var, val);
14761480
}
14771481

1482+
JL_DLLEXPORT void jl_set_initial_const(jl_module_t *m JL_ROOTING_ARGUMENT, jl_sym_t *var, jl_value_t *val JL_ROOTED_ARGUMENT, int exported)
1483+
{
1484+
// this function is only valid during initialization, so there is no risk of data races her are not too important to use
1485+
int kind = PARTITION_KIND_CONST | (exported ? PARTITION_FLAG_EXPORTED : 0);
1486+
// jl_declare_constant_val3(NULL, m, var, (jl_value_t*)jl_any_type, kind, 0);
1487+
jl_binding_t *bp = jl_get_module_binding(m, var, 1);
1488+
jl_binding_partition_t *bpart = jl_get_binding_partition(bp, 0);
1489+
assert(bpart->min_world == 0);
1490+
jl_atomic_store_relaxed(&bpart->max_world, ~(size_t)0); // jl_check_new_binding_implicit likely incorrectly truncated it
1491+
if (exported)
1492+
jl_atomic_fetch_or_relaxed(&bp->flags, BINDING_FLAG_PUBLICP);
1493+
bpart->kind = kind | (bpart->kind & PARTITION_MASK_FLAG);
1494+
bpart->restriction = val;
1495+
jl_gc_wb(bpart, val);
1496+
}
1497+
14781498
JL_DLLEXPORT void jl_set_const(jl_module_t *m JL_ROOTING_ARGUMENT, jl_sym_t *var, jl_value_t *val JL_ROOTED_ARGUMENT)
14791499
{
1480-
// this function is mostly only used during initialization, so the data races here are not too important to us
1500+
// this function is dangerous and unsound. do not use.
14811501
jl_binding_t *bp = jl_get_module_binding(m, var, 1);
14821502
jl_binding_partition_t *bpart = jl_get_binding_partition(bp, jl_current_task->world_age);
14831503
bpart->min_world = 0;

0 commit comments

Comments
 (0)