@@ -1377,13 +1377,10 @@ public abstract static class SetShapeFlagsNode extends Node {
13771377 * }
13781378 * }
13791379 *
1380- * Note that {@link AddShapeFlagsNode} is more efficient and convenient for that particular pattern.
1381- *
13821380 * @param newFlags the flags to set; must be in the range from 0 to 65535 (inclusive).
13831381 * @return {@code true} if the object's shape changed, {@code false} if no change was made.
13841382 * @throws IllegalArgumentException if the flags are not in the allowed range.
13851383 * @see GetShapeFlagsNode
1386- * @see AddShapeFlagsNode
13871384 * @see Shape.Builder#shapeFlags(int)
13881385 */
13891386 // @formatter:on
@@ -1437,108 +1434,6 @@ public static SetShapeFlagsNode getUncached() {
14371434 }
14381435 }
14391436
1440- /**
1441- * Adds language-specific object shape flags.
1442- *
1443- * @see #execute(DynamicObject, int)
1444- * @since 25.1
1445- */
1446- @ ImportStatic (DynamicObject .class )
1447- @ GeneratePackagePrivate
1448- @ GenerateUncached
1449- @ GenerateInline (false )
1450- public abstract static class AddShapeFlagsNode extends Node {
1451-
1452- AddShapeFlagsNode () {
1453- }
1454-
1455- // @formatter:off
1456- /**
1457- * Adds language-specific object shape flags, changing the object's shape if need be.
1458- *
1459- * These flags may be used to tag objects that possess characteristics that need to be queried
1460- * efficiently on fast and slow paths. For example, they can be used to mark objects as frozen.
1461- * <p>
1462- * Only the lowest 16 bits (i.e. values in the range 0 to 65535) are allowed, the remaining bits
1463- * are currently reserved.
1464- * <p>
1465- * Equivalent to:
1466- * {@snippet :
1467- * @Specialization
1468- * static void addFlags(DynamicObject receiver, int newFlags,
1469- * @Cached DynamicObject.GetShapeFlagsNode getShapeFlagsNode,
1470- * @Cached DynamicObject.SetShapeFlagsNode setShapeFlagsNode) {
1471- * setShapeFlagsNode.execute(receiver, getShapeFlagsNode.execute(receiver) | newFlags);
1472- * }
1473- * }
1474- *
1475- * <h3>Usage example:</h3>
1476- *
1477- * {@snippet :
1478- * @Specialization
1479- * static void freeze(DynamicObject receiver,
1480- * @Cached DynamicObject.AddShapeFlagsNode addShapeFlagsNode) {
1481- * addShapeFlagsNode.execute(receiver, FROZEN);
1482- * }
1483- * }
1484- *
1485- * @param newFlags the flags to set; must be in the range from 0 to 65535 (inclusive).
1486- * @return {@code true} if the object's shape changed, {@code false} if no change was made.
1487- * @throws IllegalArgumentException if the flags are not in the allowed range.
1488- * @see GetShapeFlagsNode
1489- * @see Shape.Builder#shapeFlags(int)
1490- */
1491- // @formatter:on
1492- public abstract boolean execute (DynamicObject receiver , int newFlags );
1493-
1494- @ SuppressWarnings ("unused" )
1495- @ Specialization (guards = {"shape == cachedShape" , "flags == newFlags" }, limit = "SHAPE_CACHE_LIMIT" )
1496- static boolean doCached (DynamicObject receiver , int flags ,
1497- @ Bind ("receiver.getShape()" ) Shape shape ,
1498- @ Cached ("shape" ) Shape cachedShape ,
1499- @ Cached ("flags" ) int newFlags ,
1500- @ Cached ("shapeAddFlags(cachedShape, newFlags)" ) Shape newShape ) {
1501- if (newShape != cachedShape ) {
1502- receiver .setShape (newShape );
1503- return true ;
1504- } else {
1505- return false ;
1506- }
1507- }
1508-
1509- @ Specialization (replaces = "doCached" )
1510- static boolean doGeneric (DynamicObject receiver , int flags ,
1511- @ Bind ("receiver.getShape()" ) Shape shape ) {
1512- Shape newShape = shapeAddFlags (shape , flags );
1513- if (newShape != shape ) {
1514- receiver .setShape (newShape );
1515- return true ;
1516- } else {
1517- return false ;
1518- }
1519- }
1520-
1521- static Shape shapeAddFlags (Shape shape , int newFlags ) {
1522- return shape .setFlags (shape .getFlags () | newFlags );
1523- }
1524-
1525- /**
1526- * @since 25.1
1527- */
1528- @ NeverDefault
1529- public static AddShapeFlagsNode create () {
1530- return DynamicObjectFactory .AddShapeFlagsNodeGen .create ();
1531- }
1532-
1533- /**
1534- * @since 25.1
1535- */
1536- @ NeverDefault
1537- public static AddShapeFlagsNode getUncached () {
1538- return DynamicObjectFactory .AddShapeFlagsNodeGen .getUncached ();
1539- }
1540- }
1541-
15421437 /**
15431438 * Checks whether this object is marked as shared.
15441439 *
0 commit comments