21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1Allocator.inline.hpp"
27 #include "gc/g1/g1CollectedHeap.inline.hpp"
28 #include "gc/g1/g1CollectionSet.hpp"
29 #include "gc/g1/g1OopClosures.inline.hpp"
30 #include "gc/g1/g1ParScanThreadState.inline.hpp"
31 #include "gc/g1/g1RootClosures.hpp"
32 #include "gc/g1/g1StringDedup.hpp"
33 #include "gc/shared/taskqueue.inline.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "runtime/prefetch.inline.hpp"
36
37 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length)
38 : _g1h(g1h),
39 _refs(g1h->task_queue(worker_id)),
40 _dcq(&g1h->dirty_card_queue_set()),
41 _ct_bs(g1h->g1_barrier_set()),
42 _closures(NULL),
43 _hash_seed(17),
44 _worker_id(worker_id),
45 _tenuring_threshold(g1h->g1_policy()->tenuring_threshold()),
46 _age_table(false),
47 _scanner(g1h, this),
48 _old_gen_is_full(false)
49 {
50 // we allocate G1YoungSurvRateNumRegions plus one entries, since
51 // we "sacrifice" entry 0 to keep track of surviving bytes for
52 // non-young regions (where the age is -1)
53 // We also add a few elements at the beginning and at the end in
54 // an attempt to eliminate cache contention
55 size_t real_length = 1 + young_cset_length;
56 size_t array_length = PADDING_ELEM_NUM +
57 real_length +
58 PADDING_ELEM_NUM;
59 _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
60 if (_surviving_young_words_base == NULL)
61 vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR,
384 _g1h->hr_printer()->evac_failure(r);
385 }
386
387 _g1h->preserve_mark_during_evac_failure(_worker_id, old, m);
388
389 _scanner.set_region(r);
390 old->oop_iterate_backwards(&_scanner);
391
392 return old;
393 } else {
394 // Forward-to-self failed. Either someone else managed to allocate
395 // space for this object (old != forward_ptr) or they beat us in
396 // self-forwarding it (old == forward_ptr).
397 assert(old == forward_ptr || !_g1h->is_in_cset(forward_ptr),
398 "Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " "
399 "should not be in the CSet",
400 p2i(old), p2i(forward_ptr));
401 return forward_ptr;
402 }
403 }
404
|
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1Allocator.inline.hpp"
27 #include "gc/g1/g1CollectedHeap.inline.hpp"
28 #include "gc/g1/g1CollectionSet.hpp"
29 #include "gc/g1/g1OopClosures.inline.hpp"
30 #include "gc/g1/g1ParScanThreadState.inline.hpp"
31 #include "gc/g1/g1RootClosures.hpp"
32 #include "gc/g1/g1StringDedup.hpp"
33 #include "gc/shared/taskqueue.inline.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "runtime/prefetch.inline.hpp"
36
37 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length)
38 : _g1h(g1h),
39 _refs(g1h->task_queue(worker_id)),
40 _dcq(&g1h->dirty_card_queue_set()),
41 _ct(g1h->g1_card_table()),
42 _closures(NULL),
43 _hash_seed(17),
44 _worker_id(worker_id),
45 _tenuring_threshold(g1h->g1_policy()->tenuring_threshold()),
46 _age_table(false),
47 _scanner(g1h, this),
48 _old_gen_is_full(false)
49 {
50 // we allocate G1YoungSurvRateNumRegions plus one entries, since
51 // we "sacrifice" entry 0 to keep track of surviving bytes for
52 // non-young regions (where the age is -1)
53 // We also add a few elements at the beginning and at the end in
54 // an attempt to eliminate cache contention
55 size_t real_length = 1 + young_cset_length;
56 size_t array_length = PADDING_ELEM_NUM +
57 real_length +
58 PADDING_ELEM_NUM;
59 _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
60 if (_surviving_young_words_base == NULL)
61 vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR,
384 _g1h->hr_printer()->evac_failure(r);
385 }
386
387 _g1h->preserve_mark_during_evac_failure(_worker_id, old, m);
388
389 _scanner.set_region(r);
390 old->oop_iterate_backwards(&_scanner);
391
392 return old;
393 } else {
394 // Forward-to-self failed. Either someone else managed to allocate
395 // space for this object (old != forward_ptr) or they beat us in
396 // self-forwarding it (old == forward_ptr).
397 assert(old == forward_ptr || !_g1h->is_in_cset(forward_ptr),
398 "Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " "
399 "should not be in the CSet",
400 p2i(old), p2i(forward_ptr));
401 return forward_ptr;
402 }
403 }
|