org.jruby.truffle.cext.CharPointerCheckNodeSub Maven / Gradle / Ivy
The newest version!
package org.jruby.truffle.cext;
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;
/**
* Generated for {@link org.jruby.truffle.cext.StringCharPointerAdapter}
*/
/**
* This message resolution is generated by {@link org.jruby.truffle.cext.StringCharPointerMessageResolution.CharPointerCheckNode}
* It is used by the foreign access factory {@link org.jruby.truffle.cext.StringCharPointerMessageResolutionForeign}
*/
public abstract class CharPointerCheckNodeSub extends org.jruby.truffle.cext.StringCharPointerMessageResolution.CharPointerCheckNode {
public abstract Object executeWithTarget(VirtualFrame frame, Object o);
@Specialization
protected Object testWithTarget(com.oracle.truffle.api.interop.TruffleObject receiver) {
return test(receiver);
}
private static final class LanguageCheckRootNode extends RootNode {
protected LanguageCheckRootNode(Class extends TruffleLanguage>> language) {
super(language, null, null);
}
@Child private CharPointerCheckNodeSub node = org.jruby.truffle.cext.CharPointerCheckNodeSubNodeGen.create();
@Override
public Object execute(VirtualFrame frame) {
try {
Object receiver = ForeignAccess.getReceiver(frame);
return node.executeWithTarget(frame, receiver);
} catch (UnsupportedSpecializationException e) {
if (e.getNode() instanceof CharPointerCheckNodeSub) {
throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
} else {
throw e;
}
}
}
}
public static RootNode createRoot(Class extends TruffleLanguage>> language) {
return new LanguageCheckRootNode(language);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy