@@ -33,8 +33,6 @@ export class ClassLinker {
3333
3434 inline static Function<" art_quick_to_interpreter_bridge" , void (void *)>
3535 art_quick_to_interpreter_bridge_;
36- inline static Function<" art_quick_generic_jni_trampoline" , void (void *)>
37- art_quick_generic_jni_trampoline_;
3836
3937 inline static Function<" _ZN3art15instrumentationL19GetOptimizedCodeForEPNS_9ArtMethodE" ,
4038 void *(ArtMethod *)> GetOptimizedCodeFor_;
@@ -117,8 +115,7 @@ export class ClassLinker {
117115 backup_method->SetEntryPoint (new_trampoline);
118116 }
119117 } else if (deoptimized) {
120- if (new_trampoline != &art_quick_to_interpreter_bridge_ &&
121- new_trampoline != &art_quick_generic_jni_trampoline_) {
118+ if (new_trampoline != &art_quick_to_interpreter_bridge_ && !art_method->IsNative ()) {
122119 LOGV (" re-deoptimize for %p" , art_method);
123120 SetEntryPointsToInterpreter (art_method);
124121 }
@@ -194,7 +191,7 @@ export class ClassLinker {
194191 }
195192 }
196193
197- if (!handler.dlsym (SetEntryPointsToInterpreter_)) [[unlikely ]] {
194+ if (!handler.dlsym (SetEntryPointsToInterpreter_)) [[likely ]] {
198195 if (handler.dlsym (GetOptimizedCodeFor_, true )) [[likely]] {
199196 auto obj = JNI_FindClass (env, " java/lang/Object" );
200197 if (!obj) {
@@ -210,41 +207,28 @@ export class ClassLinker {
210207 // just in case
211208 dummy->SetNonNative ();
212209 art_quick_to_interpreter_bridge_ = GetOptimizedCodeFor_ (dummy.get ());
213- }
214- if (!art_quick_to_interpreter_bridge_ && !handler.dlsym (art_quick_to_interpreter_bridge_)) [[unlikely]] {
215- return false ;
216- }
217- if (handler.dlsym (GetRuntimeQuickGenericJniStub_)) [[likely]] {
218- art_quick_generic_jni_trampoline_ = GetRuntimeQuickGenericJniStub_ (nullptr );
219- }
220- if (!art_quick_generic_jni_trampoline_ && !handler.dlsym (art_quick_generic_jni_trampoline_)) [[unlikely]] {
210+ } else if (!handler.dlsym (art_quick_to_interpreter_bridge_)) [[unlikely]] {
221211 return false ;
222212 }
223213 }
224214 LOGD (" art_quick_to_interpreter_bridge = %p" , &art_quick_to_interpreter_bridge_);
225- LOGD (" art_quick_generic_jni_trampoline = %p" , &art_quick_generic_jni_trampoline_);
226215 return true ;
227216 }
228217
229218 [[gnu::always_inline]] static bool SetEntryPointsToInterpreter (ArtMethod *art_method) {
219+ if (art_method->IsNative ()) {
220+ return false ;
221+ }
230222 if (SetEntryPointsToInterpreter_) [[likely]] {
231223 SetEntryPointsToInterpreter_ (nullptr , art_method);
232224 return true ;
233225 }
234226 // Android 13
235- if (art_quick_to_interpreter_bridge_ && art_quick_generic_jni_trampoline_) [[likely]] {
236- if (art_method->GetAccessFlags () & ArtMethod::kAccNative ) [[unlikely]] {
237- LOGV (" deoptimize native method %s from %p to %p" ,
238- art_method->PrettyMethod (true ).data (), art_method->GetEntryPoint (),
239- &art_quick_generic_jni_trampoline_);
240- art_method->SetEntryPoint (
241- reinterpret_cast <void *>(&art_quick_generic_jni_trampoline_));
242- } else {
243- LOGV (" deoptimize method %s from %p to %p" , art_method->PrettyMethod (true ).data (),
244- art_method->GetEntryPoint (), &art_quick_to_interpreter_bridge_);
245- art_method->SetEntryPoint (
246- reinterpret_cast <void *>(&art_quick_to_interpreter_bridge_));
247- }
227+ if (art_quick_to_interpreter_bridge_) [[likely]] {
228+ LOGV (" deoptimize method %s from %p to %p" , art_method->PrettyMethod (true ).data (),
229+ art_method->GetEntryPoint (), &art_quick_to_interpreter_bridge_);
230+ art_method->SetEntryPoint (
231+ reinterpret_cast <void *>(&art_quick_to_interpreter_bridge_));
248232 return true ;
249233 }
250234 return false ;
0 commit comments