< prev index next >

src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.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_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
  27 
  28 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
  29 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
  30 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
  31 #include "gc_implementation/parallelScavenge/psPromotionLAB.inline.hpp"
  32 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
  33 #include "oops/oop.inline.hpp"

  34 
  35 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
  36   assert(_manager_array != NULL, "access of NULL manager_array");
  37   assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
  38   return &_manager_array[index];
  39 }
  40 






  41 template <class T>
  42 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
  43   if (p != NULL) { // XXX: error if p != NULL here
  44     oop o = oopDesc::load_decode_heap_oop_not_null(p);
  45     if (o->is_forwarded()) {
  46       o = o->forwardee();
  47       // Card mark
  48       if (PSScavenge::is_obj_in_young(o)) {
  49         PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
  50       }
  51       oopDesc::encode_store_heap_oop_not_null(p, o);
  52     } else {
  53       push_depth(p);
  54     }
  55   }
  56 }
  57 
  58 template <class T>
  59 inline void PSPromotionManager::claim_or_forward_depth(T* p) {
  60   assert(should_scavenge(p, true), "revisiting object?");


  82     } else {
  83       // Promotion of object directly to heap
  84       if (gc_tracer->should_report_promotion_outside_plab_event()) {
  85         size_t obj_bytes = obj_size * HeapWordSize;
  86         gc_tracer->report_promotion_outside_plab_event(old_obj->klass(), obj_bytes,
  87                                                        age, tenured);
  88       }
  89     }
  90   }
  91 }
  92 
  93 inline void PSPromotionManager::push_contents(oop obj) {
  94   obj->ps_push_contents(this);
  95 }
  96 //
  97 // This method is pretty bulky. It would be nice to split it up
  98 // into smaller submethods, but we need to be careful not to hurt
  99 // performance.
 100 //
 101 template<bool promote_immediately>
 102 oop PSPromotionManager::copy_to_survivor_space(oop o) {
 103   assert(should_scavenge(&o), "Sanity");
 104 
 105   oop new_obj = NULL;
 106 
 107   // NOTE! We must be very careful with any methods that access the mark
 108   // in o. There may be multiple threads racing on it, and it may be forwarded
 109   // at any time. Do not use oop methods for accessing the mark!
 110   markOop test_mark = o->mark();
 111 
 112   // The same test as "o->is_forwarded()"
 113   if (!test_mark->is_marked()) {
 114     bool new_obj_is_tenured = false;
 115     size_t new_obj_size = o->size();
 116 
 117     // Find the objects age, MT safe.
 118     uint age = (test_mark->has_displaced_mark_helper() /* o->has_displaced_mark() */) ?
 119       test_mark->displaced_mark_helper()->age() : test_mark->age();
 120 
 121     if (!promote_immediately) {
 122       // Try allocating obj in to-space (unless too old)




  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_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
  27 
  28 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
  29 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
  30 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
  31 #include "gc_implementation/parallelScavenge/psPromotionLAB.inline.hpp"
  32 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "utilities/taskqueue.inline.hpp"
  35 
  36 inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
  37   assert(_manager_array != NULL, "access of NULL manager_array");
  38   assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
  39   return &_manager_array[index];
  40 }
  41 
  42 
  43 template <class T>
  44 inline void PSPromotionManager::push_depth(T* p) {
  45   claimed_stack_depth()->push(p);
  46 }
  47 
  48 template <class T>
  49 inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
  50   if (p != NULL) { // XXX: error if p != NULL here
  51     oop o = oopDesc::load_decode_heap_oop_not_null(p);
  52     if (o->is_forwarded()) {
  53       o = o->forwardee();
  54       // Card mark
  55       if (PSScavenge::is_obj_in_young(o)) {
  56         PSScavenge::card_table()->inline_write_ref_field_gc(p, o);
  57       }
  58       oopDesc::encode_store_heap_oop_not_null(p, o);
  59     } else {
  60       push_depth(p);
  61     }
  62   }
  63 }
  64 
  65 template <class T>
  66 inline void PSPromotionManager::claim_or_forward_depth(T* p) {
  67   assert(should_scavenge(p, true), "revisiting object?");


  89     } else {
  90       // Promotion of object directly to heap
  91       if (gc_tracer->should_report_promotion_outside_plab_event()) {
  92         size_t obj_bytes = obj_size * HeapWordSize;
  93         gc_tracer->report_promotion_outside_plab_event(old_obj->klass(), obj_bytes,
  94                                                        age, tenured);
  95       }
  96     }
  97   }
  98 }
  99 
 100 inline void PSPromotionManager::push_contents(oop obj) {
 101   obj->ps_push_contents(this);
 102 }
 103 //
 104 // This method is pretty bulky. It would be nice to split it up
 105 // into smaller submethods, but we need to be careful not to hurt
 106 // performance.
 107 //
 108 template<bool promote_immediately>
 109 inline oop PSPromotionManager::copy_to_survivor_space(oop o) {
 110   assert(should_scavenge(&o), "Sanity");
 111 
 112   oop new_obj = NULL;
 113 
 114   // NOTE! We must be very careful with any methods that access the mark
 115   // in o. There may be multiple threads racing on it, and it may be forwarded
 116   // at any time. Do not use oop methods for accessing the mark!
 117   markOop test_mark = o->mark();
 118 
 119   // The same test as "o->is_forwarded()"
 120   if (!test_mark->is_marked()) {
 121     bool new_obj_is_tenured = false;
 122     size_t new_obj_size = o->size();
 123 
 124     // Find the objects age, MT safe.
 125     uint age = (test_mark->has_displaced_mark_helper() /* o->has_displaced_mark() */) ?
 126       test_mark->displaced_mark_helper()->age() : test_mark->age();
 127 
 128     if (!promote_immediately) {
 129       // Try allocating obj in to-space (unless too old)


< prev index next >