8313564: Fix -Wconversion warnings in classfile code

Reviewed-by: matsaave, dholmes
This commit is contained in:
Coleen Phillimore 2023-08-04 14:06:16 +00:00
parent e8a37b90db
commit f66cd5008d
19 changed files with 57 additions and 52 deletions

View file

@ -115,14 +115,14 @@ static inline void log_trace_symboltable_helper(Symbol* sym, const char* msg) {
}
// Pick hashing algorithm.
static uintx hash_symbol(const char* s, int len, bool useAlt) {
static unsigned int hash_symbol(const char* s, int len, bool useAlt) {
return useAlt ?
AltHashing::halfsiphash_32(_alt_hash_seed, (const uint8_t*)s, len) :
java_lang_String::hash_code((const jbyte*)s, len);
}
#if INCLUDE_CDS
static uintx hash_shared_symbol(const char* s, int len) {
static unsigned int hash_shared_symbol(const char* s, int len) {
return java_lang_String::hash_code((const jbyte*)s, len);
}
#endif
@ -237,7 +237,7 @@ void SymbolTable::item_removed() {
}
double SymbolTable::get_load_factor() {
return (double)_items_count/_current_size;
return (double)_items_count/(double)_current_size;
}
size_t SymbolTable::table_size() {
@ -657,6 +657,9 @@ 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));
}
@ -923,14 +926,14 @@ void SymbolTable::print_histogram() {
tty->print_cr(" Total removed " SIZE_FORMAT_W(7), _symbols_removed);
if (_symbols_counted > 0) {
tty->print_cr(" Percent removed %3.2f",
((float)_symbols_removed / _symbols_counted) * 100);
((double)_symbols_removed / (double)_symbols_counted) * 100);
}
tty->print_cr(" Reference counts " SIZE_FORMAT_W(7), Symbol::_total_count);
tty->print_cr(" Symbol arena used " SIZE_FORMAT_W(7) "K", arena()->used() / K);
tty->print_cr(" Symbol arena size " SIZE_FORMAT_W(7) "K", arena()->size_in_bytes() / K);
tty->print_cr(" Total symbol length " SIZE_FORMAT_W(7), hi.total_length);
tty->print_cr(" Maximum symbol length " SIZE_FORMAT_W(7), hi.max_length);
tty->print_cr(" Average symbol length %7.2f", ((float)hi.total_length / hi.total_count));
tty->print_cr(" Average symbol length %7.2f", ((double)hi.total_length / (double)hi.total_count));
tty->print_cr(" Symbol length histogram:");
tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size");
for (size_t i = 0; i < hi.results_length; i++) {