use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.
the class HSCompilableTruffleAST method getName.
@TruffleFromLibGraal(GetCompilableName)
@Override
public String getName() {
String res = cachedName;
if (res == null) {
JNIEnv env = JNIMethodScope.env();
JString name = callGetCompilableName(env, getHandle());
res = createString(env, name);
cachedName = res;
}
return res;
}
use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.
the class HSCompilableTruffleAST method onCompilationFailed.
@TruffleFromLibGraal(CreateStringSupplier)
@TruffleFromLibGraal(OnCompilationFailed)
@Override
public void onCompilationFailed(Supplier<String> serializedException, boolean silent, boolean bailout, boolean permanentBailout, boolean graphTooBig) {
long serializedExceptionHandle = LibGraalObjectHandles.create(serializedException);
boolean success = false;
JNIEnv env = env();
try {
JObject instance = callCreateStringSupplier(env, serializedExceptionHandle);
callOnCompilationFailed(env, getHandle(), instance, silent, bailout, permanentBailout, graphTooBig);
success = true;
} finally {
if (!success) {
LibGraalObjectHandles.remove(serializedExceptionHandle);
}
}
}
use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.
the class HSCompilableTruffleAST method getCallNodes.
@TruffleFromLibGraal(GetCallNodes)
@Override
public TruffleCallNode[] getCallNodes() {
JNIMethodScope scope = scope();
JNIEnv env = scope.getEnv();
JObjectArray peerArr = callGetCallNodes(env, getHandle());
int len = JNIUtil.GetArrayLength(env, peerArr);
TruffleCallNode[] res = new TruffleCallNode[len];
for (int i = 0; i < len; i++) {
JObject peerTruffleCallNode = JNIUtil.GetObjectArrayElement(env, peerArr, i);
res[i] = new HSTruffleCallNode(scope, peerTruffleCallNode);
}
return res;
}
use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.
the class HSTruffleCompilerRuntime method isSuppressedFailure.
@TruffleFromLibGraal(CreateStringSupplier)
@TruffleFromLibGraal(IsSuppressedFailure)
@Override
public boolean isSuppressedFailure(CompilableTruffleAST compilable, Supplier<String> serializedException) {
long serializedExceptionHandle = LibGraalObjectHandles.create(serializedException);
boolean success = false;
JNIEnv env = env();
try {
JObject instance = callCreateStringSupplier(env, serializedExceptionHandle);
boolean res = callIsSuppressedFailure(env, getHandle(), ((HSCompilableTruffleAST) compilable).getHandle(), instance);
success = true;
return res;
} finally {
if (!success) {
LibGraalObjectHandles.remove(serializedExceptionHandle);
}
}
}
use of org.graalvm.jniutils.JNI.JNIEnv in project graal by oracle.
the class HSTruffleCompilerRuntime method onCodeInstallation.
@TruffleFromLibGraal(OnCodeInstallation)
@Override
public void onCodeInstallation(CompilableTruffleAST compilable, InstalledCode installedCode) {
long installedCodeHandle = LibGraal.translate(installedCode);
JNIEnv env = env();
callOnCodeInstallation(env, getHandle(), ((HSCompilableTruffleAST) compilable).getHandle(), installedCodeHandle);
}
Aggregations