< prev index next >

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

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:


   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_HEAPREGION_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
  27 
  28 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
  29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
  30 #include "gc_implementation/g1/heapRegion.hpp"
  31 #include "memory/space.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/atomic.inline.hpp"
  34 
  35 // This version requires locking.
  36 inline HeapWord* G1OffsetTableContigSpace::allocate_impl(size_t size,
  37                                                 HeapWord* const end_value) {
  38   HeapWord* obj = top();
  39   if (pointer_delta(end_value, obj) >= size) {
  40     HeapWord* new_top = obj + size;
  41     set_top(new_top);
  42     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
  43     return obj;
  44   } else {
  45     return NULL;
  46   }
  47 }
  48 
  49 // This version is lock-free.
  50 inline HeapWord* G1OffsetTableContigSpace::par_allocate_impl(size_t size,
  51                                                     HeapWord* const end_value) {


 183     // This is how we always allocate survivors.
 184     assert(_next_top_at_mark_start == bottom(), "invariant");
 185   } else {
 186     if (during_initial_mark) {
 187       // See the comment for note_start_of_copying() for the details
 188       // on this.
 189       assert(_next_top_at_mark_start == end(), "pre-condition");
 190       _next_top_at_mark_start = top();
 191     } else {
 192       // See the comment for note_start_of_copying() for the details
 193       // on this.
 194       assert(top() >= _next_top_at_mark_start, "invariant");
 195     }
 196   }
 197 }
 198 
 199 inline bool HeapRegion::in_collection_set() const {
 200   return G1CollectedHeap::heap()->is_in_cset(this);
 201 }
 202 
 203 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP


   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_HEAPREGION_INLINE_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP
  27 
  28 #include "gc/g1/g1BlockOffsetTable.inline.hpp"
  29 #include "gc/g1/g1CollectedHeap.hpp"
  30 #include "gc/g1/heapRegion.hpp"
  31 #include "gc/shared/space.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/atomic.inline.hpp"
  34 
  35 // This version requires locking.
  36 inline HeapWord* G1OffsetTableContigSpace::allocate_impl(size_t size,
  37                                                 HeapWord* const end_value) {
  38   HeapWord* obj = top();
  39   if (pointer_delta(end_value, obj) >= size) {
  40     HeapWord* new_top = obj + size;
  41     set_top(new_top);
  42     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
  43     return obj;
  44   } else {
  45     return NULL;
  46   }
  47 }
  48 
  49 // This version is lock-free.
  50 inline HeapWord* G1OffsetTableContigSpace::par_allocate_impl(size_t size,
  51                                                     HeapWord* const end_value) {


 183     // This is how we always allocate survivors.
 184     assert(_next_top_at_mark_start == bottom(), "invariant");
 185   } else {
 186     if (during_initial_mark) {
 187       // See the comment for note_start_of_copying() for the details
 188       // on this.
 189       assert(_next_top_at_mark_start == end(), "pre-condition");
 190       _next_top_at_mark_start = top();
 191     } else {
 192       // See the comment for note_start_of_copying() for the details
 193       // on this.
 194       assert(top() >= _next_top_at_mark_start, "invariant");
 195     }
 196   }
 197 }
 198 
 199 inline bool HeapRegion::in_collection_set() const {
 200   return G1CollectedHeap::heap()->is_in_cset(this);
 201 }
 202 
 203 #endif // SHARE_VM_GC_G1_HEAPREGION_INLINE_HPP
< prev index next >