Skip to content

Commit

Permalink
[runtime] Fix a regression introduced by 1be62d5 (field loading rewri…
Browse files Browse the repository at this point in the history
…te). Static field offsets were overwritten with 0 if the mono_class_setup_fields () function was called in parallel.
  • Loading branch information
vargaz committed Oct 17, 2016
1 parent 297c257 commit 1998314
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mono/metadata/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -2074,8 +2074,11 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
klass->has_references = has_references;
klass->packing_size = packing_size;
klass->min_align = min_align;
for (i = 0; i < top; ++i)
klass->fields [i].offset = field_offsets [i];
for (i = 0; i < top; ++i) {
field = &klass->fields [i];
if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
klass->fields [i].offset = field_offsets [i];
}

mono_memory_barrier ();
klass->size_inited = 1;
Expand Down

0 comments on commit 1998314

Please sign in to comment.