Mercurial > hg > truffle
comparison src/share/vm/opto/runtime.cpp @ 1166:7b0e9cba0307
6896647: card marks can be deferred too long
Summary: Deferred card marks are now flushed during the gc prologue. Parallel[Scavege,OldGC] and SerialGC no longer defer card marks generated by COMPILER2 as a result of ReduceInitialCardMarks. For these cases, introduced a diagnostic option to defer the card marks, only for the purposes of testing and diagnostics. CMS and G1 continue to defer card marks. Potential performance concern related to single-threaded flushing of deferred card marks in the gc prologue will be addressed in the future.
Reviewed-by: never, johnc
author | ysr |
---|---|
date | Wed, 13 Jan 2010 15:26:39 -0800 |
parents | 4ce7240d622c |
children | 87684f1a88b5 6deeaebad47a |
comparison
equal
deleted
inserted
replaced
1165:2dd52dea6d28 | 1166:7b0e9cba0307 |
---|---|
141 | 141 |
142 //=============================allocation====================================== | 142 //=============================allocation====================================== |
143 // We failed the fast-path allocation. Now we need to do a scavenge or GC | 143 // We failed the fast-path allocation. Now we need to do a scavenge or GC |
144 // and try allocation again. | 144 // and try allocation again. |
145 | 145 |
146 void OptoRuntime::maybe_defer_card_mark(JavaThread* thread) { | 146 void OptoRuntime::new_store_pre_barrier(JavaThread* thread) { |
147 // After any safepoint, just before going back to compiled code, | 147 // After any safepoint, just before going back to compiled code, |
148 // we inform the GC that we will be doing initializing writes to | 148 // we inform the GC that we will be doing initializing writes to |
149 // this object in the future without emitting card-marks, so | 149 // this object in the future without emitting card-marks, so |
150 // GC may take any compensating steps. | 150 // GC may take any compensating steps. |
151 // NOTE: Keep this code consistent with GraphKit::store_barrier. | 151 // NOTE: Keep this code consistent with GraphKit::store_barrier. |
154 if (new_obj == NULL) return; | 154 if (new_obj == NULL) return; |
155 | 155 |
156 assert(Universe::heap()->can_elide_tlab_store_barriers(), | 156 assert(Universe::heap()->can_elide_tlab_store_barriers(), |
157 "compiler must check this first"); | 157 "compiler must check this first"); |
158 // GC may decide to give back a safer copy of new_obj. | 158 // GC may decide to give back a safer copy of new_obj. |
159 new_obj = Universe::heap()->defer_store_barrier(thread, new_obj); | 159 new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj); |
160 thread->set_vm_result(new_obj); | 160 thread->set_vm_result(new_obj); |
161 } | 161 } |
162 | 162 |
163 // object allocation | 163 // object allocation |
164 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(klassOopDesc* klass, JavaThread* thread)) | 164 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(klassOopDesc* klass, JavaThread* thread)) |
198 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); | 198 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); |
199 JRT_BLOCK_END; | 199 JRT_BLOCK_END; |
200 | 200 |
201 if (GraphKit::use_ReduceInitialCardMarks()) { | 201 if (GraphKit::use_ReduceInitialCardMarks()) { |
202 // inform GC that we won't do card marks for initializing writes. | 202 // inform GC that we won't do card marks for initializing writes. |
203 maybe_defer_card_mark(thread); | 203 new_store_pre_barrier(thread); |
204 } | 204 } |
205 JRT_END | 205 JRT_END |
206 | 206 |
207 | 207 |
208 // array allocation | 208 // array allocation |
237 thread->set_vm_result(result); | 237 thread->set_vm_result(result); |
238 JRT_BLOCK_END; | 238 JRT_BLOCK_END; |
239 | 239 |
240 if (GraphKit::use_ReduceInitialCardMarks()) { | 240 if (GraphKit::use_ReduceInitialCardMarks()) { |
241 // inform GC that we won't do card marks for initializing writes. | 241 // inform GC that we won't do card marks for initializing writes. |
242 maybe_defer_card_mark(thread); | 242 new_store_pre_barrier(thread); |
243 } | 243 } |
244 JRT_END | 244 JRT_END |
245 | 245 |
246 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array. | 246 // Note: multianewarray for one dimension is handled inline by GraphKit::new_array. |
247 | 247 |