com.oracle.truffle.api.metadata.VarsMapKeysNodeSub Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truffle-api Show documentation
Show all versions of truffle-api Show documentation
Truffle is a multi-language framework for executing dynamic languages
that achieves high performance when combined with Graal.
package com.oracle.truffle.api.metadata;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
/**
* This message resolution is generated by {@link com.oracle.truffle.api.metadata.DefaultScopeVariables.VariablesMapObject.VariablesMapMessageResolution.VarsMapKeysNode}
* It is used by the foreign access factory {@link com.oracle.truffle.api.metadata.VariablesMapMessageResolutionForeign}
*/
abstract class VarsMapKeysNodeSub extends com.oracle.truffle.api.metadata.DefaultScopeVariables.VariablesMapObject.VariablesMapMessageResolution.VarsMapKeysNode {
public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
@Specialization
protected Object accessWithTarget(com.oracle.truffle.api.metadata.DefaultScopeVariables.VariablesMapObject varMap) {
return access(varMap);
}
private static final class KeysRootNode extends RootNode {
protected KeysRootNode() {
super(null);
}
@Child private VarsMapKeysNodeSub node = com.oracle.truffle.api.metadata.VarsMapKeysNodeSubNodeGen.create();
@Override
public Object execute(VirtualFrame frame) {
Object receiver = ForeignAccess.getReceiver(frame);
try {
return node.executeWithTarget(frame, receiver);
} catch (UnsupportedSpecializationException e) {
if (e.getNode() instanceof VarsMapKeysNodeSub) {
throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
} else {
throw e;
}
}
}
}
@Deprecated
@SuppressWarnings("unused")
public static RootNode createRoot(Class extends TruffleLanguage>> language) {
return createRoot();
}
public static RootNode createRoot() {
return new KeysRootNode();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy