summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_checker.cc
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2022-12-05 12:05:43 +0000
committer Santiago Aboy Solanes <solanes@google.com> 2022-12-05 17:26:27 +0000
commit13c3ce1edf7fa9e8e97fb60625a62cb97a13f9a9 (patch)
tree2c4188ec7dbd450d158598527371edbaa3cbd3fa /compiler/optimizing/graph_checker.cc
parent6d2b6bacc6ad5c7e85a8608094469088cd6c8f56 (diff)
Update CanTriggerGC flag for ArraySet
ArraySet instructions can trigger a GC only when perforing a type check. When clearing the needs type check flag, we should also clear the CanTriggerGC flag from the instruction's side effects. Note that once we clear the needs type check flag, we never set it again. Add check in graph checker that the needs type check and the can trigger GC flag are consistent. Add can_trigger_gc property to graph visualizer that reflects whether the ArraySet instruction can trigger a GC. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: I4c74f902aabf2339bd292e9b24737f55d2737440
Diffstat (limited to 'compiler/optimizing/graph_checker.cc')
-rw-r--r--compiler/optimizing/graph_checker.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index e4203fe492..3d80de0e04 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -1064,6 +1064,21 @@ void GraphChecker::VisitNeg(HNeg* instruction) {
}
}
+void GraphChecker::VisitArraySet(HArraySet* instruction) {
+ VisitInstruction(instruction);
+
+ if (instruction->NeedsTypeCheck() !=
+ instruction->GetSideEffects().Includes(SideEffects::CanTriggerGC())) {
+ AddError(StringPrintf(
+ "%s %d has a flag mismatch. An ArraySet instruction can trigger a GC iff it "
+ "needs a type check. Needs type check: %s, Can trigger GC: %s",
+ instruction->DebugName(),
+ instruction->GetId(),
+ instruction->NeedsTypeCheck() ? "true" : "false",
+ instruction->GetSideEffects().Includes(SideEffects::CanTriggerGC()) ? "true" : "false"));
+ }
+}
+
void GraphChecker::VisitBinaryOperation(HBinaryOperation* op) {
VisitInstruction(op);
DataType::Type lhs_type = op->InputAt(0)->GetType();