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