diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributeNode.java index a3d0c24731ed45b61ab4eb67754cddb5ccbad4d9..27d4fd901217877176dd1fd89f3a62aeed794b5e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributeNode.java @@ -32,6 +32,12 @@ import com.oracle.truffle.api.object.Shape; import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.r.runtime.data.RAttributable; +/** + * This node is responsible for retrieving a value from an arbitrary attribute. It accepts both + * {@link DynamicObject} and {@link RAttributable} instances as the first argument. If the first + * argument is {@link RAttributable} and its attributes are initialized, the recursive instance of + * this class is used to get the attribute value from the attributes. + */ public abstract class GetAttributeNode extends AttributeAccessNode { @Child private GetAttributeNode recursive; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetFixedAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetFixedAttributeNode.java index 00044e606d58dd6db224a26d58f530b20607e515..24910e4e0a6b6326c8df97dd4f00a2813aa208cf 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetFixedAttributeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetFixedAttributeNode.java @@ -33,6 +33,12 @@ import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.data.RAttributable; +/** + * This node is responsible for retrieving a value from the predefined (fixed) attribute. It accepts + * both {@link DynamicObject} and {@link RAttributable} instances as the first argument. If the + * first argument is {@link RAttributable} and its attributes are initialized, the recursive + * instance of this class is used to get the attribute value from the attributes. + */ public abstract class GetFixedAttributeNode extends FixedAttributeAccessNode { @Child private GetFixedAttributeNode recursive; 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 2856f8b339b29a8bc6536916fe3ae17e45b1758e..c09d2d58bc5897e4be6d3db446a096b77f9f1fa8 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 @@ -35,6 +35,16 @@ import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.data.RAttributable; +/** + * This node is responsible for setting a value to an arbitrary attribute. It accepts both + * {@link DynamicObject} and {@link RAttributable} instances as the first argument. If the first + * argument is {@link RAttributable} and the attribute is a special one (i.e. names, dims, dimnames, + * rownames), a corresponding node defined in the {@link SpecialAttributesFunctions} class is + * created and the processing is delegated to it. If the first argument is {@link RAttributable} and + * the attribute is not a special one, it is made sure that the attributes in the first argument are + * initialized. Then the recursive instance of this class is used to set the attribute value to the + * attributes. + */ public abstract class SetAttributeNode extends AttributeAccessNode { @Child SetAttributeNode recursive; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java index e427dc9cb466830c2bfce0a53b04646dbfddaf7e..b50ffbabe5201a036732c5f9b3e2c786c9ad7278 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java @@ -37,6 +37,16 @@ import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.data.RAttributable; +/** + * This node is responsible for setting a value to the predefined (fixed) attribute. It accepts both + * {@link DynamicObject} and {@link RAttributable} instances as the first argument. If the first + * argument is {@link RAttributable} and the attribute is a special one (i.e. names, dims, dimnames, + * rownames), a corresponding node defined in the {@link SpecialAttributesFunctions} class is + * created and the processing is delegated to it. If the first argument is {@link RAttributable} and + * the attribute is not a special one, it is made sure that the attributes in the first argument are + * initialized. Then the recursive instance of this class is used to set the attribute value to the + * attributes. + */ public abstract class SetFixedAttributeNode extends FixedAttributeAccessNode { @Child private SetFixedAttributeNode recursive; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java index fa9375895a6cfbd5a4c67f1dc661fd9d1537cc3d..3fe2f477a3a9bfa22e850272a8af3375d65ee3d4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java @@ -43,8 +43,15 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.nodes.RBaseNode; +/** + * This class defines a number of nodes used to handle the special attributes, such as names, dims, + * dimnames and rownames. + */ public final class SpecialAttributesFunctions { + /** + * A node used in guards, for example, to determine whether an attribute is a special one. + */ public static final class IsSpecialAttributeNode extends RBaseNode { private final BranchProfile namesProfile = BranchProfile.create(); @@ -95,6 +102,9 @@ public final class SpecialAttributesFunctions { } } + /** + * A node for setting a value to any special attribute. + */ public static final class GenericSpecialAttributeNode extends RBaseNode { private final BranchProfile namesProfile = BranchProfile.create(); @@ -151,6 +161,12 @@ public final class SpecialAttributesFunctions { } } + /** + * A factory method for creating a node handling the given special attribute. + * + * @param name the special attribute name + * @return the node + */ public static SetSpecialAttributeNode createSpecialAttributeNode(String name) { assert name.intern() == name; if (name == RRuntime.NAMES_ATTR_KEY) { @@ -168,6 +184,9 @@ public final class SpecialAttributesFunctions { } } + /** + * The base class for the nodes setting values to special attributes. + */ public abstract static class SetSpecialAttributeNode extends RBaseNode { public abstract void execute(RAttributable x, Object attrValue);