8202709: Move oopDesc::is_archive_object to MetaspaceShared::is_archive_object
Reviewed-by: ehelin, jiangli
--- a/src/hotspot/share/classfile/javaClasses.cpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp Mon May 07 14:57:23 2018 +0200
@@ -768,7 +768,7 @@
{
assert(fd->signature() == vmSymbols::string_signature(),
"just checking");
- if (DumpSharedSpaces && oopDesc::is_archive_object(mirror())) {
+ if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) {
// Archive the String field and update the pointer.
oop s = mirror()->obj_field(fd->offset());
oop archived_s = StringTable::create_archived_string(s, CHECK);
@@ -809,7 +809,7 @@
if (MetaspaceShared::open_archive_heap_region_mapped()) {
oop m = k->archived_java_mirror();
assert(m != NULL, "archived mirror is NULL");
- assert(oopDesc::is_archive_object(m), "must be archived mirror object");
+ assert(MetaspaceShared::is_archive_object(m), "must be archived mirror object");
Handle m_h(THREAD, m);
// restore_archived_mirror() clears the klass' _has_raw_archived_mirror flag
restore_archived_mirror(k, m_h, Handle(), Handle(), Handle(), CHECK);
--- a/src/hotspot/share/memory/metaspaceShared.cpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp Mon May 07 14:57:23 2018 +0200
@@ -1922,6 +1922,10 @@
}
}
+bool MetaspaceShared::is_archive_object(oop p) {
+ return (p == NULL) ? false : G1ArchiveAllocator::is_archive_object(p);
+}
+
void MetaspaceShared::fixup_mapped_heap_regions() {
FileMapInfo *mapinfo = FileMapInfo::current_info();
mapinfo->fixup_mapped_heap_regions();
--- a/src/hotspot/share/memory/metaspaceShared.hpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.hpp Mon May 07 14:57:23 2018 +0200
@@ -113,6 +113,9 @@
static oop archive_heap_object(oop obj, Thread* THREAD);
static void archive_klass_objects(Thread* THREAD);
#endif
+
+ static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
+
static bool is_heap_object_archiving_allowed() {
CDS_JAVA_HEAP_ONLY(return (UseG1GC && UseCompressedOops && UseCompressedClassPointers);)
NOT_CDS_JAVA_HEAP(return false;)
--- a/src/hotspot/share/oops/klass.cpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/oops/klass.cpp Mon May 07 14:57:23 2018 +0200
@@ -536,7 +536,7 @@
log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
if (m != NULL) {
// mirror is archived, restore
- assert(oopDesc::is_archive_object(m), "must be archived mirror object");
+ assert(MetaspaceShared::is_archive_object(m), "must be archived mirror object");
Handle m_h(THREAD, m);
java_lang_Class::restore_archived_mirror(this, m_h, loader, module_handle, protection_domain, CHECK);
return;
--- a/src/hotspot/share/oops/oop.cpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/oops/oop.cpp Mon May 07 14:57:23 2018 +0200
@@ -32,9 +32,6 @@
#include "runtime/handles.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/copy.hpp"
-#if INCLUDE_G1GC
-#include "gc/g1/g1Allocator.inline.hpp"
-#endif
bool always_do_update_barrier = false;
@@ -214,9 +211,3 @@
jdouble oopDesc::double_field_acquire(int offset) const { return HeapAccess<MO_ACQUIRE>::load_at(as_oop(), offset); }
void oopDesc::release_double_field_put(int offset, jdouble value) { HeapAccess<MO_RELEASE>::store_at(as_oop(), offset, value); }
-
-#if INCLUDE_CDS_JAVA_HEAP
-bool oopDesc::is_archive_object(oop p) {
- return (p == NULL) ? false : G1ArchiveAllocator::is_archive_object(p);
-}
-#endif
--- a/src/hotspot/share/oops/oop.hpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/oops/oop.hpp Mon May 07 14:57:23 2018 +0200
@@ -339,8 +339,6 @@
assert(has_klass_gap(), "only applicable to compressed klass pointers");
return klass_offset_in_bytes() + sizeof(narrowKlass);
}
-
- static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
};
#endif // SHARE_VM_OOPS_OOP_HPP
--- a/src/hotspot/share/oops/oop.inline.hpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/oops/oop.inline.hpp Mon May 07 14:57:23 2018 +0200
@@ -26,6 +26,7 @@
#define SHARE_VM_OOPS_OOP_INLINE_HPP
#include "gc/shared/collectedHeap.hpp"
+#include "memory/metaspaceShared.hpp"
#include "oops/access.inline.hpp"
#include "oops/arrayKlass.hpp"
#include "oops/arrayOop.hpp"
@@ -329,8 +330,8 @@
"forwarding to something not aligned");
assert(Universe::heap()->is_in_reserved(p),
"forwarding to something not in heap");
- assert(!is_archive_object(oop(this)) &&
- !is_archive_object(p),
+ assert(!MetaspaceShared::is_archive_object(oop(this)) &&
+ !MetaspaceShared::is_archive_object(p),
"forwarding archive object");
markOop m = markOopDesc::encode_pointer_as_mark(p);
assert(m->decode_pointer() == p, "encoding must be reversable");
--- a/src/hotspot/share/prims/whitebox.cpp Tue May 08 12:16:52 2018 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp Mon May 07 14:57:23 2018 +0200
@@ -1713,7 +1713,7 @@
WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
oop obj_oop = JNIHandles::resolve(obj);
- return oopDesc::is_archive_object(obj_oop);
+ return MetaspaceShared::is_archive_object(obj_oop);
WB_END
WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))