< prev index next >

src/share/vm/gc/g1/heapRegionSet.inline.hpp

Print this page
rev 8362 : [mq]: hotspot
   1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP
  27 
  28 #include "gc_implementation/g1/heapRegionSet.hpp"
  29 
  30 inline void HeapRegionSetBase::add(HeapRegion* hr) {
  31   check_mt_safety();
  32   assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u"));
  33   assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked"));
  34   assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked"));
  35 
  36   _count.increment(1u, hr->capacity());
  37   hr->set_containing_set(this);
  38   verify_region(hr);
  39 }
  40 
  41 inline void HeapRegionSetBase::remove(HeapRegion* hr) {
  42   check_mt_safety();
  43   verify_region(hr);
  44   assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked"));
  45   assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked"));
  46 
  47   hr->set_containing_set(NULL);
  48   assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition"));


 131   assert(length() > 0 && _head != NULL && _tail != NULL,
 132          hrs_ext_msg(this, "invariant"));
 133 
 134   HeapRegion* hr;
 135 
 136   if (from_head) {
 137     hr = remove_from_head_impl();
 138   } else {
 139     hr = remove_from_tail_impl();
 140   }
 141 
 142   if (_last == hr) {
 143     _last = NULL;
 144   }
 145 
 146   // remove() will verify the region and check mt safety.
 147   remove(hr);
 148   return hr;
 149 }
 150 
 151 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_INLINE_HPP
 152 
   1 /*
   2  * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
  27 
  28 #include "gc/g1/heapRegionSet.hpp"
  29 
  30 inline void HeapRegionSetBase::add(HeapRegion* hr) {
  31   check_mt_safety();
  32   assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u"));
  33   assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked"));
  34   assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked"));
  35 
  36   _count.increment(1u, hr->capacity());
  37   hr->set_containing_set(this);
  38   verify_region(hr);
  39 }
  40 
  41 inline void HeapRegionSetBase::remove(HeapRegion* hr) {
  42   check_mt_safety();
  43   verify_region(hr);
  44   assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked"));
  45   assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked"));
  46 
  47   hr->set_containing_set(NULL);
  48   assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition"));


 131   assert(length() > 0 && _head != NULL && _tail != NULL,
 132          hrs_ext_msg(this, "invariant"));
 133 
 134   HeapRegion* hr;
 135 
 136   if (from_head) {
 137     hr = remove_from_head_impl();
 138   } else {
 139     hr = remove_from_tail_impl();
 140   }
 141 
 142   if (_last == hr) {
 143     _last = NULL;
 144   }
 145 
 146   // remove() will verify the region and check mt safety.
 147   remove(hr);
 148   return hr;
 149 }
 150 
 151 #endif // SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
 152 
< prev index next >