Skip to content

Commit

Permalink
fixup! Don't create JNINativeCallWrapperMethods for JNICallTrampoline…
Browse files Browse the repository at this point in the history
…Methods
  • Loading branch information
zakkak committed Dec 23, 2021
1 parent adae6c0 commit 03765cf
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,30 @@ private void registerJavaCallTrampoline(BeforeAnalysisAccessImpl access, CallVar
ResolvedJavaField field = JNIAccessibleMethod.getCallWrapperField(metaAccess.getWrapped(), variant, nonVirtual);
access.getUniverse().lookup(field.getDeclaringClass()).registerAsReachable();
access.registerAsAccessed(access.getUniverse().lookup(field));
String trampolineName = JNIJavaCallTrampolines.getTrampolineName(variant, nonVirtual);
Method reflectionMethod = ReflectionUtil.lookupMethod(JNIJavaCallTrampolines.class, trampolineName);
String name = JNIJavaCallTrampolines.getTrampolineName(variant, nonVirtual);
Method method = ReflectionUtil.lookupMethod(JNIJavaCallTrampolines.class, name);
// Look up the java method to ensure a JNICallTrampolineMethod gets created for it through
// com.oracle.svm.jni.hosted.JNINativeCallWrapperSubstitutionProcessor.lookup
AnalysisMethod trampoline = metaAccess.lookupJavaMethod(reflectionMethod);
AnalysisMethod trampoline = metaAccess.lookupJavaMethod(method);
access.registerAsCompiled(trampoline);
}

public JNICallTrampolineMethod getCallTrampolineMethod(CallVariant variant, boolean nonVirtual) {
String trampolineName = JNIJavaCallTrampolines.getTrampolineName(variant, nonVirtual);
return getCallTrampolineMethod(trampolineName);
String name = JNIJavaCallTrampolines.getTrampolineName(variant, nonVirtual);
return getCallTrampolineMethod(name);
}

public JNICallTrampolineMethod getCallTrampolineMethod(String javaTrampolineName) {
JNICallTrampolineMethod jniCallTrampolineMethod = trampolineMethods.get(javaTrampolineName);
assert jniCallTrampolineMethod != null;
return jniCallTrampolineMethod;
JNICallTrampolineMethod trampoline = trampolineMethods.get(javaTrampolineName);
assert trampoline != null;
return trampoline;
}

public JNICallTrampolineMethod getOrCreateCallTrampolineMethod(DuringSetupAccessImpl access, String trampolineName) {
JNICallTrampolineMethod jniCallTrampolineMethod = trampolineMethods.get(trampolineName);
JNICallTrampolineMethod trampoline = trampolineMethods.get(trampolineName);

if (jniCallTrampolineMethod != null) {
return jniCallTrampolineMethod;
if (trampoline != null) {
return trampoline;
}

MetaAccessProvider wrappedMetaAccess = access.getMetaAccess().getWrapped();
Expand All @@ -222,7 +222,7 @@ public JNICallTrampolineMethod getOrCreateCallTrampolineMethod(DuringSetupAccess
// Use wrapped MetaAccess to avoid infinite recursion through
// com.oracle.svm.jni.hosted.JNINativeCallWrapperSubstitutionProcessor.lookup
ResolvedJavaMethod method = wrappedMetaAccess.lookupJavaMethod(reflectionMethod);
JNICallTrampolineMethod trampoline = new JNICallTrampolineMethod(method, field, nonVirtual);
trampoline = new JNICallTrampolineMethod(method, field, nonVirtual);
trampolineMethods.put(trampolineName, trampoline);
return trampoline;
}
Expand Down

0 comments on commit 03765cf

Please sign in to comment.