Compile time performance improvements focusing on interpret-only.
Reduce virtual method dispatch in the method verifier and make more code
inline-able.
Add a StringPiece with const char* equality operator to avoid redundant
StringPieces and strlens.
Remove back link from register line to verifier and pass as argument to reduce
size of RegisterLine.
Remove instruction length from instruction flags and compute from the
instruction, again to reduce size.
Add suspend checks to resolve and verify to allow for more easy monitor
inflation and reduce contention on Locks::thread_list_suspend_thread_lock_.
Change ThrowEarlierClassFailure to throw pre-allocated exception.
Avoid calls to Thread::Current() by passing self.
Template specialize IsValidClassName.
Make ANR reporting with SIGQUIT run using checkpoints rather than suspending
all threads. This makes the stack/lock analysis less lock error prone.
Extra Barrier assertions and condition variable time out is now returned as a
boolean both from Barrier and ConditionVariable::Wait.
2 threaded host x86-64 interpret-only numbers from 341 samples:
Before change: Avg 176.137ms 99% CI 3.468ms to 1060.770ms
After change: Avg 139.163% 99% CI 3.027ms to 838.257ms
Reduction in average compile time after change is 20.9%.
Slow-down without change is 26.5%.
Bug: 17471626 - Fix bug where RegTypeCache::JavaLangObject/String/Class/Throwable
could return unresolved type when class loading is disabled.
Bug: 17398101
Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index 45c0a03..81ab960 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -140,16 +140,18 @@
};
/* Verify a class. Returns "kNoFailure" on success. */
- static FailureKind VerifyClass(mirror::Class* klass, bool allow_soft_failures, std::string* error)
+ static FailureKind VerifyClass(Thread* self, mirror::Class* klass, bool allow_soft_failures,
+ std::string* error)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static FailureKind VerifyClass(const DexFile* dex_file, ConstHandle<mirror::DexCache> dex_cache,
+ static FailureKind VerifyClass(Thread* self, const DexFile* dex_file,
+ ConstHandle<mirror::DexCache> dex_cache,
ConstHandle<mirror::ClassLoader> class_loader,
const DexFile::ClassDef* class_def,
bool allow_soft_failures, std::string* error)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static void VerifyMethodAndDump(std::ostream& os, uint32_t method_idx, const DexFile* dex_file,
- ConstHandle<mirror::DexCache> dex_cache,
+ static void VerifyMethodAndDump(Thread* self, std::ostream& os, uint32_t method_idx,
+ const DexFile* dex_file, ConstHandle<mirror::DexCache> dex_cache,
ConstHandle<mirror::ClassLoader> class_loader,
const DexFile::ClassDef* class_def,
const DexFile::CodeItem* code_item,
@@ -202,7 +204,7 @@
return can_load_classes_;
}
- MethodVerifier(const DexFile* dex_file, ConstHandle<mirror::DexCache> dex_cache,
+ MethodVerifier(Thread* self, const DexFile* dex_file, ConstHandle<mirror::DexCache> dex_cache,
ConstHandle<mirror::ClassLoader> class_loader, const DexFile::ClassDef* class_def,
const DexFile::CodeItem* code_item, uint32_t method_idx,
ConstHandle<mirror::ArtMethod> method,
@@ -253,7 +255,7 @@
* (3) Iterate through the method, checking type safety and looking
* for code flow problems.
*/
- static FailureKind VerifyMethod(uint32_t method_idx, const DexFile* dex_file,
+ static FailureKind VerifyMethod(Thread* self, uint32_t method_idx, const DexFile* dex_file,
ConstHandle<mirror::DexCache> dex_cache,
ConstHandle<mirror::ClassLoader> class_loader,
const DexFile::ClassDef* class_def_idx,
@@ -625,6 +627,9 @@
const RegType& DetermineCat1Constant(int32_t value, bool precise)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ // The thread we're verifying on.
+ Thread* const self_;
+
RegTypeCache reg_types_;
PcToRegisterLineTable reg_table_;