From c54cc7cb18262fe77ed8da6a56acbf00d5bc5a71 Mon Sep 17 00:00:00 2001 From: Stelios Ioannou Date: Fri, 9 Jul 2021 17:06:03 +0100 Subject: Revert^2 "ART: Removes SuspendCheck for plain loops with a low trip count." This change removes SuspendCheck for plain loops with a low trip count. The SuspendCheck in the codegen makes sure that the thread can be interrupted during execution for GC. Not being able to do so might decrease the responsiveness of GC in the case when a very long loop or a long recursion is being executed. However, for plain loops with a small trip count, the removal of SuspendCheck should not affect the GC's responsiveness by a large margin. Consequently, since the thread won't be interrupted for plain loops, it is assumed that the performance might increase by removing SuspendCheck. Also add explicit checks to existing code to ensure that SuspendCheck is never null when it is used. This reverts commit 8f6b99fba2d043265a84d599a967d52f66738ad6 Reason for revert: Included fix for CHAGuardVisitor::HoistGuard crash by disabling codegen for optimized SuspendCheck nodes instead of removing the SuspendCheck node itself. Test: art/test.py -v -j12 --host --64 -t 2233-checker\ -remove-loop-suspend-check --run-test --optimizing Change-Id: Id6296aded91e1cf49b8f3f339dc83613cbedf876 --- compiler/optimizing/graph_checker.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'compiler/optimizing/graph_checker.cc') diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc index d1769cea0d..eda6363dda 100644 --- a/compiler/optimizing/graph_checker.cc +++ b/compiler/optimizing/graph_checker.cc @@ -674,13 +674,14 @@ void GraphChecker::HandleLoop(HBasicBlock* loop_header) { loop_information->GetPreHeader()->GetSuccessors().size())); } - if (loop_information->GetSuspendCheck() == nullptr) { - AddError(StringPrintf( - "Loop with header %d does not have a suspend check.", - loop_header->GetBlockId())); + if (!GetGraph()->SuspendChecksAreAllowedToNoOp() && + loop_information->GetSuspendCheck() == nullptr) { + AddError(StringPrintf("Loop with header %d does not have a suspend check.", + loop_header->GetBlockId())); } - if (loop_information->GetSuspendCheck() != loop_header->GetFirstInstructionDisregardMoves()) { + if (!GetGraph()->SuspendChecksAreAllowedToNoOp() && + loop_information->GetSuspendCheck() != loop_header->GetFirstInstructionDisregardMoves()) { AddError(StringPrintf( "Loop header %d does not have the loop suspend check as the first instruction.", loop_header->GetBlockId())); -- cgit v1.2.3-59-g8ed1b