diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-09-13 01:28:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-09-13 01:28:02 +0000 |
commit | 7bf641ed4d7d87f70e0e3a052ad35d15031cffcd (patch) | |
tree | f724004a682cb7c2faa0d12579756c3a81b98252 | |
parent | ebab3bbcaa09b644acd50ec18d79cb0d239bf347 (diff) | |
parent | 7c438b19b71932ac8a44eff44f20744a01559c8d (diff) | |
download | art-7bf641ed4d7d87f70e0e3a052ad35d15031cffcd.zip art-7bf641ed4d7d87f70e0e3a052ad35d15031cffcd.tar.gz art-7bf641ed4d7d87f70e0e3a052ad35d15031cffcd.tar.bz2 |
Merge "Fix stale root error in verifier"
-rw-r--r-- | runtime/runtime.cc | 1 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.cc | 4 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.h | 2 | ||||
-rw-r--r-- | runtime/verifier/reg_type_cache.cc | 22 | ||||
-rw-r--r-- | runtime/verifier/reg_type_cache.h | 22 |
5 files changed, 41 insertions, 10 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index bf1e016..b4a09e5 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1147,6 +1147,7 @@ void Runtime::VisitNonThreadRoots(RootCallback* callback, void* arg) { callee_save_methods_[i].VisitRoot(callback, arg, 0, kRootVMInternal); } } + verifier::MethodVerifier::VisitStaticRoots(callback, arg); { MutexLock mu(Thread::Current(), method_verifier_lock_); for (verifier::MethodVerifier* verifier : method_verifiers_) { diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index f90da15..b799588 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -4181,6 +4181,10 @@ void MethodVerifier::Shutdown() { verifier::RegTypeCache::ShutDown(); } +void MethodVerifier::VisitStaticRoots(RootCallback* callback, void* arg) { + RegTypeCache::VisitStaticRoots(callback, arg); +} + void MethodVerifier::VisitRoots(RootCallback* callback, void* arg) { reg_types_.VisitRoots(callback, arg); } diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index 81ab960..eef2b9e 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -221,6 +221,8 @@ class MethodVerifier { // Describe VRegs at the given dex pc. std::vector<int32_t> DescribeVRegs(uint32_t dex_pc); + static void VisitStaticRoots(RootCallback* callback, void* arg) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void VisitRoots(RootCallback* callback, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Accessors used by the compiler via CompilerCallback diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc index 121fccb..bffec4b 100644 --- a/runtime/verifier/reg_type_cache.cc +++ b/runtime/verifier/reg_type_cache.cc @@ -555,6 +555,28 @@ void RegTypeCache::Dump(std::ostream& os) { } } +void RegTypeCache::VisitStaticRoots(RootCallback* callback, void* arg) { + // Visit the primitive types, this is required since if there are no active verifiers they wont + // be in the entries array, and therefore not visited as roots. + if (primitive_initialized_) { + UndefinedType::GetInstance()->VisitRoots(callback, arg); + ConflictType::GetInstance()->VisitRoots(callback, arg); + BooleanType::GetInstance()->VisitRoots(callback, arg); + ByteType::GetInstance()->VisitRoots(callback, arg); + ShortType::GetInstance()->VisitRoots(callback, arg); + CharType::GetInstance()->VisitRoots(callback, arg); + IntegerType::GetInstance()->VisitRoots(callback, arg); + LongLoType::GetInstance()->VisitRoots(callback, arg); + LongHiType::GetInstance()->VisitRoots(callback, arg); + FloatType::GetInstance()->VisitRoots(callback, arg); + DoubleLoType::GetInstance()->VisitRoots(callback, arg); + DoubleHiType::GetInstance()->VisitRoots(callback, arg); + for (int32_t value = kMinSmallConstant; value <= kMaxSmallConstant; ++value) { + small_precise_constants_[value - kMinSmallConstant]->VisitRoots(callback, arg); + } + } +} + void RegTypeCache::VisitRoots(RootCallback* callback, void* arg) { for (const RegType* entry : entries_) { entry->VisitRoots(callback, arg); diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h index eb17a52..29933cf 100644 --- a/runtime/verifier/reg_type_cache.h +++ b/runtime/verifier/reg_type_cache.h @@ -80,34 +80,34 @@ class RegTypeCache { const BooleanType& Boolean() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *BooleanType::GetInstance(); } - const ByteType& Byte() { + const RegType& Byte() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *ByteType::GetInstance(); } - const CharType& Char() { + const RegType& Char() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *CharType::GetInstance(); } - const ShortType& Short() { + const RegType& Short() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *ShortType::GetInstance(); } - const IntegerType& Integer() { + const RegType& Integer() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *IntegerType::GetInstance(); } - const FloatType& Float() { + const RegType& Float() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *FloatType::GetInstance(); } - const LongLoType& LongLo() { + const RegType& LongLo() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *LongLoType::GetInstance(); } - const LongHiType& LongHi() { + const RegType& LongHi() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *LongHiType::GetInstance(); } - const DoubleLoType& DoubleLo() { + const RegType& DoubleLo() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *DoubleLoType::GetInstance(); } - const DoubleHiType& DoubleHi() { + const RegType& DoubleHi() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *DoubleHiType::GetInstance(); } - const UndefinedType& Undefined() { + const RegType& Undefined() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return *UndefinedType::GetInstance(); } const ConflictType& Conflict() { @@ -138,6 +138,8 @@ class RegTypeCache { const RegType& RegTypeFromPrimitiveType(Primitive::Type) const; void VisitRoots(RootCallback* callback, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + static void VisitStaticRoots(RootCallback* callback, void* arg) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); private: void FillPrimitiveAndSmallConstantTypes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |