diff options
Diffstat (limited to 'compiler/optimizing/nodes.h')
| -rw-r--r-- | compiler/optimizing/nodes.h | 517 |
1 files changed, 286 insertions, 231 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index a6d0da1c96..99fde755da 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -28,6 +28,7 @@ #include "base/iteration_range.h" #include "base/stl_util.h" #include "base/transform_array_ref.h" +#include "data_type.h" #include "deoptimization_kind.h" #include "dex_file.h" #include "dex_file_types.h" @@ -40,11 +41,11 @@ #include "method_reference.h" #include "mirror/class.h" #include "offsets.h" -#include "primitive.h" #include "utils/intrusive_forward_list.h" namespace art { +class ArenaStack; class GraphChecker; class HBasicBlock; class HConstructorFence; @@ -305,7 +306,8 @@ std::ostream& operator<<(std::ostream& os, const ReferenceTypeInfo& rhs); // Control-flow graph of a method. Contains a list of basic blocks. class HGraph : public ArenaObject<kArenaAllocGraph> { public: - HGraph(ArenaAllocator* arena, + HGraph(ArenaAllocator* allocator, + ArenaStack* arena_stack, const DexFile& dex_file, uint32_t method_idx, InstructionSet instruction_set, @@ -313,10 +315,11 @@ class HGraph : public ArenaObject<kArenaAllocGraph> { bool debuggable = false, bool osr = false, int start_instruction_id = 0) - : arena_(arena), - blocks_(arena->Adapter(kArenaAllocBlockList)), - reverse_post_order_(arena->Adapter(kArenaAllocReversePostOrder)), - linear_order_(arena->Adapter(kArenaAllocLinearOrder)), + : allocator_(allocator), + arena_stack_(arena_stack), + blocks_(allocator->Adapter(kArenaAllocBlockList)), + reverse_post_order_(allocator->Adapter(kArenaAllocReversePostOrder)), + linear_order_(allocator->Adapter(kArenaAllocLinearOrder)), entry_block_(nullptr), exit_block_(nullptr), maximum_number_of_out_vregs_(0), @@ -337,22 +340,23 @@ class HGraph : public ArenaObject<kArenaAllocGraph> { number_of_cha_guards_(0), instruction_set_(instruction_set), cached_null_constant_(nullptr), - cached_int_constants_(std::less<int32_t>(), arena->Adapter(kArenaAllocConstantsMap)), - cached_float_constants_(std::less<int32_t>(), arena->Adapter(kArenaAllocConstantsMap)), - cached_long_constants_(std::less<int64_t>(), arena->Adapter(kArenaAllocConstantsMap)), - cached_double_constants_(std::less<int64_t>(), arena->Adapter(kArenaAllocConstantsMap)), + cached_int_constants_(std::less<int32_t>(), allocator->Adapter(kArenaAllocConstantsMap)), + cached_float_constants_(std::less<int32_t>(), allocator->Adapter(kArenaAllocConstantsMap)), + cached_long_constants_(std::less<int64_t>(), allocator->Adapter(kArenaAllocConstantsMap)), + cached_double_constants_(std::less<int64_t>(), allocator->Adapter(kArenaAllocConstantsMap)), cached_current_method_(nullptr), art_method_(nullptr), inexact_object_rti_(ReferenceTypeInfo::CreateInvalid()), osr_(osr), - cha_single_implementation_list_(arena->Adapter(kArenaAllocCHA)) { + cha_single_implementation_list_(allocator->Adapter(kArenaAllocCHA)) { blocks_.reserve(kDefaultNumberOfBlocks); } // Acquires and stores RTI of inexact Object to be used when creating HNullConstant. void InitializeInexactObjectRTI(VariableSizedHandleScope* handles); - ArenaAllocator* GetArena() const { return arena_; } + ArenaAllocator* GetAllocator() const { return allocator_; } + ArenaStack* GetArenaStack() const { return arena_stack_; } const ArenaVector<HBasicBlock*>& GetBlocks() const { return blocks_; } bool IsInSsaForm() const { return in_ssa_form_; } @@ -511,7 +515,7 @@ class HGraph : public ArenaObject<kArenaAllocGraph> { // Returns a constant of the given type and value. If it does not exist // already, it is created and inserted into the graph. This method is only for // integral types. - HConstant* GetConstant(Primitive::Type type, int64_t value, uint32_t dex_pc = kNoDexPc); + HConstant* GetConstant(DataType::Type type, int64_t value, uint32_t dex_pc = kNoDexPc); // TODO: This is problematic for the consistency of reference type propagation // because it can be created anytime after the pass and thus it will be left @@ -613,7 +617,7 @@ class HGraph : public ArenaObject<kArenaAllocGraph> { // If not found or previously deleted, create and cache a new instruction. // Don't bother reviving a previously deleted instruction, for simplicity. if (constant == nullptr || constant->GetBlock() == nullptr) { - constant = new (arena_) InstructionType(value, dex_pc); + constant = new (allocator_) InstructionType(value, dex_pc); cache->Overwrite(value, constant); InsertConstant(constant); } @@ -629,7 +633,8 @@ class HGraph : public ArenaObject<kArenaAllocGraph> { // See CacheFloatConstant comment. void CacheDoubleConstant(HDoubleConstant* constant); - ArenaAllocator* const arena_; + ArenaAllocator* const allocator_; + ArenaStack* const arena_stack_; // List of blocks in insertion order. ArenaVector<HBasicBlock*> blocks_; @@ -751,9 +756,12 @@ class HLoopInformation : public ArenaObject<kArenaAllocLoopInfo> { suspend_check_(nullptr), irreducible_(false), contains_irreducible_loop_(false), - back_edges_(graph->GetArena()->Adapter(kArenaAllocLoopInfoBackEdges)), + back_edges_(graph->GetAllocator()->Adapter(kArenaAllocLoopInfoBackEdges)), // Make bit vector growable, as the number of blocks may change. - blocks_(graph->GetArena(), graph->GetBlocks().size(), true, kArenaAllocLoopInfoBackEdges) { + blocks_(graph->GetAllocator(), + graph->GetBlocks().size(), + true, + kArenaAllocLoopInfoBackEdges) { back_edges_.reserve(kDefaultNumberOfBackEdges); } @@ -916,11 +924,11 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> { public: explicit HBasicBlock(HGraph* graph, uint32_t dex_pc = kNoDexPc) : graph_(graph), - predecessors_(graph->GetArena()->Adapter(kArenaAllocPredecessors)), - successors_(graph->GetArena()->Adapter(kArenaAllocSuccessors)), + predecessors_(graph->GetAllocator()->Adapter(kArenaAllocPredecessors)), + successors_(graph->GetAllocator()->Adapter(kArenaAllocSuccessors)), loop_information_(nullptr), dominator_(nullptr), - dominated_blocks_(graph->GetArena()->Adapter(kArenaAllocDominated)), + dominated_blocks_(graph->GetAllocator()->Adapter(kArenaAllocDominated)), block_id_(kInvalidBlockId), dex_pc_(dex_pc), lifetime_start_(kNoLifetime), @@ -972,7 +980,7 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> { void AddBackEdge(HBasicBlock* back_edge) { if (loop_information_ == nullptr) { - loop_information_ = new (graph_->GetArena()) HLoopInformation(this, graph_); + loop_information_ = new (graph_->GetAllocator()) HLoopInformation(this, graph_); } DCHECK_EQ(loop_information_->GetHeader(), this); loop_information_->AddBackEdge(back_edge); @@ -1396,6 +1404,7 @@ class HLoopInformationOutwardIterator : public ValueObject { M(VecUShr, VecBinaryOperation) \ M(VecSetScalars, VecOperation) \ M(VecMultiplyAccumulate, VecOperation) \ + M(VecSADAccumulate, VecOperation) \ M(VecLoad, VecMemoryOperation) \ M(VecStore, VecMemoryOperation) \ @@ -1422,7 +1431,8 @@ class HLoopInformationOutwardIterator : public ValueObject { #else #define FOR_EACH_CONCRETE_INSTRUCTION_MIPS(M) \ M(MipsComputeBaseMethodAddress, Instruction) \ - M(MipsPackedSwitch, Instruction) + M(MipsPackedSwitch, Instruction) \ + M(IntermediateArrayAddressIndex, Instruction) #endif #define FOR_EACH_CONCRETE_INSTRUCTION_MIPS64(M) @@ -1566,7 +1576,7 @@ using HConstInputsRef = TransformArrayRef<const HUserRecord<HInstruction*>, HInp * The internal representation uses 38-bit and is described in the table below. * The first line indicates the side effect, and for field/array accesses the * second line indicates the type of the access (in the order of the - * Primitive::Type enum). + * DataType::Type enum). * The two numbered lines below indicate the bit position in the bitfield (read * vertically). * @@ -1615,23 +1625,23 @@ class SideEffects : public ValueObject { return SideEffects(kAllReads); } - static SideEffects FieldWriteOfType(Primitive::Type type, bool is_volatile) { + static SideEffects FieldWriteOfType(DataType::Type type, bool is_volatile) { return is_volatile ? AllWritesAndReads() : SideEffects(TypeFlag(type, kFieldWriteOffset)); } - static SideEffects ArrayWriteOfType(Primitive::Type type) { + static SideEffects ArrayWriteOfType(DataType::Type type) { return SideEffects(TypeFlag(type, kArrayWriteOffset)); } - static SideEffects FieldReadOfType(Primitive::Type type, bool is_volatile) { + static SideEffects FieldReadOfType(DataType::Type type, bool is_volatile) { return is_volatile ? AllWritesAndReads() : SideEffects(TypeFlag(type, kFieldReadOffset)); } - static SideEffects ArrayReadOfType(Primitive::Type type) { + static SideEffects ArrayReadOfType(DataType::Type type) { return SideEffects(TypeFlag(type, kArrayReadOffset)); } @@ -1759,14 +1769,26 @@ class SideEffects : public ValueObject { static constexpr uint64_t kAllReads = ((1ULL << (kLastBitForReads + 1 - kFieldReadOffset)) - 1) << kFieldReadOffset; - // Translates type to bit flag. - static uint64_t TypeFlag(Primitive::Type type, int offset) { - CHECK_NE(type, Primitive::kPrimVoid); - const uint64_t one = 1; - const int shift = type; // 0-based consecutive enum + // Translates type to bit flag. The type must correspond to a Java type. + static uint64_t TypeFlag(DataType::Type type, int offset) { + int shift; + switch (type) { + case DataType::Type::kReference: shift = 0; break; + case DataType::Type::kBool: shift = 1; break; + case DataType::Type::kInt8: shift = 2; break; + case DataType::Type::kUint16: shift = 3; break; + case DataType::Type::kInt16: shift = 4; break; + case DataType::Type::kInt32: shift = 5; break; + case DataType::Type::kInt64: shift = 6; break; + case DataType::Type::kFloat32: shift = 7; break; + case DataType::Type::kFloat64: shift = 8; break; + default: + LOG(FATAL) << "Unexpected data type " << type; + UNREACHABLE(); + } DCHECK_LE(kFieldWriteOffset, shift); DCHECK_LT(shift, kArrayWriteOffset); - return one << (type + offset); + return UINT64_C(1) << (shift + offset); } // Private constructor on direct flags value. @@ -1778,21 +1800,23 @@ class SideEffects : public ValueObject { // A HEnvironment object contains the values of virtual registers at a given location. class HEnvironment : public ArenaObject<kArenaAllocEnvironment> { public: - ALWAYS_INLINE HEnvironment(ArenaAllocator* arena, + ALWAYS_INLINE HEnvironment(ArenaAllocator* allocator, size_t number_of_vregs, ArtMethod* method, uint32_t dex_pc, HInstruction* holder) - : vregs_(number_of_vregs, arena->Adapter(kArenaAllocEnvironmentVRegs)), - locations_(arena->Adapter(kArenaAllocEnvironmentLocations)), + : vregs_(number_of_vregs, allocator->Adapter(kArenaAllocEnvironmentVRegs)), + locations_(allocator->Adapter(kArenaAllocEnvironmentLocations)), parent_(nullptr), method_(method), dex_pc_(dex_pc), holder_(holder) { } - ALWAYS_INLINE HEnvironment(ArenaAllocator* arena, const HEnvironment& to_copy, HInstruction* holder) - : HEnvironment(arena, + ALWAYS_INLINE HEnvironment(ArenaAllocator* allocator, + const HEnvironment& to_copy, + HInstruction* holder) + : HEnvironment(allocator, to_copy.Size(), to_copy.GetMethod(), to_copy.GetDexPc(), @@ -1911,7 +1935,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { HInstruction* GetPreviousDisregardingMoves() const; HBasicBlock* GetBlock() const { return block_; } - ArenaAllocator* GetArena() const { return block_->GetGraph()->GetArena(); } + ArenaAllocator* GetAllocator() const { return block_->GetGraph()->GetAllocator(); } void SetBlock(HBasicBlock* block) { block_ = block; } bool IsInBlock() const { return block_ != nullptr; } bool IsInLoop() const { return block_->IsInLoop(); } @@ -1955,7 +1979,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { virtual void Accept(HGraphVisitor* visitor) = 0; virtual const char* DebugName() const = 0; - virtual Primitive::Type GetType() const { return Primitive::kPrimVoid; } + virtual DataType::Type GetType() const { return DataType::Type::kVoid; } virtual bool NeedsEnvironment() const { return false; } @@ -1976,7 +2000,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { // simplifies the null check elimination. // TODO: Consider merging can_be_null into ReferenceTypeInfo. virtual bool CanBeNull() const { - DCHECK_EQ(GetType(), Primitive::kPrimNot) << "CanBeNull only applies to reference types"; + DCHECK_EQ(GetType(), DataType::Type::kReference) << "CanBeNull only applies to reference types"; return true; } @@ -1985,13 +2009,13 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { } virtual bool IsActualObject() const { - return GetType() == Primitive::kPrimNot; + return GetType() == DataType::Type::kReference; } void SetReferenceTypeInfo(ReferenceTypeInfo rti); ReferenceTypeInfo GetReferenceTypeInfo() const { - DCHECK_EQ(GetType(), Primitive::kPrimNot); + DCHECK_EQ(GetType(), DataType::Type::kReference); return ReferenceTypeInfo::CreateUnchecked(reference_type_handle_, GetPackedFlag<kFlagReferenceTypeIsExact>()); } @@ -2001,7 +2025,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { // Note: fixup_end remains valid across push_front(). auto fixup_end = uses_.empty() ? uses_.begin() : ++uses_.begin(); HUseListNode<HInstruction*>* new_node = - new (GetBlock()->GetGraph()->GetArena()) HUseListNode<HInstruction*>(user, index); + new (GetBlock()->GetGraph()->GetAllocator()) HUseListNode<HInstruction*>(user, index); uses_.push_front(*new_node); FixUpUserRecordsAfterUseInsertion(fixup_end); } @@ -2011,7 +2035,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { // Note: env_fixup_end remains valid across push_front(). auto env_fixup_end = env_uses_.empty() ? env_uses_.begin() : ++env_uses_.begin(); HUseListNode<HEnvironment*>* new_node = - new (GetBlock()->GetGraph()->GetArena()) HUseListNode<HEnvironment*>(user, index); + new (GetBlock()->GetGraph()->GetAllocator()) HUseListNode<HEnvironment*>(user, index); env_uses_.push_front(*new_node); FixUpUserRecordsAfterEnvUseInsertion(env_fixup_end); } @@ -2094,7 +2118,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { // copying, the uses lists are being updated. void CopyEnvironmentFrom(HEnvironment* environment) { DCHECK(environment_ == nullptr); - ArenaAllocator* allocator = GetBlock()->GetGraph()->GetArena(); + ArenaAllocator* allocator = GetBlock()->GetGraph()->GetAllocator(); environment_ = new (allocator) HEnvironment(allocator, *environment, this); environment_->CopyFrom(environment); if (environment->GetParent() != nullptr) { @@ -2105,7 +2129,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { void CopyEnvironmentFromWithLoopPhiAdjustment(HEnvironment* environment, HBasicBlock* block) { DCHECK(environment_ == nullptr); - ArenaAllocator* allocator = GetBlock()->GetGraph()->GetArena(); + ArenaAllocator* allocator = GetBlock()->GetGraph()->GetAllocator(); environment_ = new (allocator) HEnvironment(allocator, *environment, this); environment_->CopyFromWithLoopPhiAdjustment(environment, block); if (environment->GetParent() != nullptr) { @@ -2453,11 +2477,11 @@ class HVariableInputSizeInstruction : public HInstruction { protected: HVariableInputSizeInstruction(SideEffects side_effects, uint32_t dex_pc, - ArenaAllocator* arena, + ArenaAllocator* allocator, size_t number_of_inputs, ArenaAllocKind kind) : HInstruction(side_effects, dex_pc), - inputs_(number_of_inputs, arena->Adapter(kind)) {} + inputs_(number_of_inputs, allocator->Adapter(kind)) {} ArenaVector<HUserRecord<HInstruction*>> inputs_; @@ -2504,24 +2528,24 @@ class HTemplateInstruction<0>: public HInstruction { template<intptr_t N> class HExpression : public HTemplateInstruction<N> { public: - HExpression<N>(Primitive::Type type, SideEffects side_effects, uint32_t dex_pc) + HExpression<N>(DataType::Type type, SideEffects side_effects, uint32_t dex_pc) : HTemplateInstruction<N>(side_effects, dex_pc) { this->template SetPackedField<TypeField>(type); } virtual ~HExpression() {} - Primitive::Type GetType() const OVERRIDE { + DataType::Type GetType() const OVERRIDE { return TypeField::Decode(this->GetPackedFields()); } protected: static constexpr size_t kFieldType = HInstruction::kNumberOfGenericPackedBits; static constexpr size_t kFieldTypeSize = - MinimumBitsToStore(static_cast<size_t>(Primitive::kPrimLast)); + MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); static constexpr size_t kNumberOfExpressionPackedBits = kFieldType + kFieldTypeSize; static_assert(kNumberOfExpressionPackedBits <= HInstruction::kMaxNumberOfPackedBits, "Too many packed fields."); - using TypeField = BitField<Primitive::Type, kFieldType, kFieldTypeSize>; + using TypeField = BitField<DataType::Type, kFieldType, kFieldTypeSize>; }; // Represents dex's RETURN_VOID opcode. A HReturnVoid is a control flow @@ -2558,20 +2582,20 @@ class HReturn FINAL : public HTemplateInstruction<1> { class HPhi FINAL : public HVariableInputSizeInstruction { public: - HPhi(ArenaAllocator* arena, + HPhi(ArenaAllocator* allocator, uint32_t reg_number, size_t number_of_inputs, - Primitive::Type type, + DataType::Type type, uint32_t dex_pc = kNoDexPc) : HVariableInputSizeInstruction( SideEffects::None(), dex_pc, - arena, + allocator, number_of_inputs, kArenaAllocPhiInputs), reg_number_(reg_number) { SetPackedField<TypeField>(ToPhiType(type)); - DCHECK_NE(GetType(), Primitive::kPrimVoid); + DCHECK_NE(GetType(), DataType::Type::kVoid); // Phis are constructed live and marked dead if conflicting or unused. // Individual steps of SsaBuilder should assume that if a phi has been // marked dead, it can be ignored and will be removed by SsaPhiElimination. @@ -2580,21 +2604,21 @@ class HPhi FINAL : public HVariableInputSizeInstruction { } // Returns a type equivalent to the given `type`, but that a `HPhi` can hold. - static Primitive::Type ToPhiType(Primitive::Type type) { - return Primitive::PrimitiveKind(type); + static DataType::Type ToPhiType(DataType::Type type) { + return DataType::Kind(type); } bool IsCatchPhi() const { return GetBlock()->IsCatchBlock(); } - Primitive::Type GetType() const OVERRIDE { return GetPackedField<TypeField>(); } - void SetType(Primitive::Type new_type) { + DataType::Type GetType() const OVERRIDE { return GetPackedField<TypeField>(); } + void SetType(DataType::Type new_type) { // Make sure that only valid type changes occur. The following are allowed: // (1) int -> float/ref (primitive type propagation), // (2) long -> double (primitive type propagation). DCHECK(GetType() == new_type || - (GetType() == Primitive::kPrimInt && new_type == Primitive::kPrimFloat) || - (GetType() == Primitive::kPrimInt && new_type == Primitive::kPrimNot) || - (GetType() == Primitive::kPrimLong && new_type == Primitive::kPrimDouble)); + (GetType() == DataType::Type::kInt32 && new_type == DataType::Type::kFloat32) || + (GetType() == DataType::Type::kInt32 && new_type == DataType::Type::kReference) || + (GetType() == DataType::Type::kInt64 && new_type == DataType::Type::kFloat64)); SetPackedField<TypeField>(new_type); } @@ -2644,12 +2668,12 @@ class HPhi FINAL : public HVariableInputSizeInstruction { private: static constexpr size_t kFieldType = HInstruction::kNumberOfGenericPackedBits; static constexpr size_t kFieldTypeSize = - MinimumBitsToStore(static_cast<size_t>(Primitive::kPrimLast)); + MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); static constexpr size_t kFlagIsLive = kFieldType + kFieldTypeSize; static constexpr size_t kFlagCanBeNull = kFlagIsLive + 1; static constexpr size_t kNumberOfPhiPackedBits = kFlagCanBeNull + 1; static_assert(kNumberOfPhiPackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); - using TypeField = BitField<Primitive::Type, kFieldType, kFieldTypeSize>; + using TypeField = BitField<DataType::Type, kFieldType, kFieldTypeSize>; const uint32_t reg_number_; @@ -2690,7 +2714,7 @@ class HGoto FINAL : public HTemplateInstruction<0> { class HConstant : public HExpression<0> { public: - explicit HConstant(Primitive::Type type, uint32_t dex_pc = kNoDexPc) + explicit HConstant(DataType::Type type, uint32_t dex_pc = kNoDexPc) : HExpression(type, SideEffects::None(), dex_pc) {} bool CanBeMoved() const OVERRIDE { return true; } @@ -2728,7 +2752,8 @@ class HNullConstant FINAL : public HConstant { DECLARE_INSTRUCTION(NullConstant); private: - explicit HNullConstant(uint32_t dex_pc = kNoDexPc) : HConstant(Primitive::kPrimNot, dex_pc) {} + explicit HNullConstant(uint32_t dex_pc = kNoDexPc) + : HConstant(DataType::Type::kReference, dex_pc) {} friend class HGraph; DISALLOW_COPY_AND_ASSIGN(HNullConstant); @@ -2765,9 +2790,9 @@ class HIntConstant FINAL : public HConstant { private: explicit HIntConstant(int32_t value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimInt, dex_pc), value_(value) {} + : HConstant(DataType::Type::kInt32, dex_pc), value_(value) {} explicit HIntConstant(bool value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimInt, dex_pc), value_(value ? 1 : 0) {} + : HConstant(DataType::Type::kInt32, dex_pc), value_(value ? 1 : 0) {} const int32_t value_; @@ -2799,7 +2824,7 @@ class HLongConstant FINAL : public HConstant { private: explicit HLongConstant(int64_t value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimLong, dex_pc), value_(value) {} + : HConstant(DataType::Type::kInt64, dex_pc), value_(value) {} const int64_t value_; @@ -2848,9 +2873,9 @@ class HFloatConstant FINAL : public HConstant { private: explicit HFloatConstant(float value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimFloat, dex_pc), value_(value) {} + : HConstant(DataType::Type::kFloat32, dex_pc), value_(value) {} explicit HFloatConstant(int32_t value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimFloat, dex_pc), value_(bit_cast<float, int32_t>(value)) {} + : HConstant(DataType::Type::kFloat32, dex_pc), value_(bit_cast<float, int32_t>(value)) {} const float value_; @@ -2899,9 +2924,9 @@ class HDoubleConstant FINAL : public HConstant { private: explicit HDoubleConstant(double value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimDouble, dex_pc), value_(value) {} + : HConstant(DataType::Type::kFloat64, dex_pc), value_(value) {} explicit HDoubleConstant(int64_t value, uint32_t dex_pc = kNoDexPc) - : HConstant(Primitive::kPrimDouble, dex_pc), value_(bit_cast<double, int64_t>(value)) {} + : HConstant(DataType::Type::kFloat64, dex_pc), value_(bit_cast<double, int64_t>(value)) {} const double value_; @@ -3004,11 +3029,14 @@ class HDeoptimize FINAL : public HVariableInputSizeInstruction { public: // Use this constructor when the `HDeoptimize` acts as a barrier, where no code can move // across. - HDeoptimize(ArenaAllocator* arena, HInstruction* cond, DeoptimizationKind kind, uint32_t dex_pc) + HDeoptimize(ArenaAllocator* allocator, + HInstruction* cond, + DeoptimizationKind kind, + uint32_t dex_pc) : HVariableInputSizeInstruction( SideEffects::All(), dex_pc, - arena, + allocator, /* number_of_inputs */ 1, kArenaAllocMisc) { SetPackedFlag<kFieldCanBeMoved>(false); @@ -3021,7 +3049,7 @@ class HDeoptimize FINAL : public HVariableInputSizeInstruction { // instead of `guard`. // We set CanTriggerGC to prevent any intermediate address to be live // at the point of the `HDeoptimize`. - HDeoptimize(ArenaAllocator* arena, + HDeoptimize(ArenaAllocator* allocator, HInstruction* cond, HInstruction* guard, DeoptimizationKind kind, @@ -3029,7 +3057,7 @@ class HDeoptimize FINAL : public HVariableInputSizeInstruction { : HVariableInputSizeInstruction( SideEffects::CanTriggerGC(), dex_pc, - arena, + allocator, /* number_of_inputs */ 2, kArenaAllocMisc) { SetPackedFlag<kFieldCanBeMoved>(true); @@ -3050,8 +3078,8 @@ class HDeoptimize FINAL : public HVariableInputSizeInstruction { DeoptimizationKind GetDeoptimizationKind() const { return GetPackedField<DeoptimizeKindField>(); } - Primitive::Type GetType() const OVERRIDE { - return GuardsAnInput() ? GuardedInput()->GetType() : Primitive::kPrimVoid; + DataType::Type GetType() const OVERRIDE { + return GuardsAnInput() ? GuardedInput()->GetType() : DataType::Type::kVoid; } bool GuardsAnInput() const { @@ -3093,11 +3121,11 @@ class HShouldDeoptimizeFlag FINAL : public HVariableInputSizeInstruction { public: // CHA guards are only optimized in a separate pass and it has no side effects // with regard to other passes. - HShouldDeoptimizeFlag(ArenaAllocator* arena, uint32_t dex_pc) - : HVariableInputSizeInstruction(SideEffects::None(), dex_pc, arena, 0, kArenaAllocCHA) { + HShouldDeoptimizeFlag(ArenaAllocator* allocator, uint32_t dex_pc) + : HVariableInputSizeInstruction(SideEffects::None(), dex_pc, allocator, 0, kArenaAllocCHA) { } - Primitive::Type GetType() const OVERRIDE { return Primitive::kPrimInt; } + DataType::Type GetType() const OVERRIDE { return DataType::Type::kInt32; } // We do all CHA guard elimination/motion in a single pass, after which there is no // further guard elimination/motion since a guard might have been used for justification @@ -3116,7 +3144,7 @@ class HShouldDeoptimizeFlag FINAL : public HVariableInputSizeInstruction { // instructions that work with the dex cache. class HCurrentMethod FINAL : public HExpression<0> { public: - explicit HCurrentMethod(Primitive::Type type, uint32_t dex_pc = kNoDexPc) + explicit HCurrentMethod(DataType::Type type, uint32_t dex_pc = kNoDexPc) : HExpression(type, SideEffects::None(), dex_pc) {} DECLARE_INSTRUCTION(CurrentMethod); @@ -3135,7 +3163,7 @@ class HClassTableGet FINAL : public HExpression<1> { kLast = kIMTable }; HClassTableGet(HInstruction* cls, - Primitive::Type type, + DataType::Type type, TableKind kind, size_t index, uint32_t dex_pc) @@ -3207,13 +3235,13 @@ class HPackedSwitch FINAL : public HTemplateInstruction<1> { class HUnaryOperation : public HExpression<1> { public: - HUnaryOperation(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) + HUnaryOperation(DataType::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) : HExpression(result_type, SideEffects::None(), dex_pc) { SetRawInputAt(0, input); } HInstruction* GetInput() const { return InputAt(0); } - Primitive::Type GetResultType() const { return GetType(); } + DataType::Type GetResultType() const { return GetType(); } bool CanBeMoved() const OVERRIDE { return true; } bool InstructionDataEquals(const HInstruction* other ATTRIBUTE_UNUSED) const OVERRIDE { @@ -3239,7 +3267,7 @@ class HUnaryOperation : public HExpression<1> { class HBinaryOperation : public HExpression<2> { public: - HBinaryOperation(Primitive::Type result_type, + HBinaryOperation(DataType::Type result_type, HInstruction* left, HInstruction* right, SideEffects side_effects = SideEffects::None(), @@ -3251,7 +3279,7 @@ class HBinaryOperation : public HExpression<2> { HInstruction* GetLeft() const { return InputAt(0); } HInstruction* GetRight() const { return InputAt(1); } - Primitive::Type GetResultType() const { return GetType(); } + DataType::Type GetResultType() const { return GetType(); } virtual bool IsCommutative() const { return false; } @@ -3341,7 +3369,7 @@ std::ostream& operator<<(std::ostream& os, const ComparisonBias& rhs); class HCondition : public HBinaryOperation { public: HCondition(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc) - : HBinaryOperation(Primitive::kPrimBoolean, first, second, SideEffects::None(), dex_pc) { + : HBinaryOperation(DataType::Type::kBool, first, second, SideEffects::None(), dex_pc) { SetPackedField<ComparisonBiasField>(ComparisonBias::kNoBias); } @@ -3366,7 +3394,7 @@ class HCondition : public HBinaryOperation { } bool IsFPConditionTrueIfNaN() const { - DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); + DCHECK(DataType::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); IfCondition if_cond = GetCondition(); if (if_cond == kCondNE) { return true; @@ -3377,7 +3405,7 @@ class HCondition : public HBinaryOperation { } bool IsFPConditionFalseIfNaN() const { - DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); + DCHECK(DataType::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); IfCondition if_cond = GetCondition(); if (if_cond == kCondEQ) { return true; @@ -3403,7 +3431,7 @@ class HCondition : public HBinaryOperation { template <typename T> int32_t CompareFP(T x, T y) const { - DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); + DCHECK(DataType::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); DCHECK_NE(GetBias(), ComparisonBias::kNoBias); // Handle the bias. return std::isunordered(x, y) ? (IsGtBias() ? 1 : -1) : Compare(x, y); @@ -3820,20 +3848,20 @@ class HCompare FINAL : public HBinaryOperation { public: // Note that `comparison_type` is the type of comparison performed // between the comparison's inputs, not the type of the instantiated - // HCompare instruction (which is always Primitive::kPrimInt). - HCompare(Primitive::Type comparison_type, + // HCompare instruction (which is always DataType::Type::kInt). + HCompare(DataType::Type comparison_type, HInstruction* first, HInstruction* second, ComparisonBias bias, uint32_t dex_pc) - : HBinaryOperation(Primitive::kPrimInt, + : HBinaryOperation(DataType::Type::kInt32, first, second, SideEffectsForArchRuntimeCalls(comparison_type), dex_pc) { SetPackedField<ComparisonBiasField>(bias); - DCHECK_EQ(comparison_type, Primitive::PrimitiveKind(first->GetType())); - DCHECK_EQ(comparison_type, Primitive::PrimitiveKind(second->GetType())); + DCHECK_EQ(comparison_type, DataType::Kind(first->GetType())); + DCHECK_EQ(comparison_type, DataType::Kind(second->GetType())); } template <typename T> @@ -3841,7 +3869,7 @@ class HCompare FINAL : public HBinaryOperation { template <typename T> int32_t ComputeFP(T x, T y) const { - DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); + DCHECK(DataType::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); DCHECK_NE(GetBias(), ComparisonBias::kNoBias); // Handle the bias. return std::isunordered(x, y) ? (IsGtBias() ? 1 : -1) : Compute(x, y); @@ -3874,11 +3902,11 @@ class HCompare FINAL : public HBinaryOperation { // Does this compare instruction have a "gt bias" (vs an "lt bias")? // Only meaningful for floating-point comparisons. bool IsGtBias() const { - DCHECK(Primitive::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); + DCHECK(DataType::IsFloatingPointType(InputAt(0)->GetType())) << InputAt(0)->GetType(); return GetBias() == ComparisonBias::kGtBias; } - static SideEffects SideEffectsForArchRuntimeCalls(Primitive::Type type ATTRIBUTE_UNUSED) { + static SideEffects SideEffectsForArchRuntimeCalls(DataType::Type type ATTRIBUTE_UNUSED) { // Comparisons do not require a runtime call in any back end. return SideEffects::None(); } @@ -3913,7 +3941,7 @@ class HNewInstance FINAL : public HExpression<1> { const DexFile& dex_file, bool finalizable, QuickEntrypointEnum entrypoint) - : HExpression(Primitive::kPrimNot, SideEffects::CanTriggerGC(), dex_pc), + : HExpression(DataType::Type::kReference, SideEffects::CanTriggerGC(), dex_pc), type_index_(type_index), dex_file_(dex_file), entrypoint_(entrypoint) { @@ -4001,7 +4029,7 @@ class HInvoke : public HVariableInputSizeInstruction { // inputs at the end of their list of inputs. uint32_t GetNumberOfArguments() const { return number_of_arguments_; } - Primitive::Type GetType() const OVERRIDE { return GetPackedField<ReturnTypeField>(); } + DataType::Type GetType() const OVERRIDE { return GetPackedField<ReturnTypeField>(); } uint32_t GetDexMethodIndex() const { return dex_method_index_; } @@ -4054,17 +4082,17 @@ class HInvoke : public HVariableInputSizeInstruction { static constexpr size_t kFieldReturnType = kFieldInvokeType + kFieldInvokeTypeSize; static constexpr size_t kFieldReturnTypeSize = - MinimumBitsToStore(static_cast<size_t>(Primitive::kPrimLast)); + MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); static constexpr size_t kFlagCanThrow = kFieldReturnType + kFieldReturnTypeSize; static constexpr size_t kNumberOfInvokePackedBits = kFlagCanThrow + 1; static_assert(kNumberOfInvokePackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); using InvokeTypeField = BitField<InvokeType, kFieldInvokeType, kFieldInvokeTypeSize>; - using ReturnTypeField = BitField<Primitive::Type, kFieldReturnType, kFieldReturnTypeSize>; + using ReturnTypeField = BitField<DataType::Type, kFieldReturnType, kFieldReturnTypeSize>; - HInvoke(ArenaAllocator* arena, + HInvoke(ArenaAllocator* allocator, uint32_t number_of_arguments, uint32_t number_of_other_inputs, - Primitive::Type return_type, + DataType::Type return_type, uint32_t dex_pc, uint32_t dex_method_index, ArtMethod* resolved_method, @@ -4072,7 +4100,7 @@ class HInvoke : public HVariableInputSizeInstruction { : HVariableInputSizeInstruction( SideEffects::AllExceptGCDependency(), // Assume write/read on all fields/arrays. dex_pc, - arena, + allocator, number_of_arguments + number_of_other_inputs, kArenaAllocInvokeInputs), number_of_arguments_(number_of_arguments), @@ -4099,13 +4127,13 @@ class HInvoke : public HVariableInputSizeInstruction { class HInvokeUnresolved FINAL : public HInvoke { public: - HInvokeUnresolved(ArenaAllocator* arena, + HInvokeUnresolved(ArenaAllocator* allocator, uint32_t number_of_arguments, - Primitive::Type return_type, + DataType::Type return_type, uint32_t dex_pc, uint32_t dex_method_index, InvokeType invoke_type) - : HInvoke(arena, + : HInvoke(allocator, number_of_arguments, 0u /* number_of_other_inputs */, return_type, @@ -4123,12 +4151,12 @@ class HInvokeUnresolved FINAL : public HInvoke { class HInvokePolymorphic FINAL : public HInvoke { public: - HInvokePolymorphic(ArenaAllocator* arena, + HInvokePolymorphic(ArenaAllocator* allocator, uint32_t number_of_arguments, - Primitive::Type return_type, + DataType::Type return_type, uint32_t dex_pc, uint32_t dex_method_index) - : HInvoke(arena, + : HInvoke(allocator, number_of_arguments, 0u /* number_of_other_inputs */, return_type, @@ -4200,9 +4228,9 @@ class HInvokeStaticOrDirect FINAL : public HInvoke { uint64_t method_load_data; }; - HInvokeStaticOrDirect(ArenaAllocator* arena, + HInvokeStaticOrDirect(ArenaAllocator* allocator, uint32_t number_of_arguments, - Primitive::Type return_type, + DataType::Type return_type, uint32_t dex_pc, uint32_t method_index, ArtMethod* resolved_method, @@ -4210,7 +4238,7 @@ class HInvokeStaticOrDirect FINAL : public HInvoke { InvokeType invoke_type, MethodReference target_method, ClinitCheckRequirement clinit_check_requirement) - : HInvoke(arena, + : HInvoke(allocator, number_of_arguments, // There is potentially one extra argument for the HCurrentMethod node, and // potentially one other if the clinit check is explicit, and potentially @@ -4280,7 +4308,7 @@ class HInvokeStaticOrDirect FINAL : public HInvoke { } bool CanBeNull() const OVERRIDE { - return GetPackedField<ReturnTypeField>() == Primitive::kPrimNot && !IsStringInit(); + return GetPackedField<ReturnTypeField>() == DataType::Type::kReference && !IsStringInit(); } // Get the index of the special input, if any. @@ -4395,14 +4423,14 @@ std::ostream& operator<<(std::ostream& os, HInvokeStaticOrDirect::ClinitCheckReq class HInvokeVirtual FINAL : public HInvoke { public: - HInvokeVirtual(ArenaAllocator* arena, + HInvokeVirtual(ArenaAllocator* allocator, uint32_t number_of_arguments, - Primitive::Type return_type, + DataType::Type return_type, uint32_t dex_pc, uint32_t dex_method_index, ArtMethod* resolved_method, uint32_t vtable_index) - : HInvoke(arena, + : HInvoke(allocator, number_of_arguments, 0u, return_type, @@ -4443,14 +4471,14 @@ class HInvokeVirtual FINAL : public HInvoke { class HInvokeInterface FINAL : public HInvoke { public: - HInvokeInterface(ArenaAllocator* arena, + HInvokeInterface(ArenaAllocator* allocator, uint32_t number_of_arguments, - Primitive::Type return_type, + DataType::Type return_type, uint32_t dex_pc, uint32_t dex_method_index, ArtMethod* resolved_method, uint32_t imt_index) - : HInvoke(arena, + : HInvoke(allocator, number_of_arguments, 0u, return_type, @@ -4484,9 +4512,9 @@ class HInvokeInterface FINAL : public HInvoke { class HNeg FINAL : public HUnaryOperation { public: - HNeg(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) + HNeg(DataType::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) : HUnaryOperation(result_type, input, dex_pc) { - DCHECK_EQ(result_type, Primitive::PrimitiveKind(input->GetType())); + DCHECK_EQ(result_type, DataType::Kind(input->GetType())); } template <typename T> static T Compute(T x) { return -x; } @@ -4513,7 +4541,7 @@ class HNeg FINAL : public HUnaryOperation { class HNewArray FINAL : public HExpression<2> { public: HNewArray(HInstruction* cls, HInstruction* length, uint32_t dex_pc) - : HExpression(Primitive::kPrimNot, SideEffects::CanTriggerGC(), dex_pc) { + : HExpression(DataType::Type::kReference, SideEffects::CanTriggerGC(), dex_pc) { SetRawInputAt(0, cls); SetRawInputAt(1, length); } @@ -4543,7 +4571,7 @@ class HNewArray FINAL : public HExpression<2> { class HAdd FINAL : public HBinaryOperation { public: - HAdd(Primitive::Type result_type, + HAdd(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc = kNoDexPc) @@ -4578,7 +4606,7 @@ class HAdd FINAL : public HBinaryOperation { class HSub FINAL : public HBinaryOperation { public: - HSub(Primitive::Type result_type, + HSub(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc = kNoDexPc) @@ -4611,7 +4639,7 @@ class HSub FINAL : public HBinaryOperation { class HMul FINAL : public HBinaryOperation { public: - HMul(Primitive::Type result_type, + HMul(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc = kNoDexPc) @@ -4646,7 +4674,7 @@ class HMul FINAL : public HBinaryOperation { class HDiv FINAL : public HBinaryOperation { public: - HDiv(Primitive::Type result_type, + HDiv(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc) @@ -4654,7 +4682,7 @@ class HDiv FINAL : public HBinaryOperation { template <typename T> T ComputeIntegral(T x, T y) const { - DCHECK(!Primitive::IsFloatingPointType(GetType())) << GetType(); + DCHECK(!DataType::IsFloatingPointType(GetType())) << GetType(); // Our graph structure ensures we never have 0 for `y` during // constant folding. DCHECK_NE(y, 0); @@ -4664,7 +4692,7 @@ class HDiv FINAL : public HBinaryOperation { template <typename T> T ComputeFP(T x, T y) const { - DCHECK(Primitive::IsFloatingPointType(GetType())) << GetType(); + DCHECK(DataType::IsFloatingPointType(GetType())) << GetType(); return x / y; } @@ -4693,7 +4721,7 @@ class HDiv FINAL : public HBinaryOperation { class HRem FINAL : public HBinaryOperation { public: - HRem(Primitive::Type result_type, + HRem(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc) @@ -4701,7 +4729,7 @@ class HRem FINAL : public HBinaryOperation { template <typename T> T ComputeIntegral(T x, T y) const { - DCHECK(!Primitive::IsFloatingPointType(GetType())) << GetType(); + DCHECK(!DataType::IsFloatingPointType(GetType())) << GetType(); // Our graph structure ensures we never have 0 for `y` during // constant folding. DCHECK_NE(y, 0); @@ -4711,7 +4739,7 @@ class HRem FINAL : public HBinaryOperation { template <typename T> T ComputeFP(T x, T y) const { - DCHECK(Primitive::IsFloatingPointType(GetType())) << GetType(); + DCHECK(DataType::IsFloatingPointType(GetType())) << GetType(); return std::fmod(x, y); } @@ -4747,7 +4775,7 @@ class HDivZeroCheck FINAL : public HExpression<1> { SetRawInputAt(0, value); } - Primitive::Type GetType() const OVERRIDE { return InputAt(0)->GetType(); } + DataType::Type GetType() const OVERRIDE { return InputAt(0)->GetType(); } bool CanBeMoved() const OVERRIDE { return true; } @@ -4766,13 +4794,13 @@ class HDivZeroCheck FINAL : public HExpression<1> { class HShl FINAL : public HBinaryOperation { public: - HShl(Primitive::Type result_type, + HShl(DataType::Type result_type, HInstruction* value, HInstruction* distance, uint32_t dex_pc = kNoDexPc) : HBinaryOperation(result_type, value, distance, SideEffects::None(), dex_pc) { - DCHECK_EQ(result_type, Primitive::PrimitiveKind(value->GetType())); - DCHECK_EQ(Primitive::kPrimInt, Primitive::PrimitiveKind(distance->GetType())); + DCHECK_EQ(result_type, DataType::Kind(value->GetType())); + DCHECK_EQ(DataType::Type::kInt32, DataType::Kind(distance->GetType())); } template <typename T> @@ -4812,13 +4840,13 @@ class HShl FINAL : public HBinaryOperation { class HShr FINAL : public HBinaryOperation { public: - HShr(Primitive::Type result_type, + HShr(DataType::Type result_type, HInstruction* value, HInstruction* distance, uint32_t dex_pc = kNoDexPc) : HBinaryOperation(result_type, value, distance, SideEffects::None(), dex_pc) { - DCHECK_EQ(result_type, Primitive::PrimitiveKind(value->GetType())); - DCHECK_EQ(Primitive::kPrimInt, Primitive::PrimitiveKind(distance->GetType())); + DCHECK_EQ(result_type, DataType::Kind(value->GetType())); + DCHECK_EQ(DataType::Type::kInt32, DataType::Kind(distance->GetType())); } template <typename T> @@ -4858,13 +4886,13 @@ class HShr FINAL : public HBinaryOperation { class HUShr FINAL : public HBinaryOperation { public: - HUShr(Primitive::Type result_type, + HUShr(DataType::Type result_type, HInstruction* value, HInstruction* distance, uint32_t dex_pc = kNoDexPc) : HBinaryOperation(result_type, value, distance, SideEffects::None(), dex_pc) { - DCHECK_EQ(result_type, Primitive::PrimitiveKind(value->GetType())); - DCHECK_EQ(Primitive::kPrimInt, Primitive::PrimitiveKind(distance->GetType())); + DCHECK_EQ(result_type, DataType::Kind(value->GetType())); + DCHECK_EQ(DataType::Type::kInt32, DataType::Kind(distance->GetType())); } template <typename T> @@ -4906,7 +4934,7 @@ class HUShr FINAL : public HBinaryOperation { class HAnd FINAL : public HBinaryOperation { public: - HAnd(Primitive::Type result_type, + HAnd(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc = kNoDexPc) @@ -4943,7 +4971,7 @@ class HAnd FINAL : public HBinaryOperation { class HOr FINAL : public HBinaryOperation { public: - HOr(Primitive::Type result_type, + HOr(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc = kNoDexPc) @@ -4980,7 +5008,7 @@ class HOr FINAL : public HBinaryOperation { class HXor FINAL : public HBinaryOperation { public: - HXor(Primitive::Type result_type, + HXor(DataType::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc = kNoDexPc) @@ -5017,10 +5045,10 @@ class HXor FINAL : public HBinaryOperation { class HRor FINAL : public HBinaryOperation { public: - HRor(Primitive::Type result_type, HInstruction* value, HInstruction* distance) + HRor(DataType::Type result_type, HInstruction* value, HInstruction* distance) : HBinaryOperation(result_type, value, distance) { - DCHECK_EQ(result_type, Primitive::PrimitiveKind(value->GetType())); - DCHECK_EQ(Primitive::kPrimInt, Primitive::PrimitiveKind(distance->GetType())); + DCHECK_EQ(result_type, DataType::Kind(value->GetType())); + DCHECK_EQ(DataType::Type::kInt32, DataType::Kind(distance->GetType())); } template <typename T> @@ -5073,7 +5101,7 @@ class HParameterValue FINAL : public HExpression<0> { HParameterValue(const DexFile& dex_file, dex::TypeIndex type_index, uint8_t index, - Primitive::Type parameter_type, + DataType::Type parameter_type, bool is_this = false) : HExpression(parameter_type, SideEffects::None(), kNoDexPc), dex_file_(dex_file), @@ -5112,7 +5140,7 @@ class HParameterValue FINAL : public HExpression<0> { class HNot FINAL : public HUnaryOperation { public: - HNot(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) + HNot(DataType::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) : HUnaryOperation(result_type, input, dex_pc) {} bool CanBeMoved() const OVERRIDE { return true; } @@ -5146,7 +5174,7 @@ class HNot FINAL : public HUnaryOperation { class HBooleanNot FINAL : public HUnaryOperation { public: explicit HBooleanNot(HInstruction* input, uint32_t dex_pc = kNoDexPc) - : HUnaryOperation(Primitive::Type::kPrimBoolean, input, dex_pc) {} + : HUnaryOperation(DataType::Type::kBool, input, dex_pc) {} bool CanBeMoved() const OVERRIDE { return true; } bool InstructionDataEquals(const HInstruction* other ATTRIBUTE_UNUSED) const OVERRIDE { @@ -5183,16 +5211,16 @@ class HBooleanNot FINAL : public HUnaryOperation { class HTypeConversion FINAL : public HExpression<1> { public: // Instantiate a type conversion of `input` to `result_type`. - HTypeConversion(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc) + HTypeConversion(DataType::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc) : HExpression(result_type, SideEffects::None(), dex_pc) { SetRawInputAt(0, input); // Invariant: We should never generate a conversion to a Boolean value. - DCHECK_NE(Primitive::kPrimBoolean, result_type); + DCHECK_NE(DataType::Type::kBool, result_type); } HInstruction* GetInput() const { return InputAt(0); } - Primitive::Type GetInputType() const { return GetInput()->GetType(); } - Primitive::Type GetResultType() const { return GetType(); } + DataType::Type GetInputType() const { return GetInput()->GetType(); } + DataType::Type GetResultType() const { return GetType(); } bool CanBeMoved() const OVERRIDE { return true; } bool InstructionDataEquals(const HInstruction* other ATTRIBUTE_UNUSED) const OVERRIDE { @@ -5244,7 +5272,7 @@ class FieldInfo : public ValueObject { public: FieldInfo(ArtField* field, MemberOffset field_offset, - Primitive::Type field_type, + DataType::Type field_type, bool is_volatile, uint32_t index, uint16_t declaring_class_def_index, @@ -5259,7 +5287,7 @@ class FieldInfo : public ValueObject { ArtField* GetField() const { return field_; } MemberOffset GetFieldOffset() const { return field_offset_; } - Primitive::Type GetFieldType() const { return field_type_; } + DataType::Type GetFieldType() const { return field_type_; } uint32_t GetFieldIndex() const { return index_; } uint16_t GetDeclaringClassDefIndex() const { return declaring_class_def_index_;} const DexFile& GetDexFile() const { return dex_file_; } @@ -5268,7 +5296,7 @@ class FieldInfo : public ValueObject { private: ArtField* const field_; const MemberOffset field_offset_; - const Primitive::Type field_type_; + const DataType::Type field_type_; const bool is_volatile_; const uint32_t index_; const uint16_t declaring_class_def_index_; @@ -5279,7 +5307,7 @@ class HInstanceFieldGet FINAL : public HExpression<1> { public: HInstanceFieldGet(HInstruction* value, ArtField* field, - Primitive::Type field_type, + DataType::Type field_type, MemberOffset field_offset, bool is_volatile, uint32_t field_idx, @@ -5314,7 +5342,7 @@ class HInstanceFieldGet FINAL : public HExpression<1> { const FieldInfo& GetFieldInfo() const { return field_info_; } MemberOffset GetFieldOffset() const { return field_info_.GetFieldOffset(); } - Primitive::Type GetFieldType() const { return field_info_.GetFieldType(); } + DataType::Type GetFieldType() const { return field_info_.GetFieldType(); } bool IsVolatile() const { return field_info_.IsVolatile(); } DECLARE_INSTRUCTION(InstanceFieldGet); @@ -5330,7 +5358,7 @@ class HInstanceFieldSet FINAL : public HTemplateInstruction<2> { HInstanceFieldSet(HInstruction* object, HInstruction* value, ArtField* field, - Primitive::Type field_type, + DataType::Type field_type, MemberOffset field_offset, bool is_volatile, uint32_t field_idx, @@ -5356,7 +5384,7 @@ class HInstanceFieldSet FINAL : public HTemplateInstruction<2> { const FieldInfo& GetFieldInfo() const { return field_info_; } MemberOffset GetFieldOffset() const { return field_info_.GetFieldOffset(); } - Primitive::Type GetFieldType() const { return field_info_.GetFieldType(); } + DataType::Type GetFieldType() const { return field_info_.GetFieldType(); } bool IsVolatile() const { return field_info_.IsVolatile(); } HInstruction* GetValue() const { return InputAt(1); } bool GetValueCanBeNull() const { return GetPackedFlag<kFlagValueCanBeNull>(); } @@ -5379,10 +5407,22 @@ class HArrayGet FINAL : public HExpression<2> { public: HArrayGet(HInstruction* array, HInstruction* index, - Primitive::Type type, + DataType::Type type, + uint32_t dex_pc) + : HArrayGet(array, + index, + type, + SideEffects::ArrayReadOfType(type), + dex_pc, + /* is_string_char_at */ false) {} + + HArrayGet(HInstruction* array, + HInstruction* index, + DataType::Type type, + SideEffects side_effects, uint32_t dex_pc, - bool is_string_char_at = false) - : HExpression(type, SideEffects::ArrayReadOfType(type), dex_pc) { + bool is_string_char_at) + : HExpression(type, side_effects, dex_pc) { SetPackedFlag<kFlagIsStringCharAt>(is_string_char_at); SetRawInputAt(0, array); SetRawInputAt(1, index); @@ -5413,11 +5453,11 @@ class HArrayGet FINAL : public HExpression<2> { DCHECK_EQ(GetBlock(), other->GetBlock()); DCHECK_EQ(GetArray(), other->GetArray()); DCHECK_EQ(GetIndex(), other->GetIndex()); - if (Primitive::IsIntOrLongType(GetType())) { - DCHECK(Primitive::IsFloatingPointType(other->GetType())) << other->GetType(); + if (DataType::IsIntOrLongType(GetType())) { + DCHECK(DataType::IsFloatingPointType(other->GetType())) << other->GetType(); } else { - DCHECK(Primitive::IsFloatingPointType(GetType())) << GetType(); - DCHECK(Primitive::IsIntOrLongType(other->GetType())) << other->GetType(); + DCHECK(DataType::IsFloatingPointType(GetType())) << GetType(); + DCHECK(DataType::IsIntOrLongType(other->GetType())) << other->GetType(); } } return result; @@ -5449,18 +5489,30 @@ class HArraySet FINAL : public HTemplateInstruction<3> { HArraySet(HInstruction* array, HInstruction* index, HInstruction* value, - Primitive::Type expected_component_type, + DataType::Type expected_component_type, uint32_t dex_pc) - : HTemplateInstruction(SideEffects::None(), dex_pc) { + : HArraySet(array, + index, + value, + expected_component_type, + // Make a best guess for side effects now, may be refined during SSA building. + ComputeSideEffects(GetComponentType(value->GetType(), expected_component_type)), + dex_pc) {} + + HArraySet(HInstruction* array, + HInstruction* index, + HInstruction* value, + DataType::Type expected_component_type, + SideEffects side_effects, + uint32_t dex_pc) + : HTemplateInstruction(side_effects, dex_pc) { SetPackedField<ExpectedComponentTypeField>(expected_component_type); - SetPackedFlag<kFlagNeedsTypeCheck>(value->GetType() == Primitive::kPrimNot); + SetPackedFlag<kFlagNeedsTypeCheck>(value->GetType() == DataType::Type::kReference); SetPackedFlag<kFlagValueCanBeNull>(true); SetPackedFlag<kFlagStaticTypeOfArrayIsObjectArray>(false); SetRawInputAt(0, array); SetRawInputAt(1, index); SetRawInputAt(2, value); - // Make a best guess now, may be refined during SSA building. - ComputeSideEffects(); } bool NeedsEnvironment() const OVERRIDE { @@ -5498,29 +5550,32 @@ class HArraySet FINAL : public HTemplateInstruction<3> { HInstruction* GetIndex() const { return InputAt(1); } HInstruction* GetValue() const { return InputAt(2); } - Primitive::Type GetComponentType() const { + DataType::Type GetComponentType() const { + return GetComponentType(GetValue()->GetType(), GetRawExpectedComponentType()); + } + + static DataType::Type GetComponentType(DataType::Type value_type, + DataType::Type expected_component_type) { // The Dex format does not type floating point index operations. Since the - // `expected_component_type_` is set during building and can therefore not + // `expected_component_type` comes from SSA building and can therefore not // be correct, we also check what is the value type. If it is a floating // point type, we must use that type. - Primitive::Type value_type = GetValue()->GetType(); - return ((value_type == Primitive::kPrimFloat) || (value_type == Primitive::kPrimDouble)) + return ((value_type == DataType::Type::kFloat32) || (value_type == DataType::Type::kFloat64)) ? value_type - : GetRawExpectedComponentType(); + : expected_component_type; } - Primitive::Type GetRawExpectedComponentType() const { + DataType::Type GetRawExpectedComponentType() const { return GetPackedField<ExpectedComponentTypeField>(); } - void ComputeSideEffects() { - Primitive::Type type = GetComponentType(); - SetSideEffects(SideEffects::ArrayWriteOfType(type).Union( - SideEffectsForArchRuntimeCalls(type))); + static SideEffects ComputeSideEffects(DataType::Type type) { + return SideEffects::ArrayWriteOfType(type).Union(SideEffectsForArchRuntimeCalls(type)); } - static SideEffects SideEffectsForArchRuntimeCalls(Primitive::Type value_type) { - return (value_type == Primitive::kPrimNot) ? SideEffects::CanTriggerGC() : SideEffects::None(); + static SideEffects SideEffectsForArchRuntimeCalls(DataType::Type value_type) { + return (value_type == DataType::Type::kReference) ? SideEffects::CanTriggerGC() + : SideEffects::None(); } DECLARE_INSTRUCTION(ArraySet); @@ -5528,7 +5583,7 @@ class HArraySet FINAL : public HTemplateInstruction<3> { private: static constexpr size_t kFieldExpectedComponentType = kNumberOfGenericPackedBits; static constexpr size_t kFieldExpectedComponentTypeSize = - MinimumBitsToStore(static_cast<size_t>(Primitive::kPrimLast)); + MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); static constexpr size_t kFlagNeedsTypeCheck = kFieldExpectedComponentType + kFieldExpectedComponentTypeSize; static constexpr size_t kFlagValueCanBeNull = kFlagNeedsTypeCheck + 1; @@ -5539,7 +5594,7 @@ class HArraySet FINAL : public HTemplateInstruction<3> { kFlagStaticTypeOfArrayIsObjectArray + 1; static_assert(kNumberOfArraySetPackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); using ExpectedComponentTypeField = - BitField<Primitive::Type, kFieldExpectedComponentType, kFieldExpectedComponentTypeSize>; + BitField<DataType::Type, kFieldExpectedComponentType, kFieldExpectedComponentTypeSize>; DISALLOW_COPY_AND_ASSIGN(HArraySet); }; @@ -5547,7 +5602,7 @@ class HArraySet FINAL : public HTemplateInstruction<3> { class HArrayLength FINAL : public HExpression<1> { public: HArrayLength(HInstruction* array, uint32_t dex_pc, bool is_string_length = false) - : HExpression(Primitive::kPrimInt, SideEffects::None(), dex_pc) { + : HExpression(DataType::Type::kInt32, SideEffects::None(), dex_pc) { SetPackedFlag<kFlagIsStringLength>(is_string_length); // Note that arrays do not change length, so the instruction does not // depend on any write. @@ -5589,7 +5644,7 @@ class HBoundsCheck FINAL : public HExpression<2> { uint32_t dex_pc, bool string_char_at = false) : HExpression(index->GetType(), SideEffects::CanTriggerGC(), dex_pc) { - DCHECK_EQ(Primitive::kPrimInt, Primitive::PrimitiveKind(index->GetType())); + DCHECK_EQ(DataType::Type::kInt32, DataType::Kind(index->GetType())); SetPackedFlag<kFlagIsStringCharAt>(string_char_at); SetRawInputAt(0, index); SetRawInputAt(1, length); @@ -5799,8 +5854,8 @@ class HLoadClass FINAL : public HInstruction { &special_input_, (special_input_.GetInstruction() != nullptr) ? 1u : 0u); } - Primitive::Type GetType() const OVERRIDE { - return Primitive::kPrimNot; + DataType::Type GetType() const OVERRIDE { + return DataType::Type::kReference; } Handle<mirror::Class> GetClass() const { @@ -5967,8 +6022,8 @@ class HLoadString FINAL : public HInstruction { &special_input_, (special_input_.GetInstruction() != nullptr) ? 1u : 0u); } - Primitive::Type GetType() const OVERRIDE { - return Primitive::kPrimNot; + DataType::Type GetType() const OVERRIDE { + return DataType::Type::kReference; } DECLARE_INSTRUCTION(LoadString); @@ -6019,7 +6074,7 @@ class HClinitCheck FINAL : public HExpression<1> { public: HClinitCheck(HLoadClass* constant, uint32_t dex_pc) : HExpression( - Primitive::kPrimNot, + DataType::Type::kReference, SideEffects::AllChanges(), // Assume write/read on all fields/arrays. dex_pc) { SetRawInputAt(0, constant); @@ -6052,7 +6107,7 @@ class HStaticFieldGet FINAL : public HExpression<1> { public: HStaticFieldGet(HInstruction* cls, ArtField* field, - Primitive::Type field_type, + DataType::Type field_type, MemberOffset field_offset, bool is_volatile, uint32_t field_idx, @@ -6084,7 +6139,7 @@ class HStaticFieldGet FINAL : public HExpression<1> { const FieldInfo& GetFieldInfo() const { return field_info_; } MemberOffset GetFieldOffset() const { return field_info_.GetFieldOffset(); } - Primitive::Type GetFieldType() const { return field_info_.GetFieldType(); } + DataType::Type GetFieldType() const { return field_info_.GetFieldType(); } bool IsVolatile() const { return field_info_.IsVolatile(); } DECLARE_INSTRUCTION(StaticFieldGet); @@ -6100,7 +6155,7 @@ class HStaticFieldSet FINAL : public HTemplateInstruction<2> { HStaticFieldSet(HInstruction* cls, HInstruction* value, ArtField* field, - Primitive::Type field_type, + DataType::Type field_type, MemberOffset field_offset, bool is_volatile, uint32_t field_idx, @@ -6122,7 +6177,7 @@ class HStaticFieldSet FINAL : public HTemplateInstruction<2> { const FieldInfo& GetFieldInfo() const { return field_info_; } MemberOffset GetFieldOffset() const { return field_info_.GetFieldOffset(); } - Primitive::Type GetFieldType() const { return field_info_.GetFieldType(); } + DataType::Type GetFieldType() const { return field_info_.GetFieldType(); } bool IsVolatile() const { return field_info_.IsVolatile(); } HInstruction* GetValue() const { return InputAt(1); } @@ -6145,7 +6200,7 @@ class HStaticFieldSet FINAL : public HTemplateInstruction<2> { class HUnresolvedInstanceFieldGet FINAL : public HExpression<1> { public: HUnresolvedInstanceFieldGet(HInstruction* obj, - Primitive::Type field_type, + DataType::Type field_type, uint32_t field_index, uint32_t dex_pc) : HExpression(field_type, SideEffects::AllExceptGCDependency(), dex_pc), @@ -6156,7 +6211,7 @@ class HUnresolvedInstanceFieldGet FINAL : public HExpression<1> { bool NeedsEnvironment() const OVERRIDE { return true; } bool CanThrow() const OVERRIDE { return true; } - Primitive::Type GetFieldType() const { return GetType(); } + DataType::Type GetFieldType() const { return GetType(); } uint32_t GetFieldIndex() const { return field_index_; } DECLARE_INSTRUCTION(UnresolvedInstanceFieldGet); @@ -6171,13 +6226,13 @@ class HUnresolvedInstanceFieldSet FINAL : public HTemplateInstruction<2> { public: HUnresolvedInstanceFieldSet(HInstruction* obj, HInstruction* value, - Primitive::Type field_type, + DataType::Type field_type, uint32_t field_index, uint32_t dex_pc) : HTemplateInstruction(SideEffects::AllExceptGCDependency(), dex_pc), field_index_(field_index) { SetPackedField<FieldTypeField>(field_type); - DCHECK_EQ(Primitive::PrimitiveKind(field_type), Primitive::PrimitiveKind(value->GetType())); + DCHECK_EQ(DataType::Kind(field_type), DataType::Kind(value->GetType())); SetRawInputAt(0, obj); SetRawInputAt(1, value); } @@ -6185,7 +6240,7 @@ class HUnresolvedInstanceFieldSet FINAL : public HTemplateInstruction<2> { bool NeedsEnvironment() const OVERRIDE { return true; } bool CanThrow() const OVERRIDE { return true; } - Primitive::Type GetFieldType() const { return GetPackedField<FieldTypeField>(); } + DataType::Type GetFieldType() const { return GetPackedField<FieldTypeField>(); } uint32_t GetFieldIndex() const { return field_index_; } DECLARE_INSTRUCTION(UnresolvedInstanceFieldSet); @@ -6193,12 +6248,12 @@ class HUnresolvedInstanceFieldSet FINAL : public HTemplateInstruction<2> { private: static constexpr size_t kFieldFieldType = HInstruction::kNumberOfGenericPackedBits; static constexpr size_t kFieldFieldTypeSize = - MinimumBitsToStore(static_cast<size_t>(Primitive::kPrimLast)); + MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); static constexpr size_t kNumberOfUnresolvedStaticFieldSetPackedBits = kFieldFieldType + kFieldFieldTypeSize; static_assert(kNumberOfUnresolvedStaticFieldSetPackedBits <= HInstruction::kMaxNumberOfPackedBits, "Too many packed fields."); - using FieldTypeField = BitField<Primitive::Type, kFieldFieldType, kFieldFieldTypeSize>; + using FieldTypeField = BitField<DataType::Type, kFieldFieldType, kFieldFieldTypeSize>; const uint32_t field_index_; @@ -6207,7 +6262,7 @@ class HUnresolvedInstanceFieldSet FINAL : public HTemplateInstruction<2> { class HUnresolvedStaticFieldGet FINAL : public HExpression<0> { public: - HUnresolvedStaticFieldGet(Primitive::Type field_type, + HUnresolvedStaticFieldGet(DataType::Type field_type, uint32_t field_index, uint32_t dex_pc) : HExpression(field_type, SideEffects::AllExceptGCDependency(), dex_pc), @@ -6217,7 +6272,7 @@ class HUnresolvedStaticFieldGet FINAL : public HExpression<0> { bool NeedsEnvironment() const OVERRIDE { return true; } bool CanThrow() const OVERRIDE { return true; } - Primitive::Type GetFieldType() const { return GetType(); } + DataType::Type GetFieldType() const { return GetType(); } uint32_t GetFieldIndex() const { return field_index_; } DECLARE_INSTRUCTION(UnresolvedStaticFieldGet); @@ -6231,20 +6286,20 @@ class HUnresolvedStaticFieldGet FINAL : public HExpression<0> { class HUnresolvedStaticFieldSet FINAL : public HTemplateInstruction<1> { public: HUnresolvedStaticFieldSet(HInstruction* value, - Primitive::Type field_type, + DataType::Type field_type, uint32_t field_index, uint32_t dex_pc) : HTemplateInstruction(SideEffects::AllExceptGCDependency(), dex_pc), field_index_(field_index) { SetPackedField<FieldTypeField>(field_type); - DCHECK_EQ(Primitive::PrimitiveKind(field_type), Primitive::PrimitiveKind(value->GetType())); + DCHECK_EQ(DataType::Kind(field_type), DataType::Kind(value->GetType())); SetRawInputAt(0, value); } bool NeedsEnvironment() const OVERRIDE { return true; } bool CanThrow() const OVERRIDE { return true; } - Primitive::Type GetFieldType() const { return GetPackedField<FieldTypeField>(); } + DataType::Type GetFieldType() const { return GetPackedField<FieldTypeField>(); } uint32_t GetFieldIndex() const { return field_index_; } DECLARE_INSTRUCTION(UnresolvedStaticFieldSet); @@ -6252,12 +6307,12 @@ class HUnresolvedStaticFieldSet FINAL : public HTemplateInstruction<1> { private: static constexpr size_t kFieldFieldType = HInstruction::kNumberOfGenericPackedBits; static constexpr size_t kFieldFieldTypeSize = - MinimumBitsToStore(static_cast<size_t>(Primitive::kPrimLast)); + MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); static constexpr size_t kNumberOfUnresolvedStaticFieldSetPackedBits = kFieldFieldType + kFieldFieldTypeSize; static_assert(kNumberOfUnresolvedStaticFieldSetPackedBits <= HInstruction::kMaxNumberOfPackedBits, "Too many packed fields."); - using FieldTypeField = BitField<Primitive::Type, kFieldFieldType, kFieldFieldTypeSize>; + using FieldTypeField = BitField<DataType::Type, kFieldFieldType, kFieldFieldTypeSize>; const uint32_t field_index_; @@ -6268,7 +6323,7 @@ class HUnresolvedStaticFieldSet FINAL : public HTemplateInstruction<1> { class HLoadException FINAL : public HExpression<0> { public: explicit HLoadException(uint32_t dex_pc = kNoDexPc) - : HExpression(Primitive::kPrimNot, SideEffects::None(), dex_pc) {} + : HExpression(DataType::Type::kReference, SideEffects::None(), dex_pc) {} bool CanBeNull() const OVERRIDE { return false; } @@ -6334,7 +6389,7 @@ class HInstanceOf FINAL : public HExpression<2> { HLoadClass* constant, TypeCheckKind check_kind, uint32_t dex_pc) - : HExpression(Primitive::kPrimBoolean, + : HExpression(DataType::Type::kBool, SideEffectsForArchRuntimeCalls(check_kind), dex_pc) { SetPackedField<TypeCheckKindField>(check_kind); @@ -6385,11 +6440,11 @@ class HInstanceOf FINAL : public HExpression<2> { class HBoundType FINAL : public HExpression<1> { public: explicit HBoundType(HInstruction* input, uint32_t dex_pc = kNoDexPc) - : HExpression(Primitive::kPrimNot, SideEffects::None(), dex_pc), + : HExpression(DataType::Type::kReference, SideEffects::None(), dex_pc), upper_bound_(ReferenceTypeInfo::CreateInvalid()) { SetPackedFlag<kFlagUpperCanBeNull>(true); SetPackedFlag<kFlagCanBeNull>(true); - DCHECK_EQ(input->GetType(), Primitive::kPrimNot); + DCHECK_EQ(input->GetType(), DataType::Type::kReference); SetRawInputAt(0, input); } @@ -6595,7 +6650,7 @@ class HConstructorFence FINAL : public HVariableInputSizeInstruction { // about the associated object. HConstructorFence(HInstruction* fence_object, uint32_t dex_pc, - ArenaAllocator* arena) + ArenaAllocator* allocator) // We strongly suspect there is not a more accurate way to describe the fine-grained reordering // constraints described in the class header. We claim that these SideEffects constraints // enforce a superset of the real constraints. @@ -6619,7 +6674,7 @@ class HConstructorFence FINAL : public HVariableInputSizeInstruction { // we can refine the side effect to a smaller set of type reads (see above constraints). : HVariableInputSizeInstruction(SideEffects::AllReads(), dex_pc, - arena, + allocator, /* number_of_inputs */ 1, kArenaAllocConstructorFenceInputs) { DCHECK(fence_object != nullptr); @@ -6760,7 +6815,7 @@ class MoveOperands : public ArenaObject<kArenaAllocMoveOperands> { public: MoveOperands(Location source, Location destination, - Primitive::Type type, + DataType::Type type, HInstruction* instruction) : source_(source), destination_(destination), type_(type), instruction_(instruction) {} @@ -6810,10 +6865,10 @@ class MoveOperands : public ArenaObject<kArenaAllocMoveOperands> { return source_.IsInvalid(); } - Primitive::Type GetType() const { return type_; } + DataType::Type GetType() const { return type_; } bool Is64BitMove() const { - return Primitive::Is64BitType(type_); + return DataType::Is64BitType(type_); } HInstruction* GetInstruction() const { return instruction_; } @@ -6822,7 +6877,7 @@ class MoveOperands : public ArenaObject<kArenaAllocMoveOperands> { Location source_; Location destination_; // The type this move is for. - Primitive::Type type_; + DataType::Type type_; // The instruction this move is assocatied with. Null when this move is // for moving an input in the expected locations of user (including a phi user). // This is only used in debug mode, to ensure we do not connect interval siblings @@ -6836,15 +6891,15 @@ static constexpr size_t kDefaultNumberOfMoves = 4; class HParallelMove FINAL : public HTemplateInstruction<0> { public: - explicit HParallelMove(ArenaAllocator* arena, uint32_t dex_pc = kNoDexPc) + explicit HParallelMove(ArenaAllocator* allocator, uint32_t dex_pc = kNoDexPc) : HTemplateInstruction(SideEffects::None(), dex_pc), - moves_(arena->Adapter(kArenaAllocMoveOperands)) { + moves_(allocator->Adapter(kArenaAllocMoveOperands)) { moves_.reserve(kDefaultNumberOfMoves); } void AddMove(Location source, Location destination, - Primitive::Type type, + DataType::Type type, HInstruction* instruction) { DCHECK(source.IsValid()); DCHECK(destination.IsValid()); |