Skip to content
Snippets Groups Projects
Commit 1089579e authored by Michael Haupt's avatar Michael Haupt
Browse files

add commentary on RArguments

parent 4362581a
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,30 @@ package com.oracle.truffle.r.runtime;
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.r.runtime.data.*;
// @formatter:off
/**
* Provide access to arguments contained in frames. This is a purely static class. It defines, by
* means of slot offsets, where in a frame certain information is stored, such as the function
* executed in the frame.
*
* The frame layout, depicted, is as follows:
* <pre>
* +-------------------+
* INDEX_FUNCTION -> | RFunction |
* +-------------------+
* INDEX_ENCLOSING_FRAME -> | MaterializedFrame |
* +-------------------+
* INDEX_ARGUMENTS -> | Object[] |
* +-------------------+
* INDEX_NAMES -> | Object[] |
* +-------------------+
* </pre>
*
* All frame elements should <b>always</b> be accessed through the getter and setter functions
* defined in this class, as they provide a means of accessing the frame contents that is
* transparent to layout changes.
*/
// @formatter:on
public final class RArguments {
public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
......@@ -42,10 +61,6 @@ public final class RArguments {
private RArguments() {
}
public static RFunction getFunction(Frame frame) {
return (RFunction) frame.getArguments()[INDEX_FUNCTION];
}
public static Object[] create() {
return create(null, null, EMPTY_OBJECT_ARRAY);
}
......@@ -66,6 +81,10 @@ public final class RArguments {
return new Object[]{functionObj, enclosingFrame, evaluatedArgs, names};
}
public static RFunction getFunction(Frame frame) {
return (RFunction) frame.getArguments()[INDEX_FUNCTION];
}
public static Object[] getArgumentsArray(Frame frame) {
return (Object[]) frame.getArguments()[INDEX_ARGUMENTS];
}
......
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