Fix test failures with -Xjitthreshold:0.
Namely
- 667-jit-jni-stub:
fix GenericJNI to respect -Xjitthreshold:0,
- 1935-get-set-current-frame-jit:
check for OSR, not for being interpreted.
However, some failures remain when --gcstress is added.
Test: testrunner.py --host --jit --runtime-option=-Xjitthreshold:0
Test: testrunner.py --host
Bug: 62611253
Change-Id: I4ca880f6a8b64a1659a27a107fae9933d4174f8d
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index e9a0808..c37e9ea 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -2246,10 +2246,6 @@
ArtMethod* called = *sp;
DCHECK(called->IsNative()) << called->PrettyMethod(true);
Runtime* runtime = Runtime::Current();
- jit::Jit* jit = runtime->GetJit();
- if (jit != nullptr) {
- jit->AddSamples(self, called, 1u, /*with_backedges*/ false);
- }
uint32_t shorty_len = 0;
const char* shorty = called->GetShorty(&shorty_len);
bool critical_native = called->IsCriticalNative();
@@ -2275,6 +2271,12 @@
self->VerifyStack();
+ // We can now walk the stack if needed by JIT GC from MethodEntered() for JIT-on-first-use.
+ jit::Jit* jit = runtime->GetJit();
+ if (jit != nullptr) {
+ jit->MethodEntered(self, called);
+ }
+
uint32_t cookie;
uint32_t* sp32;
// Skip calling JniMethodStart for @CriticalNative.