diff options
author | 2019-10-17 10:32:47 -0700 | |
---|---|---|
committer | 2019-10-18 15:51:34 +0000 | |
commit | db55a1121b2437765e732c8bbedf914f8a52f624 (patch) | |
tree | 9b1be00c3684703e6a062052a634daa859068333 /runtime/verifier/class_verifier.h | |
parent | 697fe5cc6ce0e9c72c3681152a99a5d5bab4253c (diff) |
Class redefinition sometimes needs to update verification
In cases where class redefinition moves a class from having no
verification failures to having soft verification failures we need to
update the methods with new verification class flags. For example if
a method is modified to have unbalanced monitors we need to make sure
that future invokes of that method count locks and use the
interpreter.
Previously we would simply keep the same verification state as the
original implementation, causing us to try to compile in situations
the compiler cannot handle or leave monitors in inconsistent states.
Test: ./test.py --host
Bug: 142876078
Change-Id: I8adf59158639bdf237d691b20fad223f0a34db1f
Diffstat (limited to 'runtime/verifier/class_verifier.h')
-rw-r--r-- | runtime/verifier/class_verifier.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/verifier/class_verifier.h b/runtime/verifier/class_verifier.h index db5e4f592d..c97ea24799 100644 --- a/runtime/verifier/class_verifier.h +++ b/runtime/verifier/class_verifier.h @@ -50,6 +50,14 @@ namespace verifier { // Verifier that ensures the complete class is OK. class ClassVerifier { public: + // Redo verification on a loaded class. This is for use by class redefinition. Since the class is + // already loaded and in use this can only be performed with the mutator lock held. + static FailureKind ReverifyClass(Thread* self, + ObjPtr<mirror::Class> klass, + HardFailLogMode log_level, + uint32_t api_level, + std::string* error) + REQUIRES(Locks::mutator_lock_); // Verify a class. Returns "kNoFailure" on success. static FailureKind VerifyClass(Thread* self, ObjPtr<mirror::Class> klass, @@ -70,6 +78,18 @@ class ClassVerifier { uint32_t api_level, std::string* error) REQUIRES_SHARED(Locks::mutator_lock_); + static FailureKind VerifyClass(Thread* self, + const DexFile* dex_file, + Handle<mirror::DexCache> dex_cache, + Handle<mirror::ClassLoader> class_loader, + const dex::ClassDef& class_def, + CompilerCallbacks* callbacks, + bool allow_soft_failures, + HardFailLogMode log_level, + uint32_t api_level, + bool can_allocate, + std::string* error) + REQUIRES_SHARED(Locks::mutator_lock_); static void Init(ClassLinker* class_linker) REQUIRES_SHARED(Locks::mutator_lock_); static void Shutdown(); @@ -78,6 +98,16 @@ class ClassVerifier { REQUIRES_SHARED(Locks::mutator_lock_); private: + static FailureKind CommonVerifyClass(Thread* self, + ObjPtr<mirror::Class> klass, + CompilerCallbacks* callbacks, + bool allow_soft_failures, + HardFailLogMode log_level, + uint32_t api_level, + bool can_allocate, + std::string* error) + REQUIRES_SHARED(Locks::mutator_lock_); + DISALLOW_COPY_AND_ASSIGN(ClassVerifier); }; |