JDK-8198310 : G1 does not properly age objects with displaced marks
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u60,9,10,11
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2018-02-16
  • Updated: 2018-02-16
  • Resolved: 2018-02-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11Resolved
Related Reports
Relates :  
Description
In G1ParScanThreadState::copy_to_survivor_state() there is this code that updates the age of the mark. For objects that have a displaced mark the code looks as follows:

      if (old_mark->has_displaced_mark_helper()) {
        // In this case, we have to install the mark word first,
        // otherwise obj looks to be forwarded (the old mark word,
        // which contains the forward pointer, was copied)
        obj->set_mark(old_mark);
        markOop new_mark = old_mark->displaced_mark_helper()->set_age(age);
        old_mark->set_displaced_mark_helper(new_mark);
      } else {
        obj->set_mark(old_mark->set_age(age));
      }

The first line copies the old mark to the current object, then the *old_mark*, which is a local variable, is updated.
The age of the obj's mark is never updated.

The impact is that as long as the object is locked (either a lock on stack, or an inflated lock), it won't be aged out into old gen. Typically only a very small amount of objects are locked, so the problem is mostly temporary.

This bug has been introduced in JDK-8064473.
Comments
Need to think about it again. Maybe it's correct after all.
16-02-2018