< prev index next >

src/hotspot/share/classfile/stringTable.cpp

Print this page




 562   if (obj == NULL) {
 563     return 0;
 564   } else if (obj->klass() == SystemDictionary::String_klass()) {
 565     return (obj->size() + java_lang_String::value(obj)->size()) * HeapWordSize;
 566   } else {
 567     return obj->size();
 568   }
 569 }
 570 
 571 struct SizeFunc : StackObj {
 572   size_t operator()(WeakHandle<vm_string_table_data>* val) {
 573     oop s = val->peek();
 574     if (s == NULL) {
 575       // Dead
 576       return 0;
 577     }
 578     return literal_size(s);
 579   };
 580 };
 581 







 582 void StringTable::print_table_statistics(outputStream* st,
 583                                          const char* table_name) {
 584   SizeFunc sz;
 585   _local_table->statistics_to(Thread::current(), sz, st, table_name);
 586 }
 587 
 588 // Verification
 589 class VerifyStrings : StackObj {
 590  public:
 591   bool operator()(WeakHandle<vm_string_table_data>* val) {
 592     oop s = val->peek();
 593     if (s != NULL) {
 594       assert(java_lang_String::length(s) >= 0, "Length on string must work.");
 595     }
 596     return true;
 597   };
 598 };
 599 
 600 // This verification is part of Universe::verify() and needs to be quick.
 601 void StringTable::verify() {




 562   if (obj == NULL) {
 563     return 0;
 564   } else if (obj->klass() == SystemDictionary::String_klass()) {
 565     return (obj->size() + java_lang_String::value(obj)->size()) * HeapWordSize;
 566   } else {
 567     return obj->size();
 568   }
 569 }
 570 
 571 struct SizeFunc : StackObj {
 572   size_t operator()(WeakHandle<vm_string_table_data>* val) {
 573     oop s = val->peek();
 574     if (s == NULL) {
 575       // Dead
 576       return 0;
 577     }
 578     return literal_size(s);
 579   };
 580 };
 581 
 582 TableStatistics StringTable::get_table_statistics() {
 583   static TableStatistics ts;
 584   SizeFunc sz;
 585   ts = _local_table->statistics_get(Thread::current(), sz, ts);
 586   return ts;
 587 }
 588 
 589 void StringTable::print_table_statistics(outputStream* st,
 590                                          const char* table_name) {
 591   SizeFunc sz;
 592   _local_table->statistics_to(Thread::current(), sz, st, table_name);
 593 }
 594 
 595 // Verification
 596 class VerifyStrings : StackObj {
 597  public:
 598   bool operator()(WeakHandle<vm_string_table_data>* val) {
 599     oop s = val->peek();
 600     if (s != NULL) {
 601       assert(java_lang_String::length(s) >= 0, "Length on string must work.");
 602     }
 603     return true;
 604   };
 605 };
 606 
 607 // This verification is part of Universe::verify() and needs to be quick.
 608 void StringTable::verify() {


< prev index next >