Fast path interface dispatch.
Interface dispatch when the method we're dispatching against is known
currently goes slow path. This change makes the load of the interface
method either a load of a constant or from the resolve methods table. It
also makes the null check on the "this" pointer inline.
Change-Id: I69571a062d3d693bee2dec6e46a456e0f74411cd
diff --git a/src/compiler.cc b/src/compiler.cc
index c69c4ff..97a35f0 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -820,9 +820,13 @@
void Compiler::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type, AbstractMethod* method,
uintptr_t& direct_code, uintptr_t& direct_method) {
+ // For direct and static methods compute possible direct_code and direct_method values, ie
+ // an address for the Method* being invoked and an address of the code for that Method*.
+ // For interface calls compute a value for direct_method that is the interface method being
+ // invoked, so this can be passed to the out-of-line runtime support code.
direct_code = 0;
direct_method = 0;
- if (sharp_type != kStatic && sharp_type != kDirect) {
+ if (sharp_type != kStatic && sharp_type != kDirect && sharp_type != kInterface) {
return;
}
bool method_code_in_boot = method->GetDeclaringClass()->GetClassLoader() == NULL;
@@ -885,8 +889,7 @@
referrer_class);
}
if (referrer_class->CanAccess(methods_class) &&
- referrer_class->CanAccessMember(methods_class,
- resolved_method->GetAccessFlags())) {
+ referrer_class->CanAccessMember(methods_class, resolved_method->GetAccessFlags())) {
vtable_idx = resolved_method->GetMethodIndex();
const bool kEnableSharpening = true;
// Sharpen a virtual call into a direct call when the target is known.