changeset 52582:9d3a00c8c047

8210864: Reduce the use of metaspaceShared.hpp Reviewed-by: coleenp, lfoltan
author iklam
date Tue, 18 Sep 2018 21:46:17 -0700
parents feb4c9e03aed
children 3efead10e303
files src/hotspot/share/classfile/javaClasses.cpp src/hotspot/share/classfile/stringTable.cpp src/hotspot/share/gc/g1/g1CollectedHeap.cpp src/hotspot/share/gc/serial/markSweep.inline.hpp src/hotspot/share/memory/heapShared.cpp src/hotspot/share/memory/metaspaceShared.cpp src/hotspot/share/memory/metaspaceShared.hpp src/hotspot/share/memory/metaspaceShared.inline.hpp src/hotspot/share/oops/oop.cpp src/hotspot/share/oops/oop.hpp src/hotspot/share/oops/oop.inline.hpp src/hotspot/share/prims/whitebox.cpp src/hotspot/share/runtime/flags/jvmFlagRangeList.hpp
diffstat 13 files changed, 56 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/javaClasses.cpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -37,7 +37,7 @@
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/oopFactory.hpp"
-#include "memory/metaspaceShared.hpp"
+#include "memory/metaspaceShared.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/fieldStreams.hpp"
--- a/src/hotspot/share/classfile/stringTable.cpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/classfile/stringTable.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -35,7 +35,7 @@
 #include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
-#include "memory/metaspaceShared.hpp"
+#include "memory/metaspaceShared.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/access.inline.hpp"
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -79,7 +79,7 @@
 #include "logging/log.hpp"
 #include "memory/allocation.hpp"
 #include "memory/iterator.hpp"
-#include "memory/metaspaceShared.hpp"
+#include "memory/metaspaceShared.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/access.inline.hpp"
 #include "oops/compressedOops.inline.hpp"
--- a/src/hotspot/share/gc/serial/markSweep.inline.hpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/gc/serial/markSweep.inline.hpp	Tue Sep 18 21:46:17 2018 -0700
@@ -27,7 +27,6 @@
 
 #include "classfile/classLoaderData.inline.hpp"
 #include "gc/serial/markSweep.hpp"
-#include "memory/metaspaceShared.hpp"
 #include "memory/universe.hpp"
 #include "oops/markOop.inline.hpp"
 #include "oops/access.inline.hpp"
--- a/src/hotspot/share/memory/heapShared.cpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/memory/heapShared.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -33,7 +33,7 @@
 #include "memory/iterator.inline.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/metaspaceClosure.hpp"
-#include "memory/metaspaceShared.hpp"
+#include "memory/metaspaceShared.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/compressedOops.inline.hpp"
 #include "oops/oop.inline.hpp"
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -65,7 +65,6 @@
 #include "utilities/defaultStream.hpp"
 #include "utilities/hashtable.inline.hpp"
 #if INCLUDE_G1GC
-#include "gc/g1/g1Allocator.inline.hpp"
 #include "gc/g1/g1CollectedHeap.hpp"
 #endif
 
@@ -1966,10 +1965,6 @@
   }
 }
 
-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 Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.hpp	Tue Sep 18 21:46:17 2018 -0700
@@ -125,7 +125,7 @@
   }
 #endif
 
-  static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
+  inline 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);)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/memory/metaspaceShared.inline.hpp	Tue Sep 18 21:46:17 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_MEMORY_METASPACESHARED_INLINE_HPP
+#define SHARE_VM_MEMORY_METASPACESHARED_INLINE_HPP
+
+#include "memory/metaspaceShared.hpp"
+#if INCLUDE_G1GC
+#include "gc/g1/g1Allocator.inline.hpp"
+#endif
+
+#if INCLUDE_CDS_JAVA_HEAP
+bool MetaspaceShared::is_archive_object(oop p) {
+  return (p == NULL) ? false : G1ArchiveAllocator::is_archive_object(p);
+}
+#endif
+
+#endif // SHARE_VM_MEMORY_METASPACESHARED_INLINE_HPP
--- a/src/hotspot/share/oops/oop.cpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/oops/oop.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.inline.hpp"
+#include "memory/metaspaceShared.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/access.inline.hpp"
 #include "oops/oop.inline.hpp"
@@ -141,6 +142,12 @@
   if (!Universe::heap()->is_in_reserved(this)) return false;
   return mark()->is_unlocked();
 }
+
+#if INCLUDE_CDS_JAVA_HEAP
+bool oopDesc::is_archive_object(oop p) {
+  return MetaspaceShared::is_archive_object(p);
+}
+#endif
 #endif // PRODUCT
 
 VerifyOopClosure VerifyOopClosure::verify_oop;
--- a/src/hotspot/share/oops/oop.hpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/oops/oop.hpp	Tue Sep 18 21:46:17 2018 -0700
@@ -256,6 +256,7 @@
   static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
 #ifndef PRODUCT
   inline bool is_unlocked_oop() const;
+  static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
 #endif
 
   // garbage collection
--- a/src/hotspot/share/oops/oop.inline.hpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/oops/oop.inline.hpp	Tue Sep 18 21:46:17 2018 -0700
@@ -26,7 +26,6 @@
 #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"
@@ -352,8 +351,8 @@
          "forwarding to something not aligned");
   assert(Universe::heap()->is_in_reserved(p),
          "forwarding to something not in heap");
-  assert(!MetaspaceShared::is_archive_object(oop(this)) &&
-         !MetaspaceShared::is_archive_object(p),
+  assert(!is_archive_object(oop(this)) &&
+         !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 Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Sep 18 21:46:17 2018 -0700
@@ -37,7 +37,7 @@
 #include "gc/shared/genCollectedHeap.hpp"
 #include "jvmtifiles/jvmtiEnv.hpp"
 #include "memory/metadataFactory.hpp"
-#include "memory/metaspaceShared.hpp"
+#include "memory/metaspaceShared.inline.hpp"
 #include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
--- a/src/hotspot/share/runtime/flags/jvmFlagRangeList.hpp	Tue Sep 18 19:44:27 2018 -0700
+++ b/src/hotspot/share/runtime/flags/jvmFlagRangeList.hpp	Tue Sep 18 21:46:17 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_RUNTIME_JVMFLAGRANGELIST_HPP
 #define SHARE_VM_RUNTIME_JVMFLAGRANGELIST_HPP
 
-#include "memory/metaspaceShared.hpp"
 #include "runtime/flags/jvmFlag.hpp"
 #include "utilities/growableArray.hpp"