Visit targets of proxy methods when visiting thread roots.
The target of a non-static proxy method (`this` object), stored in the
proxy method's stack frame, needs to be visited as GC root. This is
especially important in the case of a moving GC, where the proxy
instance may be moved like any object.
Fix initially provided by Robert Vollmer.
Test: m test-art-host
Test: art/test/testrunner/testrunner.py --gcstress -t 1939-proxy-frames
Test: art/test/testrunner/testrunner.py --gcstress -t 1914-get-local-instance
Bug: 70216372
Bug: 67679263
Change-Id: Iea27a8eba51ccd9c9055efaf6b263892830170b5
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index e6e35c8..8b48aa2 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -328,6 +328,7 @@
}
inline bool ArtMethod::IsProxyMethod() {
+ DCHECK(!IsRuntimeMethod()) << "ArtMethod::IsProxyMethod called on a runtime method";
// Avoid read barrier since the from-space version of the class will have the correct proxy class
// flags since they are constant for the lifetime of the class.
return GetDeclaringClass<kWithoutReadBarrier>()->IsProxyClass();