diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-22 11:06:43 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-22 15:07:04 +0100 |
commit | 042fd00295d21f936ba7a8c16915ce678970e658 (patch) | |
tree | 1e8bd244d7c956ff361fb113eca6cce445a06312 /compiler | |
parent | c48c7e6a540a0e23ff26ce12e2fe94adefd8ed48 (diff) | |
download | art-042fd00295d21f936ba7a8c16915ce678970e658.zip art-042fd00295d21f936ba7a8c16915ce678970e658.tar.gz art-042fd00295d21f936ba7a8c16915ce678970e658.tar.bz2 |
Revert "Revert "Use IsAssignableFrom instead of IsSubclass for robustness.""
Don't use IsAssignableFrom, but check beforehand if the referrer is an
interface. Otherwise, we are being too aggressive on removing clinit
checks on interfaces (being a subclass doesn't imply the interface
has been initialized).
bug:21870666
This reverts commit 463580ca5a1e75e27ad0207537ffc6252091326a.
(cherry picked from commit b783b408112d1797da646f576a40f94bcb5162f3)
Change-Id: Ida03f453c9b0d4dda87a5696098f9ffbd69a3aa3
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/driver/compiler_driver-inl.h | 6 | ||||
-rw-r--r-- | compiler/optimizing/builder.cc | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h index e0c56fc..633bc1b 100644 --- a/compiler/driver/compiler_driver-inl.h +++ b/compiler/driver/compiler_driver-inl.h @@ -250,8 +250,10 @@ inline bool CompilerDriver::CanAssumeClassIsInitialized(mirror::Class* klass) { inline bool CompilerDriver::CanReferrerAssumeClassIsInitialized(mirror::Class* referrer_class, mirror::Class* klass) { - return (referrer_class != nullptr && referrer_class->IsSubClass(klass)) || - CanAssumeClassIsInitialized(klass); + return (referrer_class != nullptr + && !referrer_class->IsInterface() + && referrer_class->IsSubClass(klass)) + || CanAssumeClassIsInitialized(klass); } inline bool CompilerDriver::IsStaticFieldsClassInitialized(mirror::Class* referrer_class, diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 1a5f27c..ed39923 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -698,7 +698,8 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, &storage_index); } - if (outer_class.Get()->IsSubClass(resolved_method->GetDeclaringClass())) { + if (!outer_class->IsInterface() + && outer_class->IsSubClass(resolved_method->GetDeclaringClass())) { // If the outer class is the declaring class or a subclass // of the declaring class, no class initialization is needed // before the static method call. |