Skip to content
Snippets Groups Projects
Commit 93d25a35 authored by Zbynek Slajchrt's avatar Zbynek Slajchrt
Browse files

EmptyTypeSystemFlatLayout annotation added to the attribute nodes.

parent 66ecfb84
No related branches found
No related tags found
No related merge requests found
......@@ -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() {
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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>
* &#64;Child
* private SetFixedAttributeNode setDimNode = SetAttributeNode.create();
* private SetFixedAttributeNode setAttrNode = SetAttributeNode.create();
*
* &#64;Specialization
* protected Object handleStringVector(RAbstractStringVector v, String attrName, Object attrValue) {
* ...
* setDimNode.execute(vector, attrName, attrValue);
* setAttrNode.execute(vector, attrName, attrValue);
* ...
* }
* </pre>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment