Set HasMonitorOperations in the outer graph when inlining
If the callee graph has monitor operations, the outer graph will
have them too when inlining.
If we don't do this, e.g. we will skip adding the needed vreg info
https://cs.android.com/android/platform/superproject/+/master:art/compiler/optimizing/code_generator.cc;l=1193;drc=434d968b4af0bc8af9889170250bee3e08839bea.
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I97817ea93c12727bb7d198fb5abea21c32d181c9
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index 3d80de0..ec89022 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -375,6 +375,19 @@
}
}
+void GraphChecker::VisitMonitorOperation(HMonitorOperation* monitor_op) {
+ if (!GetGraph()->HasMonitorOperations()) {
+ AddError(
+ StringPrintf("The graph doesn't have the HasMonitorOperations bit set but we saw "
+ "%s:%d in block %d.",
+ monitor_op->DebugName(),
+ monitor_op->GetId(),
+ monitor_op->GetBlock()->GetBlockId()));
+ }
+
+ VisitInstruction(monitor_op);
+}
+
void GraphChecker::VisitInstruction(HInstruction* instruction) {
if (seen_ids_.IsBitSet(instruction->GetId())) {
AddError(StringPrintf("Instruction id %d is duplicate in graph.",
diff --git a/compiler/optimizing/graph_checker.h b/compiler/optimizing/graph_checker.h
index 950868b..738c0d6 100644
--- a/compiler/optimizing/graph_checker.h
+++ b/compiler/optimizing/graph_checker.h
@@ -68,6 +68,7 @@
void VisitInstanceOf(HInstanceOf* check) override;
void VisitInvokeStaticOrDirect(HInvokeStaticOrDirect* invoke) override;
void VisitLoadException(HLoadException* load) override;
+ void VisitMonitorOperation(HMonitorOperation* monitor_operation) override;
void VisitNeg(HNeg* instruction) override;
void VisitPackedSwitch(HPackedSwitch* instruction) override;
void VisitReturn(HReturn* ret) override;
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 8491c24..0e85838 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -2788,6 +2788,9 @@
if (HasTryCatch()) {
outer_graph->SetHasTryCatch(true);
}
+ if (HasMonitorOperations()) {
+ outer_graph->SetHasMonitorOperations(true);
+ }
if (HasSIMD()) {
outer_graph->SetHasSIMD(true);
}