diff options
author | 2020-09-07 08:30:52 +0100 | |
---|---|---|
committer | 2020-09-08 13:51:53 +0000 | |
commit | e6c0f2a75bd969253279580e2e4772e54787034b (patch) | |
tree | 79598b2b6b457d9c718ddb18e29a0211a73ae85a /compiler/optimizing/nodes.h | |
parent | 63c0c2d9da31d26781f5e77aba6125f0d0988795 (diff) |
Pass a full MethodReference of the invoke in HInvoke nodes.
Cleanup to ensure we don't make mistakes when passing a dex method index
to the HInvoke constructor, and we know which dex file it relates to.
Test: test.py
Change-Id: I625949add88a6b97e1dafeb7aed37961e105d6aa
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index bece0acea3..80d4a2f395 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -4386,8 +4386,6 @@ class HInvoke : public HVariableInputSizeInstruction { // inputs at the end of their list of inputs. uint32_t GetNumberOfArguments() const { return number_of_arguments_; } - uint32_t GetDexMethodIndex() const { return dex_method_index_; } - InvokeType GetInvokeType() const { return GetPackedField<InvokeTypeField>(); } @@ -4430,7 +4428,9 @@ class HInvoke : public HVariableInputSizeInstruction { bool IsIntrinsic() const { return intrinsic_ != Intrinsics::kNone; } ArtMethod* GetResolvedMethod() const { return resolved_method_; } - void SetResolvedMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_); + void SetResolvedMethod(ArtMethod* method); + + MethodReference GetMethodReference() const { return method_reference_; } DECLARE_ABSTRACT_INSTRUCTION(Invoke); @@ -4450,7 +4450,7 @@ class HInvoke : public HVariableInputSizeInstruction { uint32_t number_of_other_inputs, DataType::Type return_type, uint32_t dex_pc, - uint32_t dex_method_index, + MethodReference method_reference, ArtMethod* resolved_method, InvokeType invoke_type) : HVariableInputSizeInstruction( @@ -4462,13 +4462,11 @@ class HInvoke : public HVariableInputSizeInstruction { number_of_arguments + number_of_other_inputs, kArenaAllocInvokeInputs), number_of_arguments_(number_of_arguments), - dex_method_index_(dex_method_index), + method_reference_(method_reference), intrinsic_(Intrinsics::kNone), intrinsic_optimizations_(0) { SetPackedField<InvokeTypeField>(invoke_type); SetPackedFlag<kFlagCanThrow>(true); - // Check mutator lock, constructors lack annotalysis support. - Locks::mutator_lock_->AssertNotExclusiveHeld(Thread::Current()); SetResolvedMethod(resolved_method); } @@ -4476,7 +4474,7 @@ class HInvoke : public HVariableInputSizeInstruction { uint32_t number_of_arguments_; ArtMethod* resolved_method_; - const uint32_t dex_method_index_; + const MethodReference method_reference_; Intrinsics intrinsic_; // A magic word holding optimizations for intrinsics. See intrinsics.h. @@ -4489,7 +4487,7 @@ class HInvokeUnresolved final : public HInvoke { uint32_t number_of_arguments, DataType::Type return_type, uint32_t dex_pc, - uint32_t dex_method_index, + MethodReference method_reference, InvokeType invoke_type) : HInvoke(kInvokeUnresolved, allocator, @@ -4497,7 +4495,7 @@ class HInvokeUnresolved final : public HInvoke { /* number_of_other_inputs= */ 0u, return_type, dex_pc, - dex_method_index, + method_reference, nullptr, invoke_type) { } @@ -4516,7 +4514,7 @@ class HInvokePolymorphic final : public HInvoke { uint32_t number_of_arguments, DataType::Type return_type, uint32_t dex_pc, - uint32_t dex_method_index, + MethodReference method_reference, // resolved_method is the ArtMethod object corresponding to the polymorphic // method (e.g. VarHandle.get), resolved using the class linker. It is needed // to pass intrinsic information to the HInvokePolymorphic node. @@ -4528,7 +4526,7 @@ class HInvokePolymorphic final : public HInvoke { /* number_of_other_inputs= */ 0u, return_type, dex_pc, - dex_method_index, + method_reference, resolved_method, kPolymorphic), proto_idx_(proto_idx) { @@ -4551,14 +4549,15 @@ class HInvokeCustom final : public HInvoke { uint32_t number_of_arguments, uint32_t call_site_index, DataType::Type return_type, - uint32_t dex_pc) + uint32_t dex_pc, + MethodReference method_reference) : HInvoke(kInvokeCustom, allocator, number_of_arguments, /* number_of_other_inputs= */ 0u, return_type, dex_pc, - /* dex_method_index= */ dex::kDexNoIndex, + method_reference, /* resolved_method= */ nullptr, kStatic), call_site_index_(call_site_index) { @@ -4647,11 +4646,11 @@ class HInvokeStaticOrDirect final : public HInvoke { uint32_t number_of_arguments, DataType::Type return_type, uint32_t dex_pc, - uint32_t method_index, + MethodReference method_reference, ArtMethod* resolved_method, DispatchInfo dispatch_info, InvokeType invoke_type, - MethodReference target_method, + MethodReference resolved_method_reference, ClinitCheckRequirement clinit_check_requirement) : HInvoke(kInvokeStaticOrDirect, allocator, @@ -4662,10 +4661,10 @@ class HInvokeStaticOrDirect final : public HInvoke { (clinit_check_requirement == ClinitCheckRequirement::kExplicit ? 1u : 0u), return_type, dex_pc, - method_index, + method_reference, resolved_method, invoke_type), - target_method_(target_method), + resolved_method_reference_(resolved_method_reference), dispatch_info_(dispatch_info) { SetPackedField<ClinitCheckRequirementField>(clinit_check_requirement); } @@ -4753,8 +4752,8 @@ class HInvokeStaticOrDirect final : public HInvoke { return GetInvokeType() == kStatic; } - MethodReference GetTargetMethod() const { - return target_method_; + const MethodReference GetResolvedMethodReference() const { + return resolved_method_reference_; } // Does this method load kind need the current method as an input? @@ -4856,7 +4855,7 @@ class HInvokeStaticOrDirect final : public HInvoke { kFieldClinitCheckRequirementSize>; // Cached values of the resolved method, to avoid needing the mutator lock. - const MethodReference target_method_; + const MethodReference resolved_method_reference_; DispatchInfo dispatch_info_; }; std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::MethodLoadKind rhs); @@ -4869,7 +4868,7 @@ class HInvokeVirtual final : public HInvoke { uint32_t number_of_arguments, DataType::Type return_type, uint32_t dex_pc, - uint32_t dex_method_index, + MethodReference method_reference, ArtMethod* resolved_method, uint32_t vtable_index) : HInvoke(kInvokeVirtual, @@ -4878,7 +4877,7 @@ class HInvokeVirtual final : public HInvoke { 0u, return_type, dex_pc, - dex_method_index, + method_reference, resolved_method, kVirtual), vtable_index_(vtable_index) { @@ -4931,7 +4930,7 @@ class HInvokeInterface final : public HInvoke { uint32_t number_of_arguments, DataType::Type return_type, uint32_t dex_pc, - uint32_t dex_method_index, + MethodReference method_reference, ArtMethod* resolved_method, uint32_t imt_index) : HInvoke(kInvokeInterface, @@ -4940,7 +4939,7 @@ class HInvokeInterface final : public HInvoke { 0u, return_type, dex_pc, - dex_method_index, + method_reference, resolved_method, kInterface), imt_index_(imt_index) { |