Revert "Cover more cases in nterp."
This reverts commit eb1fece2e49980f91bd31b5a8ef7f78c5f410c50.
Bug: 112676029
Bug: 157658616
Reason for revert: b/157658616
Change-Id: Ic4dd6b1aa7c30c99d8bc2eb0c9f6ee5e3dc471ee
diff --git a/runtime/interpreter/mterp/mterp.cc b/runtime/interpreter/mterp/mterp.cc
index 93d9506..c6d3258 100644
--- a/runtime/interpreter/mterp/mterp.cc
+++ b/runtime/interpreter/mterp/mterp.cc
@@ -147,6 +147,7 @@
REQUIRES_SHARED(Locks::mutator_lock_) {
const Runtime* const runtime = Runtime::Current();
return
+ runtime->IsStarted() &&
!runtime->IsAotCompiler() &&
!runtime->GetInstrumentation()->IsActive() &&
// mterp only knows how to deal with the normal exits. It cannot handle any of the
diff --git a/runtime/interpreter/mterp/nterp.cc b/runtime/interpreter/mterp/nterp.cc
index 4be6e77..b025e3d 100644
--- a/runtime/interpreter/mterp/nterp.cc
+++ b/runtime/interpreter/mterp/nterp.cc
@@ -37,19 +37,13 @@
}
bool CanRuntimeUseNterp() REQUIRES_SHARED(Locks::mutator_lock_) {
- Runtime* runtime = Runtime::Current();
- instrumentation::Instrumentation* instr = runtime->GetInstrumentation();
- // Nterp shares the same restrictions as Mterp.
- // If the runtime is interpreter only, we currently don't use nterp as some
- // parts of the runtime (like instrumentation) make assumption on an
- // interpreter-only runtime to always be in a switch-like interpreter.
- return IsNterpSupported() && CanUseMterp() && !instr->InterpretOnly();
+ // Nterp has the same restrictions as Mterp.
+ return IsNterpSupported() && CanUseMterp();
}
bool CanMethodUseNterp(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) {
- return !method->IsNative() &&
- method->IsInvokable() &&
- !method->MustCountLocks() &&
+ return method->SkipAccessChecks() &&
+ !method->IsNative() &&
method->GetDexFile()->IsStandardDexFile() &&
NterpGetFrameSize(method) < kMaxNterpFrame;
}
@@ -506,12 +500,11 @@
DCHECK_LE(length, 5);
}
uint16_t type_idx = is_range ? inst->VRegB_3rc() : inst->VRegB_35c();
- ObjPtr<mirror::Class> array_class =
- ResolveVerifyAndClinit(dex::TypeIndex(type_idx),
- caller,
- self,
- /* can_run_clinit= */ true,
- /* verify_access= */ !caller->SkipAccessChecks());
+ ObjPtr<mirror::Class> array_class = ResolveVerifyAndClinit(dex::TypeIndex(type_idx),
+ caller,
+ self,
+ /* can_run_clinit= */ true,
+ /* verify_access= */ false);
if (UNLIKELY(array_class == nullptr)) {
DCHECK(self->IsExceptionPending());
return nullptr;
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 221b373..2ef1cb4 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1479,7 +1479,7 @@
return added_to_queue;
}
-bool Jit::IgnoreSamplesForMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) {
+static bool IgnoreSamplesForMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) {
if (method->IsClassInitializer() || !method->IsCompilable() || method->IsPreCompiled()) {
// We do not want to compile such methods.
return true;
diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h
index ee82af7..e9fd915 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -319,16 +319,12 @@
void NotifyInterpreterToCompiledCodeTransition(Thread* self, ArtMethod* caller)
REQUIRES_SHARED(Locks::mutator_lock_) {
- if (!IgnoreSamplesForMethod(caller)) {
- AddSamples(self, caller, options_->GetInvokeTransitionWeight(), false);
- }
+ AddSamples(self, caller, options_->GetInvokeTransitionWeight(), false);
}
void NotifyCompiledCodeToInterpreterTransition(Thread* self, ArtMethod* callee)
REQUIRES_SHARED(Locks::mutator_lock_) {
- if (!IgnoreSamplesForMethod(callee)) {
- AddSamples(self, callee, options_->GetInvokeTransitionWeight(), false);
- }
+ AddSamples(self, callee, options_->GetInvokeTransitionWeight(), false);
}
// Starts the profile saver if the config options allow profile recording.
@@ -448,10 +444,6 @@
private:
Jit(JitCodeCache* code_cache, JitOptions* options);
- // Whether we should not add hotness counts for the given method.
- bool IgnoreSamplesForMethod(ArtMethod* method)
- REQUIRES_SHARED(Locks::mutator_lock_);
-
// Compile an individual method listed in a profile. If `add_to_queue` is
// true and the method was resolved, return true. Otherwise return false.
bool CompileMethodFromProfile(Thread* self,