summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h583
1 files changed, 320 insertions, 263 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index fef6f21b46..23d605b7b5 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -77,6 +77,8 @@ static constexpr uint32_t kUnknownFieldIndex = static_cast<uint32_t>(-1);
static constexpr InvokeType kInvalidInvokeType = static_cast<InvokeType>(-1);
+static constexpr uint32_t kNoDexPc = -1;
+
enum IfCondition {
kCondEQ,
kCondNE,
@@ -316,24 +318,24 @@ 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);
+ HConstant* GetConstant(Primitive::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
// with an invalid type.
- HNullConstant* GetNullConstant();
+ HNullConstant* GetNullConstant(uint32_t dex_pc = kNoDexPc);
- HIntConstant* GetIntConstant(int32_t value) {
- return CreateConstant(value, &cached_int_constants_);
+ HIntConstant* GetIntConstant(int32_t value, uint32_t dex_pc = kNoDexPc) {
+ return CreateConstant(value, &cached_int_constants_, dex_pc);
}
- HLongConstant* GetLongConstant(int64_t value) {
- return CreateConstant(value, &cached_long_constants_);
+ HLongConstant* GetLongConstant(int64_t value, uint32_t dex_pc = kNoDexPc) {
+ return CreateConstant(value, &cached_long_constants_, dex_pc);
}
- HFloatConstant* GetFloatConstant(float value) {
- return CreateConstant(bit_cast<int32_t, float>(value), &cached_float_constants_);
+ HFloatConstant* GetFloatConstant(float value, uint32_t dex_pc = kNoDexPc) {
+ return CreateConstant(bit_cast<int32_t, float>(value), &cached_float_constants_, dex_pc);
}
- HDoubleConstant* GetDoubleConstant(double value) {
- return CreateConstant(bit_cast<int64_t, double>(value), &cached_double_constants_);
+ HDoubleConstant* GetDoubleConstant(double value, uint32_t dex_pc = kNoDexPc) {
+ return CreateConstant(bit_cast<int64_t, double>(value), &cached_double_constants_, dex_pc);
}
HCurrentMethod* GetCurrentMethod();
@@ -372,7 +374,8 @@ class HGraph : public ArenaObject<kArenaAllocGraph> {
template <class InstructionType, typename ValueType>
InstructionType* CreateConstant(ValueType value,
- ArenaSafeMap<ValueType, InstructionType*>* cache) {
+ ArenaSafeMap<ValueType, InstructionType*>* cache,
+ uint32_t dex_pc = kNoDexPc) {
// Try to find an existing constant of the given value.
InstructionType* constant = nullptr;
auto cached_constant = cache->find(value);
@@ -383,7 +386,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);
+ constant = new (arena_) InstructionType(value, dex_pc);
cache->Overwrite(value, constant);
InsertConstant(constant);
}
@@ -618,7 +621,6 @@ class TryCatchInformation : public ArenaObject<kArenaAllocTryCatchInfo> {
};
static constexpr size_t kNoLifetime = -1;
-static constexpr uint32_t kNoDexPc = -1;
// A block in a method. Contains the list of instructions represented
// as a double linked list. Each block knows its predecessors and
@@ -626,7 +628,7 @@ static constexpr uint32_t kNoDexPc = -1;
class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
public:
- explicit HBasicBlock(HGraph* graph, uint32_t dex_pc = kNoDexPc)
+ HBasicBlock(HGraph* graph, uint32_t dex_pc = kNoDexPc)
: graph_(graph),
predecessors_(graph->GetArena(), kDefaultNumberOfPredecessors),
successors_(graph->GetArena(), kDefaultNumberOfSuccessors),
@@ -683,6 +685,7 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
int GetBlockId() const { return block_id_; }
void SetBlockId(int id) { block_id_ = id; }
+ uint32_t GetDexPc() const { return dex_pc_; }
HBasicBlock* GetDominator() const { return dominator_; }
void SetDominator(HBasicBlock* dominator) { dominator_ = dominator; }
@@ -943,7 +946,6 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
void SetLifetimeStart(size_t start) { lifetime_start_ = start; }
void SetLifetimeEnd(size_t end) { lifetime_end_ = end; }
- uint32_t GetDexPc() const { return dex_pc_; }
bool EndsWithControlFlowInstruction() const;
bool EndsWithIf() const;
@@ -1076,7 +1078,9 @@ class HLoopInformationOutwardIterator : public ValueObject {
#define FOR_EACH_CONCRETE_INSTRUCTION_MIPS64(M)
-#define FOR_EACH_CONCRETE_INSTRUCTION_X86(M)
+#define FOR_EACH_CONCRETE_INSTRUCTION_X86(M) \
+ M(X86ComputeBaseMethodAddress, Instruction) \
+ M(X86LoadFromConstantTable, Instruction)
#define FOR_EACH_CONCRETE_INSTRUCTION_X86_64(M)
@@ -1689,10 +1693,11 @@ std::ostream& operator<<(std::ostream& os, const ReferenceTypeInfo& rhs);
class HInstruction : public ArenaObject<kArenaAllocInstruction> {
public:
- explicit HInstruction(SideEffects side_effects)
+ HInstruction(SideEffects side_effects, uint32_t dex_pc = kNoDexPc)
: previous_(nullptr),
next_(nullptr),
block_(nullptr),
+ dex_pc_(dex_pc),
id_(-1),
ssa_index_(-1),
environment_(nullptr),
@@ -1735,9 +1740,9 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> {
}
virtual bool NeedsEnvironment() const { return false; }
- virtual uint32_t GetDexPc() const {
- return kNoDexPc;
- }
+
+ uint32_t GetDexPc() const { return dex_pc_; }
+
virtual bool IsControlFlow() const { return false; }
virtual bool CanThrow() const { return false; }
@@ -1940,6 +1945,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> {
HInstruction* previous_;
HInstruction* next_;
HBasicBlock* block_;
+ const uint32_t dex_pc_;
// An instruction gets an id when it is added to the graph.
// It reflects creation order. A negative id means the instruction
@@ -2044,8 +2050,8 @@ class HBackwardInstructionIterator : public ValueObject {
template<size_t N>
class HTemplateInstruction: public HInstruction {
public:
- HTemplateInstruction<N>(SideEffects side_effects)
- : HInstruction(side_effects), inputs_() {}
+ HTemplateInstruction<N>(SideEffects side_effects, uint32_t dex_pc = kNoDexPc)
+ : HInstruction(side_effects, dex_pc), inputs_() {}
virtual ~HTemplateInstruction() {}
size_t InputCount() const OVERRIDE { return N; }
@@ -2071,7 +2077,9 @@ class HTemplateInstruction: public HInstruction {
template<>
class HTemplateInstruction<0>: public HInstruction {
public:
- explicit HTemplateInstruction(SideEffects side_effects) : HInstruction(side_effects) {}
+ explicit HTemplateInstruction<0>(SideEffects side_effects, uint32_t dex_pc = kNoDexPc)
+ : HInstruction(side_effects, dex_pc) {}
+
virtual ~HTemplateInstruction() {}
size_t InputCount() const OVERRIDE { return 0; }
@@ -2095,8 +2103,8 @@ class HTemplateInstruction<0>: public HInstruction {
template<intptr_t N>
class HExpression : public HTemplateInstruction<N> {
public:
- HExpression<N>(Primitive::Type type, SideEffects side_effects)
- : HTemplateInstruction<N>(side_effects), type_(type) {}
+ HExpression<N>(Primitive::Type type, SideEffects side_effects, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction<N>(side_effects, dex_pc), type_(type) {}
virtual ~HExpression() {}
Primitive::Type GetType() const OVERRIDE { return type_; }
@@ -2109,7 +2117,8 @@ class HExpression : public HTemplateInstruction<N> {
// instruction that branches to the exit block.
class HReturnVoid : public HTemplateInstruction<0> {
public:
- HReturnVoid() : HTemplateInstruction(SideEffects::None()) {}
+ explicit HReturnVoid(uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc) {}
bool IsControlFlow() const OVERRIDE { return true; }
@@ -2123,7 +2132,8 @@ class HReturnVoid : public HTemplateInstruction<0> {
// instruction that branches to the exit block.
class HReturn : public HTemplateInstruction<1> {
public:
- explicit HReturn(HInstruction* value) : HTemplateInstruction(SideEffects::None()) {
+ explicit HReturn(HInstruction* value, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc) {
SetRawInputAt(0, value);
}
@@ -2140,7 +2150,7 @@ class HReturn : public HTemplateInstruction<1> {
// exit block.
class HExit : public HTemplateInstruction<0> {
public:
- HExit() : HTemplateInstruction(SideEffects::None()) {}
+ explicit HExit(uint32_t dex_pc = kNoDexPc) : HTemplateInstruction(SideEffects::None(), dex_pc) {}
bool IsControlFlow() const OVERRIDE { return true; }
@@ -2153,7 +2163,7 @@ class HExit : public HTemplateInstruction<0> {
// Jumps from one block to another.
class HGoto : public HTemplateInstruction<0> {
public:
- HGoto() : HTemplateInstruction(SideEffects::None()) {}
+ explicit HGoto(uint32_t dex_pc = kNoDexPc) : HTemplateInstruction(SideEffects::None(), dex_pc) {}
bool IsControlFlow() const OVERRIDE { return true; }
@@ -2169,7 +2179,8 @@ class HGoto : public HTemplateInstruction<0> {
class HConstant : public HExpression<0> {
public:
- explicit HConstant(Primitive::Type type) : HExpression(type, SideEffects::None()) {}
+ explicit HConstant(Primitive::Type type, uint32_t dex_pc = kNoDexPc)
+ : HExpression(type, SideEffects::None(), dex_pc) {}
bool CanBeMoved() const OVERRIDE { return true; }
@@ -2194,7 +2205,7 @@ class HNullConstant : public HConstant {
DECLARE_INSTRUCTION(NullConstant);
private:
- HNullConstant() : HConstant(Primitive::kPrimNot) {}
+ explicit HNullConstant(uint32_t dex_pc = kNoDexPc) : HConstant(Primitive::kPrimNot, dex_pc) {}
friend class HGraph;
DISALLOW_COPY_AND_ASSIGN(HNullConstant);
@@ -2220,8 +2231,10 @@ class HIntConstant : public HConstant {
DECLARE_INSTRUCTION(IntConstant);
private:
- explicit HIntConstant(int32_t value) : HConstant(Primitive::kPrimInt), value_(value) {}
- explicit HIntConstant(bool value) : HConstant(Primitive::kPrimInt), value_(value ? 1 : 0) {}
+ explicit HIntConstant(int32_t value, uint32_t dex_pc = kNoDexPc)
+ : HConstant(Primitive::kPrimInt, dex_pc), value_(value) {}
+ explicit HIntConstant(bool value, uint32_t dex_pc = kNoDexPc)
+ : HConstant(Primitive::kPrimInt, dex_pc), value_(value ? 1 : 0) {}
const int32_t value_;
@@ -2249,7 +2262,8 @@ class HLongConstant : public HConstant {
DECLARE_INSTRUCTION(LongConstant);
private:
- explicit HLongConstant(int64_t value) : HConstant(Primitive::kPrimLong), value_(value) {}
+ explicit HLongConstant(int64_t value, uint32_t dex_pc = kNoDexPc)
+ : HConstant(Primitive::kPrimLong, dex_pc), value_(value) {}
const int64_t value_;
@@ -2261,7 +2275,8 @@ class HLongConstant : public HConstant {
// two successors.
class HIf : public HTemplateInstruction<1> {
public:
- explicit HIf(HInstruction* input) : HTemplateInstruction(SideEffects::None()) {
+ explicit HIf(HInstruction* input, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc) {
SetRawInputAt(0, input);
}
@@ -2294,8 +2309,8 @@ class HTryBoundary : public HTemplateInstruction<0> {
kExit,
};
- explicit HTryBoundary(BoundaryKind kind)
- : HTemplateInstruction(SideEffects::None()), kind_(kind) {}
+ explicit HTryBoundary(BoundaryKind kind, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc), kind_(kind) {}
bool IsControlFlow() const OVERRIDE { return true; }
@@ -2352,21 +2367,17 @@ class HExceptionHandlerIterator : public ValueObject {
// Deoptimize to interpreter, upon checking a condition.
class HDeoptimize : public HTemplateInstruction<1> {
public:
- HDeoptimize(HInstruction* cond, uint32_t dex_pc)
- : HTemplateInstruction(SideEffects::None()),
- dex_pc_(dex_pc) {
+ explicit HDeoptimize(HInstruction* cond, uint32_t dex_pc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc) {
SetRawInputAt(0, cond);
}
bool NeedsEnvironment() const OVERRIDE { return true; }
bool CanThrow() const OVERRIDE { return true; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
DECLARE_INSTRUCTION(Deoptimize);
private:
- uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HDeoptimize);
};
@@ -2375,7 +2386,8 @@ class HDeoptimize : public HTemplateInstruction<1> {
// instructions that work with the dex cache.
class HCurrentMethod : public HExpression<0> {
public:
- explicit HCurrentMethod(Primitive::Type type) : HExpression(type, SideEffects::None()) {}
+ explicit HCurrentMethod(Primitive::Type type, uint32_t dex_pc = kNoDexPc)
+ : HExpression(type, SideEffects::None(), dex_pc) {}
DECLARE_INSTRUCTION(CurrentMethod);
@@ -2385,8 +2397,8 @@ class HCurrentMethod : public HExpression<0> {
class HUnaryOperation : public HExpression<1> {
public:
- HUnaryOperation(Primitive::Type result_type, HInstruction* input)
- : HExpression(result_type, SideEffects::None()) {
+ HUnaryOperation(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc)
+ : HExpression(result_type, SideEffects::None(), dex_pc) {
SetRawInputAt(0, input);
}
@@ -2419,8 +2431,9 @@ class HBinaryOperation : public HExpression<2> {
HBinaryOperation(Primitive::Type result_type,
HInstruction* left,
HInstruction* right,
- SideEffects side_effects = SideEffects::None())
- : HExpression(result_type, side_effects) {
+ SideEffects side_effects = SideEffects::None(),
+ uint32_t dex_pc = kNoDexPc)
+ : HExpression(result_type, side_effects, dex_pc) {
SetRawInputAt(0, left);
SetRawInputAt(1, right);
}
@@ -2512,8 +2525,8 @@ enum class ComparisonBias {
class HCondition : public HBinaryOperation {
public:
- HCondition(HInstruction* first, HInstruction* second)
- : HBinaryOperation(Primitive::kPrimBoolean, first, second),
+ HCondition(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(Primitive::kPrimBoolean, first, second, SideEffects::None(), dex_pc),
needs_materialization_(true),
bias_(ComparisonBias::kNoBias) {}
@@ -2564,18 +2577,20 @@ class HCondition : public HBinaryOperation {
// Instruction to check if two inputs are equal to each other.
class HEqual : public HCondition {
public:
- HEqual(HInstruction* first, HInstruction* second)
- : HCondition(first, second) {}
+ HEqual(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HCondition(first, second, dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
template <typename T> bool Compute(T x, T y) const { return x == y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Equal);
@@ -2594,18 +2609,20 @@ class HEqual : public HCondition {
class HNotEqual : public HCondition {
public:
- HNotEqual(HInstruction* first, HInstruction* second)
- : HCondition(first, second) {}
+ HNotEqual(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HCondition(first, second, dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
template <typename T> bool Compute(T x, T y) const { return x != y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(NotEqual);
@@ -2624,16 +2641,18 @@ class HNotEqual : public HCondition {
class HLessThan : public HCondition {
public:
- HLessThan(HInstruction* first, HInstruction* second)
- : HCondition(first, second) {}
+ HLessThan(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HCondition(first, second, dex_pc) {}
template <typename T> bool Compute(T x, T y) const { return x < y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(LessThan);
@@ -2652,16 +2671,18 @@ class HLessThan : public HCondition {
class HLessThanOrEqual : public HCondition {
public:
- HLessThanOrEqual(HInstruction* first, HInstruction* second)
- : HCondition(first, second) {}
+ HLessThanOrEqual(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HCondition(first, second, dex_pc) {}
template <typename T> bool Compute(T x, T y) const { return x <= y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(LessThanOrEqual);
@@ -2680,16 +2701,18 @@ class HLessThanOrEqual : public HCondition {
class HGreaterThan : public HCondition {
public:
- HGreaterThan(HInstruction* first, HInstruction* second)
- : HCondition(first, second) {}
+ HGreaterThan(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HCondition(first, second, dex_pc) {}
template <typename T> bool Compute(T x, T y) const { return x > y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(GreaterThan);
@@ -2708,16 +2731,18 @@ class HGreaterThan : public HCondition {
class HGreaterThanOrEqual : public HCondition {
public:
- HGreaterThanOrEqual(HInstruction* first, HInstruction* second)
- : HCondition(first, second) {}
+ HGreaterThanOrEqual(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc)
+ : HCondition(first, second, dex_pc) {}
template <typename T> bool Compute(T x, T y) const { return x >= y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(GreaterThanOrEqual);
@@ -2744,9 +2769,12 @@ class HCompare : public HBinaryOperation {
HInstruction* second,
ComparisonBias bias,
uint32_t dex_pc)
- : HBinaryOperation(Primitive::kPrimInt, first, second, SideEffectsForArchRuntimeCalls(type)),
- bias_(bias),
- dex_pc_(dex_pc) {
+ : HBinaryOperation(Primitive::kPrimInt,
+ first,
+ second,
+ SideEffectsForArchRuntimeCalls(type),
+ dex_pc),
+ bias_(bias) {
DCHECK_EQ(type, first->GetType());
DCHECK_EQ(type, second->GetType());
}
@@ -2755,10 +2783,12 @@ class HCompare : public HBinaryOperation {
int32_t Compute(T x, T y) const { return x == y ? 0 : x > y ? 1 : -1; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
@@ -2769,7 +2799,6 @@ class HCompare : public HBinaryOperation {
bool IsGtBias() { return bias_ == ComparisonBias::kGtBias; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
static SideEffects SideEffectsForArchRuntimeCalls(Primitive::Type type) {
// MIPS64 uses a runtime call for FP comparisons.
@@ -2780,7 +2809,6 @@ class HCompare : public HBinaryOperation {
private:
const ComparisonBias bias_;
- const uint32_t dex_pc_;
DISALLOW_COPY_AND_ASSIGN(HCompare);
};
@@ -2789,7 +2817,7 @@ class HCompare : public HBinaryOperation {
class HLocal : public HTemplateInstruction<0> {
public:
explicit HLocal(uint16_t reg_number)
- : HTemplateInstruction(SideEffects::None()), reg_number_(reg_number) {}
+ : HTemplateInstruction(SideEffects::None(), kNoDexPc), reg_number_(reg_number) {}
DECLARE_INSTRUCTION(Local);
@@ -2805,8 +2833,8 @@ class HLocal : public HTemplateInstruction<0> {
// Load a given local. The local is an input of this instruction.
class HLoadLocal : public HExpression<1> {
public:
- HLoadLocal(HLocal* local, Primitive::Type type)
- : HExpression(type, SideEffects::None()) {
+ HLoadLocal(HLocal* local, Primitive::Type type, uint32_t dex_pc = kNoDexPc)
+ : HExpression(type, SideEffects::None(), dex_pc) {
SetRawInputAt(0, local);
}
@@ -2822,7 +2850,8 @@ class HLoadLocal : public HExpression<1> {
// and the local.
class HStoreLocal : public HTemplateInstruction<2> {
public:
- HStoreLocal(HLocal* local, HInstruction* value) : HTemplateInstruction(SideEffects::None()) {
+ HStoreLocal(HLocal* local, HInstruction* value, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc) {
SetRawInputAt(0, local);
SetRawInputAt(1, value);
}
@@ -2863,9 +2892,10 @@ class HFloatConstant : public HConstant {
DECLARE_INSTRUCTION(FloatConstant);
private:
- explicit HFloatConstant(float value) : HConstant(Primitive::kPrimFloat), value_(value) {}
- explicit HFloatConstant(int32_t value)
- : HConstant(Primitive::kPrimFloat), value_(bit_cast<float, int32_t>(value)) {}
+ explicit HFloatConstant(float value, uint32_t dex_pc = kNoDexPc)
+ : HConstant(Primitive::kPrimFloat, 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)) {}
const float value_;
@@ -2903,9 +2933,10 @@ class HDoubleConstant : public HConstant {
DECLARE_INSTRUCTION(DoubleConstant);
private:
- explicit HDoubleConstant(double value) : HConstant(Primitive::kPrimDouble), value_(value) {}
- explicit HDoubleConstant(int64_t value)
- : HConstant(Primitive::kPrimDouble), value_(bit_cast<double, int64_t>(value)) {}
+ explicit HDoubleConstant(double value, uint32_t dex_pc = kNoDexPc)
+ : HConstant(Primitive::kPrimDouble, 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)) {}
const double value_;
@@ -2952,7 +2983,6 @@ class HInvoke : public HInstruction {
Primitive::Type GetType() const OVERRIDE { return return_type_; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
uint32_t GetDexMethodIndex() const { return dex_method_index_; }
const DexFile& GetDexFile() const { return GetEnvironment()->GetDexFile(); }
@@ -2985,11 +3015,10 @@ class HInvoke : public HInstruction {
uint32_t dex_method_index,
InvokeType original_invoke_type)
: HInstruction(
- SideEffects::AllExceptGCDependency()), // Assume write/read on all fields/arrays.
+ SideEffects::AllExceptGCDependency(), dex_pc), // Assume write/read on all fields/arrays.
number_of_arguments_(number_of_arguments),
inputs_(arena, number_of_arguments),
return_type_(return_type),
- dex_pc_(dex_pc),
dex_method_index_(dex_method_index),
original_invoke_type_(original_invoke_type),
intrinsic_(Intrinsics::kNone),
@@ -3006,7 +3035,6 @@ class HInvoke : public HInstruction {
uint32_t number_of_arguments_;
GrowableArray<HUserRecord<HInstruction*> > inputs_;
const Primitive::Type return_type_;
- const uint32_t dex_pc_;
const uint32_t dex_method_index_;
const InvokeType original_invoke_type_;
Intrinsics intrinsic_;
@@ -3307,15 +3335,13 @@ class HNewInstance : public HExpression<1> {
uint16_t type_index,
const DexFile& dex_file,
QuickEntrypointEnum entrypoint)
- : HExpression(Primitive::kPrimNot, SideEffects::CanTriggerGC()),
- dex_pc_(dex_pc),
+ : HExpression(Primitive::kPrimNot, SideEffects::CanTriggerGC(), dex_pc),
type_index_(type_index),
dex_file_(dex_file),
entrypoint_(entrypoint) {
SetRawInputAt(0, current_method);
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
uint16_t GetTypeIndex() const { return type_index_; }
const DexFile& GetDexFile() const { return dex_file_; }
@@ -3334,7 +3360,6 @@ class HNewInstance : public HExpression<1> {
DECLARE_INSTRUCTION(NewInstance);
private:
- const uint32_t dex_pc_;
const uint16_t type_index_;
const DexFile& dex_file_;
const QuickEntrypointEnum entrypoint_;
@@ -3344,16 +3369,16 @@ class HNewInstance : public HExpression<1> {
class HNeg : public HUnaryOperation {
public:
- HNeg(Primitive::Type result_type, HInstruction* input)
- : HUnaryOperation(result_type, input) {}
+ HNeg(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc)
+ : HUnaryOperation(result_type, input, dex_pc) {}
template <typename T> T Compute(T x) const { return -x; }
HConstant* Evaluate(HIntConstant* x) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Neg);
@@ -3370,8 +3395,7 @@ class HNewArray : public HExpression<2> {
uint16_t type_index,
const DexFile& dex_file,
QuickEntrypointEnum entrypoint)
- : HExpression(Primitive::kPrimNot, SideEffects::CanTriggerGC()),
- dex_pc_(dex_pc),
+ : HExpression(Primitive::kPrimNot, SideEffects::CanTriggerGC(), dex_pc),
type_index_(type_index),
dex_file_(dex_file),
entrypoint_(entrypoint) {
@@ -3379,7 +3403,6 @@ class HNewArray : public HExpression<2> {
SetRawInputAt(1, current_method);
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
uint16_t GetTypeIndex() const { return type_index_; }
const DexFile& GetDexFile() const { return dex_file_; }
@@ -3396,7 +3419,6 @@ class HNewArray : public HExpression<2> {
DECLARE_INSTRUCTION(NewArray);
private:
- const uint32_t dex_pc_;
const uint16_t type_index_;
const DexFile& dex_file_;
const QuickEntrypointEnum entrypoint_;
@@ -3406,18 +3428,23 @@ class HNewArray : public HExpression<2> {
class HAdd : public HBinaryOperation {
public:
- HAdd(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HAdd(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
template <typename T> T Compute(T x, T y) const { return x + y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Add);
@@ -3428,16 +3455,21 @@ class HAdd : public HBinaryOperation {
class HSub : public HBinaryOperation {
public:
- HSub(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HSub(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
template <typename T> T Compute(T x, T y) const { return x - y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Sub);
@@ -3448,18 +3480,23 @@ class HSub : public HBinaryOperation {
class HMul : public HBinaryOperation {
public:
- HMul(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HMul(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
template <typename T> T Compute(T x, T y) const { return x * y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Mul);
@@ -3470,9 +3507,11 @@ class HMul : public HBinaryOperation {
class HDiv : public HBinaryOperation {
public:
- HDiv(Primitive::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc)
- : HBinaryOperation(result_type, left, right, SideEffectsForArchRuntimeCalls()),
- dex_pc_(dex_pc) {}
+ HDiv(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc)
+ : HBinaryOperation(result_type, left, right, SideEffectsForArchRuntimeCalls(), dex_pc) {}
template <typename T>
T Compute(T x, T y) const {
@@ -3484,14 +3523,14 @@ class HDiv : public HBinaryOperation {
}
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
-
static SideEffects SideEffectsForArchRuntimeCalls() {
// The generated code can use a runtime call.
return SideEffects::CanTriggerGC();
@@ -3500,16 +3539,16 @@ class HDiv : public HBinaryOperation {
DECLARE_INSTRUCTION(Div);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HDiv);
};
class HRem : public HBinaryOperation {
public:
- HRem(Primitive::Type result_type, HInstruction* left, HInstruction* right, uint32_t dex_pc)
- : HBinaryOperation(result_type, left, right, SideEffectsForArchRuntimeCalls()),
- dex_pc_(dex_pc) {}
+ HRem(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc)
+ : HBinaryOperation(result_type, left, right, SideEffectsForArchRuntimeCalls(), dex_pc) {}
template <typename T>
T Compute(T x, T y) const {
@@ -3521,13 +3560,14 @@ class HRem : public HBinaryOperation {
}
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
static SideEffects SideEffectsForArchRuntimeCalls() {
return SideEffects::CanTriggerGC();
@@ -3536,15 +3576,13 @@ class HRem : public HBinaryOperation {
DECLARE_INSTRUCTION(Rem);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HRem);
};
class HDivZeroCheck : public HExpression<1> {
public:
HDivZeroCheck(HInstruction* value, uint32_t dex_pc)
- : HExpression(value->GetType(), SideEffects::None()), dex_pc_(dex_pc) {
+ : HExpression(value->GetType(), SideEffects::None(), dex_pc) {
SetRawInputAt(0, value);
}
@@ -3560,20 +3598,19 @@ class HDivZeroCheck : public HExpression<1> {
bool NeedsEnvironment() const OVERRIDE { return true; }
bool CanThrow() const OVERRIDE { return true; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
-
DECLARE_INSTRUCTION(DivZeroCheck);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HDivZeroCheck);
};
class HShl : public HBinaryOperation {
public:
- HShl(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HShl(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
template <typename T, typename U, typename V>
T Compute(T x, U y, V max_shift_value) const {
@@ -3584,17 +3621,17 @@ class HShl : public HBinaryOperation {
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetIntConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxIntShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxIntShiftValue), GetDexPc());
}
// There is no `Evaluate(HIntConstant* x, HLongConstant* y)`, as this
// case is handled as `x << static_cast<int>(y)`.
HConstant* Evaluate(HLongConstant* x, HIntConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetLongConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetLongConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue), GetDexPc());
}
DECLARE_INSTRUCTION(Shl);
@@ -3605,8 +3642,11 @@ class HShl : public HBinaryOperation {
class HShr : public HBinaryOperation {
public:
- HShr(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HShr(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
template <typename T, typename U, typename V>
T Compute(T x, U y, V max_shift_value) const {
@@ -3617,17 +3657,17 @@ class HShr : public HBinaryOperation {
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetIntConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxIntShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxIntShiftValue), GetDexPc());
}
// There is no `Evaluate(HIntConstant* x, HLongConstant* y)`, as this
// case is handled as `x >> static_cast<int>(y)`.
HConstant* Evaluate(HLongConstant* x, HIntConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetLongConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetLongConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue), GetDexPc());
}
DECLARE_INSTRUCTION(Shr);
@@ -3638,8 +3678,11 @@ class HShr : public HBinaryOperation {
class HUShr : public HBinaryOperation {
public:
- HUShr(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HUShr(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
template <typename T, typename U, typename V>
T Compute(T x, U y, V max_shift_value) const {
@@ -3651,17 +3694,17 @@ class HUShr : public HBinaryOperation {
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetIntConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxIntShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxIntShiftValue), GetDexPc());
}
// There is no `Evaluate(HIntConstant* x, HLongConstant* y)`, as this
// case is handled as `x >>> static_cast<int>(y)`.
HConstant* Evaluate(HLongConstant* x, HIntConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetLongConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
return GetBlock()->GetGraph()->GetLongConstant(
- Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue));
+ Compute(x->GetValue(), y->GetValue(), kMaxLongShiftValue), GetDexPc());
}
DECLARE_INSTRUCTION(UShr);
@@ -3672,8 +3715,11 @@ class HUShr : public HBinaryOperation {
class HAnd : public HBinaryOperation {
public:
- HAnd(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HAnd(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
@@ -3681,16 +3727,20 @@ class HAnd : public HBinaryOperation {
auto Compute(T x, U y) const -> decltype(x & y) { return x & y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HIntConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(And);
@@ -3701,8 +3751,11 @@ class HAnd : public HBinaryOperation {
class HOr : public HBinaryOperation {
public:
- HOr(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HOr(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
@@ -3710,16 +3763,20 @@ class HOr : public HBinaryOperation {
auto Compute(T x, U y) const -> decltype(x | y) { return x | y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HIntConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Or);
@@ -3730,8 +3787,11 @@ class HOr : public HBinaryOperation {
class HXor : public HBinaryOperation {
public:
- HXor(Primitive::Type result_type, HInstruction* left, HInstruction* right)
- : HBinaryOperation(result_type, left, right) {}
+ HXor(Primitive::Type result_type,
+ HInstruction* left,
+ HInstruction* right,
+ uint32_t dex_pc = kNoDexPc)
+ : HBinaryOperation(result_type, left, right, SideEffects::None(), dex_pc) {}
bool IsCommutative() const OVERRIDE { return true; }
@@ -3739,16 +3799,20 @@ class HXor : public HBinaryOperation {
auto Compute(T x, U y) const -> decltype(x ^ y) { return x ^ y; }
HConstant* Evaluate(HIntConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HIntConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HIntConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x, HLongConstant* y) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue(), y->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(
+ Compute(x->GetValue(), y->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Xor);
@@ -3761,8 +3825,10 @@ class HXor : public HBinaryOperation {
// the calling convention.
class HParameterValue : public HExpression<0> {
public:
- HParameterValue(uint8_t index, Primitive::Type parameter_type, bool is_this = false)
- : HExpression(parameter_type, SideEffects::None()),
+ HParameterValue(uint8_t index,
+ Primitive::Type parameter_type,
+ bool is_this = false)
+ : HExpression(parameter_type, SideEffects::None(), kNoDexPc),
index_(index),
is_this_(is_this),
can_be_null_(!is_this) {}
@@ -3791,8 +3857,8 @@ class HParameterValue : public HExpression<0> {
class HNot : public HUnaryOperation {
public:
- HNot(Primitive::Type result_type, HInstruction* input)
- : HUnaryOperation(result_type, input) {}
+ HNot(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc = kNoDexPc)
+ : HUnaryOperation(result_type, input, dex_pc) {}
bool CanBeMoved() const OVERRIDE { return true; }
bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
@@ -3803,10 +3869,10 @@ class HNot : public HUnaryOperation {
template <typename T> T Compute(T x) const { return ~x; }
HConstant* Evaluate(HIntConstant* x) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x) const OVERRIDE {
- return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue()));
+ return GetBlock()->GetGraph()->GetLongConstant(Compute(x->GetValue()), GetDexPc());
}
DECLARE_INSTRUCTION(Not);
@@ -3817,8 +3883,8 @@ class HNot : public HUnaryOperation {
class HBooleanNot : public HUnaryOperation {
public:
- explicit HBooleanNot(HInstruction* input)
- : HUnaryOperation(Primitive::Type::kPrimBoolean, input) {}
+ explicit HBooleanNot(HInstruction* input, uint32_t dex_pc = kNoDexPc)
+ : HUnaryOperation(Primitive::Type::kPrimBoolean, input, dex_pc) {}
bool CanBeMoved() const OVERRIDE { return true; }
bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
@@ -3832,7 +3898,7 @@ class HBooleanNot : public HUnaryOperation {
}
HConstant* Evaluate(HIntConstant* x) const OVERRIDE {
- return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue()));
+ return GetBlock()->GetGraph()->GetIntConstant(Compute(x->GetValue()), GetDexPc());
}
HConstant* Evaluate(HLongConstant* x ATTRIBUTE_UNUSED) const OVERRIDE {
LOG(FATAL) << DebugName() << " is not defined for long values";
@@ -3849,8 +3915,9 @@ class HTypeConversion : public HExpression<1> {
public:
// Instantiate a type conversion of `input` to `result_type`.
HTypeConversion(Primitive::Type result_type, HInstruction* input, uint32_t dex_pc)
- : HExpression(result_type, SideEffectsForArchRuntimeCalls(input->GetType(), result_type)),
- dex_pc_(dex_pc) {
+ : HExpression(result_type,
+ SideEffectsForArchRuntimeCalls(input->GetType(), result_type),
+ dex_pc) {
SetRawInputAt(0, input);
DCHECK_NE(input->GetType(), result_type);
}
@@ -3861,7 +3928,6 @@ class HTypeConversion : public HExpression<1> {
// Required by the x86 and ARM code generators when producing calls
// to the runtime.
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
bool CanBeMoved() const OVERRIDE { return true; }
bool InstructionDataEquals(HInstruction* other ATTRIBUTE_UNUSED) const OVERRIDE { return true; }
@@ -3885,8 +3951,6 @@ class HTypeConversion : public HExpression<1> {
DECLARE_INSTRUCTION(TypeConversion);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HTypeConversion);
};
@@ -3894,8 +3958,12 @@ static constexpr uint32_t kNoRegNumber = -1;
class HPhi : public HInstruction {
public:
- HPhi(ArenaAllocator* arena, uint32_t reg_number, size_t number_of_inputs, Primitive::Type type)
- : HInstruction(SideEffects::None()),
+ HPhi(ArenaAllocator* arena,
+ uint32_t reg_number,
+ size_t number_of_inputs,
+ Primitive::Type type,
+ uint32_t dex_pc = kNoDexPc)
+ : HInstruction(SideEffects::None(), dex_pc),
inputs_(arena, number_of_inputs),
reg_number_(reg_number),
type_(type),
@@ -3973,7 +4041,7 @@ class HPhi : public HInstruction {
class HNullCheck : public HExpression<1> {
public:
HNullCheck(HInstruction* value, uint32_t dex_pc)
- : HExpression(value->GetType(), SideEffects::None()), dex_pc_(dex_pc) {
+ : HExpression(value->GetType(), SideEffects::None(), dex_pc) {
SetRawInputAt(0, value);
}
@@ -3989,13 +4057,10 @@ class HNullCheck : public HExpression<1> {
bool CanBeNull() const OVERRIDE { return false; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
DECLARE_INSTRUCTION(NullCheck);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HNullCheck);
};
@@ -4038,10 +4103,11 @@ class HInstanceFieldGet : public HExpression<1> {
bool is_volatile,
uint32_t field_idx,
const DexFile& dex_file,
- Handle<mirror::DexCache> dex_cache)
+ Handle<mirror::DexCache> dex_cache,
+ uint32_t dex_pc = kNoDexPc)
: HExpression(
field_type,
- SideEffects::FieldReadOfType(field_type, is_volatile)),
+ SideEffects::FieldReadOfType(field_type, is_volatile), dex_pc),
field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache) {
SetRawInputAt(0, value);
}
@@ -4083,9 +4149,10 @@ class HInstanceFieldSet : public HTemplateInstruction<2> {
bool is_volatile,
uint32_t field_idx,
const DexFile& dex_file,
- Handle<mirror::DexCache> dex_cache)
+ Handle<mirror::DexCache> dex_cache,
+ uint32_t dex_pc = kNoDexPc)
: HTemplateInstruction(
- SideEffects::FieldWriteOfType(field_type, is_volatile)),
+ SideEffects::FieldWriteOfType(field_type, is_volatile), dex_pc),
field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache),
value_can_be_null_(true) {
SetRawInputAt(0, object);
@@ -4115,8 +4182,11 @@ class HInstanceFieldSet : public HTemplateInstruction<2> {
class HArrayGet : public HExpression<2> {
public:
- HArrayGet(HInstruction* array, HInstruction* index, Primitive::Type type)
- : HExpression(type, SideEffects::ArrayReadOfType(type)) {
+ HArrayGet(HInstruction* array,
+ HInstruction* index,
+ Primitive::Type type,
+ uint32_t dex_pc = kNoDexPc)
+ : HExpression(type, SideEffects::ArrayReadOfType(type), dex_pc) {
SetRawInputAt(0, array);
SetRawInputAt(1, index);
}
@@ -4156,8 +4226,7 @@ class HArraySet : public HTemplateInstruction<3> {
uint32_t dex_pc)
: HTemplateInstruction(
SideEffects::ArrayWriteOfType(expected_component_type).Union(
- SideEffectsForArchRuntimeCalls(value->GetType()))),
- dex_pc_(dex_pc),
+ SideEffectsForArchRuntimeCalls(value->GetType())), dex_pc),
expected_component_type_(expected_component_type),
needs_type_check_(value->GetType() == Primitive::kPrimNot),
value_can_be_null_(true) {
@@ -4192,8 +4261,6 @@ class HArraySet : public HTemplateInstruction<3> {
bool GetValueCanBeNull() const { return value_can_be_null_; }
bool NeedsTypeCheck() const { return needs_type_check_; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
-
HInstruction* GetArray() const { return InputAt(0); }
HInstruction* GetIndex() const { return InputAt(1); }
HInstruction* GetValue() const { return InputAt(2); }
@@ -4216,7 +4283,6 @@ class HArraySet : public HTemplateInstruction<3> {
DECLARE_INSTRUCTION(ArraySet);
private:
- const uint32_t dex_pc_;
const Primitive::Type expected_component_type_;
bool needs_type_check_;
bool value_can_be_null_;
@@ -4226,8 +4292,8 @@ class HArraySet : public HTemplateInstruction<3> {
class HArrayLength : public HExpression<1> {
public:
- explicit HArrayLength(HInstruction* array)
- : HExpression(Primitive::kPrimInt, SideEffects::None()) {
+ explicit HArrayLength(HInstruction* array, uint32_t dex_pc = kNoDexPc)
+ : HExpression(Primitive::kPrimInt, SideEffects::None(), dex_pc) {
// Note that arrays do not change length, so the instruction does not
// depend on any write.
SetRawInputAt(0, array);
@@ -4251,7 +4317,7 @@ class HArrayLength : public HExpression<1> {
class HBoundsCheck : public HExpression<2> {
public:
HBoundsCheck(HInstruction* index, HInstruction* length, uint32_t dex_pc)
- : HExpression(index->GetType(), SideEffects::None()), dex_pc_(dex_pc) {
+ : HExpression(index->GetType(), SideEffects::None(), dex_pc) {
DCHECK(index->GetType() == Primitive::kPrimInt);
SetRawInputAt(0, index);
SetRawInputAt(1, length);
@@ -4267,13 +4333,10 @@ class HBoundsCheck : public HExpression<2> {
bool CanThrow() const OVERRIDE { return true; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
DECLARE_INSTRUCTION(BoundsCheck);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HBoundsCheck);
};
@@ -4286,7 +4349,8 @@ class HBoundsCheck : public HExpression<2> {
*/
class HTemporary : public HTemplateInstruction<0> {
public:
- explicit HTemporary(size_t index) : HTemplateInstruction(SideEffects::None()), index_(index) {}
+ explicit HTemporary(size_t index, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc), index_(index) {}
size_t GetIndex() const { return index_; }
@@ -4300,28 +4364,24 @@ class HTemporary : public HTemplateInstruction<0> {
private:
const size_t index_;
-
DISALLOW_COPY_AND_ASSIGN(HTemporary);
};
class HSuspendCheck : public HTemplateInstruction<0> {
public:
explicit HSuspendCheck(uint32_t dex_pc)
- : HTemplateInstruction(SideEffects::CanTriggerGC()), dex_pc_(dex_pc), slow_path_(nullptr) {}
+ : HTemplateInstruction(SideEffects::CanTriggerGC(), dex_pc), slow_path_(nullptr) {}
bool NeedsEnvironment() const OVERRIDE {
return true;
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
void SetSlowPath(SlowPathCode* slow_path) { slow_path_ = slow_path; }
SlowPathCode* GetSlowPath() const { return slow_path_; }
DECLARE_INSTRUCTION(SuspendCheck);
private:
- const uint32_t dex_pc_;
-
// Only used for code generation, in order to share the same slow path between back edges
// of a same loop.
SlowPathCode* slow_path_;
@@ -4339,11 +4399,10 @@ class HLoadClass : public HExpression<1> {
const DexFile& dex_file,
bool is_referrers_class,
uint32_t dex_pc)
- : HExpression(Primitive::kPrimNot, SideEffectsForArchRuntimeCalls()),
+ : HExpression(Primitive::kPrimNot, SideEffectsForArchRuntimeCalls(), dex_pc),
type_index_(type_index),
dex_file_(dex_file),
is_referrers_class_(is_referrers_class),
- dex_pc_(dex_pc),
generate_clinit_check_(false),
loaded_class_rti_(ReferenceTypeInfo::CreateInvalid()) {
SetRawInputAt(0, current_method);
@@ -4357,7 +4416,6 @@ class HLoadClass : public HExpression<1> {
size_t ComputeHashCode() const OVERRIDE { return type_index_; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
uint16_t GetTypeIndex() const { return type_index_; }
bool IsReferrersClass() const { return is_referrers_class_; }
bool CanBeNull() const OVERRIDE { return false; }
@@ -4410,7 +4468,6 @@ class HLoadClass : public HExpression<1> {
const uint16_t type_index_;
const DexFile& dex_file_;
const bool is_referrers_class_;
- const uint32_t dex_pc_;
// Whether this instruction must generate the initialization check.
// Used for code generation.
bool generate_clinit_check_;
@@ -4423,9 +4480,8 @@ class HLoadClass : public HExpression<1> {
class HLoadString : public HExpression<1> {
public:
HLoadString(HCurrentMethod* current_method, uint32_t string_index, uint32_t dex_pc)
- : HExpression(Primitive::kPrimNot, SideEffectsForArchRuntimeCalls()),
- string_index_(string_index),
- dex_pc_(dex_pc) {
+ : HExpression(Primitive::kPrimNot, SideEffectsForArchRuntimeCalls(), dex_pc),
+ string_index_(string_index) {
SetRawInputAt(0, current_method);
}
@@ -4437,7 +4493,6 @@ class HLoadString : public HExpression<1> {
size_t ComputeHashCode() const OVERRIDE { return string_index_; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
uint32_t GetStringIndex() const { return string_index_; }
// TODO: Can we deopt or debug when we resolve a string?
@@ -4453,7 +4508,6 @@ class HLoadString : public HExpression<1> {
private:
const uint32_t string_index_;
- const uint32_t dex_pc_;
DISALLOW_COPY_AND_ASSIGN(HLoadString);
};
@@ -4466,8 +4520,8 @@ class HClinitCheck : public HExpression<1> {
HClinitCheck(HLoadClass* constant, uint32_t dex_pc)
: HExpression(
Primitive::kPrimNot,
- SideEffects::AllChanges()), // Assume write/read on all fields/arrays.
- dex_pc_(dex_pc) {
+ SideEffects::AllChanges(), // Assume write/read on all fields/arrays.
+ dex_pc) {
SetRawInputAt(0, constant);
}
@@ -4482,15 +4536,12 @@ class HClinitCheck : public HExpression<1> {
return true;
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
HLoadClass* GetLoadClass() const { return InputAt(0)->AsLoadClass(); }
DECLARE_INSTRUCTION(ClinitCheck);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HClinitCheck);
};
@@ -4502,10 +4553,11 @@ class HStaticFieldGet : public HExpression<1> {
bool is_volatile,
uint32_t field_idx,
const DexFile& dex_file,
- Handle<mirror::DexCache> dex_cache)
+ Handle<mirror::DexCache> dex_cache,
+ uint32_t dex_pc = kNoDexPc)
: HExpression(
field_type,
- SideEffects::FieldReadOfType(field_type, is_volatile)),
+ SideEffects::FieldReadOfType(field_type, is_volatile), dex_pc),
field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache) {
SetRawInputAt(0, cls);
}
@@ -4544,9 +4596,10 @@ class HStaticFieldSet : public HTemplateInstruction<2> {
bool is_volatile,
uint32_t field_idx,
const DexFile& dex_file,
- Handle<mirror::DexCache> dex_cache)
+ Handle<mirror::DexCache> dex_cache,
+ uint32_t dex_pc = kNoDexPc)
: HTemplateInstruction(
- SideEffects::FieldWriteOfType(field_type, is_volatile)),
+ SideEffects::FieldWriteOfType(field_type, is_volatile), dex_pc),
field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache),
value_can_be_null_(true) {
SetRawInputAt(0, cls);
@@ -4574,7 +4627,8 @@ class HStaticFieldSet : public HTemplateInstruction<2> {
// Implement the move-exception DEX instruction.
class HLoadException : public HExpression<0> {
public:
- HLoadException() : HExpression(Primitive::kPrimNot, SideEffects::None()) {}
+ explicit HLoadException(uint32_t dex_pc = kNoDexPc)
+ : HExpression(Primitive::kPrimNot, SideEffects::None(), dex_pc) {}
bool CanBeNull() const OVERRIDE { return false; }
@@ -4588,7 +4642,8 @@ class HLoadException : public HExpression<0> {
// Must not be removed because the runtime expects the TLS to get cleared.
class HClearException : public HTemplateInstruction<0> {
public:
- HClearException() : HTemplateInstruction(SideEffects::AllWrites()) {}
+ explicit HClearException(uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::AllWrites(), dex_pc) {}
DECLARE_INSTRUCTION(ClearException);
@@ -4599,7 +4654,7 @@ class HClearException : public HTemplateInstruction<0> {
class HThrow : public HTemplateInstruction<1> {
public:
HThrow(HInstruction* exception, uint32_t dex_pc)
- : HTemplateInstruction(SideEffects::CanTriggerGC()), dex_pc_(dex_pc) {
+ : HTemplateInstruction(SideEffects::CanTriggerGC(), dex_pc) {
SetRawInputAt(0, exception);
}
@@ -4609,13 +4664,10 @@ class HThrow : public HTemplateInstruction<1> {
bool CanThrow() const OVERRIDE { return true; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
DECLARE_INSTRUCTION(Throw);
private:
- const uint32_t dex_pc_;
-
DISALLOW_COPY_AND_ASSIGN(HThrow);
};
@@ -4625,10 +4677,11 @@ class HInstanceOf : public HExpression<2> {
HLoadClass* constant,
bool class_is_final,
uint32_t dex_pc)
- : HExpression(Primitive::kPrimBoolean, SideEffectsForArchRuntimeCalls(class_is_final)),
+ : HExpression(Primitive::kPrimBoolean,
+ SideEffectsForArchRuntimeCalls(class_is_final),
+ dex_pc),
class_is_final_(class_is_final),
- must_do_null_check_(true),
- dex_pc_(dex_pc) {
+ must_do_null_check_(true) {
SetRawInputAt(0, object);
SetRawInputAt(1, constant);
}
@@ -4643,8 +4696,6 @@ class HInstanceOf : public HExpression<2> {
return false;
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
-
bool IsClassFinal() const { return class_is_final_; }
// Used only in code generation.
@@ -4660,7 +4711,6 @@ class HInstanceOf : public HExpression<2> {
private:
const bool class_is_final_;
bool must_do_null_check_;
- const uint32_t dex_pc_;
DISALLOW_COPY_AND_ASSIGN(HInstanceOf);
};
@@ -4669,8 +4719,11 @@ class HBoundType : public HExpression<1> {
public:
// Constructs an HBoundType with the given upper_bound.
// Ensures that the upper_bound is valid.
- HBoundType(HInstruction* input, ReferenceTypeInfo upper_bound, bool upper_can_be_null)
- : HExpression(Primitive::kPrimNot, SideEffects::None()),
+ HBoundType(HInstruction* input,
+ ReferenceTypeInfo upper_bound,
+ bool upper_can_be_null,
+ uint32_t dex_pc = kNoDexPc)
+ : HExpression(Primitive::kPrimNot, SideEffects::None(), dex_pc),
upper_bound_(upper_bound),
upper_can_be_null_(upper_can_be_null),
can_be_null_(upper_can_be_null) {
@@ -4714,10 +4767,9 @@ class HCheckCast : public HTemplateInstruction<2> {
HLoadClass* constant,
bool class_is_final,
uint32_t dex_pc)
- : HTemplateInstruction(SideEffects::CanTriggerGC()),
+ : HTemplateInstruction(SideEffects::CanTriggerGC(), dex_pc),
class_is_final_(class_is_final),
- must_do_null_check_(true),
- dex_pc_(dex_pc) {
+ must_do_null_check_(true) {
SetRawInputAt(0, object);
SetRawInputAt(1, constant);
}
@@ -4738,7 +4790,6 @@ class HCheckCast : public HTemplateInstruction<2> {
bool MustDoNullCheck() const { return must_do_null_check_; }
void ClearMustDoNullCheck() { must_do_null_check_ = false; }
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
bool IsClassFinal() const { return class_is_final_; }
@@ -4747,16 +4798,15 @@ class HCheckCast : public HTemplateInstruction<2> {
private:
const bool class_is_final_;
bool must_do_null_check_;
- const uint32_t dex_pc_;
DISALLOW_COPY_AND_ASSIGN(HCheckCast);
};
class HMemoryBarrier : public HTemplateInstruction<0> {
public:
- explicit HMemoryBarrier(MemBarrierKind barrier_kind)
+ explicit HMemoryBarrier(MemBarrierKind barrier_kind, uint32_t dex_pc = kNoDexPc)
: HTemplateInstruction(
- SideEffects::AllWritesAndReads()), // Assume write/read on all fields/arrays.
+ SideEffects::AllWritesAndReads(), dex_pc), // Assume write/read on all fields/arrays.
barrier_kind_(barrier_kind) {}
MemBarrierKind GetBarrierKind() { return barrier_kind_; }
@@ -4778,8 +4828,8 @@ class HMonitorOperation : public HTemplateInstruction<1> {
HMonitorOperation(HInstruction* object, OperationKind kind, uint32_t dex_pc)
: HTemplateInstruction(
- SideEffects::AllExceptGCDependency()), // Assume write/read on all fields/arrays.
- kind_(kind), dex_pc_(dex_pc) {
+ SideEffects::AllExceptGCDependency(), dex_pc), // Assume write/read on all fields/arrays.
+ kind_(kind) {
SetRawInputAt(0, object);
}
@@ -4793,7 +4843,6 @@ class HMonitorOperation : public HTemplateInstruction<1> {
return IsEnter();
}
- uint32_t GetDexPc() const OVERRIDE { return dex_pc_; }
bool IsEnter() const { return kind_ == kEnter; }
@@ -4801,7 +4850,6 @@ class HMonitorOperation : public HTemplateInstruction<1> {
private:
const OperationKind kind_;
- const uint32_t dex_pc_;
private:
DISALLOW_COPY_AND_ASSIGN(HMonitorOperation);
@@ -4816,7 +4864,8 @@ class HMonitorOperation : public HTemplateInstruction<1> {
*/
class HFakeString : public HTemplateInstruction<0> {
public:
- HFakeString() : HTemplateInstruction(SideEffects::None()) {}
+ explicit HFakeString(uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc) {}
Primitive::Type GetType() const OVERRIDE { return Primitive::kPrimNot; }
@@ -4904,8 +4953,8 @@ static constexpr size_t kDefaultNumberOfMoves = 4;
class HParallelMove : public HTemplateInstruction<0> {
public:
- explicit HParallelMove(ArenaAllocator* arena)
- : HTemplateInstruction(SideEffects::None()), moves_(arena, kDefaultNumberOfMoves) {}
+ explicit HParallelMove(ArenaAllocator* arena, uint32_t dex_pc = kNoDexPc)
+ : HTemplateInstruction(SideEffects::None(), dex_pc), moves_(arena, kDefaultNumberOfMoves) {}
void AddMove(Location source,
Location destination,
@@ -4955,6 +5004,14 @@ class HParallelMove : public HTemplateInstruction<0> {
DISALLOW_COPY_AND_ASSIGN(HParallelMove);
};
+} // namespace art
+
+#ifdef ART_ENABLE_CODEGEN_x86
+#include "nodes_x86.h"
+#endif
+
+namespace art {
+
class HGraphVisitor : public ValueObject {
public:
explicit HGraphVisitor(HGraph* graph) : graph_(graph) {}