< prev index next >

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

Print this page




  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.inline.hpp"
  30 #include "gc/g1/heapRegion.hpp"
  31 #include "gc/shared/space.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/atomic.hpp"

  34 
  35 inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size,
  36                                                   size_t desired_word_size,
  37                                                   size_t* actual_size) {
  38   HeapWord* obj = top();
  39   size_t available = pointer_delta(end(), obj);
  40   size_t want_to_allocate = MIN2(available, desired_word_size);
  41   if (want_to_allocate >= min_word_size) {
  42     HeapWord* new_top = obj + want_to_allocate;
  43     set_top(new_top);
  44     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
  45     *actual_size = want_to_allocate;
  46     return obj;
  47   } else {
  48     return NULL;
  49   }
  50 }
  51 
  52 inline HeapWord* G1ContiguousSpace::par_allocate_impl(size_t min_word_size,
  53                                                       size_t desired_word_size,




  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.inline.hpp"
  30 #include "gc/g1/heapRegion.hpp"
  31 #include "gc/shared/space.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/atomic.hpp"
  34 #include "utilities/align.hpp"
  35 
  36 inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size,
  37                                                   size_t desired_word_size,
  38                                                   size_t* actual_size) {
  39   HeapWord* obj = top();
  40   size_t available = pointer_delta(end(), obj);
  41   size_t want_to_allocate = MIN2(available, desired_word_size);
  42   if (want_to_allocate >= min_word_size) {
  43     HeapWord* new_top = obj + want_to_allocate;
  44     set_top(new_top);
  45     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
  46     *actual_size = want_to_allocate;
  47     return obj;
  48   } else {
  49     return NULL;
  50   }
  51 }
  52 
  53 inline HeapWord* G1ContiguousSpace::par_allocate_impl(size_t min_word_size,
  54                                                       size_t desired_word_size,


< prev index next >