< prev index next >
src/share/vm/classfile/stringTable.cpp
Print this page
@@ -31,10 +31,11 @@
#include "gc/shared/collectedHeap.inline.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
+#include "memory/metaspaceShared.hpp"
#include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/mutexLocker.hpp"
#include "utilities/hashtable.inline.hpp"
@@ -728,24 +729,26 @@
java_lang_String::set_hash(new_s, hash);
}
// add to the compact table
writer->add(hash, new_s);
+
+ MetaspaceShared::relocate_klass_ptr(new_s);
+ MetaspaceShared::relocate_klass_ptr(new_v);
}
}
G1CollectedHeap::heap()->end_archive_alloc_range(string_space, os::vm_allocation_granularity());
assert(string_space->length() <= 2, "sanity");
#endif
return true;
}
-void StringTable::serialize(SerializeClosure* soc, GrowableArray<MemRegion> *string_space,
+void StringTable::write_to_archive(GrowableArray<MemRegion> *string_space,
size_t* space_size) {
-#if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS)
+#if INCLUDE_CDS
_shared_table.reset();
- if (soc->writing()) {
if (!(UseG1GC && UseCompressedOops && UseCompressedClassPointers)) {
log_info(cds)(
"Shared strings are excluded from the archive as UseG1GC, "
"UseCompressedOops and UseCompressedClassPointers are required."
"Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.",
@@ -764,12 +767,15 @@
*space_size += string_space->at(i).byte_size();
}
writer.dump(&_shared_table);
}
}
- }
+#endif
+}
+void StringTable::serialize(SerializeClosure* soc) {
+#if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS)
_shared_table.set_type(CompactHashtable<oop, char>::_string_table);
_shared_table.serialize(soc);
if (soc->writing()) {
_shared_table.reset(); // Sanity. Make sure we don't use the shared table at dump time
< prev index next >