src/hotspot/share/classfile/stringTable.cpp
changeset 52062 8dbf1a13af49
parent 52047 7bc8b456e5ac
child 52402 72d4e10305b9
equal deleted inserted replaced
52061:070186461dbb 52062:8dbf1a13af49
    34 #include "logging/log.hpp"
    34 #include "logging/log.hpp"
    35 #include "logging/logStream.hpp"
    35 #include "logging/logStream.hpp"
    36 #include "memory/allocation.inline.hpp"
    36 #include "memory/allocation.inline.hpp"
    37 #include "memory/filemap.hpp"
    37 #include "memory/filemap.hpp"
    38 #include "memory/heapShared.inline.hpp"
    38 #include "memory/heapShared.inline.hpp"
    39 #include "memory/metaspaceShared.inline.hpp"
       
    40 #include "memory/resourceArea.hpp"
    39 #include "memory/resourceArea.hpp"
    41 #include "memory/universe.hpp"
    40 #include "memory/universe.hpp"
    42 #include "oops/access.inline.hpp"
    41 #include "oops/access.inline.hpp"
    43 #include "oops/oop.inline.hpp"
    42 #include "oops/oop.inline.hpp"
    44 #include "oops/typeArrayOop.inline.hpp"
    43 #include "oops/typeArrayOop.inline.hpp"
   796 }
   795 }
   797 
   796 
   798 oop StringTable::create_archived_string(oop s, Thread* THREAD) {
   797 oop StringTable::create_archived_string(oop s, Thread* THREAD) {
   799   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
   798   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
   800 
   799 
   801   if (MetaspaceShared::is_archive_object(s)) {
   800   if (HeapShared::is_archived_object(s)) {
   802     return s;
   801     return s;
   803   }
   802   }
   804 
   803 
   805   oop new_s = NULL;
   804   oop new_s = NULL;
   806   typeArrayOop v = java_lang_String::value_no_keepalive(s);
   805   typeArrayOop v = java_lang_String::value_no_keepalive(s);
   807   typeArrayOop new_v =
   806   typeArrayOop new_v = (typeArrayOop)HeapShared::archive_heap_object(v, THREAD);
   808     (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
       
   809   if (new_v == NULL) {
   807   if (new_v == NULL) {
   810     return NULL;
   808     return NULL;
   811   }
   809   }
   812   new_s = MetaspaceShared::archive_heap_object(s, THREAD);
   810   new_s = HeapShared::archive_heap_object(s, THREAD);
   813   if (new_s == NULL) {
   811   if (new_s == NULL) {
   814     return NULL;
   812     return NULL;
   815   }
   813   }
   816 
   814 
   817   // adjust the pointer to the 'value' field in the new String oop
   815   // adjust the pointer to the 'value' field in the new String oop
   845     return true;
   843     return true;
   846   }
   844   }
   847 };
   845 };
   848 
   846 
   849 void StringTable::copy_shared_string_table(CompactHashtableWriter* writer) {
   847 void StringTable::copy_shared_string_table(CompactHashtableWriter* writer) {
   850   assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
   848   assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
   851 
   849 
   852   CopyToArchive copy(writer);
   850   CopyToArchive copy(writer);
   853   StringTable::the_table()->_local_table->do_scan(Thread::current(), copy);
   851   StringTable::the_table()->_local_table->do_scan(Thread::current(), copy);
   854 }
   852 }
   855 
   853 
   856 void StringTable::write_to_archive() {
   854 void StringTable::write_to_archive() {
   857   assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
   855   assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
   858 
   856 
   859   _shared_table.reset();
   857   _shared_table.reset();
   860   int num_buckets = CompactHashtableWriter::default_num_buckets(
   858   int num_buckets = CompactHashtableWriter::default_num_buckets(
   861       StringTable::the_table()->_items_count);
   859       StringTable::the_table()->_items_count);
   862   CompactHashtableWriter writer(num_buckets,
   860   CompactHashtableWriter writer(num_buckets,