< prev index next >

src/share/vm/gc/parallel/psParallelCompact.inline.hpp

Print this page
rev 13014 : imported patch 8180755-remove-bitmap-inline-hpp-include


   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_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
  26 #define SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
  27 
  28 #include "gc/parallel/parallelScavengeHeap.hpp"

  29 #include "gc/parallel/psParallelCompact.hpp"
  30 #include "gc/shared/collectedHeap.hpp"
  31 #include "oops/klass.hpp"
  32 #include "oops/oop.inline.hpp"





























































  33 
  34 inline bool PSParallelCompact::mark_obj(oop obj) {
  35   const int obj_size = obj->size();
  36   if (mark_bitmap()->mark_obj(obj, obj_size)) {
  37     _summary_data.add_obj(obj, obj_size);
  38     return true;
  39   } else {
  40     return false;
  41   }
  42 }
  43 
  44 template <class T>
  45 inline void PSParallelCompact::adjust_pointer(T* p, ParCompactionManager* cm) {
  46   T heap_oop = oopDesc::load_heap_oop(p);
  47   if (!oopDesc::is_null(heap_oop)) {
  48     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
  49     assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap");
  50 
  51     oop new_obj = (oop)summary_data().calc_new_pointer(obj, cm);
  52     assert(new_obj != NULL,                    // is forwarding ptr?


   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_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
  26 #define SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP
  27 
  28 #include "gc/parallel/parallelScavengeHeap.hpp"
  29 #include "gc/parallel/parMarkBitMap.inline.hpp"
  30 #include "gc/parallel/psParallelCompact.hpp"
  31 #include "gc/shared/collectedHeap.hpp"
  32 #include "oops/klass.hpp"
  33 #include "oops/oop.inline.hpp"
  34 
  35 inline bool PSParallelCompact::is_marked(oop obj) {
  36   return mark_bitmap()->is_marked(obj);
  37 }
  38 
  39 inline double PSParallelCompact::normal_distribution(double density) {
  40   assert(_dwl_initialized, "uninitialized");
  41   const double squared_term = (density - _dwl_mean) / _dwl_std_dev;
  42   return _dwl_first_term * exp(-0.5 * squared_term * squared_term);
  43 }
  44 
  45 inline bool PSParallelCompact::dead_space_crosses_boundary(const RegionData* region,
  46                                                            idx_t bit) {
  47   assert(bit > 0, "cannot call this for the first bit/region");
  48   assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit),
  49          "sanity check");
  50 
  51   // Dead space crosses the boundary if (1) a partial object does not extend
  52   // onto the region, (2) an object does not start at the beginning of the
  53   // region, and (3) an object does not end at the end of the prior region.
  54   return region->partial_obj_size() == 0 &&
  55     !_mark_bitmap.is_obj_beg(bit) &&
  56     !_mark_bitmap.is_obj_end(bit - 1);
  57 }
  58 
  59 inline bool PSParallelCompact::is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr) {
  60   return p >= beg_addr && p < end_addr;
  61 }
  62 
  63 inline bool PSParallelCompact::is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr) {
  64   return is_in((HeapWord*)p, beg_addr, end_addr);
  65 }
  66 
  67 inline MutableSpace* PSParallelCompact::space(SpaceId id) {
  68   assert(id < last_space_id, "id out of range");
  69   return _space_info[id].space();
  70 }
  71 
  72 inline HeapWord* PSParallelCompact::new_top(SpaceId id) {
  73   assert(id < last_space_id, "id out of range");
  74   return _space_info[id].new_top();
  75 }
  76 
  77 inline HeapWord* PSParallelCompact::dense_prefix(SpaceId id) {
  78   assert(id < last_space_id, "id out of range");
  79   return _space_info[id].dense_prefix();
  80 }
  81 
  82 inline ObjectStartArray* PSParallelCompact::start_array(SpaceId id) {
  83   assert(id < last_space_id, "id out of range");
  84   return _space_info[id].start_array();
  85 }
  86 
  87 #ifdef ASSERT
  88 inline void PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr) {
  89   assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr),
  90          "must move left or to a different space");
  91   assert(is_object_aligned((intptr_t)old_addr) && is_object_aligned((intptr_t)new_addr),
  92          "checking alignment");
  93 }
  94 #endif // ASSERT
  95 
  96 inline bool PSParallelCompact::mark_obj(oop obj) {
  97   const int obj_size = obj->size();
  98   if (mark_bitmap()->mark_obj(obj, obj_size)) {
  99     _summary_data.add_obj(obj, obj_size);
 100     return true;
 101   } else {
 102     return false;
 103   }
 104 }
 105 
 106 template <class T>
 107 inline void PSParallelCompact::adjust_pointer(T* p, ParCompactionManager* cm) {
 108   T heap_oop = oopDesc::load_heap_oop(p);
 109   if (!oopDesc::is_null(heap_oop)) {
 110     oop obj     = oopDesc::decode_heap_oop_not_null(heap_oop);
 111     assert(ParallelScavengeHeap::heap()->is_in(obj), "should be in heap");
 112 
 113     oop new_obj = (oop)summary_data().calc_new_pointer(obj, cm);
 114     assert(new_obj != NULL,                    // is forwarding ptr?
< prev index next >