RFR: 8329726: Use non-short forward jumps in lightweight locking

Aleksey Shipilev shade at openjdk.org
Fri Apr 5 15:47:00 UTC 2024


On Fri, 5 Apr 2024 13:33:33 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> This turns a few short-jumps to long-jumps in x86 lightweight locking code paths. When running with -XX:+ShowMessageBoxOnError, MA::stop() generates more code and jccb is not sufficient to address this.
> 
> Two of the jccb are in ASSERT path anyway. However, another is also in a product path. We *could* generate jccb or jcc conditionally on ShowMessageBoxOnError, however, I don't think it is worth the trouble. WDYT?
> 
> Unfortunately, I could not make a simple test-case, because ShowMessageBoxOnError stops and waits on error, which would make jtreg time-out.
> 
> Testing:
>  - [x] manual test with dacapo as provided in the bug report
>  - [ ] tier1

Sad to give up a short jump in synchronization code just for asserts. Maybe we give up on code readability a bit? E.g.:


#ifdef ASSERT
  // Check that locked label is reached with ZF set.
  Label zf_bad_zero, zf_correct;
  jcc(Assembler::zero, zf_correct);
  jmp(zf_bad_zero)
#endif

  bind(slow_path);

#ifdef ASSERT
  // Check that slow_path label is reached with ZF not set.
  jccb(Assembler::notZero, zf_correct);
  stop("Fast Lock ZF != 0");
  bind(zf_bad_zero);
  stop("Fast Lock ZF != 1");
  bind(zf_correct);
#endif

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

PR Review: https://git.openjdk.org/jdk/pull/18657#pullrequestreview-1983580258


More information about the hotspot-compiler-dev mailing list