com.oracle.truffle.tck.StructuredDataEntryReadNodeSub Maven / Gradle / Ivy
package com.oracle.truffle.tck;
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.tck.StructuredDataEntryMessageResolution.StructuredDataEntryReadNode}
* It is used by the foreign access factory {@link com.oracle.truffle.tck.StructuredDataEntryMessageResolutionForeign}
*/
abstract class StructuredDataEntryReadNodeSub extends com.oracle.truffle.tck.StructuredDataEntryMessageResolution.StructuredDataEntryReadNode {
public abstract Object executeWithTarget(VirtualFrame frame, Object o0, Object o1);
@Specialization
protected Object accessWithTarget(com.oracle.truffle.tck.StructuredDataEntry data, java.lang.String name) {
return access(data, name);
}
private static final class ReadRootNode extends RootNode {
protected ReadRootNode(Class extends TruffleLanguage>> language) {
super(language, null, null);
}
@Child private StructuredDataEntryReadNodeSub node = com.oracle.truffle.tck.StructuredDataEntryReadNodeSubNodeGen.create();
@Override
public Object execute(VirtualFrame frame) {
Object receiver = ForeignAccess.getReceiver(frame);
Object identifier = ForeignAccess.getArguments(frame).get(0);
try {
return node.executeWithTarget(frame, receiver, identifier);
} catch (UnsupportedSpecializationException e) {
if (e.getNode() instanceof StructuredDataEntryReadNodeSub) {
throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
} else {
throw e;
}
}
}
}
public static RootNode createRoot(Class extends TruffleLanguage>> language) {
return new ReadRootNode(language);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy