26
26
#include " gc/serial/defNewGeneration.inline.hpp"
27
27
#include " gc/serial/serialGcRefProcProxyTask.hpp"
28
28
#include " gc/serial/serialHeap.inline.hpp"
29
+ #include " gc/serial/serialStringDedup.inline.hpp"
29
30
#include " gc/serial/tenuredGeneration.hpp"
30
31
#include " gc/shared/adaptiveSizePolicy.hpp"
31
32
#include " gc/shared/ageTable.inline.hpp"
@@ -142,7 +143,8 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
142
143
: Generation(rs, initial_size),
143
144
_preserved_marks_set(false /* in_c_heap */ ),
144
145
_promo_failure_drain_in_progress(false ),
145
- _should_allocate_from_space(false )
146
+ _should_allocate_from_space(false ),
147
+ _string_dedup_requests()
146
148
{
147
149
MemRegion cmr ((HeapWord*)_virtual_space.low (),
148
150
(HeapWord*)_virtual_space.high ());
@@ -601,6 +603,8 @@ void DefNewGeneration::collect(bool full,
601
603
// Verify that the usage of keep_alive didn't copy any objects.
602
604
assert (heap->no_allocs_since_save_marks (), " save marks have not been newly set." );
603
605
606
+ _string_dedup_requests.flush ();
607
+
604
608
if (!_promotion_failed) {
605
609
// Swap the survivor spaces.
606
610
eden ()->clear (SpaceDecorator::Mangle);
@@ -705,13 +709,15 @@ oop DefNewGeneration::copy_to_survivor_space(oop old) {
705
709
obj = cast_to_oop (to ()->allocate (s));
706
710
}
707
711
712
+ bool new_obj_is_tenured = false ;
708
713
// Otherwise try allocating obj tenured
709
714
if (obj == NULL ) {
710
715
obj = _old_gen->promote (old, s);
711
716
if (obj == NULL ) {
712
717
handle_promotion_failure (old);
713
718
return old;
714
719
}
720
+ new_obj_is_tenured = true ;
715
721
} else {
716
722
// Prefetch beyond obj
717
723
const intx interval = PrefetchCopyIntervalInBytes;
@@ -728,6 +734,11 @@ oop DefNewGeneration::copy_to_survivor_space(oop old) {
728
734
// Done, insert forward pointer to obj in this header
729
735
old->forward_to (obj);
730
736
737
+ if (SerialStringDedup::is_candidate_from_evacuation (obj, new_obj_is_tenured)) {
738
+ // Record old; request adds a new weak reference, which reference
739
+ // processing expects to refer to a from-space object.
740
+ _string_dedup_requests.add (old);
741
+ }
731
742
return obj;
732
743
}
733
744
1 commit comments
openjdk-notifier[bot] commentedon Aug 23, 2021
Review
Issues