diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeAccessNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeAccessNode.java index d67f5a81d74a009919ed2ad01e5122267b66bc22..5cf678a06dfe84f878b30ad0ca5e27d0b6b35a2e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeAccessNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeAccessNode.java @@ -23,16 +23,19 @@ package com.oracle.truffle.r.nodes.attributes; import com.oracle.truffle.api.CompilerAsserts; +import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.object.DynamicObject; import com.oracle.truffle.api.object.Location; import com.oracle.truffle.api.object.Property; import com.oracle.truffle.api.object.Shape; +import com.oracle.truffle.r.nodes.EmptyTypeSystemFlatLayout; import com.oracle.truffle.r.runtime.nodes.RBaseNode; /** * The base class for the nodes that get/set/remove attributes. It encapsulates the common methods * used in guards and for caching. */ +@TypeSystemReference(EmptyTypeSystemFlatLayout.class) public abstract class AttributeAccessNode extends RBaseNode { protected AttributeAccessNode() { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeIterativeAccessNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeIterativeAccessNode.java index a0eee1c48c83079f7a08ce425e143249a7167d50..525c7491fe44c695ec4b011174e7c4b84e092a0e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeIterativeAccessNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/AttributeIterativeAccessNode.java @@ -24,11 +24,13 @@ package com.oracle.truffle.r.nodes.attributes; import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.api.object.DynamicObject; import com.oracle.truffle.api.object.Property; import com.oracle.truffle.api.object.Shape; import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.r.nodes.EmptyTypeSystemFlatLayout; import com.oracle.truffle.r.runtime.data.RAttributesLayout; import com.oracle.truffle.r.runtime.data.RAttributesLayout.AttrsLayout; import com.oracle.truffle.r.runtime.nodes.RBaseNode; @@ -41,6 +43,7 @@ import com.oracle.truffle.r.runtime.nodes.RBaseNode; * properties (i.e. attributes) it is unnecessary to invoke method {@link Shape#getPropertyList()}, * which would be more expensive. */ +@TypeSystemReference(EmptyTypeSystemFlatLayout.class) public abstract class AttributeIterativeAccessNode extends RBaseNode { protected static final int CACHE_LIMIT = RAttributesLayout.LAYOUTS.length; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java index b08100173bbe22f68c21222c3649a8e81e9b2a89..3b86bb862727a741e13091ce09c2bd026658d5c4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java @@ -170,6 +170,9 @@ public abstract class SetAttributeNode extends AttributeAccessNode { recursive.execute(attributes, name, value); + // TODO: To verify: It might be beneficial to increment the reference counter only if the + // old and new values differ. One should verify, though, whether the costs brought about by + // reading the old value do not prevail in the end. updateRefCountNode.execute(value); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/package-info.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/package-info.java index e5630bc4483d3d8cbdcc98fb644692187fa78b6b..b9490530d1b5e41a61fddeef56b05ea61df7702d 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/package-info.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/package-info.java @@ -36,7 +36,7 @@ * <li>{@link com.oracle.truffle.r.nodes.attributes.GetAttributeNode}: retrieves the value of an * arbitrary attribute * <li>{@link com.oracle.truffle.r.nodes.attributes.SetAttributeNode}: sets the value of an - * arbitrary attribute. If the first argument is an instance if + * arbitrary attribute. If the first argument is an instance * {@link com.oracle.truffle.r.runtime.data.RAttributable}, the node initializes the object with the * empty attributes. * </ul> @@ -49,7 +49,7 @@ * <li>{@link com.oracle.truffle.r.nodes.attributes.HasFixedAttributeNode}: determines the existence * of the predefined attribute * <li>{@link com.oracle.truffle.r.nodes.attributes.SetFixedAttributeNode}: sets the value of the - * predefined attribute. If the first argument is an instance if + * predefined attribute. If the first argument is an instance * {@link com.oracle.truffle.r.runtime.data.RAttributable}, the node initializes the object with the * empty attributes. * <li>{@link com.oracle.truffle.r.nodes.attributes.RemoveFixedAttributeNode}: removes the @@ -105,12 +105,12 @@ * * <pre> * @Child - * private SetFixedAttributeNode setDimNode = SetAttributeNode.create(); + * private SetFixedAttributeNode setAttrNode = SetAttributeNode.create(); * * @Specialization * protected Object handleStringVector(RAbstractStringVector v, String attrName, Object attrValue) { * ... - * setDimNode.execute(vector, attrName, attrValue); + * setAttrNode.execute(vector, attrName, attrValue); * ... * } * </pre>