diff options
author | 2025-01-24 09:43:20 +0000 | |
---|---|---|
committer | 2025-01-24 02:50:18 -0800 | |
commit | ff0184c6afa5d8faab4f1d76a85b7dd7829754e7 (patch) | |
tree | 8312863bc33e6d6ab3924e14aba27d0f75aa3a25 | |
parent | f79077ad9e7b1e5b885466dce7f672130ee7efea (diff) |
Don't use WellKnownClasses in ReferenceProcessor's GetSlowPathFlagOffset.
It may not be initialized at the point the reference processor is
running.
Test: test.py
Change-Id: I21adb9aea1d99b2512d424a6a9982546fef08f06
-rw-r--r-- | runtime/gc/reference_processor.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc index 2621629bb8..6420fbbff6 100644 --- a/runtime/gc/reference_processor.cc +++ b/runtime/gc/reference_processor.cc @@ -54,8 +54,11 @@ ReferenceProcessor::ReferenceProcessor() static inline MemberOffset GetSlowPathFlagOffset(ObjPtr<mirror::Class> reference_class) REQUIRES_SHARED(Locks::mutator_lock_) { DCHECK(reference_class == GetClassRoot<mirror::Reference>()); - ArtField* field = WellKnownClasses::java_lang_ref_Reference_slowPathEnabled; + // Don't use WellKnownClasses here as it may not be initialized at the point + // we're being called. + ArtField* field = reference_class->GetField(reference_class->NumFields() - 1); DCHECK(field->IsStatic()); + DCHECK_STREQ(field->GetName(), "slowPathEnabled"); return field->GetOffset(); } |