Fix CHA in the presence of default conflict methods.
We don't want to set single implementation bits for default
conflict methods, as we need to thor ICCE for them.
bug: 112189179
Test: 966-default-conflict
Change-Id: I768f307f1996b775e3942c87cbe388ce22bebf5d
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e19dedc..489d602 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7039,9 +7039,12 @@
// mark this as a default, non-abstract method, since thats what it is. Also clear the
// kAccSkipAccessChecks bit since this class hasn't been verified yet it shouldn't have
// methods that are skipping access checks.
+ // Also clear potential kAccSingleImplementation to avoid CHA trying to inline
+ // the default method.
DCHECK_EQ(new_method.GetAccessFlags() & kAccNative, 0u);
constexpr uint32_t kSetFlags = kAccDefault | kAccDefaultConflict | kAccCopied;
- constexpr uint32_t kMaskFlags = ~(kAccAbstract | kAccSkipAccessChecks);
+ constexpr uint32_t kMaskFlags =
+ ~(kAccAbstract | kAccSkipAccessChecks | kAccSingleImplementation);
new_method.SetAccessFlags((new_method.GetAccessFlags() | kSetFlags) & kMaskFlags);
DCHECK(new_method.IsDefaultConflicting());
// The actual method might or might not be marked abstract since we just copied it from a