// We really need to be careful how we update this. If we ever in the future make it so that // these arrays are written into without all threads being suspended we have a race condition! This // race could cause obsolete methods to be missed. bool ClassExt::ExtendObsoleteArrays(Handle<ClassExt> h_this, Thread* self, uint32_t increase) { // TODO It would be good to check that we have locked the class associated with this ClassExt.
StackHandleScope<4> hs(self);
Handle<PointerArray> old_methods(hs.NewHandle(h_this->GetObsoleteMethods()));
Handle<ObjectArray<DexCache>> old_dex_caches(hs.NewHandle(h_this->GetObsoleteDexCaches()));
ClassLinker* cl = Runtime::Current()->GetClassLinker();
size_t new_len; if (old_methods == nullptr) {
CHECK(old_dex_caches == nullptr);
new_len = increase;
} else {
CHECK_EQ(old_methods->GetLength(), old_dex_caches->GetLength());
new_len = increase + old_methods->GetLength();
}
Handle<PointerArray> new_methods(hs.NewHandle<PointerArray>(
cl->AllocPointerArray(self, new_len))); if (new_methods.IsNull()) { // Fail.
self->AssertPendingOOMException(); returnfalse;
}
Handle<ObjectArray<DexCache>> new_dex_caches(hs.NewHandle<ObjectArray<DexCache>>(
ObjectArray<DexCache>::Alloc(self,
cl->FindSystemClass(self, "[Ljava/lang/DexCache;"),
new_len))); if (new_dex_caches.IsNull()) { // Fail.
self->AssertPendingOOMException(); returnfalse;
}
if (!old_methods.IsNull()) { // Copy the old contents.
new_methods->Memcpy(0,
old_methods.Get(), 0,
old_methods->GetLength(),
cl->GetImagePointerSize());
new_dex_caches->AsObjectArray<Object>()->AssignableCheckingMemcpy<false>( 0, old_dex_caches->AsObjectArray<Object>(), 0, old_dex_caches->GetLength(), false);
} // Set the fields.
h_this->SetObsoleteArrays(new_methods.Get(), new_dex_caches.Get());
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.10Bemerkung:
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.