< prev index next >

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

Print this page
rev 57095 : [mq]: use
rev 57096 : [mq]: trailing_semi
   1 /*
   2  * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONSET_HPP
  25 #define SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONSET_HPP
  26 
  27 #include "memory/allocation.hpp"
  28 #include "gc/shenandoah/shenandoahHeap.hpp"
  29 #include "gc/shenandoah/shenandoahHeapRegion.hpp"

  30 
  31 class ShenandoahHeapRegionSet;
  32 
  33 class ShenandoahHeapRegionSetIterator : public StackObj {
  34 private:
  35   const ShenandoahHeapRegionSet* _set;
  36   ShenandoahHeap* const _heap;
  37 
  38   DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile jint));
  39   volatile jint _current_index;
  40   DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0);
  41 
  42   // No implicit copying: iterators should be passed by reference to capture the state
  43   ShenandoahHeapRegionSetIterator(const ShenandoahHeapRegionSetIterator& that);
  44   ShenandoahHeapRegionSetIterator& operator=(const ShenandoahHeapRegionSetIterator& o);
  45 
  46 public:
  47   ShenandoahHeapRegionSetIterator(const ShenandoahHeapRegionSet* const set);
  48 
  49   // Reset existing iterator to new set
  50   void reset(const ShenandoahHeapRegionSet* const set);
  51 
  52   // MT version
  53   ShenandoahHeapRegion* claim_next();
  54 
  55   // Single-thread version
  56   ShenandoahHeapRegion* next();
  57 };
  58 
  59 class ShenandoahHeapRegionSet : public CHeapObj<mtGC> {
  60   friend class ShenandoahHeap;
  61 private:
  62   ShenandoahHeap* const _heap;
  63   size_t const          _map_size;
  64   size_t const          _region_size_bytes_shift;


   1 /*
   2  * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONSET_HPP
  25 #define SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONSET_HPP
  26 
  27 #include "memory/allocation.hpp"
  28 #include "gc/shenandoah/shenandoahHeap.hpp"
  29 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  30 #include "utilities/macros.hpp"
  31 
  32 class ShenandoahHeapRegionSet;
  33 
  34 class ShenandoahHeapRegionSetIterator : public StackObj {
  35 private:
  36   const ShenandoahHeapRegionSet* _set;
  37   ShenandoahHeap* const _heap;
  38 
  39   DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile jint));
  40   volatile jint _current_index;
  41   DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0);
  42 
  43   // No implicit copying: iterators should be passed by reference to capture the state
  44   NONCOPYABLE(ShenandoahHeapRegionSetIterator);

  45 
  46 public:
  47   ShenandoahHeapRegionSetIterator(const ShenandoahHeapRegionSet* const set);
  48 
  49   // Reset existing iterator to new set
  50   void reset(const ShenandoahHeapRegionSet* const set);
  51 
  52   // MT version
  53   ShenandoahHeapRegion* claim_next();
  54 
  55   // Single-thread version
  56   ShenandoahHeapRegion* next();
  57 };
  58 
  59 class ShenandoahHeapRegionSet : public CHeapObj<mtGC> {
  60   friend class ShenandoahHeap;
  61 private:
  62   ShenandoahHeap* const _heap;
  63   size_t const          _map_size;
  64   size_t const          _region_size_bytes_shift;


< prev index next >