// Add h_X to the class table.
table.Insert(h_X.Get());
EXPECT_OBJ_PTR_EQ(table.LookupByDescriptor(h_X.Get()), h_X.Get());
EXPECT_OBJ_PTR_EQ(table.Lookup(descriptor_x, ComputeModifiedUtf8Hash(descriptor_x)), h_X.Get());
EXPECT_TRUE(table.Lookup("NOT_THERE", ComputeModifiedUtf8Hash("NOT_THERE")) == nullptr);
EXPECT_EQ(table.NumZygoteClasses(class_loader.Get()), 0u);
EXPECT_EQ(table.NumNonZygoteClasses(class_loader.Get()), 1u);
// Create the zygote snapshot and ensure the accounting is correct.
table.FreezeSnapshot();
EXPECT_EQ(table.NumZygoteClasses(class_loader.Get()), 1u);
EXPECT_EQ(table.NumNonZygoteClasses(class_loader.Get()), 0u);
// Test inserting and related lookup functions.
EXPECT_TRUE(table.LookupByDescriptor(h_Y.Get()) == nullptr);
table.Insert(h_Y.Get());
EXPECT_OBJ_PTR_EQ(table.LookupByDescriptor(h_X.Get()), h_X.Get());
EXPECT_OBJ_PTR_EQ(table.LookupByDescriptor(h_Y.Get()), h_Y.Get());
// Collect all the roots and make sure there is nothing missing.
CollectRootVisitor roots;
table.VisitRoots(roots);
EXPECT_TRUE(roots.roots_.find(h_X.Get()) != roots.roots_.end());
EXPECT_TRUE(roots.roots_.find(h_Y.Get()) != roots.roots_.end());
EXPECT_TRUE(roots.roots_.find(obj_X.Get()) != roots.roots_.end());
// Test that reading a class set from memory works.
ClassTable::ClassSet temp_set;
table.Visit([&temp_set](ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_) {
temp_set.insert(ClassTable::TableSlot(klass)); returntrue;
}); const size_t count = temp_set.WriteToMemory(nullptr);
std::unique_ptr<uint8_t[]> buffer(new uint8_t[count]());
ASSERT_EQ(temp_set.WriteToMemory(&buffer[0]), count);
ClassTable table2;
size_t count2 = table2.ReadFromMemory(&buffer[0]);
EXPECT_EQ(count, count2); // Strong roots are not serialized, only classes.
EXPECT_OBJ_PTR_EQ(table2.LookupByDescriptor(h_X.Get()), h_X.Get());
EXPECT_OBJ_PTR_EQ(table2.LookupByDescriptor(h_Y.Get()), h_Y.Get());
// TODO: Add tests for UpdateClass, InsertOatFile.
}
} // namespace mirror
} // namespace art
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.13Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-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.