diff options
author | 2024-08-29 14:04:02 +0100 | |
---|---|---|
committer | 2024-09-02 12:19:35 +0000 | |
commit | 8ff3ec2695b65c0d35ff54b7649a12a9c9427eab (patch) | |
tree | ec6b74cf745a08098a2e2c600823c930be1c322f | |
parent | 1647f4c5edf18b13ef8476921a92141c40c754d5 (diff) |
Don't devirtualize to an intrinsic invalid after the builder phase
As a drive-by, print the intrisic itself and not its index in
graph_checker.cc.
Bug: 362091596
Test: Compile the app in the bug
Change-Id: I55c857f193d334d1a40cac637dfedf6334522f00
-rw-r--r-- | compiler/optimizing/graph_checker.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc index 1ff0d4dc84..db76c04bc0 100644 --- a/compiler/optimizing/graph_checker.cc +++ b/compiler/optimizing/graph_checker.cc @@ -754,10 +754,12 @@ void GraphChecker::VisitInvoke(HInvoke* invoke) { // Check for intrinsics which should have been replaced by intermediate representation in the // instruction builder. if (!IsValidIntrinsicAfterBuilder(invoke->GetIntrinsic())) { + std::stringstream ss; + ss << invoke->GetIntrinsic(); AddError( - StringPrintf("The graph contains the instrinsic %d which should have been replaced in the " + StringPrintf("The graph contains the instrinsic %s which should have been replaced in the " "instruction builder: %s:%d in block %d.", - enum_cast<int>(invoke->GetIntrinsic()), + ss.str().c_str(), invoke->DebugName(), invoke->GetId(), invoke->GetBlock()->GetBlockId())); diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 8a25e82816..45322e7e27 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -1343,6 +1343,14 @@ bool HInliner::TryDevirtualize(HInvoke* invoke_instruction, return false; } + // Don't devirtualize to an intrinsic invalid after the builder phase. The ArtMethod might be an + // intrinsic even when the HInvoke isn't e.g. java.lang.CharSequence.isEmpty (not an intrinsic) + // can get devirtualized into java.lang.String.isEmpty (which is an intrinsic). + if (method->IsIntrinsic() && + !IsValidIntrinsicAfterBuilder(static_cast<Intrinsics>(method->GetIntrinsic()))) { + return false; + } + // Don't bother trying to call directly a default conflict method. It // doesn't have a proper MethodReference, but also `GetCanonicalMethod` // will return an actual default implementation. |