summaryrefslogtreecommitdiff
path: root/runtime/class_table.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2021-01-15 10:04:45 +0000
committer Vladimir Marko <vmarko@google.com> 2021-01-19 09:11:51 +0000
commit4c796aad94ecf594d3e792da4e5d2424638791da (patch)
tree466b796ded30a136713b7b2756e8fa6d5db6dafb /runtime/class_table.cc
parentdd732cc38f57844bfcedc5687d4b66df7102f31f (diff)
Rewrite class table construction in ImageWriter.
Make sure that class tables in images are at maximum load factor (full) and make that maximum load factor independent of runtime parameters. As we pre-allocate a class table buffer of the right size in ImageWriter, we also avoid unnecessary resizing of the temporary class table. Make sure that app image class tables are deterministic. We previously just copied the class table from the app class loader even though some entries may have been inserted there during multi-threaded phases of the compilation, causing non-deterministic contents based on insertion order. Remove obsolete comment related to patchoat relocations. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: boots. Bug: 175869411 Change-Id: I605048b639f67a5ed4b03eb8888cbaafa9ba4091
Diffstat (limited to 'runtime/class_table.cc')
-rw-r--r--runtime/class_table.cc38
1 files changed, 0 insertions, 38 deletions
diff --git a/runtime/class_table.cc b/runtime/class_table.cc
index cb87ee2f8a..65d976828d 100644
--- a/runtime/class_table.cc
+++ b/runtime/class_table.cc
@@ -146,24 +146,6 @@ void ClassTable::Insert(ObjPtr<mirror::Class> klass) {
classes_.back().InsertWithHash(TableSlot(klass, hash), hash);
}
-void ClassTable::CopyWithoutLocks(const ClassTable& source_table) {
- if (kIsDebugBuild) {
- for (ClassSet& class_set : classes_) {
- CHECK(class_set.empty());
- }
- }
- for (const ClassSet& class_set : source_table.classes_) {
- for (const TableSlot& slot : class_set) {
- classes_.back().insert(slot);
- }
- }
-}
-
-void ClassTable::InsertWithoutLocks(ObjPtr<mirror::Class> klass) {
- const uint32_t hash = TableSlot::HashDescriptor(klass);
- classes_.back().InsertWithHash(TableSlot(klass, hash), hash);
-}
-
void ClassTable::InsertWithHash(ObjPtr<mirror::Class> klass, size_t hash) {
WriterMutexLock mu(Thread::Current(), lock_);
classes_.back().InsertWithHash(TableSlot(klass, hash), hash);
@@ -255,26 +237,6 @@ bool ClassTable::InsertOatFileLocked(const OatFile* oat_file) {
return true;
}
-size_t ClassTable::WriteToMemory(uint8_t* ptr) const {
- ReaderMutexLock mu(Thread::Current(), lock_);
- ClassSet combined;
- // Combine all the class sets in case there are multiple, also adjusts load factor back to
- // default in case classes were pruned.
- for (const ClassSet& class_set : classes_) {
- for (const TableSlot& root : class_set) {
- combined.insert(root);
- }
- }
- const size_t ret = combined.WriteToMemory(ptr);
- // Validity check
- if (kIsDebugBuild && ptr != nullptr) {
- size_t read_count;
- ClassSet class_set(ptr, /*make copy*/false, &read_count);
- class_set.Verify();
- }
- return ret;
-}
-
size_t ClassTable::ReadFromMemory(uint8_t* ptr) {
size_t read_count = 0;
AddClassSet(ClassSet(ptr, /*make copy*/false, &read_count));