Skip to content

Commit

Permalink
fix tracking of serialization state for Function types
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy authored and JeffBezanson committed Sep 16, 2015
1 parent 5b82198 commit 3d6c872
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions base/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -507,24 +507,30 @@ function deserialize(s::SerializationState, ::Type{Function})
if b==0
name = deserialize(s)::Symbol
if !isdefined(Base,name)
return (args...)->error("function $name not defined on process $(myid())")
f = (args...)->error("function $name not defined on process $(myid())")
else
f = getfield(Base,name)::Function
end
return getfield(Base,name)::Function
elseif b==2
mod = deserialize(s)::Module
name = deserialize(s)::Symbol
if !isdefined(mod,name)
return (args...)->error("function $name not defined on process $(myid())")
f = (args...)->error("function $name not defined on process $(myid())")
else
f = getfield(mod,name)::Function
end
return getfield(mod,name)::Function
elseif b==3
env = deserialize(s)
return ccall(:jl_new_gf_internal, Any, (Any,), env)::Function
f = ccall(:jl_new_gf_internal, Any, (Any,), env)::Function
else
linfo = deserialize(s)
f = ccall(:jl_new_closure, Any, (Ptr{Void}, Ptr{Void}, Any), C_NULL, C_NULL, linfo)::Function
deserialize_cycle(s, f)
f.env = deserialize(s)
return f
end
linfo = deserialize(s)
f = ccall(:jl_new_closure, Any, (Ptr{Void}, Ptr{Void}, Any), C_NULL, C_NULL, linfo)::Function

deserialize_cycle(s, f)
f.env = deserialize(s)
return f
end

Expand Down

0 comments on commit 3d6c872

Please sign in to comment.