< prev index next >

src/share/vm/gc_implementation/parNew/parNewGeneration.cpp

Print this page
rev 8033 : imported patch parNew


  39 #include "memory/defNewGeneration.inline.hpp"
  40 #include "memory/genCollectedHeap.hpp"
  41 #include "memory/genOopClosures.inline.hpp"
  42 #include "memory/generation.hpp"
  43 #include "memory/referencePolicy.hpp"
  44 #include "memory/resourceArea.hpp"
  45 #include "memory/sharedHeap.hpp"
  46 #include "memory/space.hpp"
  47 #include "oops/objArrayOop.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "oops/oop.pcgc.inline.hpp"
  50 #include "runtime/atomic.inline.hpp"
  51 #include "runtime/handles.hpp"
  52 #include "runtime/handles.inline.hpp"
  53 #include "runtime/java.hpp"
  54 #include "runtime/thread.inline.hpp"
  55 #include "utilities/copy.hpp"
  56 #include "utilities/globalDefinitions.hpp"
  57 #include "utilities/workgroup.hpp"
  58 
  59 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  60 
  61 #ifdef _MSC_VER
  62 #pragma warning( push )
  63 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
  64 #endif
  65 ParScanThreadState::ParScanThreadState(Space* to_space_,
  66                                        ParNewGeneration* gen_,
  67                                        Generation* old_gen_,
  68                                        int thread_num_,
  69                                        ObjToScanQueueSet* work_queue_set_,
  70                                        Stack<oop, mtGC>* overflow_stacks_,
  71                                        size_t desired_plab_sz_,
  72                                        ParallelTaskTerminator& term_) :
  73   _to_space(to_space_), _old_gen(old_gen_), _young_gen(gen_), _thread_num(thread_num_),
  74   _work_queue(work_queue_set_->queue(thread_num_)), _to_space_full(false),
  75   _overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL),
  76   _ageTable(false), // false ==> not the global age table, no perf data.
  77   _to_space_alloc_buffer(desired_plab_sz_),
  78   _to_space_closure(gen_, this), _old_gen_closure(gen_, this),
  79   _to_space_root_closure(gen_, this), _old_gen_root_closure(gen_, this),
  80   _older_gen_closure(gen_, this),


