Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-0.4] backports for RC2 #13182

Merged
merged 24 commits into from
Sep 18, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0dd43a7
fix tracking of serialization state for Function types
amitmurthy Sep 15, 2015
02a885d
added tests [ci skip]
amitmurthy Sep 16, 2015
abba461
fix serializing functions with cycles, and a bug in serializing Expr
JeffBezanson Sep 16, 2015
2b69ef6
Constify deprecated bindings
tkelman Sep 17, 2015
dcd7ffc
Minor doc fix.
GlenHertz Sep 16, 2015
fc83771
Fix #13175, segfault with 👻 fields
simonster Sep 17, 2015
fcc4eb7
handle passing of Ref{GhostType} to cfunction signature (fix #13031)
vtjnash Sep 16, 2015
a6cf1d3
Makefile src/libccalltest needs to depend on julia-deps target
vtjnash Sep 16, 2015
73e132c
remove leading heisenzero from grisu output (fix #12899, fix #10908, …
vtjnash Sep 17, 2015
a89c40c
Doc: note convention for upper-case Module names
mbauman Sep 17, 2015
f7e3590
Doc: simple typo fix
mbauman Sep 17, 2015
79ffcb6
DOC: missing ncv optional argument in eigs
mzaffalon Sep 17, 2015
18d1507
Improving documentation typo
omus Sep 17, 2015
2ad9701
fix #13183, infinite recursion in compiler via static parameter
JeffBezanson Sep 17, 2015
3596965
basedocs: abstract, bitstype, module, baremodule, macro
catawbasam Sep 17, 2015
2b71231
Fix compiler warning about incompatible pointer types. jl_fptr_t is a…
yuyichao Sep 17, 2015
0c3dd77
fix missing `io` argument to `println` in umfpack
JeffBezanson Sep 17, 2015
f972e6a
add deprecation for Union()
JeffBezanson Sep 17, 2015
efe88f3
Grouped docstrings for FFTW in an if USE_GPL_LIBS block
nkottary Sep 14, 2015
abcc5fb
Moved fft docstrings from helpdb.jl to appropriate files in base/fft/
nkottary Sep 14, 2015
da6e9fa
Moved docstrings for *fft* functions from helpdb.jl to base/dft.jl an…
nkottary Sep 15, 2015
6457fd3
in codegen, use StructRet where appropriate
vtjnash Sep 17, 2015
1c584ea
fix compiler warning
JeffBezanson Sep 17, 2015
df6db8b
fix doctests again
tkelman Sep 17, 2015
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
Prev Previous commit
Next Next commit
fix serializing functions with cycles, and a bug in serializing Expr
fixes #12848

(cherry picked from commit a9ae0ad)
  • Loading branch information
JeffBezanson authored and tkelman committed Sep 17, 2015
commit abba461c1c098841e9064079a694cd04f5c6df5e
25 changes: 15 additions & 10 deletions base/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function serialize(s::SerializationState, n::BigFloat)
end

function serialize(s::SerializationState, ex::Expr)
serialize_cycle(s, e) && return
serialize_cycle(s, ex) && return
l = length(ex.args)
if l <= 255
writetag(s.io, EXPR_TAG)
Expand Down Expand Up @@ -265,8 +265,6 @@ function serialize(s::SerializationState, m::Module)
end

function serialize(s::SerializationState, f::Function)
serialize_cycle(s, f) && return
writetag(s.io, FUNCTION_TAG)
name = false
if isgeneric(f)
name = f.env.name
Expand All @@ -275,6 +273,7 @@ function serialize(s::SerializationState, f::Function)
end
if isa(name,Symbol)
if isdefined(Base,name) && is(f,getfield(Base,name))
writetag(s.io, FUNCTION_TAG)
write(s.io, UInt8(0))
serialize(s, name)
return
Expand All @@ -288,18 +287,23 @@ function serialize(s::SerializationState, f::Function)
if mod !== ()
if isdefined(mod,name) && is(f,getfield(mod,name))
# toplevel named func
writetag(s.io, FUNCTION_TAG)
write(s.io, UInt8(2))
serialize(s, mod)
serialize(s, name)
return
end
end
serialize_cycle(s, f) && return
writetag(s.io, FUNCTION_TAG)
write(s.io, UInt8(3))
serialize(s, f.env)
else
serialize_cycle(s, f) && return
writetag(s.io, FUNCTION_TAG)
write(s.io, UInt8(1))
linfo = f.code
@assert isa(linfo,LambdaStaticData)
write(s.io, UInt8(1))
serialize(s, linfo)
serialize(s, f.env)
end
Expand Down Expand Up @@ -520,17 +524,18 @@ function deserialize(s::SerializationState, ::Type{Function})
f = getfield(mod,name)::Function
end
elseif b==3
env = deserialize(s)
f = ccall(:jl_new_gf_internal, Any, (Any,), env)::Function
f = ccall(:jl_new_gf_internal, Any, (Any,), nothing)::Function
deserialize_cycle(s, f)
f.env = deserialize(s)
else
linfo = deserialize(s)
f = ccall(:jl_new_closure, Any, (Ptr{Void}, Ptr{Void}, Any), C_NULL, C_NULL, linfo)::Function
f = ccall(:jl_new_closure, Any, (Ptr{Void}, Ptr{Void}, Any),
cglobal(:jl_trampoline), C_NULL, nothing)::Function
deserialize_cycle(s, f)
f.code = li = deserialize(s)
f.fptr = ccall(:jl_linfo_fptr, Ptr{Void}, (Any,), li)
f.env = deserialize(s)
return f
end

deserialize_cycle(s, f)
return f
end

Expand Down
5 changes: 5 additions & 0 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ DLLEXPORT jl_function_t *jl_new_closure(jl_fptr_t fptr, jl_value_t *env,
return f;
}

DLLEXPORT jl_fptr_t *jl_linfo_fptr(jl_lambda_info_t *linfo)
{
return linfo->fptr;
}

DLLEXPORT
jl_lambda_info_t *jl_new_lambda_info(jl_value_t *ast, jl_svec_t *sparams, jl_module_t *ctx)
{
Expand Down