diff options
| author | 2017-03-16 13:13:31 -0700 | |
|---|---|---|
| committer | 2017-03-16 14:23:46 -0700 | |
| commit | 4f2e957b07c8b6e48bbd7593bb64f3c5214fa489 (patch) | |
| tree | efcfcaaa1efdc567449c406e7107da2e94c127c2 /runtime/mirror/class_ext.h | |
| parent | ed883a11b8cd7f3712bd30fca1e2b0fb641bff63 (diff) | |
Ensure the GC visits Obsolete Methods
We were previously not visiting obsolete methods during GCs. This
could lead to the use of stale pointers.
Bug: 36335999
Test: ./test/testrunner/testrunner.py --host --interp-ac --gcstress -j40
Change-Id: I2b5c7c75b29f9037204a860501fcdb78104b5e7a
Diffstat (limited to 'runtime/mirror/class_ext.h')
| -rw-r--r-- | runtime/mirror/class_ext.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/runtime/mirror/class_ext.h b/runtime/mirror/class_ext.h index ad8a61b676..fac955a45e 100644 --- a/runtime/mirror/class_ext.h +++ b/runtime/mirror/class_ext.h @@ -17,9 +17,8 @@ #ifndef ART_RUNTIME_MIRROR_CLASS_EXT_H_ #define ART_RUNTIME_MIRROR_CLASS_EXT_H_ -#include "class-inl.h" - #include "array.h" +#include "class.h" #include "dex_cache.h" #include "gc_root.h" #include "object.h" @@ -36,10 +35,7 @@ namespace mirror { // C++ mirror of dalvik.system.ClassExt class MANAGED ClassExt : public Object { public: - static uint32_t ClassSize(PointerSize pointer_size) { - uint32_t vtable_entries = Object::kVTableLength; - return Class::ComputeClassSize(true, vtable_entries, 0, 0, 0, 0, 0, pointer_size); - } + static uint32_t ClassSize(PointerSize pointer_size); // Size of an instance of dalvik.system.ClassExt. static constexpr uint32_t InstanceSize() { @@ -57,8 +53,11 @@ class MANAGED ClassExt : public Object { OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_dex_caches_)); } - PointerArray* GetObsoleteMethods() REQUIRES_SHARED(Locks::mutator_lock_) { - return GetFieldObject<PointerArray>(OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_methods_)); + template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags, + ReadBarrierOption kReadBarrierOption = kWithReadBarrier> + inline PointerArray* GetObsoleteMethods() REQUIRES_SHARED(Locks::mutator_lock_) { + return GetFieldObject<PointerArray, kVerifyFlags, kReadBarrierOption>( + OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_methods_)); } ByteArray* GetOriginalDexFileBytes() REQUIRES_SHARED(Locks::mutator_lock_) { @@ -78,6 +77,10 @@ class MANAGED ClassExt : public Object { static void ResetClass(); static void VisitRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_); + template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier, class Visitor> + inline void VisitNativeRoots(Visitor& visitor, PointerSize pointer_size) + REQUIRES_SHARED(Locks::mutator_lock_); + static ClassExt* Alloc(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_); private: |