comparison src/share/vm/memory/genCollectedHeap.cpp @ 3377:2aa9ddbb9e60

7041789: 30% perf regression with c2/arm following 7017732 Summary: Implement a more accurate is_scavengable() Reviewed-by: stefank, jcoomes, ysr
author jmasa
date Tue, 03 May 2011 10:30:34 -0700
parents 78542e2b5e35
children 6747fd0512e0
comparison
equal deleted inserted replaced
3373:688202ef6306 3377:2aa9ddbb9e60
709 void GenCollectedHeap::set_par_threads(int t) { 709 void GenCollectedHeap::set_par_threads(int t) {
710 SharedHeap::set_par_threads(t); 710 SharedHeap::set_par_threads(t);
711 _gen_process_strong_tasks->set_n_threads(t); 711 _gen_process_strong_tasks->set_n_threads(t);
712 } 712 }
713 713
714 class AssertIsPermClosure: public OopClosure {
715 public:
716 void do_oop(oop* p) {
717 assert((*p) == NULL || (*p)->is_perm(), "Referent should be perm.");
718 }
719 void do_oop(narrowOop* p) { ShouldNotReachHere(); }
720 };
721 static AssertIsPermClosure assert_is_perm_closure;
722
723 void GenCollectedHeap:: 714 void GenCollectedHeap::
724 gen_process_strong_roots(int level, 715 gen_process_strong_roots(int level,
725 bool younger_gens_as_roots, 716 bool younger_gens_as_roots,
726 bool activate_scope, 717 bool activate_scope,
727 bool collecting_perm_gen, 718 bool collecting_perm_gen,
960 false /* is_tlab */, 951 false /* is_tlab */,
961 n_gens() - 1 /* max_level */); 952 n_gens() - 1 /* max_level */);
962 } 953 }
963 } 954 }
964 955
956 bool GenCollectedHeap::is_in_young(oop p) {
957 bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start();
958 assert(result == _gens[0]->is_in_reserved(p),
959 err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p));
960 return result;
961 }
962
965 // Returns "TRUE" iff "p" points into the allocated area of the heap. 963 // Returns "TRUE" iff "p" points into the allocated area of the heap.
966 bool GenCollectedHeap::is_in(const void* p) const { 964 bool GenCollectedHeap::is_in(const void* p) const {
967 #ifndef ASSERT 965 #ifndef ASSERT
968 guarantee(VerifyBeforeGC || 966 guarantee(VerifyBeforeGC ||
969 VerifyDuringGC || 967 VerifyDuringGC ||
982 if (_perm_gen->as_gen()->is_in(p)) return true; 980 if (_perm_gen->as_gen()->is_in(p)) return true;
983 // Otherwise... 981 // Otherwise...
984 return false; 982 return false;
985 } 983 }
986 984
987 // Returns "TRUE" iff "p" points into the allocated area of the heap. 985 #ifdef ASSERT
988 bool GenCollectedHeap::is_in_youngest(void* p) { 986 // Don't implement this by using is_in_young(). This method is used
989 return _gens[0]->is_in(p); 987 // in some cases to check that is_in_young() is correct.
990 } 988 bool GenCollectedHeap::is_in_partial_collection(const void* p) {
989 assert(is_in_reserved(p) || p == NULL,
990 "Does not work if address is non-null and outside of the heap");
991 // The order of the generations is young (low addr), old, perm (high addr)
992 return p < _gens[_n_gens - 2]->reserved().end() && p != NULL;
993 }
994 #endif
991 995
992 void GenCollectedHeap::oop_iterate(OopClosure* cl) { 996 void GenCollectedHeap::oop_iterate(OopClosure* cl) {
993 for (int i = 0; i < _n_gens; i++) { 997 for (int i = 0; i < _n_gens; i++) {
994 _gens[i]->oop_iterate(cl); 998 _gens[i]->oop_iterate(cl);
995 } 999 }