RFR: 8318462: [GenShen] Prevent unsafe access to displaced mark-word [v2]

Zhengyu Gu zgu at openjdk.org
Wed Nov 1 13:29:59 UTC 2023


On Tue, 31 Oct 2023 09:39:45 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> > Just FYI: Here is another place to update object age, probably you want to consolidate.
> > https://github.com/openjdk/shenandoah/blob/master/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp#L55
> 
> Right. The problem there is that this block of code does a sort of concurrent/atomic update of the object age that would require re-working and/or adding age helper methods. I'd rather not do that now.

I think for GenShen, StringDeduplication should not update age, so code can just be simplified as following:


bool ShenandoahStringDedup::is_candidate(oop obj) {
  if (!is_string_candidate(obj)) {
    return false;
  }

  const markWord mark = obj->mark();

  // Having/had displaced header, too risky to deal with them, skip
  if ((LockingMode != LM_LIGHTWEIGHT && mark == markWord::INFLATING()) || mark.has_displaced_mark_helper()) {
    return false;
  }

  return StringDedup::is_threshold_age(new_mark.age()) &&
             !dedup_requested(obj);
}

-------------

PR Comment: https://git.openjdk.org/shenandoah/pull/343#issuecomment-1788955550


More information about the shenandoah-dev mailing list