diff --git a/truffle/src/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectLibraryImpl.java b/truffle/src/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectLibraryImpl.java index 216d13ee6de9..86c5622edb9d 100644 --- a/truffle/src/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectLibraryImpl.java +++ b/truffle/src/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectLibraryImpl.java @@ -1246,6 +1246,7 @@ protected boolean putImpl(DynamicObject object, Shape cachedShape, Object key, O return false; } else { LocationImpl location = getLocation(newProperty); + boolean guardCondition = object.getShape() == oldShape; if (location.canStore(value)) { Shape newShape = c.newShape; if (newShape != oldShape) { @@ -1254,7 +1255,7 @@ protected boolean putImpl(DynamicObject object, Shape cachedShape, Object key, O continue; } try { - location.set(object, value, object.getShape() == oldShape); + location.set(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1287,6 +1288,7 @@ protected boolean putIntImpl(DynamicObject object, Shape cachedShape, Object key } else { LocationImpl location = getLocation(newProperty); Shape newShape = c.newShape; + boolean guardCondition = object.getShape() == oldShape; if (location.isIntLocation()) { if (newShape != oldShape) { ACCESS.growAndSetShape(object, oldShape, newShape); @@ -1294,7 +1296,7 @@ protected boolean putIntImpl(DynamicObject object, Shape cachedShape, Object key continue; } try { - location.setInt(object, value, object.getShape() == oldShape); + location.setInt(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1307,7 +1309,7 @@ protected boolean putIntImpl(DynamicObject object, Shape cachedShape, Object key continue; } try { - location.setLong(object, value, object.getShape() == oldShape); + location.setLong(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1320,7 +1322,7 @@ protected boolean putIntImpl(DynamicObject object, Shape cachedShape, Object key continue; } try { - location.setDouble(object, value, object.getShape() == oldShape); + location.setDouble(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1333,7 +1335,7 @@ protected boolean putIntImpl(DynamicObject object, Shape cachedShape, Object key continue; } try { - location.set(object, value, object.getShape() == oldShape); + location.set(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1363,6 +1365,7 @@ protected boolean putLongImpl(DynamicObject object, Shape cachedShape, Object ke return false; } else { LocationImpl location = getLocation(newProperty); + boolean guardCondition = object.getShape() == oldShape; if (location.isLongLocation()) { Shape newShape = c.newShape; if (newShape != oldShape) { @@ -1371,7 +1374,7 @@ protected boolean putLongImpl(DynamicObject object, Shape cachedShape, Object ke continue; } try { - location.setLong(object, value, object.getShape() == oldShape); + location.setLong(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1385,7 +1388,7 @@ protected boolean putLongImpl(DynamicObject object, Shape cachedShape, Object ke continue; } try { - location.set(object, value, object.getShape() == oldShape); + location.set(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1415,6 +1418,7 @@ protected boolean putDoubleImpl(DynamicObject object, Shape cachedShape, Object return false; } else { LocationImpl location = getLocation(newProperty); + boolean guardCondition = object.getShape() == oldShape; if (location.isDoubleLocation()) { Shape newShape = c.newShape; if (newShape != oldShape) { @@ -1423,7 +1427,7 @@ protected boolean putDoubleImpl(DynamicObject object, Shape cachedShape, Object continue; } try { - location.setDouble(object, value, object.getShape() == oldShape); + location.setDouble(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1437,7 +1441,7 @@ protected boolean putDoubleImpl(DynamicObject object, Shape cachedShape, Object continue; } try { - location.set(object, value, object.getShape() == oldShape); + location.set(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); } @@ -1467,6 +1471,7 @@ protected boolean putBooleanImpl(DynamicObject object, Shape cachedShape, Object return false; } else { LocationImpl location = getLocation(newProperty); + boolean guardCondition = object.getShape() == oldShape; if (location.canStore(value)) { Shape newShape = c.newShape; if (newShape != oldShape) { @@ -1475,7 +1480,7 @@ protected boolean putBooleanImpl(DynamicObject object, Shape cachedShape, Object continue; } try { - location.set(object, value, object.getShape() == oldShape); + location.set(object, value, guardCondition); } catch (IncompatibleLocationException | FinalLocationException e) { throw shouldNotHappen(e); }