Supporting de-virtualization for precise types.
Sharpening invoke-virtual and invoke-interface calls to invoke-direct for cases
where the type of "this" pointer in the invoke- params is precisely known.
Instructions that have an invoke opcode are marked as interesting, for each invoke-virtual/interface
we come across with a precise type for "this" we mark the location as a candidate for sharpening,
resolve the concrete method and save its method reference <DexFile, DexMethodIndex> to be sharpened
in CompilerDriver::ComputeInvokeInfo().
Added a new entry to AOT statistics showing the percentage of sharpened calls that were based on
type analysis.
Fix a minor bug in type creation for GetSuperClass(). Previously super class of a precise reference
had precise types created which is not necessarily the case.
Fixed DCHECK in Class::FindVirtualMethodForVirtual to handle cases for Miranda methods.
Sharpening only takes place for cases where no soft failures happen at verification time.
Change-Id: Ic027d0226d6f95260c1918014cb6313f2e0ca455
diff --git a/src/mirror/class-inl.h b/src/mirror/class-inl.h
index d7afed6..62740be 100644
--- a/src/mirror/class-inl.h
+++ b/src/mirror/class-inl.h
@@ -225,7 +225,7 @@
inline AbstractMethod* Class::FindVirtualMethodForVirtual(AbstractMethod* method) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(!method->GetDeclaringClass()->IsInterface());
+ DCHECK(!method->GetDeclaringClass()->IsInterface() || method->IsMiranda());
// The argument method may from a super class.
// Use the index to a potentially overridden one for this instance's class.
return GetVTable()->Get(method->GetMethodIndex());
diff --git a/src/mirror/class.h b/src/mirror/class.h
index afab314..dfbe815 100644
--- a/src/mirror/class.h
+++ b/src/mirror/class.h
@@ -346,7 +346,7 @@
return !IsPrimitive() && GetSuperClass() == NULL;
}
bool IsInstantiable() const {
- return !IsPrimitive() && !IsInterface() && !IsAbstract();
+ return (!IsPrimitive() && !IsInterface() && !IsAbstract()) || ((IsAbstract()) && IsArrayClass());
}
bool IsObjectArrayClass() const {