Skip to content

Commit 0887df4

Browse files
authored
Merge pull request #125 from JuliaLang/kf/jlsetconst
Don't use internal jl_set_const to create constants
2 parents 1c7eb92 + 52d5703 commit 0887df4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/clusterserialize.jl

+7-2
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,15 @@ function deserialize_global_from_main(s::ClusterSerializer, sym)
167167
return nothing
168168
end
169169
end
170-
Core.eval(Main, Expr(:global, sym))
171170
if sym_isconst
172-
ccall(:jl_set_const, Cvoid, (Any, Any, Any), Main, sym, v)
171+
# Note that the post-lowering const form is not allowed in value
172+
# position, so there needs to be a dummy `nothing` argument to drop the
173+
# return value.
174+
Core.eval(Main, Expr(:block,
175+
Expr(:const, GlobalRef(Main, sym), v),
176+
nothing))
173177
else
178+
Core.eval(Main, Expr(:global, sym))
174179
invokelatest(setglobal!, Main, sym, v)
175180
end
176181
return nothing

0 commit comments

Comments
 (0)