From fd7673767b767fbb2941777b627207990a1e4d66 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Thu, 23 Dec 2021 16:10:49 +0200 Subject: [PATCH] fixup! Don't create JNINativeCallWrapperMethods for JNICallTrampolineMethods --- .../svm/jni/access/JNIAccessFeature.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/substratevm/src/com.oracle.svm.jni/src/com/oracle/svm/jni/access/JNIAccessFeature.java b/substratevm/src/com.oracle.svm.jni/src/com/oracle/svm/jni/access/JNIAccessFeature.java index c650d94b9533..d4cf2b3c0b15 100644 --- a/substratevm/src/com.oracle.svm.jni/src/com/oracle/svm/jni/access/JNIAccessFeature.java +++ b/substratevm/src/com.oracle.svm.jni/src/com/oracle/svm/jni/access/JNIAccessFeature.java @@ -189,30 +189,30 @@ private static void registerJavaCallTrampoline(BeforeAnalysisAccessImpl access, 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(); @@ -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; }