hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp
changeset 30150 d9c940aa42ef
parent 29792 8c6fa07f0869
child 30151 c7cdaa576875
equal deleted inserted replaced
30149:c0f930abe5ed 30150:d9c940aa42ef
    24 
    24 
    25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP
    25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP
    26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP
    26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP
    27 
    27 
    28 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
    28 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
    29 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
    29 #include "gc_implementation/parallelScavenge/psParallelCompact.inline.hpp"
    30 #include "oops/objArrayKlass.inline.hpp"
    30 #include "oops/objArrayOop.hpp"
    31 #include "oops/oop.pcgc.inline.hpp"
    31 #include "oops/oop.inline.hpp"
       
    32 #include "utilities/debug.hpp"
       
    33 #include "utilities/globalDefinitions.hpp"
    32 
    34 
    33 void ParCompactionManager::push_objarray(oop obj, size_t index)
    35 void ParCompactionManager::push_objarray(oop obj, size_t index)
    34 {
    36 {
    35   ObjArrayTask task(obj, index);
    37   ObjArrayTask task(obj, index);
    36   assert(task.is_valid(), "bad ObjArrayTask");
    38   assert(task.is_valid(), "bad ObjArrayTask");
    47 #endif
    49 #endif
    48   region_stack()->push(index);
    50   region_stack()->push(index);
    49 }
    51 }
    50 
    52 
    51 inline void ParCompactionManager::follow_contents(oop obj) {
    53 inline void ParCompactionManager::follow_contents(oop obj) {
    52   obj->follow_contents(this);
    54   assert(PSParallelCompact::mark_bitmap()->is_marked(obj), "should be marked");
       
    55   obj->pc_follow_contents(this);
       
    56 }
       
    57 
       
    58 template <class T>
       
    59 inline void oop_pc_follow_contents_specialized(ObjArrayKlass* klass, oop obj, int index, ParCompactionManager* cm) {
       
    60   objArrayOop a = objArrayOop(obj);
       
    61   const size_t len = size_t(a->length());
       
    62   const size_t beg_index = size_t(index);
       
    63   assert(beg_index < len || len == 0, "index too large");
       
    64 
       
    65   const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
       
    66   const size_t end_index = beg_index + stride;
       
    67   T* const base = (T*)a->base();
       
    68   T* const beg = base + beg_index;
       
    69   T* const end = base + end_index;
       
    70 
       
    71   // Push the non-NULL elements of the next stride on the marking stack.
       
    72   for (T* e = beg; e < end; e++) {
       
    73     PSParallelCompact::mark_and_push<T>(cm, e);
       
    74   }
       
    75 
       
    76   if (end_index < len) {
       
    77     cm->push_objarray(a, end_index); // Push the continuation.
       
    78   }
    53 }
    79 }
    54 
    80 
    55 inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
    81 inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
    56   ObjArrayKlass* k = (ObjArrayKlass*)obj->klass();
    82   if (UseCompressedOops) {
    57   k->oop_follow_contents(this, obj, index);
    83     oop_pc_follow_contents_specialized<narrowOop>((ObjArrayKlass*)obj->klass(), obj, index, this);
       
    84   } else {
       
    85     oop_pc_follow_contents_specialized<oop>((ObjArrayKlass*)obj->klass(), obj, index, this);
       
    86   }
    58 }
    87 }
    59 
    88 
    60 inline void ParCompactionManager::update_contents(oop obj) {
    89 inline void ParCompactionManager::update_contents(oop obj) {
    61   obj->update_contents(this);
    90   obj->pc_update_contents();
    62 }
    91 }
    63 
    92 
    64 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP
    93 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP