diff options
author | 2016-12-06 14:27:17 +0000 | |
---|---|---|
committer | 2016-12-06 14:27:17 +0000 | |
commit | 02d45c6afcd6d2d55fd8fd2a89fce75311ec5b44 (patch) | |
tree | 1742c81fe1abafe6ef1265a79ad158a1c0ac45c6 | |
parent | 07830e11b718774c474d5f618ecfb29e238e47f7 (diff) | |
parent | 1d0ae3f849aa1825cdb50e4a304652b0d2ad80ed (diff) |
Merge "Fix two tests after vdex change."
-rw-r--r-- | compiler/dex/verification_results.h | 3 | ||||
-rw-r--r-- | compiler/utils/atomic_method_ref_map-inl.h | 9 | ||||
-rw-r--r-- | compiler/utils/atomic_method_ref_map.h | 2 | ||||
-rw-r--r-- | compiler/verifier_deps_test.cc | 14 | ||||
-rw-r--r-- | test/Android.run-test.mk | 4 |
5 files changed, 31 insertions, 1 deletions
diff --git a/compiler/dex/verification_results.h b/compiler/dex/verification_results.h index ab735c1315..22749fa621 100644 --- a/compiler/dex/verification_results.h +++ b/compiler/dex/verification_results.h @@ -32,6 +32,7 @@ namespace art { namespace verifier { class MethodVerifier; +class VerifierDepsTest; } // namespace verifier class CompilerOptions; @@ -80,6 +81,8 @@ class VerificationResults { // Rejected classes. ReaderWriterMutex rejected_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; std::set<ClassReference> rejected_classes_ GUARDED_BY(rejected_classes_lock_); + + friend class verifier::VerifierDepsTest; }; } // namespace art diff --git a/compiler/utils/atomic_method_ref_map-inl.h b/compiler/utils/atomic_method_ref_map-inl.h index 70ea028b17..d71c2fe997 100644 --- a/compiler/utils/atomic_method_ref_map-inl.h +++ b/compiler/utils/atomic_method_ref_map-inl.h @@ -78,6 +78,15 @@ inline void AtomicMethodRefMap<T>::Visit(const Visitor& visitor) { } } +template <typename T> +inline void AtomicMethodRefMap<T>::ClearEntries() { + for (auto& it : arrays_) { + for (auto& element : it.second) { + element.StoreRelaxed(nullptr); + } + } +} + } // namespace art #endif // ART_COMPILER_UTILS_ATOMIC_METHOD_REF_MAP_INL_H_ diff --git a/compiler/utils/atomic_method_ref_map.h b/compiler/utils/atomic_method_ref_map.h index 11ab211817..fed848f563 100644 --- a/compiler/utils/atomic_method_ref_map.h +++ b/compiler/utils/atomic_method_ref_map.h @@ -55,6 +55,8 @@ class AtomicMethodRefMap { template <typename Visitor> void Visit(const Visitor& visitor); + void ClearEntries(); + private: // Verified methods. The method array is fixed to avoid needing a lock to extend it. using ElementArray = dchecked_vector<Atomic<T>>; diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc index 90fe6da438..52765f9e73 100644 --- a/compiler/verifier_deps_test.cc +++ b/compiler/verifier_deps_test.cc @@ -19,8 +19,11 @@ #include "class_linker.h" #include "compiler/common_compiler_test.h" +#include "compiler/dex/verification_results.h" +#include "compiler/dex/verified_method.h" #include "compiler/driver/compiler_options.h" #include "compiler/driver/compiler_driver.h" +#include "compiler/utils/atomic_method_ref_map-inl.h" #include "compiler_callbacks.h" #include "dex_file.h" #include "dex_file_types.h" @@ -90,6 +93,14 @@ class VerifierDepsTest : public CommonCompilerTest { verifier_deps_.reset(callbacks_->GetVerifierDeps()); } callbacks_->SetVerifierDeps(nullptr); + // Clear entries in the verification results to avoid hitting a DCHECK that + // we always succeed inserting a new entry after verifying. + AtomicMethodRefMap<const VerifiedMethod*>* map = + &compiler_driver_->GetVerificationResults()->atomic_verified_methods_; + map->Visit([](const MethodReference& ref ATTRIBUTE_UNUSED, const VerifiedMethod* method) { + delete method; + }); + map->ClearEntries(); } void SetVerifierDeps(const std::vector<const DexFile*>& dex_files) { @@ -112,6 +123,9 @@ class VerifierDepsTest : public CommonCompilerTest { for (const DexFile* dex_file : dex_files_) { class_linker_->RegisterDexFile(*dex_file, loader.Get()); } + for (const DexFile* dex_file : dex_files_) { + compiler_driver_->GetVerificationResults()->AddDexFile(dex_file); + } } void LoadDexFile(ScopedObjectAccess* soa) REQUIRES_SHARED(Locks::mutator_lock_) { diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index d7dfe5a3a0..28e1e60313 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -427,6 +427,7 @@ ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREB # explicitly test for them. These all also assume we have an image. # 147-stripped-dex-fallback is disabled because it requires --prebuild. # 554-jit-profile-file is disabled because it needs a primary oat file to know what it should save. +# 629-vdex-speed requires compiled code. TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \ 116-nodex2oat \ 117-nopatchoat \ @@ -435,7 +436,8 @@ TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \ 137-cfi \ 138-duplicate-classes-check2 \ 147-stripped-dex-fallback \ - 554-jit-profile-file + 554-jit-profile-file \ + 629-vdex-speed # This test fails without an image. TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS := \ |