summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2015-04-24 19:14:22 +0100
committerRoland Levillain <rpl@google.com>2015-04-24 19:18:27 +0100
commit5f02c6caf9f38be49e655f8bdeeeb99b6faf9383 (patch)
treee0675b7691662a452a2bb48ebbf5410ceac51c85 /compiler/optimizing/builder.cc
parenteb5459ca861b58ee8a9907789f11400dcdddb87b (diff)
downloadart-5f02c6caf9f38be49e655f8bdeeeb99b6faf9383.tar.gz
art-5f02c6caf9f38be49e655f8bdeeeb99b6faf9383.tar.bz2
art-5f02c6caf9f38be49e655f8bdeeeb99b6faf9383.zip
Reduce the number of explicit clinit checks for static invokes.
Do not generate explicit clinit checks for static invokes when the class of the called method is a super class of the caller method's class (referrer class). Change-Id: I86ba18facef261fbb71f7ed20867756630ed3c53
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index bb2080766d..2f8a605ab4 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -666,9 +666,10 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction,
&storage_index);
}
- if (is_referrer_class) {
- // If the declaring class is the referrer class, no class
- // initialization is needed before the static method call.
+ if (referrer_class.Get()->IsSubClass(resolved_method->GetDeclaringClass())) {
+ // If the referrer class is the declaring class or a subclass
+ // of the declaring class, no class initialization is needed
+ // before the static method call.
clinit_check_requirement = HInvokeStaticOrDirect::ClinitCheckRequirement::kNone;
} else if (storage_index != DexFile::kDexNoIndex) {
// If the method's class type index is available, check