hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp
changeset 30173 13cf7580b000
parent 26572 d5e6cac59ba1
child 30583 74ff3d21d616
equal deleted inserted replaced
30172:4dcc7e33e633 30173:13cf7580b000
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
       
    26 #include "gc_implementation/g1/g1CollectedHeap.hpp"
    26 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
    27 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
    27 #include "gc_implementation/g1/heapRegion.hpp"
    28 #include "gc_implementation/g1/heapRegion.hpp"
    28 #include "memory/space.hpp"
    29 #include "memory/space.hpp"
    29 #include "oops/oop.inline.hpp"
    30 #include "oops/oop.inline.hpp"
    30 #include "runtime/java.hpp"
    31 #include "runtime/java.hpp"
   301          "phantom block");
   302          "phantom block");
   302   assert(blk_end > threshold, "should be past threshold");
   303   assert(blk_end > threshold, "should be past threshold");
   303   assert(blk_start <= threshold, "blk_start should be at or before threshold");
   304   assert(blk_start <= threshold, "blk_start should be at or before threshold");
   304   assert(pointer_delta(threshold, blk_start) <= N_words,
   305   assert(pointer_delta(threshold, blk_start) <= N_words,
   305          "offset should be <= BlockOffsetSharedArray::N");
   306          "offset should be <= BlockOffsetSharedArray::N");
   306   assert(Universe::heap()->is_in_reserved(blk_start),
   307   assert(G1CollectedHeap::heap()->is_in_reserved(blk_start),
   307          "reference must be into the heap");
   308          "reference must be into the heap");
   308   assert(Universe::heap()->is_in_reserved(blk_end-1),
   309   assert(G1CollectedHeap::heap()->is_in_reserved(blk_end-1),
   309          "limit must be within the heap");
   310          "limit must be within the heap");
   310   assert(threshold == _array->_reserved.start() + index*N_words,
   311   assert(threshold == _array->_reserved.start() + index*N_words,
   311          "index must agree with threshold");
   312          "index must agree with threshold");
   312 
   313 
   313   DEBUG_ONLY(size_t orig_index = index;)
   314   DEBUG_ONLY(size_t orig_index = index;)
   456   _next_offset_threshold = NULL;
   457   _next_offset_threshold = NULL;
   457   _next_offset_index = 0;
   458   _next_offset_index = 0;
   458 }
   459 }
   459 
   460 
   460 HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold_raw() {
   461 HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold_raw() {
   461   assert(!Universe::heap()->is_in_reserved(_array->_offset_array),
   462   assert(!G1CollectedHeap::heap()->is_in_reserved(_array->_offset_array),
   462          "just checking");
   463          "just checking");
   463   _next_offset_index = _array->index_for_raw(_bottom);
   464   _next_offset_index = _array->index_for_raw(_bottom);
   464   _next_offset_index++;
   465   _next_offset_index++;
   465   _next_offset_threshold =
   466   _next_offset_threshold =
   466     _array->address_for_index_raw(_next_offset_index);
   467     _array->address_for_index_raw(_next_offset_index);
   467   return _next_offset_threshold;
   468   return _next_offset_threshold;
   468 }
   469 }
   469 
   470 
   470 void G1BlockOffsetArrayContigSpace::zero_bottom_entry_raw() {
   471 void G1BlockOffsetArrayContigSpace::zero_bottom_entry_raw() {
   471   assert(!Universe::heap()->is_in_reserved(_array->_offset_array),
   472   assert(!G1CollectedHeap::heap()->is_in_reserved(_array->_offset_array),
   472          "just checking");
   473          "just checking");
   473   size_t bottom_index = _array->index_for_raw(_bottom);
   474   size_t bottom_index = _array->index_for_raw(_bottom);
   474   assert(_array->address_for_index_raw(bottom_index) == _bottom,
   475   assert(_array->address_for_index_raw(bottom_index) == _bottom,
   475          "Precondition of call");
   476          "Precondition of call");
   476   _array->set_offset_array_raw(bottom_index, 0);
   477   _array->set_offset_array_raw(bottom_index, 0);
   477 }
   478 }
   478 
   479 
   479 HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold() {
   480 HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold() {
   480   assert(!Universe::heap()->is_in_reserved(_array->_offset_array),
   481   assert(!G1CollectedHeap::heap()->is_in_reserved(_array->_offset_array),
   481          "just checking");
   482          "just checking");
   482   _next_offset_index = _array->index_for(_bottom);
   483   _next_offset_index = _array->index_for(_bottom);
   483   _next_offset_index++;
   484   _next_offset_index++;
   484   _next_offset_threshold =
   485   _next_offset_threshold =
   485     _array->address_for_index(_next_offset_index);
   486     _array->address_for_index(_next_offset_index);