Skip to content

Commit

Permalink
Fix another case where the slot needs to be generalized
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Jun 26, 2017
1 parent ffe2668 commit 23c52a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/som/interpreter/objectstorage/ObjectLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public ObjectLayout withGeneralizedField(final SlotDefinition slot) {
if (type == Object.class) {
return this;
} else {
assert type != Object.class;
return cloneWithChanged(slot, Object.class);
}
}
Expand All @@ -135,6 +134,12 @@ public ObjectLayout withInitializedField(final SlotDefinition slot, final Class<
if (currentType == specType) {
return this;
} else {
// It can happen that two threads try to initialize the field to different types
// This is handled here by ensuring that we generalize it when necessary.
if ((currentType == Long.class && specType == Double.class)
|| (currentType == Double.class && specType == Long.class)) {
specType = Object.class;
}
assert currentType == null;
return cloneWithChanged(slot, specType);
}
Expand Down

0 comments on commit 23c52a7

Please # to comment.