Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -60,6 +60,9 @@ public void writeExistingField(DynamicObject object, Object value,
if (shared) {
writeBarrierNode.executeWriteBarrier(value);
synchronized (object) {
// Re-check the shape under the monitor as another thread might have changed it
// by adding a field (fine) or upgrading an existing field to Object storage
// (need to use the new storage)
if (object.getShape() != cachedShape) {
CompilerDirectives.transferToInterpreter();
execute(object, value);
@@ -95,6 +98,9 @@ public void writeNewField(DynamicObject object, Object value,
if (shared) {
writeBarrierNode.executeWriteBarrier(value);
synchronized (object) {
// Re-check the shape under the monitor as another thread might have changed it
// by adding a field or upgrading an existing field to Object storage
// (we need to make sure to have the right shape to add the new field)
if (object.getShape() != oldShape) {
CompilerDirectives.transferToInterpreter();
execute(object, value);

0 comments on commit 1a8a43a

Please sign in to comment.