8232650: ZGC: Add initialization hooks for OS specific code
authorstefank
Mon, 28 Oct 2019 11:26:53 +0100
changeset 58814 bfb419c66ae9
parent 58813 67009d58dd70
child 58815 a4cdca87152b
8232650: ZGC: Add initialization hooks for OS specific code Reviewed-by: pliden, eosterlund
src/hotspot/os/posix/gc/z/zInitialize_posix.cpp
src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp
src/hotspot/share/gc/z/zInitialize.cpp
src/hotspot/share/gc/z/zInitialize.hpp
src/hotspot/share/gc/z/zVirtualMemory.cpp
src/hotspot/share/gc/z/zVirtualMemory.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/posix/gc/z/zInitialize_posix.cpp	Mon Oct 28 11:26:53 2019 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#include "precompiled.hpp"
+#include "gc/z/zInitialize.hpp"
+
+void ZInitialize::initialize_os() {
+  // Does nothing
+}
--- a/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp	Mon Oct 28 11:26:00 2019 +0100
+++ b/src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp	Mon Oct 28 11:26:53 2019 +0100
@@ -29,6 +29,10 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 
+void ZVirtualMemoryManager::initialize_os() {
+  // Does nothing
+}
+
 static void unmap(uintptr_t start, size_t size) {
   const int res = munmap((void*)start, size);
   assert(res == 0, "Failed to unmap memory");
--- a/src/hotspot/share/gc/z/zInitialize.cpp	Mon Oct 28 11:26:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zInitialize.cpp	Mon Oct 28 11:26:53 2019 +0100
@@ -50,4 +50,6 @@
   ZTracer::initialize();
   ZLargePages::initialize();
   ZBarrierSet::set_barrier_set(barrier_set);
+
+  initialize_os();
 }
--- a/src/hotspot/share/gc/z/zInitialize.hpp	Mon Oct 28 11:26:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zInitialize.hpp	Mon Oct 28 11:26:53 2019 +0100
@@ -29,6 +29,9 @@
 class ZBarrierSet;
 
 class ZInitialize {
+private:
+  void initialize_os();
+
 public:
   ZInitialize(ZBarrierSet* barrier_set);
 };
--- a/src/hotspot/share/gc/z/zVirtualMemory.cpp	Mon Oct 28 11:26:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zVirtualMemory.cpp	Mon Oct 28 11:26:53 2019 +0100
@@ -47,6 +47,9 @@
     return;
   }
 
+  // Initialize OS specific parts
+  initialize_os();
+
   // Successfully initialized
   _initialized = true;
 }
--- a/src/hotspot/share/gc/z/zVirtualMemory.hpp	Mon Oct 28 11:26:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zVirtualMemory.hpp	Mon Oct 28 11:26:53 2019 +0100
@@ -50,6 +50,8 @@
   ZMemoryManager _manager;
   bool           _initialized;
 
+  void initialize_os();
+
   bool reserve_contiguous_platform(uintptr_t start, size_t size);
   bool reserve_contiguous(size_t size);
   size_t reserve_discontiguous(uintptr_t start, size_t size, size_t min_range);