diff options
author | 2019-10-23 14:14:25 -0700 | |
---|---|---|
committer | 2019-10-28 23:46:26 +0000 | |
commit | c2d0c9627b969ba988c8817d1b765b1cb61a61f3 (patch) | |
tree | be3d4547d2a0a42d4085355383c509b0cb55f587 /runtime/verifier/method_verifier.h | |
parent | 0c262edd22824f4465e0cb08879b7eea89d3fac0 (diff) |
Perform reverify with shared mutator-lock.
Despite comments that seemed to indicate otherwise the verifier is not
capable of running with a strong mutator-lock in all circumstances.
Specifically it relies on being able to allocate exceptions in a
number of situations (for example when a field could not be found but
the class could). This could lead to problems when trying to
reverify a class. To fix this we changed the reverify step to happen
outside of the strong mutator-lock and instead temporarily mark the
redefined methods with every verifier fail flag. The new verification
will then be performed and the flags reset (after suspending
everything).
This also fixes a related issue where performing the verification
with an exclusive mutator lock changed how elements in the dex-cache
were populated, causing the dex-cache to break invariants about
methods always having their classes be present. This could cause
crashes in some circumstances (for example test 1990).
Test: ./test.py --host
Test: go/lem
Bug: 142876078
This partially reverts commit b1eebde9469914ad634a6dc3746ddfb222595609
This partially reverts commit db55a1121b2437765e732c8bbedf914f8a52f624
Change-Id: I0f1e8c47118cc84c8f23c4068944069ac74f5ea3
Diffstat (limited to 'runtime/verifier/method_verifier.h')
-rw-r--r-- | runtime/verifier/method_verifier.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index 09d384a069..83dafd3975 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -72,6 +72,16 @@ enum RegisterTrackingMode { kTrackRegsAll, }; +// A class used by the verifier to tell users about what options need to be set for given methods. +class VerifierCallback { + public: + virtual ~VerifierCallback() {} + virtual void SetDontCompile(ArtMethod* method, bool value) + REQUIRES_SHARED(Locks::mutator_lock_) = 0; + virtual void SetMustCountLocks(ArtMethod* method, bool value) + REQUIRES_SHARED(Locks::mutator_lock_) = 0; +}; + // A mapping from a dex pc to the register line statuses as they are immediately prior to the // execution of that instruction. class PcToRegisterLineTable { @@ -248,12 +258,12 @@ class MethodVerifier { ArtMethod* method, uint32_t method_access_flags, CompilerCallbacks* callbacks, + VerifierCallback* verifier_callback, bool allow_soft_failures, HardFailLogMode log_level, bool need_precise_constants, uint32_t api_level, bool aot_mode, - bool allow_suspension, std::string* hard_failure_msg) REQUIRES_SHARED(Locks::mutator_lock_); @@ -270,12 +280,12 @@ class MethodVerifier { ArtMethod* method, uint32_t method_access_flags, CompilerCallbacks* callbacks, + VerifierCallback* verifier_callback, bool allow_soft_failures, HardFailLogMode log_level, bool need_precise_constants, uint32_t api_level, bool aot_mode, - bool allow_suspension, std::string* hard_failure_msg) REQUIRES_SHARED(Locks::mutator_lock_); |