< prev index next >

src/hotspot/share/classfile/stringTable.cpp

Print this page




 427 // See StringTable::verify_and_compare() below for exhaustive verification.
 428 void StringTable::verify() {
 429   for (int i = 0; i < the_table()->table_size(); ++i) {
 430     HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
 431     for ( ; p != NULL; p = p->next()) {
 432       oop s = string_object_no_keepalive(p);
 433       guarantee(s != NULL, "interned string is NULL");
 434       unsigned int h = hash_string(s);
 435       guarantee(p->hash() == h, "broken hash in string table entry");
 436       guarantee(the_table()->hash_to_index(h) == i,
 437                 "wrong index in string table");
 438     }
 439   }
 440 }
 441 
 442 void StringTable::dump(outputStream* st, bool verbose) {
 443   if (!verbose) {
 444     the_table()->print_table_statistics(st, "StringTable");
 445   } else {
 446     Thread* THREAD = Thread::current();
 447     st->print_cr("VERSION: 1.1");
 448     for (int i = 0; i < the_table()->table_size(); ++i) {
 449       HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
 450       for ( ; p != NULL; p = p->next()) {
 451         oop s = string_object_no_keepalive(p);
 452         typeArrayOop value     = java_lang_String::value_no_keepalive(s);
 453         int          length    = java_lang_String::length(s);
 454         bool         is_latin1 = java_lang_String::is_latin1(s);
 455 
 456         if (length <= 0) {
 457           st->print("%d: ", length);
 458         } else {
 459           ResourceMark rm(THREAD);
 460           int utf8_length = length;
 461           char* utf8_string;
 462 
 463           if (!is_latin1) {
 464             jchar* chars = value->char_at_addr(0);
 465             utf8_string = UNICODE::as_utf8(chars, utf8_length);
 466           } else {
 467             jbyte* bytes = value->byte_at_addr(0);




 427 // See StringTable::verify_and_compare() below for exhaustive verification.
 428 void StringTable::verify() {
 429   for (int i = 0; i < the_table()->table_size(); ++i) {
 430     HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
 431     for ( ; p != NULL; p = p->next()) {
 432       oop s = string_object_no_keepalive(p);
 433       guarantee(s != NULL, "interned string is NULL");
 434       unsigned int h = hash_string(s);
 435       guarantee(p->hash() == h, "broken hash in string table entry");
 436       guarantee(the_table()->hash_to_index(h) == i,
 437                 "wrong index in string table");
 438     }
 439   }
 440 }
 441 
 442 void StringTable::dump(outputStream* st, bool verbose) {
 443   if (!verbose) {
 444     the_table()->print_table_statistics(st, "StringTable");
 445   } else {
 446     Thread* THREAD = Thread::current();
 447     st->print_cr(HASHTABLE_VERSION);
 448     for (int i = 0; i < the_table()->table_size(); ++i) {
 449       HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
 450       for ( ; p != NULL; p = p->next()) {
 451         oop s = string_object_no_keepalive(p);
 452         typeArrayOop value     = java_lang_String::value_no_keepalive(s);
 453         int          length    = java_lang_String::length(s);
 454         bool         is_latin1 = java_lang_String::is_latin1(s);
 455 
 456         if (length <= 0) {
 457           st->print("%d: ", length);
 458         } else {
 459           ResourceMark rm(THREAD);
 460           int utf8_length = length;
 461           char* utf8_string;
 462 
 463           if (!is_latin1) {
 464             jchar* chars = value->char_at_addr(0);
 465             utf8_string = UNICODE::as_utf8(chars, utf8_length);
 466           } else {
 467             jbyte* bytes = value->byte_at_addr(0);


< prev index next >