< prev index next >

src/hotspot/share/classfile/stringTable.cpp

Print this page
rev 50951 : 8202035: Archive the set of ModuleDescriptor and ModuleReference objects for observable system modules with unnamed initial module.
Summary: Support system module archiving with unnamed initial module at dump time.
Reviewed-by: erikj, coleenp, mchung, iklam, ccheung
Contributed-by: alan.bateman@oracle.com, jiangli.zhou@oracle.com


 768   StringtableDCmd* dcmd = new StringtableDCmd(NULL, false);
 769   if (dcmd != NULL) {
 770     DCmdMark mark(dcmd);
 771     return dcmd->_dcmdparser.num_arguments();
 772   } else {
 773     return 0;
 774   }
 775 }
 776 
 777 // Sharing
 778 #if INCLUDE_CDS_JAVA_HEAP
 779 oop StringTable::lookup_shared(jchar* name, int len, unsigned int hash) {
 780   assert(hash == java_lang_String::hash_code(name, len),
 781          "hash must be computed using java_lang_String::hash_code");
 782   return _shared_table.lookup((const char*)name, hash, len);
 783 }
 784 
 785 oop StringTable::create_archived_string(oop s, Thread* THREAD) {
 786   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
 787 




 788   oop new_s = NULL;
 789   typeArrayOop v = java_lang_String::value_no_keepalive(s);
 790   typeArrayOop new_v =
 791     (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
 792   if (new_v == NULL) {
 793     return NULL;
 794   }
 795   new_s = MetaspaceShared::archive_heap_object(s, THREAD);
 796   if (new_s == NULL) {
 797     return NULL;
 798   }
 799 
 800   // adjust the pointer to the 'value' field in the new String oop
 801   java_lang_String::set_value_raw(new_s, new_v);
 802   return new_s;
 803 }
 804 
 805 struct CopyToArchive : StackObj {
 806   CompactStringTableWriter* _writer;
 807   CopyToArchive(CompactStringTableWriter* writer) : _writer(writer) {}




 768   StringtableDCmd* dcmd = new StringtableDCmd(NULL, false);
 769   if (dcmd != NULL) {
 770     DCmdMark mark(dcmd);
 771     return dcmd->_dcmdparser.num_arguments();
 772   } else {
 773     return 0;
 774   }
 775 }
 776 
 777 // Sharing
 778 #if INCLUDE_CDS_JAVA_HEAP
 779 oop StringTable::lookup_shared(jchar* name, int len, unsigned int hash) {
 780   assert(hash == java_lang_String::hash_code(name, len),
 781          "hash must be computed using java_lang_String::hash_code");
 782   return _shared_table.lookup((const char*)name, hash, len);
 783 }
 784 
 785 oop StringTable::create_archived_string(oop s, Thread* THREAD) {
 786   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
 787 
 788   if (MetaspaceShared::is_archive_object(s)) {
 789     return s;
 790   }
 791 
 792   oop new_s = NULL;
 793   typeArrayOop v = java_lang_String::value_no_keepalive(s);
 794   typeArrayOop new_v =
 795     (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
 796   if (new_v == NULL) {
 797     return NULL;
 798   }
 799   new_s = MetaspaceShared::archive_heap_object(s, THREAD);
 800   if (new_s == NULL) {
 801     return NULL;
 802   }
 803 
 804   // adjust the pointer to the 'value' field in the new String oop
 805   java_lang_String::set_value_raw(new_s, new_v);
 806   return new_s;
 807 }
 808 
 809 struct CopyToArchive : StackObj {
 810   CompactStringTableWriter* _writer;
 811   CopyToArchive(CompactStringTableWriter* writer) : _writer(writer) {}


< prev index next >