Skip to content

Commit

Permalink
fix type uniquing (caching) in incremental deserializer (JuliaLang#39744
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored and ElOceanografo committed May 4, 2021
1 parent 96632d1 commit da07bef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static void jl_serialize_datatype(jl_serializer_state *s, jl_datatype_t *dt) JL_
if (!internal && jl_unwrap_unionall(dt->name->wrapper) == (jl_value_t*)dt) {
tag = 6; // external primary type
}
else if (!dt->isconcretetype) {
else if (jl_is_tuple_type(dt) ? !dt->isconcretetype : dt->hasfreetypevars) {
tag = 0; // normal struct
}
else if (internal) {
Expand All @@ -212,8 +212,8 @@ static void jl_serialize_datatype(jl_serializer_state *s, jl_datatype_t *dt) JL_
tag = 11; // external, but definitely new (still needs caching, but not full unique-ing)
}
else {
// this'll need unique-ing later
// flag this in the backref table as special
// this is eligible for (and possibly requires) unique-ing later,
// so flag this in the backref table as special
uintptr_t *bp = (uintptr_t*)ptrhash_bp(&backref_table, dt);
assert(*bp != (uintptr_t)HT_NOTFOUND);
*bp |= 1;
Expand Down
2 changes: 2 additions & 0 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ precompile_test_harness(false) do dir
const t17809s = Any[
Tuple{
Type{Ptr{MyType{i}}},
Ptr{Type{MyType{i}}},
Array{Ptr{MyType{MyType{:sym}()}}(0), 0},
Val{Complex{Int}(1, 2)},
Val{3},
Expand Down Expand Up @@ -340,6 +341,7 @@ precompile_test_harness(false) do dir
@test all(i -> Foo.t17809s[i + 1] ===
Tuple{
Type{Ptr{Foo.MyType{i}}},
Ptr{Type{Foo.MyType{i}}},
Array{Ptr{Foo.MyType{Foo.MyType{:sym}()}}(0), 0},
Val{Complex{Int}(1, 2)},
Val{3},
Expand Down

0 comments on commit da07bef

Please sign in to comment.