Skip to content

Commit

Permalink
Backport of patch for #37594 to Julia 1.5.2 / for Julia 1.5.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sacha0 committed Oct 21, 2020
1 parent 628e8cb commit cf8b9ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
3 changes: 3 additions & 0 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ jl_datatype_t *jl_new_uninitialized_datatype(void)
t->zeroinit = 0;
t->isinlinealloc = 0;
t->has_concrete_subtype = 1;
t->name = NULL;
t->super = NULL;
t->parameters = NULL;
t->layout = NULL;
t->names = NULL;
t->types = NULL;
Expand Down
29 changes: 13 additions & 16 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,7 @@ static int64_t write_dependency_list(ios_t *s, jl_array_t **udepsp, jl_array_t *

static jl_value_t *jl_deserialize_datatype(jl_serializer_state *s, int pos, jl_value_t **loc) JL_GC_DISABLED
{
assert(pos == backref_list.len - 1 && "nothing should have been deserialized since assigning pos");
int tag = read_uint8(s->s);
if (tag == 6 || tag == 7) {
jl_typename_t *name = (jl_typename_t*)jl_deserialize_value(s, NULL);
Expand All @@ -1449,19 +1450,18 @@ static jl_value_t *jl_deserialize_datatype(jl_serializer_state *s, int pos, jl_v
backref_list.items[pos] = dtv;
return dtv;
}
size_t size = read_int32(s->s);
uint8_t flags = read_uint8(s->s);
uint8_t memflags = read_uint8(s->s);
jl_datatype_t *dt = NULL;
if (tag == 0 || tag == 5 || tag == 10 || tag == 11 || tag == 12)
dt = jl_new_uninitialized_datatype();
else {
if (!(tag == 0 || tag == 5 || tag == 10 || tag == 11 || tag == 12)) {
assert(0 && "corrupt deserialization state");
abort();
}
assert(s->method == NULL && s->mode != MODE_IR && "no new data-types expected during MODE_IR");
assert(pos == backref_list.len - 1 && "nothing should have been deserialized since assigning pos");
jl_datatype_t *dt = jl_new_uninitialized_datatype();
backref_list.items[pos] = dt;
if (loc != NULL && loc != HT_NOTFOUND)
*loc = (jl_value_t*)dt;
size_t size = read_int32(s->s);
uint8_t flags = read_uint8(s->s);
uint8_t memflags = read_uint8(s->s);
dt->size = size;
dt->abstract = flags & 1;
dt->mutabl = (flags >> 1) & 1;
Expand All @@ -1474,11 +1474,6 @@ static jl_value_t *jl_deserialize_datatype(jl_serializer_state *s, int pos, jl_v
dt->zeroinit = (memflags >> 4) & 1;
dt->isinlinealloc = (memflags >> 5) & 1;
dt->has_concrete_subtype = (memflags >> 6) & 1;
dt->types = NULL;
dt->parameters = NULL;
dt->name = NULL;
dt->super = NULL;
dt->layout = NULL;
if (!dt->abstract)
dt->ninitialized = read_uint16(s->s);
else
Expand Down Expand Up @@ -1542,15 +1537,17 @@ static jl_value_t *jl_deserialize_datatype(jl_serializer_state *s, int pos, jl_v
return (jl_value_t*)dt;
}

static jl_value_t *jl_deserialize_value_svec(jl_serializer_state *s, uint8_t tag) JL_GC_DISABLED
static jl_value_t *jl_deserialize_value_svec(jl_serializer_state *s, uint8_t tag, jl_value_t **loc) JL_GC_DISABLED
{
int usetable = (s->mode != MODE_IR);
size_t i, len;
if (tag == TAG_SVEC)
len = read_uint8(s->s);
else
len = read_int32(s->s);
jl_svec_t *sv = jl_alloc_svec_uninit(len);
jl_svec_t *sv = jl_alloc_svec(len);
if (loc != NULL)
*loc = (jl_value_t*)sv;
if (usetable)
arraylist_push(&backref_list, (jl_value_t*)sv);
jl_value_t **data = jl_svec_data(sv);
Expand Down Expand Up @@ -2115,7 +2112,7 @@ static jl_value_t *jl_deserialize_value(jl_serializer_state *s, jl_value_t **loc
case TAG_LONG_METHODROOT:
return jl_array_ptr_ref(s->method->roots, read_uint16(s->s));
case TAG_SVEC: JL_FALLTHROUGH; case TAG_LONG_SVEC:
return jl_deserialize_value_svec(s, tag);
return jl_deserialize_value_svec(s, tag, loc);
case TAG_COMMONSYM:
return deser_symbols[read_uint8(s->s)];
case TAG_SYMBOL: JL_FALLTHROUGH; case TAG_LONG_SYMBOL:
Expand Down

0 comments on commit cf8b9ec

Please sign in to comment.