summaryrefslogtreecommitdiffstats
path: root/compiler/driver
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-01-02 16:40:37 +0000
committerVladimir Marko <vmarko@google.com>2014-03-18 16:16:16 +0000
commit9820b7c1dc70e75ad405b9e6e63578fa9fe94e94 (patch)
tree2fff53b061b16d758870a2a5299a383bdbe550b6 /compiler/driver
parent80f9d0c48d6f8561700630b8b08adb4398d61008 (diff)
downloadart-9820b7c1dc70e75ad405b9e6e63578fa9fe94e94.zip
art-9820b7c1dc70e75ad405b9e6e63578fa9fe94e94.tar.gz
art-9820b7c1dc70e75ad405b9e6e63578fa9fe94e94.tar.bz2
Early inlining of simple methods.
Inlining "special" methods: empty methods, methods returning constants or their arguments, simple getters and setters. Bug: 8164439 Change-Id: I8c7fa9c14351fbb2470000b378a22974daaef236
Diffstat (limited to 'compiler/driver')
-rw-r--r--compiler/driver/compiler_driver-inl.h10
-rw-r--r--compiler/driver/compiler_driver.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h
index 664f809..d9f2a3a 100644
--- a/compiler/driver/compiler_driver-inl.h
+++ b/compiler/driver/compiler_driver-inl.h
@@ -289,6 +289,16 @@ inline int CompilerDriver::IsFastInvoke(
return stats_flags;
}
+inline bool CompilerDriver::NeedsClassInitialization(mirror::Class* referrer_class,
+ mirror::ArtMethod* resolved_method) {
+ if (!resolved_method->IsStatic()) {
+ return false;
+ }
+ mirror::Class* methods_class = resolved_method->GetDeclaringClass();
+ // NOTE: Unlike in IsFastStaticField(), we don't check CanAssumeTypeIsPresentInDexCache() here.
+ return methods_class != referrer_class && !methods_class->IsInitialized();
+}
+
} // namespace art
#endif // ART_COMPILER_DRIVER_COMPILER_DRIVER_INL_H_
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index d88b2aa..256aa46 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -283,6 +283,10 @@ class CompilerDriver {
uintptr_t* direct_code, uintptr_t* direct_method)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ // Does invokation of the resolved method need class initialization?
+ bool NeedsClassInitialization(mirror::Class* referrer_class, mirror::ArtMethod* resolved_method)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
void ProcessedInstanceField(bool resolved);
void ProcessedStaticField(bool resolved, bool local);
void ProcessedInvoke(InvokeType invoke_type, int flags);