comparison src/share/vm/memory/sharedHeap.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 1f4413413144
children c2bf0120ee5d
comparison
equal deleted inserted replaced
3373:688202ef6306 3377:2aa9ddbb9e60
99 assert((*p) == NULL || (*p)->is_perm(), "Referent should be perm."); 99 assert((*p) == NULL || (*p)->is_perm(), "Referent should be perm.");
100 } 100 }
101 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } 101 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
102 }; 102 };
103 static AssertIsPermClosure assert_is_perm_closure; 103 static AssertIsPermClosure assert_is_perm_closure;
104
105 #ifdef ASSERT
106 class AssertNonScavengableClosure: public OopClosure {
107 public:
108 virtual void do_oop(oop* p) {
109 assert(!Universe::heap()->is_in_partial_collection(*p),
110 "Referent should not be scavengable."); }
111 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
112 };
113 static AssertNonScavengableClosure assert_is_non_scavengable_closure;
114 #endif
104 115
105 void SharedHeap::change_strong_roots_parity() { 116 void SharedHeap::change_strong_roots_parity() {
106 // Also set the new collection parity. 117 // Also set the new collection parity.
107 assert(_strong_roots_parity >= 0 && _strong_roots_parity <= 2, 118 assert(_strong_roots_parity >= 0 && _strong_roots_parity <= 2,
108 "Not in range."); 119 "Not in range.");
194 // CodeCache::do_unloading. This will kill off nmethods with expired 205 // CodeCache::do_unloading. This will kill off nmethods with expired
195 // weak references, such as stale invokedynamic targets. 206 // weak references, such as stale invokedynamic targets.
196 CodeCache::scavenge_root_nmethods_do(code_roots); 207 CodeCache::scavenge_root_nmethods_do(code_roots);
197 } 208 }
198 } 209 }
199 // Verify if the code cache contents are in the perm gen 210 // Verify that the code cache contents are not subject to
200 NOT_PRODUCT(CodeBlobToOopClosure assert_code_is_perm(&assert_is_perm_closure, /*do_marking=*/ false)); 211 // movement by a scavenging collection.
201 NOT_PRODUCT(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_perm)); 212 DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, /*do_marking=*/ false));
213 DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
202 } 214 }
203 215
204 if (!collecting_perm_gen) { 216 if (!collecting_perm_gen) {
205 // All threads perform this; coordination is handled internally. 217 // All threads perform this; coordination is handled internally.
206 218