--- a/src/hotspot/share/oops/oop.cpp Thu Sep 05 08:26:44 2019 +0200
+++ b/src/hotspot/share/oops/oop.cpp Thu Sep 05 08:26:49 2019 +0200
@@ -35,6 +35,7 @@
#include "runtime/handles.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/copy.hpp"
+#include "utilities/macros.hpp"
bool always_do_update_barrier = false;
@@ -123,14 +124,6 @@
return obj == NULL ? true : is_oop(obj, ignore_mark_word);
}
-#ifndef PRODUCT
-#if INCLUDE_CDS_JAVA_HEAP
-bool oopDesc::is_archived_object(oop p) {
- return HeapShared::is_archived_object(p);
-}
-#endif
-#endif // PRODUCT
-
VerifyOopClosure VerifyOopClosure::verify_oop;
template <class T> void VerifyOopClosure::do_oop_work(T* p) {
@@ -215,3 +208,13 @@
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); }
+
+#ifdef ASSERT
+void oopDesc::verify_forwardee(oop forwardee) {
+ Universe::heap()->check_oop_location(forwardee);
+#if INCLUDE_CDS_JAVA_HEAP
+ assert(!HeapShared::is_archived_object(forwardee) && !HeapShared::is_archived_object(this),
+ "forwarding archive object");
+#endif
+}
+#endif