summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2022-09-07 10:31:59 +0000
committer Santiago Aboy Solanes <solanes@google.com> 2022-09-08 08:19:12 +0000
commit3fcfd7303a7a0683e334d0509b17d65d773b3d71 (patch)
tree0cc5689bdb0e7b4d944db3f83255cc2dc470482d /compiler/optimizing/instruction_builder.cc
parent567e144f8d0798d539fe8401d0440963311856fd (diff)
Reland "Add an environment to the beginning of catch blocks"
This reverts commit 37fe26288aaacae0f26873131dd92704796e09ec. Reason for revert: Pattern match fix Bug: 227283224 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b --debuggable 565-checker-condition-liveness (also for --target) Change-Id: Iaf784c12fb6229df6cfbd9a1b43467f5ed43c4d4
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index 605427ba11..ba58c8d1fe 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -343,6 +343,10 @@ static bool IsBlockPopulated(HBasicBlock* block) {
// Suspend checks were inserted into loop headers during building of dominator tree.
DCHECK(block->GetFirstInstruction()->IsSuspendCheck());
return block->GetFirstInstruction() != block->GetLastInstruction();
+ } else if (block->IsCatchBlock()) {
+ // Nops were inserted into the beginning of catch blocks.
+ DCHECK(block->GetFirstInstruction()->IsNop());
+ return block->GetFirstInstruction() != block->GetLastInstruction();
} else {
return !block->GetInstructions().IsEmpty();
}
@@ -387,6 +391,11 @@ bool HInstructionBuilder::Build() {
// This is slightly odd because the loop header might not be empty (TryBoundary).
// But we're still creating the environment with locals from the top of the block.
InsertInstructionAtTop(suspend_check);
+ } else if (current_block_->IsCatchBlock()) {
+ // We add an environment emitting instruction at the beginning of each catch block, in order
+ // to support try catch inlining.
+ // This is slightly odd because the catch block might not be empty (TryBoundary).
+ InsertInstructionAtTop(new (allocator_) HNop(block_dex_pc, /* needs_environment= */ true));
}
if (block_dex_pc == kNoDexPc || current_block_ != block_builder_->GetBlockAt(block_dex_pc)) {