Mercurial > hg > truffle
comparison src/share/vm/memory/genCollectedHeap.cpp @ 14521:29ccc4cbabca
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 12 Mar 2014 13:30:08 +0100 |
parents | d166675568f6 |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14520:f84115370178 | 14521:29ccc4cbabca |
---|---|
124 | 124 |
125 _reserved = MemRegion((HeapWord*)heap_rs.base(), | 125 _reserved = MemRegion((HeapWord*)heap_rs.base(), |
126 (HeapWord*)(heap_rs.base() + heap_rs.size())); | 126 (HeapWord*)(heap_rs.base() + heap_rs.size())); |
127 | 127 |
128 // It is important to do this in a way such that concurrent readers can't | 128 // It is important to do this in a way such that concurrent readers can't |
129 // temporarily think somethings in the heap. (Seen this happen in asserts.) | 129 // temporarily think something is in the heap. (Seen this happen in asserts.) |
130 _reserved.set_word_size(0); | 130 _reserved.set_word_size(0); |
131 _reserved.set_start((HeapWord*)heap_rs.base()); | 131 _reserved.set_start((HeapWord*)heap_rs.base()); |
132 size_t actual_heap_size = heap_rs.size(); | 132 size_t actual_heap_size = heap_rs.size(); |
133 _reserved.set_end((HeapWord*)(heap_rs.base() + actual_heap_size)); | 133 _reserved.set_end((HeapWord*)(heap_rs.base() + actual_heap_size)); |
134 | 134 |
590 | 590 |
591 void GenCollectedHeap:: | 591 void GenCollectedHeap:: |
592 gen_process_strong_roots(int level, | 592 gen_process_strong_roots(int level, |
593 bool younger_gens_as_roots, | 593 bool younger_gens_as_roots, |
594 bool activate_scope, | 594 bool activate_scope, |
595 bool is_scavenging, | |
596 SharedHeap::ScanningOption so, | 595 SharedHeap::ScanningOption so, |
597 OopsInGenClosure* not_older_gens, | 596 OopsInGenClosure* not_older_gens, |
598 bool do_code_roots, | |
599 OopsInGenClosure* older_gens, | 597 OopsInGenClosure* older_gens, |
600 KlassClosure* klass_closure) { | 598 KlassClosure* klass_closure) { |
601 // General strong roots. | 599 // General strong roots. |
602 | 600 |
603 if (!do_code_roots) { | 601 SharedHeap::process_strong_roots(activate_scope, so, |
604 SharedHeap::process_strong_roots(activate_scope, is_scavenging, so, | 602 not_older_gens, klass_closure); |
605 not_older_gens, NULL, klass_closure); | |
606 } else { | |
607 bool do_code_marking = (activate_scope || nmethod::oops_do_marking_is_active()); | |
608 CodeBlobToOopClosure code_roots(not_older_gens, /*do_marking=*/ do_code_marking); | |
609 SharedHeap::process_strong_roots(activate_scope, is_scavenging, so, | |
610 not_older_gens, &code_roots, klass_closure); | |
611 } | |
612 | 603 |
613 if (younger_gens_as_roots) { | 604 if (younger_gens_as_roots) { |
614 if (!_gen_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) { | 605 if (!_gen_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) { |
615 for (int i = 0; i < level; i++) { | 606 for (int i = 0; i < level; i++) { |
616 not_older_gens->set_generation(_gens[i]); | 607 not_older_gens->set_generation(_gens[i]); |
628 } | 619 } |
629 | 620 |
630 _gen_process_strong_tasks->all_tasks_completed(); | 621 _gen_process_strong_tasks->all_tasks_completed(); |
631 } | 622 } |
632 | 623 |
633 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure, | 624 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) { |
634 CodeBlobClosure* code_roots) { | 625 SharedHeap::process_weak_roots(root_closure); |
635 SharedHeap::process_weak_roots(root_closure, code_roots); | |
636 // "Local" "weak" refs | 626 // "Local" "weak" refs |
637 for (int i = 0; i < _n_gens; i++) { | 627 for (int i = 0; i < _n_gens; i++) { |
638 _gens[i]->ref_processor()->weak_oops_do(root_closure); | 628 _gens[i]->ref_processor()->weak_oops_do(root_closure); |
639 } | 629 } |
640 } | 630 } |
669 return _gens[0]->top_addr(); | 659 return _gens[0]->top_addr(); |
670 } | 660 } |
671 | 661 |
672 HeapWord** GenCollectedHeap::end_addr() const { | 662 HeapWord** GenCollectedHeap::end_addr() const { |
673 return _gens[0]->end_addr(); | 663 return _gens[0]->end_addr(); |
674 } | |
675 | |
676 size_t GenCollectedHeap::unsafe_max_alloc() { | |
677 return _gens[0]->unsafe_max_alloc_nogc(); | |
678 } | 664 } |
679 | 665 |
680 // public collection interfaces | 666 // public collection interfaces |
681 | 667 |
682 void GenCollectedHeap::collect(GCCause::Cause cause) { | 668 void GenCollectedHeap::collect(GCCause::Cause cause) { |
935 } | 921 } |
936 } | 922 } |
937 return result; | 923 return result; |
938 } | 924 } |
939 | 925 |
926 size_t GenCollectedHeap::tlab_used(Thread* thr) const { | |
927 size_t result = 0; | |
928 for (int i = 0; i < _n_gens; i += 1) { | |
929 if (_gens[i]->supports_tlab_allocation()) { | |
930 result += _gens[i]->tlab_used(); | |
931 } | |
932 } | |
933 return result; | |
934 } | |
935 | |
940 size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const { | 936 size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const { |
941 size_t result = 0; | 937 size_t result = 0; |
942 for (int i = 0; i < _n_gens; i += 1) { | 938 for (int i = 0; i < _n_gens; i += 1) { |
943 if (_gens[i]->supports_tlab_allocation()) { | 939 if (_gens[i]->supports_tlab_allocation()) { |
944 result += _gens[i]->unsafe_max_tlab_alloc(); | 940 result += _gens[i]->unsafe_max_tlab_alloc(); |
1265 _time = MIN2(_time, gen->time_of_last_gc(_now)); | 1261 _time = MIN2(_time, gen->time_of_last_gc(_now)); |
1266 } | 1262 } |
1267 }; | 1263 }; |
1268 | 1264 |
1269 jlong GenCollectedHeap::millis_since_last_gc() { | 1265 jlong GenCollectedHeap::millis_since_last_gc() { |
1270 // We need a monotonically non-deccreasing time in ms but | 1266 // We need a monotonically non-decreasing time in ms but |
1271 // os::javaTimeMillis() does not guarantee monotonicity. | 1267 // os::javaTimeMillis() does not guarantee monotonicity. |
1272 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; | 1268 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; |
1273 GenTimeOfLastGCClosure tolgc_cl(now); | 1269 GenTimeOfLastGCClosure tolgc_cl(now); |
1274 // iterate over generations getting the oldest | 1270 // iterate over generations getting the oldest |
1275 // time that a generation was collected | 1271 // time that a generation was collected |