Search in sources :

Example 1 with GraphInfo

use of org.graalvm.compiler.truffle.common.TruffleCompilerListener.GraphInfo in project graal by oracle.

the class TruffleToLibGraalEntryPoints method getNodeTypes.

@TruffleToLibGraal(GetNodeTypes)
@CEntryPoint(name = "Java_org_graalvm_compiler_truffle_runtime_hotspot_libgraal_TruffleToLibGraalCalls_getNodeTypes")
@SuppressWarnings({ "unused", "try" })
public static JObjectArray getNodeTypes(JNIEnv env, JClass hsClazz, @CEntryPoint.IsolateThreadContext long isolateThreadId, long handle, boolean simpleNames) {
    JNIMethodScope scope = LibGraalUtil.openScope(TruffleToLibGraalEntryPoints.class, GetNodeTypes, env);
    try (JNIMethodScope s = scope) {
        GraphInfo orig = LibGraalObjectHandles.resolve(handle, GraphInfo.class);
        String[] nodeTypes = orig.getNodeTypes(simpleNames);
        JClass componentType = FromLibGraalCalls.getJNIClass(env, String.class);
        JObjectArray res = NewObjectArray(env, nodeTypes.length, componentType, WordFactory.nullPointer());
        for (int i = 0; i < nodeTypes.length; i++) {
            SetObjectArrayElement(env, res, i, JNIUtil.createHSString(env, nodeTypes[i]));
        }
        scope.setObjectResult(res);
    } catch (Throwable t) {
        JNIExceptionWrapper.throwInHotSpot(env, t);
        scope.setObjectResult(WordFactory.nullPointer());
    }
    return scope.getObjectResult();
}
Also used : GraphInfo(org.graalvm.compiler.truffle.common.TruffleCompilerListener.GraphInfo) JNIMethodScope(org.graalvm.jniutils.JNIMethodScope) JClass(org.graalvm.jniutils.JNI.JClass) JNIUtil.createString(org.graalvm.jniutils.JNIUtil.createString) JString(org.graalvm.jniutils.JNI.JString) GetSuppliedString(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString) JNIUtil.createHSString(org.graalvm.jniutils.JNIUtil.createHSString) JObjectArray(org.graalvm.jniutils.JNI.JObjectArray) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) TruffleToLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)

Aggregations

GraphInfo (org.graalvm.compiler.truffle.common.TruffleCompilerListener.GraphInfo)1 TruffleToLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal)1 GetSuppliedString (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleToLibGraal.Id.GetSuppliedString)1 JClass (org.graalvm.jniutils.JNI.JClass)1 JObjectArray (org.graalvm.jniutils.JNI.JObjectArray)1 JString (org.graalvm.jniutils.JNI.JString)1 JNIMethodScope (org.graalvm.jniutils.JNIMethodScope)1 JNIUtil.createHSString (org.graalvm.jniutils.JNIUtil.createHSString)1 JNIUtil.createString (org.graalvm.jniutils.JNIUtil.createString)1 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)1