com.oracle.truffle.api.interop.java.PropertyInfoNodeSub 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.interop.java;
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.interop.java.JavaObjectMessageResolution.PropertyInfoNode}
* It is used by the foreign access factory {@link com.oracle.truffle.api.interop.java.JavaObjectMessageResolutionForeign}
*/
abstract class PropertyInfoNodeSub extends com.oracle.truffle.api.interop.java.JavaObjectMessageResolution.PropertyInfoNode {
public abstract Object executeWithTarget(VirtualFrame frame, Object o0, Object o1);
@Specialization
protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver, java.lang.Number index) {
return access(receiver, index);
}
@Specialization
protected Object accessWithTarget(com.oracle.truffle.api.interop.java.JavaObject receiver, java.lang.String name) {
return access(receiver, name);
}
private static final class KEY_INFORootNode extends RootNode {
protected KEY_INFORootNode() {
super(null);
}
@Child private PropertyInfoNodeSub node = com.oracle.truffle.api.interop.java.PropertyInfoNodeSubNodeGen.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 PropertyInfoNodeSub) {
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 KEY_INFORootNode();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy