diff options
author | 2015-08-12 13:43:29 +0100 | |
---|---|---|
committer | 2015-08-12 13:43:29 +0100 | |
commit | 78e3ef6bc5f8aa149f2f8bf0c78ce854c2f910fa (patch) | |
tree | b8aa83bef462e20e2e7e09650e6c15d3a8d97fa6 /compiler/optimizing/code_generator.cc | |
parent | 6a5037eb3340e4c981fd7de3ff45167ee5b7fc82 (diff) |
Add a GVN dependency 'GC' for garbage collection.
This will be used by incoming architecture specific optimizations. The
dependencies must be conservative. When an HInstruction is created we
may not be sure whether it can trigger GC. In that case the
'ChangesGC' dependency must be set. We control at code-generation time
that HInstructions that can call have the 'ChangesGC' dependency
set.
Change-Id: Iea6a7f430009f37a9599b0a0039207049906e45d
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 4607ebe548..77d6628ff6 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -1005,6 +1005,31 @@ void CodeGenerator::EmitParallelMoves(Location from1, GetMoveResolver()->EmitNativeCode(¶llel_move); } +void CodeGenerator::ValidateInvokeRuntime(HInstruction* instruction, SlowPathCode* slow_path) { + // Ensure that the call kind indication given to the register allocator is + // coherent with the runtime call generated, and that the GC side effect is + // set when required. + if (slow_path == nullptr) { + DCHECK(instruction->GetLocations()->WillCall()); + DCHECK(instruction->GetSideEffects().Includes(SideEffects::CanTriggerGC())); + } else { + DCHECK(instruction->GetLocations()->OnlyCallsOnSlowPath() || slow_path->IsFatal()); + DCHECK(instruction->GetSideEffects().Includes(SideEffects::CanTriggerGC()) || + // Control flow would not come back into the code if a fatal slow + // path is taken, so we do not care if it triggers GC. + slow_path->IsFatal() || + // HDeoptimize is a special case: we know we are not coming back from + // it into the code. + instruction->IsDeoptimize()); + } + + // Check the coherency of leaf information. + DCHECK(instruction->IsSuspendCheck() + || ((slow_path != nullptr) && slow_path->IsFatal()) + || instruction->GetLocations()->CanCall() + || !IsLeafMethod()); +} + void SlowPathCode::RecordPcInfo(CodeGenerator* codegen, HInstruction* instruction, uint32_t dex_pc) { codegen->RecordPcInfo(instruction, dex_pc, this); } |