diff options
author | 2015-09-14 21:26:33 +0000 | |
---|---|---|
committer | 2015-09-14 21:26:33 +0000 | |
commit | 659562aaf133c41b8d90ec9216c07646f0f14362 (patch) | |
tree | be1beae390262bf2f5a17bfa44de93081a849d07 /compiler/optimizing/code_generator.cc | |
parent | b022fa1300e6d78639b3b910af0cf85c43df44bb (diff) |
Revert "ART: Register allocation and runtime support for try/catch"
Breaks libcore test org.apache.harmony.security.tests.java.security.KeyStorePrivateKeyEntryTest#testGetCertificateChain. Need to investigate.
This reverts commit b022fa1300e6d78639b3b910af0cf85c43df44bb.
Change-Id: Ib24d3a80064d963d273e557a93469c95f37b1f6f
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 92 |
1 files changed, 7 insertions, 85 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 3bbff6ae17..0bb90b27e6 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -248,12 +248,6 @@ void CodeGenerator::CompileInternal(CodeAllocator* allocator, bool is_baseline) GenerateSlowPaths(); - // Emit catch stack maps at the end of the stack map stream as expected by the - // runtime exception handler. - if (!is_baseline && graph_->HasTryCatch()) { - RecordCatchBlockInfo(); - } - // Finalize instructions in assember; Finalize(allocator); } @@ -811,73 +805,6 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction, stack_map_stream_.EndStackMapEntry(); } -void CodeGenerator::RecordCatchBlockInfo() { - ArenaAllocator* arena = graph_->GetArena(); - - for (size_t i = 0, e = block_order_->Size(); i < e; ++i) { - HBasicBlock* block = block_order_->Get(i); - if (!block->IsCatchBlock()) { - continue; - } - - uint32_t dex_pc = block->GetDexPc(); - uint32_t num_vregs = graph_->GetNumberOfVRegs(); - uint32_t inlining_depth = 0; // Inlining of catch blocks is not supported at the moment. - uint32_t native_pc = GetAddressOf(block); - uint32_t register_mask = 0; // Not used. - - // The stack mask is not used, so we leave it empty. - ArenaBitVector* stack_mask = new (arena) ArenaBitVector(arena, 0, /* expandable */ true); - - stack_map_stream_.BeginStackMapEntry(dex_pc, - native_pc, - register_mask, - stack_mask, - num_vregs, - inlining_depth); - - HInstruction* current_phi = block->GetFirstPhi(); - for (size_t vreg = 0; vreg < num_vregs; ++vreg) { - while (current_phi != nullptr && current_phi->AsPhi()->GetRegNumber() < vreg) { - HInstruction* next_phi = current_phi->GetNext(); - DCHECK(next_phi == nullptr || - current_phi->AsPhi()->GetRegNumber() <= next_phi->AsPhi()->GetRegNumber()) - << "Phis need to be sorted by vreg number to keep this a linear-time loop."; - current_phi = next_phi; - } - - if (current_phi == nullptr || current_phi->AsPhi()->GetRegNumber() != vreg) { - stack_map_stream_.AddDexRegisterEntry(DexRegisterLocation::Kind::kNone, 0); - } else { - Location location = current_phi->GetLiveInterval()->ToLocation(); - switch (location.GetKind()) { - case Location::kStackSlot: { - stack_map_stream_.AddDexRegisterEntry( - DexRegisterLocation::Kind::kInStack, location.GetStackIndex()); - break; - } - case Location::kDoubleStackSlot: { - stack_map_stream_.AddDexRegisterEntry( - DexRegisterLocation::Kind::kInStack, location.GetStackIndex()); - stack_map_stream_.AddDexRegisterEntry( - DexRegisterLocation::Kind::kInStack, location.GetHighStackIndex(kVRegSize)); - ++vreg; - DCHECK_LT(vreg, num_vregs); - break; - } - default: { - // All catch phis must be allocated to a stack slot. - LOG(FATAL) << "Unexpected kind " << location.GetKind(); - UNREACHABLE(); - } - } - } - } - - stack_map_stream_.EndStackMapEntry(); - } -} - void CodeGenerator::EmitEnvironment(HEnvironment* environment, SlowPathCode* slow_path) { if (environment == nullptr) return; @@ -1048,13 +975,6 @@ void CodeGenerator::EmitEnvironment(HEnvironment* environment, SlowPathCode* slo } } -bool CodeGenerator::IsImplicitNullCheckAllowed(HNullCheck* null_check) const { - return compiler_options_.GetImplicitNullChecks() && - // Null checks which might throw into a catch block need to save live - // registers and therefore cannot be done implicitly. - !null_check->CanThrowIntoCatchBlock(); -} - bool CodeGenerator::CanMoveNullCheckToUser(HNullCheck* null_check) { HInstruction* first_next_not_move = null_check->GetNextDisregardingMoves(); @@ -1070,6 +990,10 @@ void CodeGenerator::MaybeRecordImplicitNullCheck(HInstruction* instr) { return; } + if (!compiler_options_.GetImplicitNullChecks()) { + return; + } + if (!instr->CanDoImplicitNullCheckOn(instr->InputAt(0))) { return; } @@ -1081,11 +1005,9 @@ void CodeGenerator::MaybeRecordImplicitNullCheck(HInstruction* instr) { // and needs to record the pc. if (first_prev_not_move != nullptr && first_prev_not_move->IsNullCheck()) { HNullCheck* null_check = first_prev_not_move->AsNullCheck(); - if (IsImplicitNullCheckAllowed(null_check)) { - // TODO: The parallel moves modify the environment. Their changes need to be - // reverted otherwise the stack maps at the throw point will not be correct. - RecordPcInfo(null_check, null_check->GetDexPc()); - } + // TODO: The parallel moves modify the environment. Their changes need to be reverted + // otherwise the stack maps at the throw point will not be correct. + RecordPcInfo(null_check, null_check->GetDexPc()); } } |