Avoid read barrier in `ArtMethod::IsOverridableByDefaultMethod()`.
Also clean up a few other things related to method linking.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 181943478
Bug: 119486698
Change-Id: I888dd63db272075cad524e561b3f6271445e8b00
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index 29886ab..5c9c739 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -102,6 +102,13 @@
return type;
}
+inline bool ArtMethod::IsOverridableByDefaultMethod() {
+ // It is safe to avoid the read barrier here since the constant interface flag
+ // in the `Class` object is stored before creating the `ArtMethod` and storing
+ // the declaring class reference. See `ReadBarrierOption`.
+ return GetDeclaringClass<kWithoutReadBarrier>()->IsInterface();
+}
+
inline bool ArtMethod::CheckIncompatibleClassChange(InvokeType type) {
switch (type) {
case kStatic: