summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-02-03 01:30:48 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-02-03 01:30:48 +0000
commit26bf9632d0652c57cbe7c4b00970f2b6091651fd (patch)
tree33118c62634a7d1d900d5c320c0a7d9a6de40e8c
parent8b6d2fd300624ad1716c0907e646b87997b6671d (diff)
parentfcbafb36eff1facdd4c2b60e5f56dd986c558901 (diff)
Merge "Ensure we don't attempt to compile obsolete methods."
-rw-r--r--runtime/art_method.cc2
-rw-r--r--runtime/art_method.h6
-rw-r--r--runtime/openjdkjvmti/ti_redefine.cc1
-rw-r--r--runtime/verifier/method_verifier.cc4
4 files changed, 10 insertions, 3 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 61ff41742b..6cb8544617 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -446,6 +446,8 @@ static const OatFile::OatMethod FindOatMethodFor(ArtMethod* method,
PointerSize pointer_size,
bool* found)
REQUIRES_SHARED(Locks::mutator_lock_) {
+ // We shouldn't be calling this with obsolete methods.
+ DCHECK(!method->IsObsolete());
// Although we overwrite the trampoline of non-static methods, we may get here via the resolution
// method for direct methods (or virtual methods made direct).
mirror::Class* declaring_class = method->GetDeclaringClass();
diff --git a/runtime/art_method.h b/runtime/art_method.h
index d4a65c8c38..383630363e 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -201,6 +201,10 @@ class ArtMethod FINAL {
return (GetAccessFlags() & kAccCompileDontBother) == 0;
}
+ void SetDontCompile() {
+ AddAccessFlags(kAccCompileDontBother);
+ }
+
// A default conflict method is a special sentinel method that stands for a conflict between
// multiple default methods. It cannot be invoked, throwing an IncompatibleClassChangeError if one
// attempts to do so.
@@ -226,7 +230,7 @@ class ArtMethod FINAL {
void SetIsObsolete() {
// TODO We should really support redefining intrinsic if possible.
DCHECK(!IsIntrinsic());
- SetAccessFlags(GetAccessFlags() | kAccObsoleteMethod);
+ AddAccessFlags(kAccObsoleteMethod);
}
template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
diff --git a/runtime/openjdkjvmti/ti_redefine.cc b/runtime/openjdkjvmti/ti_redefine.cc
index eb4c2f9f21..b7257f8994 100644
--- a/runtime/openjdkjvmti/ti_redefine.cc
+++ b/runtime/openjdkjvmti/ti_redefine.cc
@@ -121,6 +121,7 @@ class ObsoleteMethodStackVisitor : public art::StackVisitor {
new_obsolete_method->CopyFrom(old_method, ptr_size);
DCHECK_EQ(new_obsolete_method->GetDeclaringClass(), old_method->GetDeclaringClass());
new_obsolete_method->SetIsObsolete();
+ new_obsolete_method->SetDontCompile();
obsolete_maps_->insert({old_method, new_obsolete_method});
// Update JIT Data structures to point to the new method.
art::jit::Jit* jit = art::Runtime::Current()->GetJit();
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index b915457557..5f55f3fd29 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -415,12 +415,12 @@ MethodVerifier::FailureData MethodVerifier::VerifyMethod(Thread* self,
result.kind = kSoftFailure;
if (method != nullptr &&
!CanCompilerHandleVerificationFailure(verifier.encountered_failure_types_)) {
- method->AddAccessFlags(kAccCompileDontBother);
+ method->SetDontCompile();
}
}
if (method != nullptr) {
if (verifier.HasInstructionThatWillThrow()) {
- method->AddAccessFlags(kAccCompileDontBother);
+ method->SetDontCompile();
if (Runtime::Current()->IsAotCompiler() &&
(callbacks != nullptr) && !callbacks->IsBootImage()) {
// When compiling apps, make HasInstructionThatWillThrow a soft error to trigger