From d1aa7d0eec33e5f297d1eadedda714d4d0a3ef91 Mon Sep 17 00:00:00 2001 From: Artem Serov Date: Fri, 22 Jun 2018 11:35:46 +0100 Subject: ART: Remove unneeded SideEffects for fatal instructions. Remove "CanTriggerGC" side effect for NullCheck, BoundsCheck and DivZeroCheck - instructions which have fatal slow paths. Even though GC might happen after going through those instructions' slow path execution doesn't return to the next instruction after the exceptional one so side effects can be relaxed. Performance improvement (angler, arm64, little core): - Geomean: 2.8% - Particular benchmarks - algorithm/Sort.SystemSort: 13.0% - stanford/IntMM: 12.7% - stanford/Puzzle: 9.5% - benchmarksgame/revcomp: 8.9% - reversigame/Reversi: 3.5% Test: 510-checker-try-catch. Test: 706-checker-scheduler. Test: 527-checker-array-access-split. Test: test-art-host, test-art-target. Change-Id: I55ac011822e5dbac82c828a700213dbea87329c8 --- compiler/optimizing/code_generator.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/code_generator.cc') diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index a13efcaee2..095b273182 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -1514,7 +1514,12 @@ void CodeGenerator::ValidateInvokeRuntime(QuickEntrypointEnum entrypoint, << " instruction->GetSideEffects().ToString()=" << instruction->GetSideEffects().ToString(); } else { - DCHECK(instruction->GetSideEffects().Includes(SideEffects::CanTriggerGC()) || + // 'CanTriggerGC' side effect is used to restrict optimization of instructions which depend + // on GC (e.g. IntermediateAddress) - to ensure they are not alive across GC points. However + // if execution never returns to the compiled code from a GC point this restriction is + // unnecessary - in particular for fatal slow paths which might trigger GC. + DCHECK((slow_path->IsFatal() && !instruction->GetLocations()->WillCall()) || + instruction->GetSideEffects().Includes(SideEffects::CanTriggerGC()) || // When (non-Baker) read barriers are enabled, some instructions // use a slow path to emit a read barrier, which does not trigger // GC. -- cgit v1.2.3