97 int remainder = end - start;
98 // We'll try not to push a range that's smaller than ParGCArrayScanChunk.
99 if (remainder > 2 * ParGCArrayScanChunk) {
100 end = start + ParGCArrayScanChunk;
101 to_obj_array->set_length(end);
102 // Push the remainder before we process the range in case another
103 // worker has run out of things to do and can steal it.
104 oop* from_obj_p = set_partial_array_mask(from_obj);
105 push_on_queue(from_obj_p);
106 } else {
107 assert(length == end, "sanity");
108 // We'll process the final range for this object. Restore the length
109 // so that the heap remains parsable in case of evacuation failure.
110 to_obj_array->set_length(end);
111 }
112 _scanner.set_region(_g1h->heap_region_containing_raw(to_obj));
113 // Process indexes [start,end). It will also process the header
114 // along with the first chunk (i.e., the chunk with start == 0).
115 // Note that at this point the length field of to_obj_array is not
116 // correct given that we are using it to keep track of the next
117 // start index. oop_iterate_range() (thankfully!) ignores the length
118 // field and only relies on the start / end parameters. It does
119 // however return the size of the object which will be incorrect. So
120 // we have to ignore it even if we wanted to use it.
121 to_obj_array->oop_iterate_range(&_scanner, start, end);
122 }
123
124 template <class T> inline void G1ParScanThreadState::deal_with_reference(T* ref_to_scan) {
125 if (!has_partial_array_mask(ref_to_scan)) {
126 // Note: we can use "raw" versions of "region_containing" because
127 // "obj_to_scan" is definitely in the heap, and is not in a
128 // humongous region.
129 HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan);
130 do_oop_evac(ref_to_scan, r);
131 } else {
132 do_oop_partial_array((oop*)ref_to_scan);
133 }
134 }
135
136 inline void G1ParScanThreadState::dispatch_reference(StarTask ref) {
137 assert(verify_task(ref), "sanity");
138 if (ref.is_narrow()) {
139 deal_with_reference((narrowOop*)ref);
140 } else {
141 deal_with_reference((oop*)ref);
|
97 int remainder = end - start;
98 // We'll try not to push a range that's smaller than ParGCArrayScanChunk.
99 if (remainder > 2 * ParGCArrayScanChunk) {
100 end = start + ParGCArrayScanChunk;
101 to_obj_array->set_length(end);
102 // Push the remainder before we process the range in case another
103 // worker has run out of things to do and can steal it.
104 oop* from_obj_p = set_partial_array_mask(from_obj);
105 push_on_queue(from_obj_p);
106 } else {
107 assert(length == end, "sanity");
108 // We'll process the final range for this object. Restore the length
109 // so that the heap remains parsable in case of evacuation failure.
110 to_obj_array->set_length(end);
111 }
112 _scanner.set_region(_g1h->heap_region_containing_raw(to_obj));
113 // Process indexes [start,end). It will also process the header
114 // along with the first chunk (i.e., the chunk with start == 0).
115 // Note that at this point the length field of to_obj_array is not
116 // correct given that we are using it to keep track of the next
117 // start index. oop_iterate_range_t() (thankfully!) ignores the length
118 // field and only relies on the start / end parameters. It does
119 // however return the size of the object which will be incorrect. So
120 // we have to ignore it even if we wanted to use it.
121 to_obj_array->oop_iterate_range_t<true>(&_scanner, start, end);
122 }
123
124 template <class T> inline void G1ParScanThreadState::deal_with_reference(T* ref_to_scan) {
125 if (!has_partial_array_mask(ref_to_scan)) {
126 // Note: we can use "raw" versions of "region_containing" because
127 // "obj_to_scan" is definitely in the heap, and is not in a
128 // humongous region.
129 HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan);
130 do_oop_evac(ref_to_scan, r);
131 } else {
132 do_oop_partial_array((oop*)ref_to_scan);
133 }
134 }
135
136 inline void G1ParScanThreadState::dispatch_reference(StarTask ref) {
137 assert(verify_task(ref), "sanity");
138 if (ref.is_narrow()) {
139 deal_with_reference((narrowOop*)ref);
140 } else {
141 deal_with_reference((oop*)ref);
|