1196     forward_ptr = NULL;
1197   } else {
1198     // Is in to-space; do copying ourselves.
1199     Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)new_obj, sz);
1200     assert(Universe::heap()->is_in_reserved(new_obj), "illegal forwarding pointer value.");
1201     forward_ptr = old->forward_to_atomic(new_obj);
1202     // Restore the mark word copied above.
1203     new_obj->set_mark(m);
1204     // Increment age if obj still in new generation
1205     new_obj->incr_age();
1206     par_scan_state->age_table()->add(new_obj, sz);
1207   }
1208   assert(new_obj != NULL, "just checking");
1209 
1210 #ifndef PRODUCT
1211   // This code must come after the CAS test, or it will print incorrect
1212   // information.
1213   if (TraceScavenge) {
1214     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
1215        is_in_reserved(new_obj) ? "copying" : "tenuring",
1216        new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
1217   }
1218 #endif
1219 
1220   if (forward_ptr == NULL) {
1221     oop obj_to_push = new_obj;
1222     if (par_scan_state->should_be_partially_scanned(obj_to_push, old)) {
1223       // Length field used as index of next element to be scanned.
1224       // Real length can be obtained from real_forwardee()
1225       arrayOop(old)->set_length(0);
1226       obj_to_push = old;
1227       assert(obj_to_push->is_forwarded() && obj_to_push->forwardee() != obj_to_push,
1228              "push forwarded object");
1229     }
1230     // Push it on one of the queues of to-be-scanned objects.
1231     bool simulate_overflow = false;
1232     NOT_PRODUCT(
1233       if (ParGCWorkQueueOverflowALot && should_simulate_overflow()) {
1234         // simulate a stack overflow
1235         simulate_overflow = true;
1236       }




  39 #include "memory/defNewGeneration.inline.hpp"
  40 #include "memory/genCollectedHeap.hpp"
  41 #include "memory/genOopClosures.inline.hpp"
  42 #include "memory/generation.hpp"
  43 #include "memory/referencePolicy.hpp"
  44 #include "memory/resourceArea.hpp"
  45 #include "memory/sharedHeap.hpp"
  46 #include "memory/space.hpp"
  47 #include "oops/objArrayOop.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "oops/oop.pcgc.inline.hpp"
  50 #include "runtime/atomic.inline.hpp"
  51 #include "runtime/handles.hpp"
  52 #include "runtime/handles.inline.hpp"
  53 #include "runtime/java.hpp"
  54 #include "runtime/thread.inline.hpp"
  55 #include "utilities/copy.hpp"
  56 #include "utilities/globalDefinitions.hpp"
  57 #include "utilities/workgroup.hpp"
  58 


  59 #ifdef _MSC_VER
  60 #pragma warning( push )
  61 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
  62 #endif
  63 ParScanThreadState::ParScanThreadState(Space* to_space_,
  64                                        ParNewGeneration* gen_,
  65                                        Generation* old_gen_,
  66                                        int thread_num_,
  67                                        ObjToScanQueueSet* work_queue_set_,
  68                                        Stack<oop, mtGC>* overflow_stacks_,
  69                                        size_t desired_plab_sz_,
  70                                        ParallelTaskTerminator& term_) :
  71   _to_space(to_space_), _old_gen(old_gen_), _young_gen(gen_), _thread_num(thread_num_),
  72   _work_queue(work_queue_set_->queue(thread_num_)), _to_space_full(false),
  73   _overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL),
  74   _ageTable(false), // false ==> not the global age table, no perf data.
  75   _to_space_alloc_buffer(desired_plab_sz_),
  76   _to_space_closure(gen_, this), _old_gen_closure(gen_, this),
  77   _to_space_root_closure(gen_, this), _old_gen_root_closure(gen_, this),
  78   _older_gen_closure(gen_, this),


1194     forward_ptr = NULL;
1195   } else {
1196     // Is in to-space; do copying ourselves.
1197     Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)new_obj, sz);
1198     assert(Universe::heap()->is_in_reserved(new_obj), "illegal forwarding pointer value.");
1199     forward_ptr = old->forward_to_atomic(new_obj);
1200     // Restore the mark word copied above.
1201     new_obj->set_mark(m);
1202     // Increment age if obj still in new generation
1203     new_obj->incr_age();
1204     par_scan_state->age_table()->add(new_obj, sz);
1205   }
1206   assert(new_obj != NULL, "just checking");
1207 
1208 #ifndef PRODUCT
1209   // This code must come after the CAS test, or it will print incorrect
1210   // information.
1211   if (TraceScavenge) {
1212     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
1213        is_in_reserved(new_obj) ? "copying" : "tenuring",
1214        new_obj->klass()->internal_name(), p2i(old), p2i(new_obj), new_obj->size());
1215   }
1216 #endif
1217 
1218   if (forward_ptr == NULL) {
1219     oop obj_to_push = new_obj;
1220     if (par_scan_state->should_be_partially_scanned(obj_to_push, old)) {
1221       // Length field used as index of next element to be scanned.
1222       // Real length can be obtained from real_forwardee()
1223       arrayOop(old)->set_length(0);
1224       obj_to_push = old;
1225       assert(obj_to_push->is_forwarded() && obj_to_push->forwardee() != obj_to_push,
1226              "push forwarded object");
1227     }
1228     // Push it on one of the queues of to-be-scanned objects.
1229     bool simulate_overflow = false;
1230     NOT_PRODUCT(
1231       if (ParGCWorkQueueOverflowALot && should_simulate_overflow()) {
1232         // simulate a stack overflow
1233         simulate_overflow = true;
1234       }


< prev index next >