3094 } |
3094 } |
3095 return NULL; |
3095 return NULL; |
3096 } |
3096 } |
3097 |
3097 |
3098 void do_object_work(oop obj) { |
3098 void do_object_work(oop obj) { |
3099 guarantee(!_g1h->obj_in_cs(obj), |
3099 guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || obj->is_oop(), |
|
3100 err_msg("Non-oop " PTR_FORMAT ", phase: %s, info: %d", |
|
3101 p2i((void*) obj), phase_str(), _info)); |
|
3102 guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || !_g1h->obj_in_cs(obj), |
3100 err_msg("obj: " PTR_FORMAT " in CSet, phase: %s, info: %d", |
3103 err_msg("obj: " PTR_FORMAT " in CSet, phase: %s, info: %d", |
3101 p2i((void*) obj), phase_str(), _info)); |
3104 p2i((void*) obj), phase_str(), _info)); |
3102 } |
3105 } |
3103 |
3106 |
3104 public: |
3107 public: |
3504 #endif |
3507 #endif |
3505 |
3508 |
3506 template<bool scan> |
3509 template<bool scan> |
3507 inline void CMTask::process_grey_object(oop obj) { |
3510 inline void CMTask::process_grey_object(oop obj) { |
3508 assert(scan || obj->is_typeArray(), "Skipping scan of grey non-typeArray"); |
3511 assert(scan || obj->is_typeArray(), "Skipping scan of grey non-typeArray"); |
3509 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant"); |
|
3510 |
3512 |
3511 if (_cm->verbose_high()) { |
3513 if (_cm->verbose_high()) { |
3512 gclog_or_tty->print_cr("[%u] processing grey object " PTR_FORMAT, |
3514 gclog_or_tty->print_cr("[%u] processing grey object " PTR_FORMAT, |
3513 _worker_id, p2i((void*) obj)); |
3515 _worker_id, p2i((void*) obj)); |
3514 } |
3516 } |
3515 |
3517 |
3516 size_t obj_size = obj->size(); |
3518 assert(G1CMObjArrayProcessor::is_array_slice(obj) || _nextMarkBitMap->isMarked((HeapWord*) obj), |
3517 _words_scanned += obj_size; |
3519 "Any stolen object should be a slice or marked"); |
3518 |
3520 |
3519 if (scan) { |
3521 if (scan) { |
3520 obj->oop_iterate(_cm_oop_closure); |
3522 if (G1CMObjArrayProcessor::is_array_slice(obj)) { |
|
3523 _words_scanned += _objArray_processor.process_slice(obj); |
|
3524 } else if (G1CMObjArrayProcessor::should_be_sliced(obj)) { |
|
3525 _words_scanned += _objArray_processor.process_obj(obj); |
|
3526 } else { |
|
3527 size_t obj_size = obj->size(); |
|
3528 _words_scanned += obj_size; |
|
3529 obj->oop_iterate(_cm_oop_closure);; |
|
3530 } |
3521 } |
3531 } |
3522 statsOnly( ++_objs_scanned ); |
3532 statsOnly( ++_objs_scanned ); |
3523 check_limits(); |
3533 check_limits(); |
3524 } |
3534 } |
3525 |
3535 |
3875 if (_cm->verbose_medium()) { |
3885 if (_cm->verbose_medium()) { |
3876 gclog_or_tty->print_cr("[%u] popped %d entries from the global stack", |
3886 gclog_or_tty->print_cr("[%u] popped %d entries from the global stack", |
3877 _worker_id, n); |
3887 _worker_id, n); |
3878 } |
3888 } |
3879 for (int i = 0; i < n; ++i) { |
3889 for (int i = 0; i < n; ++i) { |
|
3890 assert(G1CMObjArrayProcessor::is_array_slice(buffer[i]) || buffer[i]->is_oop(), |
|
3891 err_msg("Element " PTR_FORMAT " must be an array slice or oop", p2i(buffer[i]))); |
3880 bool success = _task_queue->push(buffer[i]); |
3892 bool success = _task_queue->push(buffer[i]); |
3881 // We only call this when the local queue is empty or under a |
3893 // We only call this when the local queue is empty or under a |
3882 // given target limit. So, we do not expect this push to fail. |
3894 // given target limit. So, we do not expect this push to fail. |
3883 assert(success, "invariant"); |
3895 assert(success, "invariant"); |
3884 } |
3896 } |
3893 // this operation was quite expensive, so decrease the limits |
3905 // this operation was quite expensive, so decrease the limits |
3894 decrease_limits(); |
3906 decrease_limits(); |
3895 } |
3907 } |
3896 |
3908 |
3897 void CMTask::drain_local_queue(bool partially) { |
3909 void CMTask::drain_local_queue(bool partially) { |
3898 if (has_aborted()) return; |
3910 if (has_aborted()) { |
|
3911 return; |
|
3912 } |
3899 |
3913 |
3900 // Decide what the target size is, depending whether we're going to |
3914 // Decide what the target size is, depending whether we're going to |
3901 // drain it partially (so that other tasks can steal if they run out |
3915 // drain it partially (so that other tasks can steal if they run out |
3902 // of things to do) or totally (at the very end). |
3916 // of things to do) or totally (at the very end). |
3903 size_t target_size; |
3917 size_t target_size; |
3920 |
3934 |
3921 if (_cm->verbose_high()) { |
3935 if (_cm->verbose_high()) { |
3922 gclog_or_tty->print_cr("[%u] popped " PTR_FORMAT, _worker_id, |
3936 gclog_or_tty->print_cr("[%u] popped " PTR_FORMAT, _worker_id, |
3923 p2i((void*) obj)); |
3937 p2i((void*) obj)); |
3924 } |
3938 } |
3925 |
|
3926 assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); |
|
3927 assert(!_g1h->is_on_master_free_list( |
|
3928 _g1h->heap_region_containing((HeapWord*) obj)), "invariant"); |
|
3929 |
3939 |
3930 scan_object(obj); |
3940 scan_object(obj); |
3931 |
3941 |
3932 if (_task_queue->size() <= target_size || has_aborted()) { |
3942 if (_task_queue->size() <= target_size || has_aborted()) { |
3933 ret = false; |
3943 ret = false; |
4425 _worker_id, p2i((void*) obj)); |
4435 _worker_id, p2i((void*) obj)); |
4426 } |
4436 } |
4427 |
4437 |
4428 statsOnly( ++_steals ); |
4438 statsOnly( ++_steals ); |
4429 |
4439 |
4430 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), |
|
4431 "any stolen object should be marked"); |
|
4432 scan_object(obj); |
4440 scan_object(obj); |
4433 |
4441 |
4434 // And since we're towards the end, let's totally drain the |
4442 // And since we're towards the end, let's totally drain the |
4435 // local queue and global stack. |
4443 // local queue and global stack. |
4436 drain_local_queue(false); |
4444 drain_local_queue(false); |
4600 BitMap* card_bm, |
4608 BitMap* card_bm, |
4601 CMTaskQueue* task_queue, |
4609 CMTaskQueue* task_queue, |
4602 CMTaskQueueSet* task_queues) |
4610 CMTaskQueueSet* task_queues) |
4603 : _g1h(G1CollectedHeap::heap()), |
4611 : _g1h(G1CollectedHeap::heap()), |
4604 _worker_id(worker_id), _cm(cm), |
4612 _worker_id(worker_id), _cm(cm), |
|
4613 _objArray_processor(this), |
4605 _claimed(false), |
4614 _claimed(false), |
4606 _nextMarkBitMap(NULL), _hash_seed(17), |
4615 _nextMarkBitMap(NULL), _hash_seed(17), |
4607 _task_queue(task_queue), |
4616 _task_queue(task_queue), |
4608 _task_queues(task_queues), |
4617 _task_queues(task_queues), |
4609 _cm_oop_closure(NULL), |
4618 _cm_oop_closure(NULL), |