< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
  *
  * 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.
  *

@@ -31,13 +31,15 @@
 #include "gc/shenandoah/shenandoahPacer.hpp"
 #include "memory/universe.hpp"
 #include "utilities/sizes.hpp"
 
 class VMStructs;
+class ShenandoahHeapRegionStateConstant;
 
 class ShenandoahHeapRegion : public ContiguousSpace {
   friend class VMStructs;
+  friend class ShenandoahHeapRegionStateConstant;
 private:
   /*
     Region state is described by a state machine. Transitions are guarded by
     heap lock, which allows changing the state of several regions atomically.
     Region states can be logically aggregated in groups.

@@ -114,13 +116,14 @@
     _pinned_humongous_start,  // region is both humongous start and pinned
     _cset,                    // region is in collection set
     _pinned,                  // region is pinned
     _pinned_cset,             // region is pinned and in cset (evac failure path)
     _trash,                   // region contains only trash
+    _REGION_STATES_NUM,       // last
   };
 
-  const char* region_state_to_string(RegionState s) const {
+  static const char* region_state_to_string(RegionState s) {
     switch (s) {
       case _empty_uncommitted:       return "Empty Uncommitted";
       case _empty_committed:         return "Empty Committed";
       case _regular:                 return "Regular";
       case _humongous_start:         return "Humongous Start";

@@ -156,10 +159,14 @@
   }
 
   void report_illegal_transition(const char* method);
 
 public:
+  static const int region_states_num() {
+    return _REGION_STATES_NUM;
+  }
+
   // Allowed transitions from the outside code:
   void make_regular_allocation();
   void make_regular_bypass();
   void make_humongous_start();
   void make_humongous_cont();

@@ -424,8 +431,10 @@
 
   void oop_iterate_objects(OopIterateClosure* cl);
   void oop_iterate_humongous(OopIterateClosure* cl);
 
   inline void internal_increase_live_data(size_t s);
+
+  void set_state(RegionState to);
 };
 
 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGION_HPP
< prev index next >