< prev index next >
src/share/vm/gc/parallel/gcTaskThread.cpp
Print this page
rev 11970 : [mq]: parallel_gc_task_threads_singlethreaded
*** 56,71 ****
GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
if (_time_stamps == NULL) {
// We allocate the _time_stamps array lazily since logging can be enabled dynamically
! GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
! void* old = Atomic::cmpxchg_ptr(time_stamps, &_time_stamps, NULL);
! if (old != NULL) {
! // Someone already setup the time stamps
! FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
! }
}
return &(_time_stamps[index]);
}
--- 56,66 ----
GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
if (_time_stamps == NULL) {
// We allocate the _time_stamps array lazily since logging can be enabled dynamically
! _time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
}
return &(_time_stamps[index]);
}
*** 138,162 ****
task->do_it(manager(), which());
// Use the saved value of is_idle_task because references
// using "task" are not reliable for the barrier task.
if (!is_idle_task) {
- manager()->note_completion(which());
-
if (log_is_enabled(Debug, gc, task, time)) {
timer.update();
GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
time_stamp->set_name(name);
time_stamp->set_entry_time(entry_time);
time_stamp->set_exit_time(timer.ticks());
-
- // Update the index after we have set up the entry correctly since
- // GCTaskThread::print_task_time_stamps() may read this value concurrently.
_time_stamp_index++;
}
} else {
// idle tasks complete outside the normal accounting
// so that a task can complete without waiting for idle tasks.
// They have to be terminated separately.
IdleGCTask::destroy((IdleGCTask*)task);
--- 133,153 ----
task->do_it(manager(), which());
// Use the saved value of is_idle_task because references
// using "task" are not reliable for the barrier task.
if (!is_idle_task) {
if (log_is_enabled(Debug, gc, task, time)) {
timer.update();
GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
time_stamp->set_name(name);
time_stamp->set_entry_time(entry_time);
time_stamp->set_exit_time(timer.ticks());
_time_stamp_index++;
}
+ manager()->note_completion(which());
} else {
// idle tasks complete outside the normal accounting
// so that a task can complete without waiting for idle tasks.
// They have to be terminated separately.
IdleGCTask::destroy((IdleGCTask*)task);
< prev index next >