Java Code Examples for com.oracle.truffle.api.frame.VirtualFrame#getArguments()

The following examples show how to use com.oracle.truffle.api.frame.VirtualFrame#getArguments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HashemEvalRootNode.java    From mr-hashemi with Universal Permissive License v1.0 6 votes vote down vote up
@Override
public Object execute(VirtualFrame frame) {
    /* Lazy registrations of functions on first execution. */
    if (!registered) {
        /* Function registration is a slow-path operation that must not be compiled. */
        CompilerDirectives.transferToInterpreterAndInvalidate();
        lookupContextReference(HashemLanguage.class).get().getFunctionRegistry().register(functions);
        registered = true;
    }

    if (mainCallNode == null) {
        /* The source code did not have a "main" function, so nothing to execute. */
        return HashemPooch.SINGLETON;
    } else {
        /* Conversion of arguments to types understood by SL. */
        Object[] arguments = frame.getArguments();
        for (int i = 0; i < arguments.length; i++) {
            arguments[i] = HashemContext.fromForeignValue(arguments[i]);
        }
        return mainCallNode.call(arguments);
    }
}
 
Example 2
Source File: HashemReadArgumentNode.java    From mr-hashemi with Universal Permissive License v1.0 5 votes vote down vote up
@Override
public Object executeGeneric(VirtualFrame frame) {
    Object[] args = frame.getArguments();
    if (index < args.length) {
        return args[index];
    } else {
        /* In the interpreter, record profiling information that the branch was used. */
        outOfBoundsTaken.enter();
        /* Use the default null value. */
        return HashemPooch.SINGLETON;
    }
}
 
Example 3
Source File: BuiltinRootEventHandler.java    From nodeprof.js with Apache License 2.0 5 votes vote down vote up
public Object getReceiver(VirtualFrame frame) {
    Object receiver = frame.getArguments()[0];
    if (receiver == JSFunction.CONSTRUCT) {
        return "[[Construct]]";
    }
    return receiver;
}
 
Example 4
Source File: BuiltinRootEventHandler.java    From nodeprof.js with Apache License 2.0 4 votes vote down vote up
public Object getFunction(VirtualFrame frame) {
    return frame.getArguments()[1];
}
 
Example 5
Source File: BuiltinRootEventHandler.java    From nodeprof.js with Apache License 2.0 4 votes vote down vote up
public Object[] getArguments(VirtualFrame frame) {
    return frame.getArguments();
}
 
Example 6
Source File: FunctionRootEventHandler.java    From nodeprof.js with Apache License 2.0 4 votes vote down vote up
public Object getFunction(VirtualFrame frame) {
    return frame.getArguments()[1];
}
 
Example 7
Source File: FunctionRootEventHandler.java    From nodeprof.js with Apache License 2.0 4 votes vote down vote up
public Object[] getArguments(VirtualFrame frame) {
    return frame.getArguments();
}
 
Example 8
Source File: MumblerNode.java    From mumbler with GNU General Public License v3.0 4 votes vote down vote up
protected boolean isArgumentIndexInRange(VirtualFrame virtualFrame,
        int index) {
    return (index + 1) < virtualFrame.getArguments().length;
}
 
Example 9
Source File: MumblerNode.java    From mumbler with GNU General Public License v3.0 4 votes vote down vote up
protected Object getArgument(VirtualFrame virtualFrame, int index) {
    return virtualFrame.getArguments()[index + 1];
}