Skip to content

Commit

Permalink
Don't use internal jl_set_const to create constants
Browse files Browse the repository at this point in the history
The internal function `jl_set_const` is allowed during bootstrap only
and ignores world age partition. This would give incorrect results after
JuliaLang/julia#57150. Just eval the constant definition directly,
which has well defined semantics.
  • Loading branch information
Keno committed Jan 25, 2025
1 parent ff34f4c commit 07261b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/clusterserialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ function deserialize_global_from_main(s::ClusterSerializer, sym)
return nothing
end
end
Core.eval(Main, Expr(:global, sym))
if sym_isconst
ccall(:jl_set_const, Cvoid, (Any, Any, Any), Main, sym, v)
Core.eval(Main, Expr(:block,
Expr(:const, GlobalRef(Main, sym), v),
nothing))
else
Core.eval(Main, Expr(:global, sym))
invokelatest(setglobal!, Main, sym, v)
end
return nothing
Expand Down

0 comments on commit 07261b0

Please sign in to comment.