summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2016-04-04 17:47:42 +0000
committer David Brazdil <dbrazdil@google.com> 2016-04-04 17:47:42 +0000
commit60328910cad396589474f8513391ba733d19390b (patch)
tree01702f6df5c39925b354a3152dd04289e7d97062 /compiler/optimizing/nodes.cc
parente3ff7b293be2a6791fe9d135d660c0cffe4bd73f (diff)
Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals"
Bug: 27995065 This reverts commit e3ff7b293be2a6791fe9d135d660c0cffe4bd73f. Change-Id: I5363c7ce18f47fd422c15eed5423a345a57249d8
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 1086cbf503..9f448af73a 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -318,11 +318,21 @@ void HGraph::SimplifyLoop(HBasicBlock* header) {
}
}
+ // Place the suspend check at the beginning of the header, so that live registers
+ // will be known when allocating registers. Note that code generation can still
+ // generate the suspend check at the back edge, but needs to be careful with
+ // loop phi spill slots (which are not written to at back edge).
HInstruction* first_instruction = header->GetFirstInstruction();
- if (first_instruction != nullptr && first_instruction->IsSuspendCheck()) {
- // Called from DeadBlockElimination. Update SuspendCheck pointer.
- info->SetSuspendCheck(first_instruction->AsSuspendCheck());
+ if (first_instruction == nullptr) {
+ HSuspendCheck* check = new (arena_) HSuspendCheck(header->GetDexPc());
+ header->AddInstruction(check);
+ first_instruction = check;
+ } else if (!first_instruction->IsSuspendCheck()) {
+ HSuspendCheck* check = new (arena_) HSuspendCheck(header->GetDexPc());
+ header->InsertInstructionBefore(check, first_instruction);
+ first_instruction = check;
}
+ info->SetSuspendCheck(first_instruction->AsSuspendCheck());
}
void HGraph::ComputeTryBlockInformation() {
@@ -1872,7 +1882,6 @@ HInstruction* HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) {
instr_it.Advance()) {
HInstruction* current = instr_it.Current();
if (current->NeedsEnvironment()) {
- DCHECK(current->HasEnvironment());
current->GetEnvironment()->SetAndCopyParentChain(
outer_graph->GetArena(), invoke->GetEnvironment());
}