Fixup Epsilon for GC interface updates epsilon-gc-branch
authorshade
Thu, 30 Nov 2017 18:32:06 +0100
branchepsilon-gc-branch
changeset 55935 f4e069848424
parent 55934 912c55e702d6
child 55938 d7b4990d04d6
Fixup Epsilon for GC interface updates
src/hotspot/share/gc/epsilon/epsilonArguments.cpp
src/hotspot/share/gc/epsilon/epsilonArguments.hpp
src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp
src/hotspot/share/gc/shared/barrierSetConfig.hpp
src/hotspot/share/gc/shared/barrierSetConfig.inline.hpp
src/hotspot/share/gc/shared/gcArguments.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp	Thu Nov 30 18:32:06 2017 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
+ * 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/epsilon/epsilonArguments.hpp"
+#include "gc/epsilon/epsilonCollectedHeap.hpp"
+#include "gc/epsilon/epsilonCollectorPolicy.hpp"
+#include "gc/shared/gcArguments.inline.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/globals_extension.hpp"
+#include "runtime/vm_version.hpp"
+
+size_t EpsilonArguments::conservative_max_heap_alignment() {
+  return UseLargePages ? os::large_page_size() : os::vm_page_size();
+}
+
+void EpsilonArguments::initialize_flags() {
+  GCArguments::initialize_flags();
+
+  assert(UseEpsilonGC, "Error");
+
+  // Forcefully exit when OOME is detected. Nothing we can do at that point.
+  if (FLAG_IS_DEFAULT(ExitOnOutOfMemoryError)) {
+    FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true);
+  }
+
+#if INCLUDE_ALL_GCS
+  if (EpsilonMaxTLABSize < MinTLABSize) {
+    warning("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
+    EpsilonMaxTLABSize = MinTLABSize;
+  }
+#endif
+}
+
+CollectedHeap* EpsilonArguments::create_heap() {
+  return create_heap_with_policy<EpsilonCollectedHeap, EpsilonCollectorPolicy>();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/epsilon/epsilonArguments.hpp	Thu Nov 30 18:32:06 2017 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
+* 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_GC_EPSILON_EPSILONARGUMENTS_HPP
+#define SHARE_GC_EPSILON_EPSILONARGUMENTS_HPP
+
+#include "gc/shared/gcArguments.hpp"
+
+class CollectedHeap;
+
+class EpsilonArguments : public GCArguments {
+public:
+  virtual void initialize_flags();
+  virtual size_t conservative_max_heap_alignment();
+  virtual CollectedHeap* create_heap();
+};
+
+#endif // SHARE_GC_EPSILON_EPSILONARGUMENTS_HPP
--- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp	Thu Nov 30 17:13:33 2017 +0100
+++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp	Thu Nov 30 18:32:06 2017 +0100
@@ -39,8 +39,10 @@
   virtual void resize_covered_region(MemRegion new_region) {}
   virtual void print_on(outputStream *st) const {}
 
+  template <DecoratorSet decorators, typename BarrierSetT = EpsilonBarrierSet>
+  class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {};
+
 protected:
-  virtual void write_ref_field_work(void *field, oop new_val, bool release) {}
   virtual void write_ref_array_work(MemRegion mr) {}
   virtual void write_region_work(MemRegion mr) {}
 };
@@ -50,4 +52,9 @@
   static const BarrierSet::Name value = BarrierSet::Epsilon;
 };
 
+template<>
+struct BarrierSet::GetType<BarrierSet::Epsilon> {
+  typedef EpsilonBarrierSet type;
+};
+
 #endif // SHARE_VM_GC_EPSILON_BARRIERSET_HPP
--- a/src/hotspot/share/gc/shared/barrierSetConfig.hpp	Thu Nov 30 17:13:33 2017 +0100
+++ b/src/hotspot/share/gc/shared/barrierSetConfig.hpp	Thu Nov 30 18:32:06 2017 +0100
@@ -30,7 +30,8 @@
 #if INCLUDE_ALL_GCS
 #define FOR_EACH_CONCRETE_INCLUDE_ALL_GC_BARRIER_SET_DO(f) \
   f(CardTableExtension)                                    \
-  f(G1SATBCTLogging)
+  f(G1SATBCTLogging)                                       \
+  f(Epsilon)
 #else
 #define FOR_EACH_CONCRETE_INCLUDE_ALL_GC_BARRIER_SET_DO(f)
 #endif
@@ -47,7 +48,8 @@
   f(CardTableForRS)                   \
   f(CardTableExtension)               \
   f(G1SATBCT)                         \
-  f(G1SATBCTLogging)
+  f(G1SATBCTLogging)                  \
+  f(Epsilon)
 
 // To enable runtime-resolution of GC barriers on primitives, please
 // define SUPPORT_BARRIER_ON_PRIMITIVES.
--- a/src/hotspot/share/gc/shared/barrierSetConfig.inline.hpp	Thu Nov 30 17:13:33 2017 +0100
+++ b/src/hotspot/share/gc/shared/barrierSetConfig.inline.hpp	Thu Nov 30 18:32:06 2017 +0100
@@ -34,6 +34,7 @@
 #if INCLUDE_ALL_GCS
 #include "gc/parallel/cardTableExtension.hpp"       // Parallel support
 #include "gc/g1/g1SATBCardTableModRefBS.inline.hpp" // G1 support
+#include "gc/epsilon/epsilonBarrierSet.hpp"         // Epsilon support
 #endif
 
 #endif // SHARE_VM_GC_SHARED_BARRIERSETCONFIG_INLINE_HPP
--- a/src/hotspot/share/gc/shared/gcArguments.cpp	Thu Nov 30 17:13:33 2017 +0100
+++ b/src/hotspot/share/gc/shared/gcArguments.cpp	Thu Nov 30 18:32:06 2017 +0100
@@ -38,6 +38,7 @@
 #include "gc/parallel/parallelArguments.hpp"
 #include "gc/cms/cmsArguments.hpp"
 #include "gc/g1/g1Arguments.hpp"
+#include "gc/epsilon/epsilonArguments.hpp"
 #endif
 
 GCArguments* GCArguments::_instance = NULL;
@@ -53,7 +54,7 @@
 
 bool GCArguments::gc_selected() {
 #if INCLUDE_ALL_GCS
-  return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC;
+  return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC || UseEpsilonGC;
 #else
   return UseSerialGC;
 #endif // INCLUDE_ALL_GCS
@@ -121,6 +122,8 @@
     _instance = new G1Arguments();
   } else if (UseConcMarkSweepGC) {
     _instance = new CMSArguments();
+  } else if (UseEpsilonGC) {
+    _instance = new EpsilonArguments();
 #endif
   } else if (UseSerialGC) {
     _instance = new SerialArguments();