Skip to content
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 src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ JL_CALLABLE(jl_f_getglobal)

JL_CALLABLE(jl_f_setglobal)
{
enum jl_memory_order order = jl_memory_order_monotonic;
enum jl_memory_order order = jl_memory_order_release;
JL_NARGS(setglobal!, 3, 4);
if (nargs == 4) {
JL_TYPECHK(setglobal!, symbol, args[3]);
Expand Down
5 changes: 3 additions & 2 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2879,6 +2879,7 @@ static bool emit_f_opglobal(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
const jl_cgval_t &sym = argv[2];
const jl_cgval_t &val = argv[3];
enum jl_memory_order order = jl_memory_order_unspecified;
assert(f == jl_builtin_setglobal && modifyop == nullptr && "unimplemented");

if (nargs == 4) {
const jl_cgval_t &arg4 = argv[4];
Expand All @@ -2888,7 +2889,7 @@ static bool emit_f_opglobal(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
return false;
}
else
order = jl_memory_order_monotonic;
order = jl_memory_order_release;

if (order == jl_memory_order_invalid || order == jl_memory_order_notatomic) {
emit_atomic_error(ctx, order == jl_memory_order_invalid ? "invalid atomic ordering" : "setglobal!: module binding cannot be written non-atomically");
Expand Down Expand Up @@ -4686,7 +4687,7 @@ static void emit_assignment(jl_codectx_t &ctx, jl_value_t *l, jl_value_t *r, ssi
bp = global_binding_pointer(ctx, jl_globalref_mod(l), jl_globalref_name(l), &bnd, true);
}
if (bp != NULL) {
emit_globalset(ctx, bnd, bp, rval_info, AtomicOrdering::Unordered);
emit_globalset(ctx, bnd, bp, rval_info, AtomicOrdering::Release);
// Global variable. Does not need debug info because the debugger knows about
// its memory location.
}
Expand Down