Skip to content

Commit

Permalink
Fix atomicfields serialization for system image (JuliaLang#42390)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf authored and LilithHafner committed Mar 8, 2022
1 parent 374fac0 commit 8d2987f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,14 +1041,14 @@ static void jl_write_values(jl_serializer_state *s)
jl_typename_t *tn = (jl_typename_t*)v;
jl_typename_t *newtn = (jl_typename_t*)&s->s->buf[reloc_offset];
if (tn->atomicfields != NULL) {
size_t nf = jl_svec_len(tn->names);
size_t nb = (jl_svec_len(tn->names) + 31) / 32 * sizeof(uint32_t);
uintptr_t layout = LLT_ALIGN(ios_pos(s->const_data), sizeof(void*));
write_padding(s->const_data, layout - ios_pos(s->const_data)); // realign stream
newtn->atomicfields = NULL; // relocation offset
layout /= sizeof(void*);
arraylist_push(&s->relocs_list, (void*)(reloc_offset + offsetof(jl_typename_t, atomicfields))); // relocation location
arraylist_push(&s->relocs_list, (void*)(((uintptr_t)ConstDataRef << RELOC_TAG_OFFSET) + layout)); // relocation target
ios_write(s->const_data, (char*)tn->atomicfields, nf);
ios_write(s->const_data, (char*)tn->atomicfields, nb);
}
}
else if (((jl_datatype_t*)(jl_typeof(v)))->name == jl_idtable_typename) {
Expand Down

0 comments on commit 8d2987f

Please sign in to comment.