summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author xueliang.zhong <xueliang.zhong@linaro.org> 2017-10-30 13:43:14 +0000
committer xueliang.zhong <xueliang.zhong@linaro.org> 2017-11-02 16:17:17 +0000
commite0eb48353ddf0c1b79bfec2ba15c899a413c2c70 (patch)
tree71dfe896afa05c39d64373518d1e1e36cb8d8d43 /compiler/optimizing/nodes.h
parent3e6c13997373efac343a65740da0c4f6e77338b9 (diff)
Fix LSA hunt for original reference bug.
Fix a bug in LSA where it doesn't take IntermediateAddress into account during hunting for original reference. In following example, original reference i0 can be transformed by NullCheck, BoundType, IntermediateAddress, etc. i0 NewArray i1 HInstruction(i0) i2 ArrayGet(i1, index) Test: test-art-host Test: test-art-target Test: load_store_analysis_test Test: 706-checker-scheduler Change-Id: I162dd8a86fcd31daee3517357c6af638c950b31b
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 88609ea790..29c78a1e34 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -1334,6 +1334,7 @@ class HLoopInformationOutwardIterator : public ValueObject {
M(InstanceFieldSet, Instruction) \
M(InstanceOf, Instruction) \
M(IntConstant, Constant) \
+ M(IntermediateAddress, Instruction) \
M(InvokeUnresolved, Invoke) \
M(InvokeInterface, Invoke) \
M(InvokeStaticOrDirect, Invoke) \
@@ -1418,7 +1419,6 @@ class HLoopInformationOutwardIterator : public ValueObject {
M(BitwiseNegatedRight, Instruction) \
M(DataProcWithShifterOp, Instruction) \
M(MultiplyAccumulate, Instruction) \
- M(IntermediateAddress, Instruction) \
M(IntermediateAddressIndex, Instruction)
#endif
@@ -6966,6 +6966,38 @@ class HParallelMove FINAL : public HTemplateInstruction<0> {
DISALLOW_COPY_AND_ASSIGN(HParallelMove);
};
+// This instruction computes an intermediate address pointing in the 'middle' of an object. The
+// result pointer cannot be handled by GC, so extra care is taken to make sure that this value is
+// never used across anything that can trigger GC.
+// The result of this instruction is not a pointer in the sense of `DataType::Type::kreference`.
+// So we represent it by the type `DataType::Type::kInt`.
+class HIntermediateAddress FINAL : public HExpression<2> {
+ public:
+ HIntermediateAddress(HInstruction* base_address, HInstruction* offset, uint32_t dex_pc)
+ : HExpression(DataType::Type::kInt32, SideEffects::DependsOnGC(), dex_pc) {
+ DCHECK_EQ(DataType::Size(DataType::Type::kInt32),
+ DataType::Size(DataType::Type::kReference))
+ << "kPrimInt and kPrimNot have different sizes.";
+ SetRawInputAt(0, base_address);
+ SetRawInputAt(1, offset);
+ }
+
+ bool CanBeMoved() const OVERRIDE { return true; }
+ bool InstructionDataEquals(const HInstruction* other ATTRIBUTE_UNUSED) const OVERRIDE {
+ return true;
+ }
+ bool IsActualObject() const OVERRIDE { return false; }
+
+ HInstruction* GetBaseAddress() const { return InputAt(0); }
+ HInstruction* GetOffset() const { return InputAt(1); }
+
+ DECLARE_INSTRUCTION(IntermediateAddress);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(HIntermediateAddress);
+};
+
+
} // namespace art
#include "nodes_vector.h"