@@ -160,7 +160,6 @@ private Location createLocationForValue(ShapeImpl oldShape, Object value, long p
160160
161161 protected ShapeImpl definePropertyChangeFlags (ShapeImpl oldShape , Property existing , Object value , int propertyFlags , long putFlags ) {
162162 assert existing .getFlags () != propertyFlags ;
163- oldShape .onPropertyTransition (existing );
164163 if (existing .getLocation ().canStore (value )) {
165164 Property newProperty = Property .create (existing .getKey (), existing .getLocation (), propertyFlags );
166165 return replaceProperty (oldShape , existing , newProperty );
@@ -170,7 +169,6 @@ protected ShapeImpl definePropertyChangeFlags(ShapeImpl oldShape, Property exist
170169 }
171170
172171 protected ShapeImpl definePropertyGeneralize (ShapeImpl oldShape , Property oldProperty , Object value , com .oracle .truffle .api .object .LocationFactory locationFactory , long putFlags ) {
173- oldShape .onPropertyTransition (oldProperty );
174172 if (Flags .isSeparateShape (putFlags )) {
175173 Location newLocation = createLocationForValue (oldShape , value , putFlags , locationFactory );
176174 Property newProperty = ((PropertyImpl ) oldProperty ).relocate (newLocation );
@@ -189,7 +187,6 @@ protected ShapeImpl generalizeProperty(Property oldProperty, Object value, Shape
189187 Location oldLocation = oldProperty .getLocation ();
190188 Location newLocation = currentShape .allocator ().locationForValueUpcast (value , oldLocation , putFlags );
191189 Property newProperty = ((PropertyImpl ) oldProperty ).relocate (newLocation );
192- nextShape .onPropertyTransition (oldProperty );
193190 return replaceProperty (nextShape , oldProperty , newProperty );
194191 }
195192
@@ -226,10 +223,9 @@ protected ShapeImpl replaceProperty(ShapeImpl shape, Property oldProperty, Prope
226223
227224 /** @since 0.17 or earlier */
228225 protected ShapeImpl removeProperty (ShapeImpl shape , Property property ) {
229- shape .onPropertyTransition (property );
230-
231226 boolean direct = shape .isShared ();
232227 RemovePropertyTransition transition = newRemovePropertyTransition (property , direct );
228+ shape .onPropertyTransition (transition );
233229 ShapeImpl cachedShape = shape .queryTransition (transition );
234230 if (cachedShape != null ) {
235231 return ensureValid (cachedShape );
@@ -306,9 +302,8 @@ private static ShapeImpl directReplacePropertyInner(ShapeImpl shape, Property ol
306302 return shape ;
307303 }
308304
309- shape .onPropertyTransition (oldProperty );
310-
311- Transition replacePropertyTransition = new Transition .DirectReplacePropertyTransition (oldProperty , newProperty );
305+ var replacePropertyTransition = new Transition .DirectReplacePropertyTransition (oldProperty , newProperty );
306+ shape .onPropertyTransition (replacePropertyTransition );
312307 ShapeImpl cachedShape = shape .queryTransition (replacePropertyTransition );
313308 if (cachedShape != null ) {
314309 return cachedShape ;
@@ -326,6 +321,7 @@ private static ShapeImpl directReplacePropertyInner(ShapeImpl shape, Property ol
326321 }
327322
328323 protected ShapeImpl separateReplaceProperty (ShapeImpl shape , Property oldProperty , Property newProperty ) {
324+ shape .invalidateAllPropertyAssumptions ();
329325 ShapeImpl newRoot = shape .createShape (shape .getLayout (), shape .sharedData , null , shape .objectType , PropertyMap .empty (), null , shape .getLayout ().createAllocator (), shape .flags );
330326 ShapeImpl newShape = newRoot ;
331327 boolean found = false ;
@@ -343,6 +339,7 @@ protected ShapeImpl separateReplaceProperty(ShapeImpl shape, Property oldPropert
343339 }
344340
345341 protected ShapeImpl createSeparateShape (ShapeImpl shape ) {
342+ shape .invalidateAllPropertyAssumptions ();
346343 ShapeImpl newRoot = shape .createShape (shape .getLayout (), shape .sharedData , null , shape .objectType , PropertyMap .empty (), null , shape .getLayout ().createAllocator (), shape .flags );
347344 ShapeImpl newShape = newRoot ;
348345 for (Iterator <Property > iterator = shape .getPropertyMap ().orderedValueIterator (); iterator .hasNext ();) {
@@ -371,9 +368,9 @@ protected ShapeImpl addProperty(ShapeImpl shape, Property property, boolean ensu
371368
372369 private ShapeImpl addPropertyInner (ShapeImpl shape , Property property ) {
373370 assert !(shape .hasProperty (property .getKey ())) : "duplicate property " + property .getKey ();
374- shape .onPropertyTransition (property );
375371
376372 AddPropertyTransition addTransition = newAddPropertyTransition (property );
373+ shape .onPropertyTransition (addTransition );
377374 ShapeImpl cachedShape = shape .queryTransition (addTransition );
378375 if (cachedShape != null ) {
379376 return cachedShape ;
0 commit comments