提交 e6f75963 编写于 作者: J johnc

7127708: G1: change task num types from int to uint in concurrent mark

Summary: Change the type of various task num fields, parameters etc to unsigned and rename them to be more consistent with the other collectors. Code changes were also reviewed by Vitaly Davidovich.
Reviewed-by: johnc
Contributed-by: NKaushik Srenevasan <kaushik@twitter.com>
上级 7a9dad8d
......@@ -399,9 +399,9 @@ protected:
// last claimed region
// marking tasks
uint _max_task_num; // maximum task number
uint _max_worker_id;// maximum worker id
uint _active_tasks; // task num currently active
CMTask** _tasks; // task queue array (max_task_num len)
CMTask** _tasks; // task queue array (max_worker_id len)
CMTaskQueueSet* _task_queues; // task queue set
ParallelTaskTerminator _terminator; // for termination
......@@ -492,10 +492,10 @@ protected:
ParallelTaskTerminator* terminator() { return &_terminator; }
// It claims the next available region to be scanned by a marking
// task. It might return NULL if the next region is empty or we have
// run out of regions. In the latter case, out_of_regions()
// task/thread. It might return NULL if the next region is empty or
// we have run out of regions. In the latter case, out_of_regions()
// determines whether we've really run out of regions or the task
// should call claim_region() again. This might seem a bit
// should call claim_region() again. This might seem a bit
// awkward. Originally, the code was written so that claim_region()
// either successfully returned with a non-empty region or there
// were no more regions to be claimed. The problem with this was
......@@ -505,7 +505,7 @@ protected:
// method. So, this way, each task will spend very little time in
// claim_region() and is allowed to call the regular clock method
// frequently.
HeapRegion* claim_region(int task);
HeapRegion* claim_region(uint worker_id);
// It determines whether we've run out of regions to scan.
bool out_of_regions() { return _finger == _heap_end; }
......@@ -537,8 +537,8 @@ protected:
bool has_aborted() { return _has_aborted; }
// Methods to enter the two overflow sync barriers
void enter_first_sync_barrier(int task_num);
void enter_second_sync_barrier(int task_num);
void enter_first_sync_barrier(uint worker_id);
void enter_second_sync_barrier(uint worker_id);
ForceOverflowSettings* force_overflow_conc() {
return &_force_overflow_conc;
......@@ -626,14 +626,14 @@ public:
double all_task_accum_vtime() {
double ret = 0.0;
for (int i = 0; i < (int)_max_task_num; ++i)
for (uint i = 0; i < _max_worker_id; ++i)
ret += _accum_task_vtime[i];
return ret;
}
// Attempts to steal an object from the task queues of other tasks
bool try_stealing(int task_num, int* hash_seed, oop& obj) {
return _task_queues->steal(task_num, hash_seed, obj);
bool try_stealing(uint worker_id, int* hash_seed, oop& obj) {
return _task_queues->steal(worker_id, hash_seed, obj);
}
ConcurrentMark(ReservedSpace rs, uint max_regions);
......@@ -823,7 +823,7 @@ public:
// Returns the card bitmap for a given task or worker id.
BitMap* count_card_bitmap_for(uint worker_id) {
assert(0 <= worker_id && worker_id < _max_task_num, "oob");
assert(0 <= worker_id && worker_id < _max_worker_id, "oob");
assert(_count_card_bitmaps != NULL, "uninitialized");
BitMap* task_card_bm = &_count_card_bitmaps[worker_id];
assert(task_card_bm->size() == _card_bm.size(), "size mismatch");
......@@ -833,7 +833,7 @@ public:
// Returns the array containing the marked bytes for each region,
// for the given worker or task id.
size_t* count_marked_bytes_array_for(uint worker_id) {
assert(0 <= worker_id && worker_id < _max_task_num, "oob");
assert(0 <= worker_id && worker_id < _max_worker_id, "oob");
assert(_count_marked_bytes != NULL, "uninitialized");
size_t* marked_bytes_array = _count_marked_bytes[worker_id];
assert(marked_bytes_array != NULL, "uninitialized");
......@@ -939,7 +939,7 @@ private:
global_stack_transfer_size = 16
};
int _task_id;
uint _worker_id;
G1CollectedHeap* _g1h;
ConcurrentMark* _cm;
CMBitMap* _nextMarkBitMap;
......@@ -1115,8 +1115,8 @@ public:
_elapsed_time_ms = os::elapsedTime() * 1000.0 - _elapsed_time_ms;
}
// returns the task ID
int task_id() { return _task_id; }
// returns the worker ID associated with this task.
uint worker_id() { return _worker_id; }
// From TerminatorTerminator. It determines whether this task should
// exit the termination protocol after it's entered it.
......@@ -1170,7 +1170,7 @@ public:
_finger = new_finger;
}
CMTask(int task_num, ConcurrentMark *cm,
CMTask(uint worker_id, ConcurrentMark *cm,
size_t* marked_bytes, BitMap* card_bm,
CMTaskQueue* task_queue, CMTaskQueueSet* task_queues);
......
......@@ -279,7 +279,7 @@ inline void CMTask::push(oop obj) {
assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] pushing "PTR_FORMAT, _task_id, (void*) obj);
gclog_or_tty->print_cr("[%u] pushing "PTR_FORMAT, _worker_id, (void*) obj);
}
if (!_task_queue->push(obj)) {
......@@ -287,9 +287,9 @@ inline void CMTask::push(oop obj) {
// to the global stack.
if (_cm->verbose_medium()) {
gclog_or_tty->print_cr("[%d] task queue overflow, "
gclog_or_tty->print_cr("[%u] task queue overflow, "
"moving entries to the global stack",
_task_id);
_worker_id);
}
move_entries_to_global_stack();
......@@ -318,8 +318,8 @@ inline void CMTask::push(oop obj) {
inline void CMTask::deal_with_reference(oop obj) {
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] we're dealing with reference = "PTR_FORMAT,
_task_id, (void*) obj);
gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT,
_worker_id, (void*) obj);
}
++_refs_reached;
......@@ -335,8 +335,8 @@ inline void CMTask::deal_with_reference(oop obj) {
HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
if (!hr->obj_allocated_since_next_marking(obj)) {
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] "PTR_FORMAT" is not considered marked",
_task_id, (void*) obj);
gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked",
_worker_id, (void*) obj);
}
// we need to mark it first
......@@ -350,8 +350,8 @@ inline void CMTask::deal_with_reference(oop obj) {
if (_finger != NULL && objAddr < _finger) {
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] below the local finger ("PTR_FORMAT"), "
"pushing it", _task_id, _finger);
gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), "
"pushing it", _worker_id, _finger);
}
push(obj);
} else if (_curr_region != NULL && objAddr < _region_limit) {
......@@ -367,9 +367,9 @@ inline void CMTask::deal_with_reference(oop obj) {
// correctness problems.
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] below the global finger "
gclog_or_tty->print_cr("[%u] below the global finger "
"("PTR_FORMAT"), pushing it",
_task_id, global_finger);
_worker_id, global_finger);
}
push(obj);
} else {
......@@ -382,9 +382,9 @@ inline void CMTask::deal_with_reference(oop obj) {
// see long comment above
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] below the global finger "
gclog_or_tty->print_cr("[%u] below the global finger "
"("PTR_FORMAT"), pushing it",
_task_id, global_finger);
_worker_id, global_finger);
}
push(obj);
}
......
......@@ -111,9 +111,9 @@ inline void G1CMOopClosure::do_oop_nv(T* p) {
oop obj = oopDesc::load_decode_heap_oop(p);
if (_cm->verbose_high()) {
gclog_or_tty->print_cr("[%d] we're looking at location "
gclog_or_tty->print_cr("[%u] we're looking at location "
"*"PTR_FORMAT" = "PTR_FORMAT,
_task->task_id(), p, (void*) obj);
_task->worker_id(), p, (void*) obj);
}
_task->deal_with_reference(obj);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册