1 /* |
1 /* |
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
312 // !val_equals -> it will check that all cards covered by mr do not equal val |
316 // !val_equals -> it will check that all cards covered by mr do not equal val |
313 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN; |
317 void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN; |
314 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN; |
318 void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN; |
315 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN; |
319 void verify_dirty_region(MemRegion mr) PRODUCT_RETURN; |
316 |
320 |
|
321 // ReduceInitialCardMarks |
|
322 void initialize_deferred_card_mark_barriers(); |
|
323 |
|
324 // If the CollectedHeap was asked to defer a store barrier above, |
|
325 // this informs it to flush such a deferred store barrier to the |
|
326 // remembered set. |
|
327 void flush_deferred_card_mark_barrier(JavaThread* thread); |
|
328 |
|
329 // Can a compiler initialize a new object without store barriers? |
|
330 // This permission only extends from the creation of a new object |
|
331 // via a TLAB up to the first subsequent safepoint. If such permission |
|
332 // is granted for this heap type, the compiler promises to call |
|
333 // defer_store_barrier() below on any slow path allocation of |
|
334 // a new object for which such initializing store barriers will |
|
335 // have been elided. G1, like CMS, allows this, but should be |
|
336 // ready to provide a compensating write barrier as necessary |
|
337 // if that storage came out of a non-young region. The efficiency |
|
338 // of this implementation depends crucially on being able to |
|
339 // answer very efficiently in constant time whether a piece of |
|
340 // storage in the heap comes from a young region or not. |
|
341 // See ReduceInitialCardMarks. |
|
342 virtual bool can_elide_tlab_store_barriers() const { |
|
343 return true; |
|
344 } |
|
345 |
|
346 // If a compiler is eliding store barriers for TLAB-allocated objects, |
|
347 // we will be informed of a slow-path allocation by a call |
|
348 // to on_slowpath_allocation_exit() below. Such a call precedes the |
|
349 // initialization of the object itself, and no post-store-barriers will |
|
350 // be issued. Some heap types require that the barrier strictly follows |
|
351 // the initializing stores. (This is currently implemented by deferring the |
|
352 // barrier until the next slow-path allocation or gc-related safepoint.) |
|
353 // This interface answers whether a particular barrier type needs the card |
|
354 // mark to be thus strictly sequenced after the stores. |
|
355 virtual bool card_mark_must_follow_store() const = 0; |
|
356 |
|
357 virtual bool is_in_young(oop obj) const = 0; |
|
358 |
|
359 virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj); |
|
360 virtual void flush_deferred_barriers(JavaThread* thread); |
|
361 |
|
362 virtual void make_parsable(JavaThread* thread) { flush_deferred_card_mark_barrier(thread); } |
|
363 |
317 template <DecoratorSet decorators, typename BarrierSetT = CardTableModRefBS> |
364 template <DecoratorSet decorators, typename BarrierSetT = CardTableModRefBS> |
318 class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {}; |
365 class AccessBarrier: public ModRefBarrierSet::AccessBarrier<decorators, BarrierSetT> {}; |
319 }; |
366 }; |
320 |
367 |
321 template<> |
368 template<> |