src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
Print this page
@@ -67,16 +67,18 @@
Generation* old_gen_,
int thread_num_,
ObjToScanQueueSet* work_queue_set_,
Stack<oop, mtGC>* overflow_stacks_,
size_t desired_plab_sz_,
+ ParNewTracer* gc_tracer,
ParallelTaskTerminator& term_) :
_to_space(to_space_), _old_gen(old_gen_), _young_gen(gen_), _thread_num(thread_num_),
_work_queue(work_queue_set_->queue(thread_num_)), _to_space_full(false),
_overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL),
_ageTable(false), // false ==> not the global age table, no perf data.
_to_space_alloc_buffer(desired_plab_sz_),
+ _gc_tracer(gc_tracer),
_to_space_closure(gen_, this), _old_gen_closure(gen_, this),
_to_space_root_closure(gen_, this), _old_gen_root_closure(gen_, this),
_older_gen_closure(gen_, this),
_evacuate_followers(this, &_to_space_closure, &_old_gen_closure,
&_to_space_root_closure, gen_, &_old_gen_root_closure,
@@ -220,11 +222,11 @@
assert(ParGCUseLocalOverflow, "Else should not call");
overflow_stack()->push(p);
assert(young_gen()->overflow_list() == NULL, "Error");
}
-HeapWord* ParScanThreadState::alloc_in_to_space_slow(size_t word_sz) {
+HeapWord* ParScanThreadState::alloc_in_to_space_slow(size_t word_sz, oop const old, uint age) {
// Otherwise, if the object is small enough, try to reallocate the
// buffer.
HeapWord* obj = NULL;
if (!_to_space_full) {
@@ -250,10 +252,11 @@
}
if (buf_space != NULL) {
plab->set_word_size(buf_size);
plab->set_buf(buf_space);
record_survivor_plab(buf_space, buf_size);
+ gc_tracer()->report_promotion_to_new_plab(old, age, false, buf_size);
obj = plab->allocate_aligned(word_sz, SurvivorAlignmentInBytes);
// Note that we cannot compare buf_size < word_sz below
// because of AlignmentReserve (see ParGCAllocBuffer::allocate()).
assert(obj != NULL || plab->words_remaining() < word_sz,
"Else should have been able to allocate");
@@ -265,10 +268,11 @@
_to_space_full = true;
}
} else {
// Too large; allocate the object individually.
+ gc_tracer()->report_promotion_to_new_plab(old, age, false, old->size());
obj = sp->par_allocate(word_sz);
}
}
return obj;
}
@@ -301,10 +305,11 @@
ParNewGeneration& gen,
Generation& old_gen,
ObjToScanQueueSet& queue_set,
Stack<oop, mtGC>* overflow_stacks_,
size_t desired_plab_sz,
+ ParNewTracer* gc_tracer,
ParallelTaskTerminator& term);
~ParScanThreadStateSet() { TASKQUEUE_STATS_ONLY(reset_stats()); }
inline ParScanThreadState& thread_state(int i);
@@ -335,22 +340,23 @@
ParScanThreadStateSet::ParScanThreadStateSet(
int num_threads, Space& to_space, ParNewGeneration& gen,
Generation& old_gen, ObjToScanQueueSet& queue_set,
Stack<oop, mtGC>* overflow_stacks,
- size_t desired_plab_sz, ParallelTaskTerminator& term)
+ size_t desired_plab_sz,
+ ParNewTracer* gc_tracer, ParallelTaskTerminator& term)
: ResourceArray(sizeof(ParScanThreadState), num_threads),
_gen(gen), _next_gen(old_gen), _term(term)
{
assert(num_threads > 0, "sanity check!");
assert(ParGCUseLocalOverflow == (overflow_stacks != NULL),
"overflow_stack allocation mismatch");
// Initialize states.
for (int i = 0; i < num_threads; ++i) {
new ((ParScanThreadState*)_data + i)
ParScanThreadState(&to_space, &gen, &old_gen, i, &queue_set,
- overflow_stacks, desired_plab_sz, term);
+ overflow_stacks, desired_plab_sz, gc_tracer, term);
}
}
inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i)
{
@@ -978,11 +984,11 @@
// Always set the terminator for the active number of workers
// because only those workers go through the termination protocol.
ParallelTaskTerminator _term(n_workers, task_queues());
ParScanThreadStateSet thread_state_set(workers->active_workers(),
*to(), *this, *_next_gen, *task_queues(),
- _overflow_stacks, desired_plab_sz(), _term);
+ _overflow_stacks, desired_plab_sz(), &gc_tracer, _term);
ParNewGenTask tsk(this, _next_gen, reserved().end(), &thread_state_set);
gch->set_par_threads(n_workers);
gch->rem_set()->prepare_for_younger_refs_iterate(true);
// It turns out that even when we're using 1 thread, doing the work in a
@@ -1178,11 +1184,11 @@
oop new_obj = NULL;
oop forward_ptr;
// Try allocating obj in to-space (unless too old)
if (dummyOld.age() < tenuring_threshold()) {
- new_obj = (oop)par_scan_state->alloc_in_to_space(sz);
+ new_obj = (oop)par_scan_state->alloc_in_to_space(sz, old, dummyOld.age());
if (new_obj == NULL) {
set_survivor_overflow(true);
}
}
@@ -1305,11 +1311,11 @@
oop new_obj = NULL;
oop forward_ptr;
// Try allocating obj in to-space (unless too old)
if (dummyOld.age() < tenuring_threshold()) {
- new_obj = (oop)par_scan_state->alloc_in_to_space(sz);
+ new_obj = (oop)par_scan_state->alloc_in_to_space(sz, old, dummyOld.age());
if (new_obj == NULL) {
set_survivor_overflow(true);
}
}