org.jruby.truffle.cext.CharPointerGetSizeNodeSub 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;
/**
* This message resolution is generated by {@link org.jruby.truffle.cext.StringCharPointerMessageResolution.CharPointerGetSizeNode}
* It is used by the foreign access factory {@link org.jruby.truffle.cext.StringCharPointerMessageResolutionForeign}
*/
public abstract class CharPointerGetSizeNodeSub extends org.jruby.truffle.cext.StringCharPointerMessageResolution.CharPointerGetSizeNode {
public abstract Object executeWithTarget(VirtualFrame frame, Object o0);
@Specialization
protected Object accessWithTarget(org.jruby.truffle.cext.StringCharPointerAdapter stringCharPointerAdapter) {
return access(stringCharPointerAdapter);
}
private static final class GET_SIZERootNode extends RootNode {
protected GET_SIZERootNode(Class extends TruffleLanguage>> language) {
super(language, null, null);
}
@Child private CharPointerGetSizeNodeSub node = org.jruby.truffle.cext.CharPointerGetSizeNodeSubNodeGen.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 CharPointerGetSizeNodeSub) {
throw UnsupportedTypeException.raise(e, e.getSuppliedValues());
} else {
throw e;
}
}
}
}
public static RootNode createRoot(Class extends TruffleLanguage>> language) {
return new GET_SIZERootNode(language);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy