Skip to content

Commit 4fc72b8

Browse files
committedMar 4, 2025
8351082: Remove dead code for estimating CDS archive size
Reviewed-by: ccheung
1 parent b6e2d66 commit 4fc72b8

7 files changed

+1
-65
lines changed
 

‎src/hotspot/share/classfile/compactHashtable.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,6 @@ CompactHashtableWriter::~CompactHashtableWriter() {
7272
FREE_C_HEAP_ARRAY(GrowableArray<Entry>*, _buckets);
7373
}
7474

75-
size_t CompactHashtableWriter::estimate_size(int num_entries) {
76-
int num_buckets = calculate_num_buckets(num_entries);
77-
size_t bucket_bytes = ArchiveBuilder::ro_array_bytesize<u4>(num_buckets + 1);
78-
79-
// In worst case, we have no VALUE_ONLY_BUCKET_TYPE, so each entry takes 2 slots
80-
int entries_space = 2 * num_entries;
81-
size_t entry_bytes = ArchiveBuilder::ro_array_bytesize<u4>(entries_space);
82-
83-
return bucket_bytes
84-
+ entry_bytes
85-
+ SimpleCompactHashtable::calculate_header_size();
86-
}
87-
8875
// Add a symbol entry to the temporary hash table
8976
void CompactHashtableWriter::add(unsigned int hash, u4 value) {
9077
int index = hash % _num_buckets;

‎src/hotspot/share/classfile/compactHashtable.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ class CompactHashtableWriter: public StackObj {
134134

135135
public:
136136
void dump(SimpleCompactHashtable *cht, const char* table_name);
137-
138-
static size_t estimate_size(int num_entries);
139137
};
140138
#endif // INCLUDE_CDS
141139

‎src/hotspot/share/classfile/moduleEntry.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -207,7 +207,6 @@ class ModuleEntry : public CHeapObj<mtModule> {
207207
void load_from_archive(ClassLoaderData* loader_data);
208208
void restore_archived_oops(ClassLoaderData* loader_data);
209209
void clear_archived_oops();
210-
void update_oops_in_archived_module(int root_oop_index);
211210
static void verify_archived_module_entries() PRODUCT_RETURN;
212211
#endif
213212
};

‎src/hotspot/share/classfile/symbolTable.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -705,13 +705,6 @@ void SymbolTable::copy_shared_symbol_table(GrowableArray<Symbol*>* symbols,
705705
}
706706
}
707707

708-
size_t SymbolTable::estimate_size_for_archive() {
709-
if (_items_count > (size_t)max_jint) {
710-
fatal("Too many symbols to be archived: %zu", _items_count);
711-
}
712-
return CompactHashtableWriter::estimate_size(int(_items_count));
713-
}
714-
715708
void SymbolTable::write_to_archive(GrowableArray<Symbol*>* symbols) {
716709
CompactHashtableWriter writer(int(_items_count), ArchiveBuilder::symbol_stats());
717710
copy_shared_symbol_table(symbols, &writer);

‎src/hotspot/share/classfile/symbolTable.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ class SymbolTable : public AllStatic {
161161
static void copy_shared_symbol_table(GrowableArray<Symbol*>* symbols,
162162
CompactHashtableWriter* ch_table);
163163
public:
164-
static size_t estimate_size_for_archive() NOT_CDS_RETURN_(0);
165164
static void write_to_archive(GrowableArray<Symbol*>* symbols) NOT_CDS_RETURN;
166165
static void serialize_shared_table_header(SerializeClosure* soc,
167166
bool is_static_archive = true) NOT_CDS_RETURN;

‎src/hotspot/share/classfile/systemDictionaryShared.cpp

-39
Original file line numberDiff line numberDiff line change
@@ -1223,45 +1223,6 @@ bool SystemDictionaryShared::is_supported_invokedynamic(BootstrapInfo* bsi) {
12231223
return false;
12241224
}
12251225

1226-
class EstimateSizeForArchive : StackObj {
1227-
size_t _shared_class_info_size;
1228-
int _num_builtin_klasses;
1229-
int _num_unregistered_klasses;
1230-
1231-
public:
1232-
EstimateSizeForArchive() {
1233-
_shared_class_info_size = 0;
1234-
_num_builtin_klasses = 0;
1235-
_num_unregistered_klasses = 0;
1236-
}
1237-
1238-
void do_entry(InstanceKlass* k, DumpTimeClassInfo& info) {
1239-
if (!info.is_excluded()) {
1240-
size_t byte_size = info.runtime_info_bytesize();
1241-
_shared_class_info_size += align_up(byte_size, SharedSpaceObjectAlignment);
1242-
}
1243-
}
1244-
1245-
size_t total() {
1246-
return _shared_class_info_size;
1247-
}
1248-
};
1249-
1250-
size_t SystemDictionaryShared::estimate_size_for_archive() {
1251-
EstimateSizeForArchive est;
1252-
_dumptime_table->iterate_all_live_classes(&est);
1253-
size_t total_size = est.total() +
1254-
CompactHashtableWriter::estimate_size(_dumptime_table->count_of(true)) +
1255-
CompactHashtableWriter::estimate_size(_dumptime_table->count_of(false));
1256-
1257-
size_t bytesize = align_up(sizeof(RunTimeLambdaProxyClassInfo), SharedSpaceObjectAlignment);
1258-
total_size +=
1259-
(bytesize * _dumptime_lambda_proxy_class_dictionary->_count) +
1260-
CompactHashtableWriter::estimate_size(_dumptime_lambda_proxy_class_dictionary->_count);
1261-
1262-
return total_size;
1263-
}
1264-
12651226
unsigned int SystemDictionaryShared::hash_for_shared_dictionary(address ptr) {
12661227
if (ArchiveBuilder::is_active()) {
12671228
uintx offset = ArchiveBuilder::current()->any_to_offset(ptr);

‎src/hotspot/share/classfile/systemDictionaryShared.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ class SystemDictionaryShared: public SystemDictionary {
294294
static void set_excluded_locked(InstanceKlass* k);
295295
static bool warn_excluded(InstanceKlass* k, const char* reason);
296296
static void dumptime_classes_do(class MetaspaceClosure* it);
297-
static size_t estimate_size_for_archive();
298297
static void write_to_archive(bool is_static_archive = true);
299298
static void adjust_lambda_proxy_class_dictionary();
300299
static void serialize_dictionary_headers(class SerializeClosure* soc,

0 commit comments

Comments
 (0)
Please sign in to comment.