8351082: Remove dead code for estimating CDS archive size

Reviewed-by: ccheung
This commit is contained in:
Ioi Lam 2025-03-04 05:23:30 +00:00
parent b6e2d66cc4
commit 4fc72b8e4b
7 changed files with 1 additions and 65 deletions

View File

@ -72,19 +72,6 @@ CompactHashtableWriter::~CompactHashtableWriter() {
FREE_C_HEAP_ARRAY(GrowableArray<Entry>*, _buckets);
}
size_t CompactHashtableWriter::estimate_size(int num_entries) {
int num_buckets = calculate_num_buckets(num_entries);
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 = ArchiveBuilder::ro_array_bytesize<u4>(entries_space);
return bucket_bytes
+ entry_bytes
+ SimpleCompactHashtable::calculate_header_size();
}
// Add a symbol entry to the temporary hash table
void CompactHashtableWriter::add(unsigned int hash, u4 value) {
int index = hash % _num_buckets;

View File

@ -134,8 +134,6 @@ private:
public:
void dump(SimpleCompactHashtable *cht, const char* table_name);
static size_t estimate_size(int num_entries);
};
#endif // INCLUDE_CDS

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -207,7 +207,6 @@ public:
void load_from_archive(ClassLoaderData* loader_data);
void restore_archived_oops(ClassLoaderData* loader_data);
void clear_archived_oops();
void update_oops_in_archived_module(int root_oop_index);
static void verify_archived_module_entries() PRODUCT_RETURN;
#endif
};

View File

@ -705,13 +705,6 @@ void SymbolTable::copy_shared_symbol_table(GrowableArray<Symbol*>* symbols,
}
}
size_t SymbolTable::estimate_size_for_archive() {
if (_items_count > (size_t)max_jint) {
fatal("Too many symbols to be archived: %zu", _items_count);
}
return CompactHashtableWriter::estimate_size(int(_items_count));
}
void SymbolTable::write_to_archive(GrowableArray<Symbol*>* symbols) {
CompactHashtableWriter writer(int(_items_count), ArchiveBuilder::symbol_stats());
copy_shared_symbol_table(symbols, &writer);

View File

@ -161,7 +161,6 @@ private:
static void copy_shared_symbol_table(GrowableArray<Symbol*>* symbols,
CompactHashtableWriter* ch_table);
public:
static size_t estimate_size_for_archive() NOT_CDS_RETURN_(0);
static void write_to_archive(GrowableArray<Symbol*>* symbols) NOT_CDS_RETURN;
static void serialize_shared_table_header(SerializeClosure* soc,
bool is_static_archive = true) NOT_CDS_RETURN;

View File

@ -1223,45 +1223,6 @@ bool SystemDictionaryShared::is_supported_invokedynamic(BootstrapInfo* bsi) {
return false;
}
class EstimateSizeForArchive : StackObj {
size_t _shared_class_info_size;
int _num_builtin_klasses;
int _num_unregistered_klasses;
public:
EstimateSizeForArchive() {
_shared_class_info_size = 0;
_num_builtin_klasses = 0;
_num_unregistered_klasses = 0;
}
void do_entry(InstanceKlass* k, DumpTimeClassInfo& info) {
if (!info.is_excluded()) {
size_t byte_size = info.runtime_info_bytesize();
_shared_class_info_size += align_up(byte_size, SharedSpaceObjectAlignment);
}
}
size_t total() {
return _shared_class_info_size;
}
};
size_t SystemDictionaryShared::estimate_size_for_archive() {
EstimateSizeForArchive est;
_dumptime_table->iterate_all_live_classes(&est);
size_t total_size = est.total() +
CompactHashtableWriter::estimate_size(_dumptime_table->count_of(true)) +
CompactHashtableWriter::estimate_size(_dumptime_table->count_of(false));
size_t bytesize = align_up(sizeof(RunTimeLambdaProxyClassInfo), SharedSpaceObjectAlignment);
total_size +=
(bytesize * _dumptime_lambda_proxy_class_dictionary->_count) +
CompactHashtableWriter::estimate_size(_dumptime_lambda_proxy_class_dictionary->_count);
return total_size;
}
unsigned int SystemDictionaryShared::hash_for_shared_dictionary(address ptr) {
if (ArchiveBuilder::is_active()) {
uintx offset = ArchiveBuilder::current()->any_to_offset(ptr);

View File

@ -294,7 +294,6 @@ public:
static void set_excluded_locked(InstanceKlass* k);
static bool warn_excluded(InstanceKlass* k, const char* reason);
static void dumptime_classes_do(class MetaspaceClosure* it);
static size_t estimate_size_for_archive();
static void write_to_archive(bool is_static_archive = true);
static void adjust_lambda_proxy_class_dictionary();
static void serialize_dictionary_headers(class SerializeClosure* soc,