Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @ 20223:b0c374311c4e
8035400: Move G1ParScanThreadState into its own files
Summary: Extract the G1ParScanThreadState class from G1CollectedHeap.?pp into its own files.
Reviewed-by: brutisso, mgerdin
author | tschatzl |
---|---|
date | Mon, 21 Jul 2014 09:41:04 +0200 |
parents | d7e2d5f2846b |
children | a3953c777565 |
comparison
equal
deleted
inserted
replaced
20222:0abcece2ee27 | 20223:b0c374311c4e |
---|---|
27 | 27 |
28 #include "gc_implementation/g1/concurrentMark.hpp" | 28 #include "gc_implementation/g1/concurrentMark.hpp" |
29 #include "gc_implementation/g1/g1CollectedHeap.hpp" | 29 #include "gc_implementation/g1/g1CollectedHeap.hpp" |
30 #include "gc_implementation/g1/g1AllocRegion.inline.hpp" | 30 #include "gc_implementation/g1/g1AllocRegion.inline.hpp" |
31 #include "gc_implementation/g1/g1CollectorPolicy.hpp" | 31 #include "gc_implementation/g1/g1CollectorPolicy.hpp" |
32 #include "gc_implementation/g1/g1RemSet.inline.hpp" | |
33 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" | 32 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
34 #include "gc_implementation/g1/heapRegionSet.inline.hpp" | 33 #include "gc_implementation/g1/heapRegionSet.inline.hpp" |
35 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" | 34 #include "gc_implementation/g1/heapRegionSeq.inline.hpp" |
36 #include "runtime/orderAccess.inline.hpp" | 35 #include "runtime/orderAccess.inline.hpp" |
37 #include "utilities/taskqueue.hpp" | 36 #include "utilities/taskqueue.hpp" |
289 else return true; | 288 else return true; |
290 } | 289 } |
291 else return is_obj_ill(obj, hr); | 290 else return is_obj_ill(obj, hr); |
292 } | 291 } |
293 | 292 |
294 template <class T> inline void G1ParScanThreadState::immediate_rs_update(HeapRegion* from, T* p, int tid) { | |
295 if (!from->is_survivor()) { | |
296 _g1_rem->par_write_ref(from, p, tid); | |
297 } | |
298 } | |
299 | |
300 template <class T> void G1ParScanThreadState::update_rs(HeapRegion* from, T* p, int tid) { | |
301 if (G1DeferredRSUpdate) { | |
302 deferred_rs_update(from, p, tid); | |
303 } else { | |
304 immediate_rs_update(from, p, tid); | |
305 } | |
306 } | |
307 | |
308 | |
309 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) { | |
310 assert(has_partial_array_mask(p), "invariant"); | |
311 oop from_obj = clear_partial_array_mask(p); | |
312 | |
313 assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap."); | |
314 assert(from_obj->is_objArray(), "must be obj array"); | |
315 objArrayOop from_obj_array = objArrayOop(from_obj); | |
316 // The from-space object contains the real length. | |
317 int length = from_obj_array->length(); | |
318 | |
319 assert(from_obj->is_forwarded(), "must be forwarded"); | |
320 oop to_obj = from_obj->forwardee(); | |
321 assert(from_obj != to_obj, "should not be chunking self-forwarded objects"); | |
322 objArrayOop to_obj_array = objArrayOop(to_obj); | |
323 // We keep track of the next start index in the length field of the | |
324 // to-space object. | |
325 int next_index = to_obj_array->length(); | |
326 assert(0 <= next_index && next_index < length, | |
327 err_msg("invariant, next index: %d, length: %d", next_index, length)); | |
328 | |
329 int start = next_index; | |
330 int end = length; | |
331 int remainder = end - start; | |
332 // We'll try not to push a range that's smaller than ParGCArrayScanChunk. | |
333 if (remainder > 2 * ParGCArrayScanChunk) { | |
334 end = start + ParGCArrayScanChunk; | |
335 to_obj_array->set_length(end); | |
336 // Push the remainder before we process the range in case another | |
337 // worker has run out of things to do and can steal it. | |
338 oop* from_obj_p = set_partial_array_mask(from_obj); | |
339 push_on_queue(from_obj_p); | |
340 } else { | |
341 assert(length == end, "sanity"); | |
342 // We'll process the final range for this object. Restore the length | |
343 // so that the heap remains parsable in case of evacuation failure. | |
344 to_obj_array->set_length(end); | |
345 } | |
346 _scanner.set_region(_g1h->heap_region_containing_raw(to_obj)); | |
347 // Process indexes [start,end). It will also process the header | |
348 // along with the first chunk (i.e., the chunk with start == 0). | |
349 // Note that at this point the length field of to_obj_array is not | |
350 // correct given that we are using it to keep track of the next | |
351 // start index. oop_iterate_range() (thankfully!) ignores the length | |
352 // field and only relies on the start / end parameters. It does | |
353 // however return the size of the object which will be incorrect. So | |
354 // we have to ignore it even if we wanted to use it. | |
355 to_obj_array->oop_iterate_range(&_scanner, start, end); | |
356 } | |
357 | |
358 template <class T> inline void G1ParScanThreadState::deal_with_reference(T* ref_to_scan) { | |
359 if (!has_partial_array_mask(ref_to_scan)) { | |
360 // Note: we can use "raw" versions of "region_containing" because | |
361 // "obj_to_scan" is definitely in the heap, and is not in a | |
362 // humongous region. | |
363 HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan); | |
364 do_oop_evac(ref_to_scan, r); | |
365 } else { | |
366 do_oop_partial_array((oop*)ref_to_scan); | |
367 } | |
368 } | |
369 | |
370 inline void G1ParScanThreadState::deal_with_reference(StarTask ref) { | |
371 assert(verify_task(ref), "sanity"); | |
372 if (ref.is_narrow()) { | |
373 deal_with_reference((narrowOop*)ref); | |
374 } else { | |
375 deal_with_reference((oop*)ref); | |
376 } | |
377 } | |
378 | |
379 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP | 293 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP |