From 2f40d24aea4b9b2726c994de71b17ae2f82e9238 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 8 Apr 2020 12:56:45 +0100 Subject: Small cleanup in InstructionBuilder. Refactor BuildInvoke() to reduce runtime state transitions (fewer ScopedObjectAccess objects) and separate the class init check for static methods from the instruction creation in preparation for allocating replacement instructions for intrinsics such as Math.abs(). Delay Handle<> creation in ProcessClinitCheckForInvoke until it's actually needed. Change function parameters to ObjPtr<> instead of Handle<> if they cannot cause thread suspension. Test: aosp_taimen-userdebug boots. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I8d5ebf5db76f0c8b1fec790a2f8621818d64b4dc --- compiler/optimizing/instruction_builder.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'compiler/optimizing/instruction_builder.h') diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h index d701445946..c0211342ff 100644 --- a/compiler/optimizing/instruction_builder.h +++ b/compiler/optimizing/instruction_builder.h @@ -230,7 +230,7 @@ class HInstructionBuilder : public ValueObject { Handle ResolveClass(ScopedObjectAccess& soa, dex::TypeIndex type_index) REQUIRES_SHARED(Locks::mutator_lock_); - bool LoadClassNeedsAccessCheck(Handle klass) + bool LoadClassNeedsAccessCheck(ObjPtr klass) REQUIRES_SHARED(Locks::mutator_lock_); // Builds a `HLoadMethodHandle` loading the given `method_handle_index`. @@ -263,8 +263,7 @@ class HInstructionBuilder : public ValueObject { HClinitCheck* ProcessClinitCheckForInvoke( uint32_t dex_pc, ArtMethod* method, - HInvokeStaticOrDirect::ClinitCheckRequirement* clinit_check_requirement) - REQUIRES_SHARED(Locks::mutator_lock_); + HInvokeStaticOrDirect::ClinitCheckRequirement* clinit_check_requirement); // Build a HNewInstance instruction. HNewInstance* BuildNewInstance(dex::TypeIndex type_index, uint32_t dex_pc); @@ -274,13 +273,9 @@ class HInstructionBuilder : public ValueObject { void BuildConstructorFenceForAllocation(HInstruction* allocation); // Return whether the compiler can assume `cls` is initialized. - bool IsInitialized(Handle cls) const + bool IsInitialized(ObjPtr 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. - ArtMethod* ResolveMethod(uint16_t method_idx, InvokeType invoke_type); - // Try to resolve a field using the class linker. Return null if it could not // be found. ArtField* ResolveField(uint16_t field_idx, bool is_static, bool is_put); -- cgit v1.2.3-59-g8ed1b