Avoid compile time rewriting of dex code by verifier.
Compile time rewriting of dex code leads to dead code that is causing
issues with the LLVM compiler. Make instantiation and incompatible class
change errors be detected in slow path field and invoke logic so its
safe for the compile time verification just to softly fail the effected
classes.
This change places incompatible class change logic into the class
linkers ResolveMethod and consequently changes a number of APIs.
Change-Id: Ifb25f09accea348d15180f6ff041e38dfe0d536e
diff --git a/src/class_linker.h b/src/class_linker.h
index c69c442..8a6aaec 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -174,10 +174,10 @@
uint32_t method_idx,
DexCache* dex_cache,
ClassLoader* class_loader,
- bool is_direct)
+ InvokeType type)
SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
- Method* ResolveMethod(uint32_t method_idx, const Method* referrer, bool is_direct)
+ Method* ResolveMethod(uint32_t method_idx, const Method* referrer, InvokeType type)
SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_) {
Method* resolved_method = referrer->GetDexCacheResolvedMethods()->Get(method_idx);
if (UNLIKELY(resolved_method == NULL || resolved_method->IsRuntimeMethod())) {
@@ -185,7 +185,7 @@
DexCache* dex_cache = declaring_class->GetDexCache();
ClassLoader* class_loader = declaring_class->GetClassLoader();
const DexFile& dex_file = FindDexFile(dex_cache);
- resolved_method = ResolveMethod(dex_file, method_idx, dex_cache, class_loader, is_direct);
+ resolved_method = ResolveMethod(dex_file, method_idx, dex_cache, class_loader, type);
}
return resolved_method;
}