From 51b8aafd3beb8855a258383a9eb876a783375629 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 9 Jun 2017 15:17:05 +0100 Subject: Fix HClinitCheck elimination in instruction builder. To handle escaping instances of erroneous classes correctly, we can omit the HClinitCheck only when using a class in the static method of the very same class. Even for superclasses we need to do the check. The new test exposes the cases where we were previously diverging from the RI. Also clean up the CompilerDriver by inlining one function directly to the HInstructionBuild::IsInitialized(.) and removing some related functions that are no longer used. The size of the aosp_taimen-userdebug prebuilts: - before: arm/boot*.oat: 16891788 arm64/boot*.oat: 19815520 oat/arm64/services.odex: 20071624 - after: arm/boot*.oat: 16949532 (+56.4KiB, +0.34%) arm64/boot*.oat: 19889752 (+72.5KiB, +0.37%) oat/arm64/services.odex: 20224328 (+149.1KiB, +0.76%) with minor changes to other app prebuilts. Note: Some of that could be reclaimed by reinstating the old optimization for classes where no bytecode can be executed during initialization (no to execute in that class or superclasses). Test: 174-escaping-instance-of-bad-class Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: testrunner.py --jvm -t 174 Test: Pixel 2 XL boots. Test: testrunner.py --target --optimizing Bug: 62478025 Change-Id: I41f026ea7fecc615c06e87f3b6cb847de0ede8a6 --- compiler/optimizing/instruction_builder.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'compiler/optimizing/instruction_builder.h') diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h index af7092a0cf..578172a18e 100644 --- a/compiler/optimizing/instruction_builder.h +++ b/compiler/optimizing/instruction_builder.h @@ -98,11 +98,6 @@ class HInstructionBuilder : public ValueObject { void InitializeParameters(); - // Returns whether the current method needs access check for the type. - // Output parameter finalizable is set to whether the type is finalizable. - bool NeedsAccessCheck(dex::TypeIndex type_index, /*out*/bool* finalizable) const - REQUIRES_SHARED(Locks::mutator_lock_); - template void Unop_12x(const Instruction& instruction, DataType::Type type, uint32_t dex_pc); @@ -287,8 +282,7 @@ class HInstructionBuilder : public ValueObject { void BuildConstructorFenceForAllocation(HInstruction* allocation); // Return whether the compiler can assume `cls` is initialized. - bool IsInitialized(Handle cls) const - REQUIRES_SHARED(Locks::mutator_lock_); + bool IsInitialized(Handle cls) const REQUIRES_SHARED(Locks::mutator_lock_); // Try to resolve a method using the class linker. Return null if a method could // not be resolved. -- cgit v1.2.3-59-g8ed1b