mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8261608: Move common CDS archive building code to archiveBuilder.cpp
Reviewed-by: coleenp, ccheung
This commit is contained in:
parent
235da6aa04
commit
d9744f6536
31 changed files with 502 additions and 637 deletions
|
@ -27,10 +27,9 @@
|
|||
#include "classfile/compactHashtable.hpp"
|
||||
#include "classfile/javaClasses.hpp"
|
||||
#include "logging/logMessage.hpp"
|
||||
#include "memory/dynamicArchive.hpp"
|
||||
#include "memory/archiveBuilder.hpp"
|
||||
#include "memory/heapShared.inline.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
#include "memory/metaspaceShared.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/vmThread.hpp"
|
||||
|
@ -74,11 +73,11 @@ CompactHashtableWriter::~CompactHashtableWriter() {
|
|||
|
||||
size_t CompactHashtableWriter::estimate_size(int num_entries) {
|
||||
int num_buckets = calculate_num_buckets(num_entries);
|
||||
size_t bucket_bytes = MetaspaceShared::ro_array_bytesize<u4>(num_buckets + 1);
|
||||
size_t bucket_bytes = ArchiveBuilder::ro_array_bytesize<u4>(num_buckets + 1);
|
||||
|
||||
// In worst case, we have no VALUE_ONLY_BUCKET_TYPE, so each entry takes 2 slots
|
||||
int entries_space = 2 * num_entries;
|
||||
size_t entry_bytes = MetaspaceShared::ro_array_bytesize<u4>(entries_space);
|
||||
size_t entry_bytes = ArchiveBuilder::ro_array_bytesize<u4>(entries_space);
|
||||
|
||||
return bucket_bytes
|
||||
+ entry_bytes
|
||||
|
@ -109,8 +108,8 @@ void CompactHashtableWriter::allocate_table() {
|
|||
"Too many entries.");
|
||||
}
|
||||
|
||||
_compact_buckets = MetaspaceShared::new_ro_array<u4>(_num_buckets + 1);
|
||||
_compact_entries = MetaspaceShared::new_ro_array<u4>(entries_space);
|
||||
_compact_buckets = ArchiveBuilder::new_ro_array<u4>(_num_buckets + 1);
|
||||
_compact_entries = ArchiveBuilder::new_ro_array<u4>(entries_space);
|
||||
|
||||
_stats->bucket_count = _num_buckets;
|
||||
_stats->bucket_bytes = align_up(_compact_buckets->size() * BytesPerWord,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue