Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/hotspot/share/classfile/stringTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ volatile bool StringTable::_needs_rehashing = false;
OopStorage* StringTable::_oop_storage;

static size_t _current_size = 0;
static volatile int _items_count = 0;
static volatile size_t _items_count = 0;

volatile bool _alt_hash = false;

Expand Down Expand Up @@ -665,7 +665,7 @@ class VerifyCompStrings : StackObj {
string_hash, string_equals> _table;
public:
size_t _errors;
VerifyCompStrings() : _table((_items_count / 8) + 1, 0 /* do not resize */), _errors(0) {}
VerifyCompStrings() : _table(unsigned(_items_count / 8) + 1, 0 /* do not resize */), _errors(0) {}
bool operator()(WeakHandle* val) {
oop s = val->resolve();
if (s == nullptr) {
Expand Down Expand Up @@ -801,11 +801,11 @@ oop StringTable::lookup_shared(const jchar* name, int len) {
// to guarantee because CDS runs with a single Java thread. See JDK-8253495.)
void StringTable::allocate_shared_strings_array(TRAPS) {
assert(DumpSharedSpaces, "must be");
if (_items_count > max_jint) {
fatal("Too many strings to be archived: %d", _items_count);
if (_items_count > (size_t)max_jint) {
fatal("Too many strings to be archived: " SIZE_FORMAT, _items_count);
}

int total = _items_count;
int total = (int)_items_count;
size_t single_array_size = objArrayOopDesc::object_size(total);

log_info(cds)("allocated string table for %d strings", total);
Expand All @@ -825,7 +825,7 @@ void StringTable::allocate_shared_strings_array(TRAPS) {
// This can only happen if you have an extremely large number of classes that
// refer to more than 16384 * 16384 = 26M interned strings! Not a practical concern
// but bail out for safety.
log_error(cds)("Too many strings to be archived: %d", _items_count);
log_error(cds)("Too many strings to be archived: " SIZE_FORMAT, _items_count);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto %zu?

MetaspaceShared::unrecoverable_writing_error();
}

Expand Down Expand Up @@ -888,7 +888,7 @@ oop StringTable::init_shared_table(const DumpedInternedStrings* dumped_interned_
verify_secondary_array_index_bits();

_shared_table.reset();
CompactHashtableWriter writer(_items_count, ArchiveBuilder::string_stats());
CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats());

int index = 0;
auto copy_into_array = [&] (oop string, bool value_ignored) {
Expand Down
9 changes: 6 additions & 3 deletions src/hotspot/share/classfile/symbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static size_t _symbols_removed = 0;
static size_t _symbols_counted = 0;
static size_t _current_size = 0;

static volatile int _items_count = 0;
static volatile size_t _items_count = 0;
static volatile bool _has_items_to_clean = false;


Expand Down Expand Up @@ -657,11 +657,14 @@ void SymbolTable::copy_shared_symbol_table(GrowableArray<Symbol*>* symbols,
}

size_t SymbolTable::estimate_size_for_archive() {
return CompactHashtableWriter::estimate_size(_items_count);
if (_items_count > (size_t)max_jint) {
fatal("Too many symbols to be archived: " SIZE_FORMAT, _items_count);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto %zu?

}
return CompactHashtableWriter::estimate_size(int(_items_count));
}

void SymbolTable::write_to_archive(GrowableArray<Symbol*>* symbols) {
CompactHashtableWriter writer(_items_count, ArchiveBuilder::symbol_stats());
CompactHashtableWriter writer(int(_items_count), ArchiveBuilder::symbol_stats());
copy_shared_symbol_table(symbols, &writer);
if (!DynamicDumpSharedSpaces) {
_shared_table.reset();
Expand Down