From 07261b0096b419f48c29bb83d2fc215a035c3413 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Sat, 25 Jan 2025 04:53:48 +0000 Subject: [PATCH] Don't use internal jl_set_const to create constants 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. --- src/clusterserialize.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/clusterserialize.jl b/src/clusterserialize.jl index d2f09e7..1e49b6a 100644 --- a/src/clusterserialize.jl +++ b/src/clusterserialize.jl @@ -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