summaryrefslogtreecommitdiff
path: root/compiler/optimizing/ssa_liveness_analysis.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2018-08-27 20:56:45 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2018-08-28 13:44:43 +0100
commit2aee3af146e4e1d431074cbad384890042c9f633 (patch)
tree6b5651b40e9d55d38f9cf0317f243269651bb001 /compiler/optimizing/ssa_liveness_analysis.h
parent4a7133d666976967c1cf7f9be70e159bab60a863 (diff)
Adjust safepoint position of implicit null checks.
The safepoint records stack masks and register masks. For implicit null checks, they need to have their position to the instruction doing the null check (the next one). Test: org.apache.harmony.tests.java.io.BufferedWriterTest#test_write_LStringII_Exception Change-Id: I347d9fe38fb9df23fbc00f9aa36f1ee9c54bf912
Diffstat (limited to 'compiler/optimizing/ssa_liveness_analysis.h')
-rw-r--r--compiler/optimizing/ssa_liveness_analysis.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/compiler/optimizing/ssa_liveness_analysis.h b/compiler/optimizing/ssa_liveness_analysis.h
index cebd4adcd8..dfe6103e04 100644
--- a/compiler/optimizing/ssa_liveness_analysis.h
+++ b/compiler/optimizing/ssa_liveness_analysis.h
@@ -230,12 +230,25 @@ class SafepointPosition : public ArenaObject<kArenaAllocSsaLiveness> {
: instruction_(instruction),
next_(nullptr) {}
+ static size_t ComputePosition(HInstruction* instruction) {
+ // We special case instructions emitted at use site, as their
+ // safepoint position needs to be at their use.
+ if (instruction->IsEmittedAtUseSite()) {
+ // Currently only applies to implicit null checks, which are emitted
+ // at the next instruction.
+ DCHECK(instruction->IsNullCheck()) << instruction->DebugName();
+ return instruction->GetLifetimePosition() + 2;
+ } else {
+ return instruction->GetLifetimePosition();
+ }
+ }
+
void SetNext(SafepointPosition* next) {
next_ = next;
}
size_t GetPosition() const {
- return instruction_->GetLifetimePosition();
+ return ComputePosition(instruction_);
}
SafepointPosition* GetNext() const {
@@ -922,7 +935,7 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> {
if (first_safepoint_ == nullptr) {
first_safepoint_ = last_safepoint_ = safepoint;
} else {
- DCHECK_LT(last_safepoint_->GetPosition(), safepoint->GetPosition());
+ DCHECK_LE(last_safepoint_->GetPosition(), safepoint->GetPosition());
last_safepoint_->SetNext(safepoint);
last_safepoint_ = safepoint;
}