RFR: Fix object iteration over limit
Dominik Inführ
dominik.infuehr at gmail.com
Wed Oct 18 12:58:06 UTC 2017
HeapWord* end = MIN2(top_at_mark_start +
BrooksPointer::word_size(), region->end());+ HeapWord* limit_bitmap =
MIN2(limit, top_at_mark_start);+
HeapWord* addr = mark_bit_map->getNextMarkedWordAddress(start, end);
+ // We have stepped over the TAMS with bitmap scan, rewind back:+
if (addr >= top_at_mark_start) {+ addr = top_at_mark_start +
BrooksPointer::word_size();+ }
I don't understand why this `if` here is necessary.
mark_bit_map->getNextMarkedWordAddress(start, end) returns a value
between [start, end]. Where end = TAMS+BrooksPointer::word_size() (or
region->end() if smaller but this shouldn't be relevant here).
Hence addr should already be in [start,
TAMS+BrooksPointer::word_size()]. addr == TAMS shouldn't be possible
since we mark the object, not the fwdptr before it. Where am I
mistaken here?
Couldn't addr after the assignment addr = top_at_mark_start +
BrooksPointer::word_size(); be larger than region->end()? In the case
that the region is completely full before InitMark?
Again, I'm sorry for being annoying, but I might have to adapt this
code for my thesis, so I guess it is good if I understand this.
Dominik
On Wed, Oct 18, 2017 at 2:08 PM, Aleksey Shipilev <shade at redhat.com> wrote:
> On 10/18/2017 01:09 PM, Aleksey Shipilev wrote:
> > On 10/17/2017 09:13 PM, Zhengyu Gu wrote:
> >> When iterating object using bitmap, we may pass TAMS limit if remaining
> oops under TAMS are not marked.
> >>
> >> http://cr.openjdk.java.net/~zgu/shenandoah/obj_itr/webrev.00/
> >
> > I agree this is the bug (and a serious one, at that) -- thanks for
> catching this!
> > I understand the fix, but let me see if there is a more concise solution.
>
> What a mess. I think there are three places where we can hit this bug:
> http://cr.openjdk.java.net/~shade/shenandoah/markscan-
> tams-bug/webrev.01/
>
> I think it would be cleaner to just rewrite marked_object_iterate. I can
> do this, if you want.
>
> -Aleksey
>
>
More information about the shenandoah-dev
mailing list