JDK-8203628 : Optimize (masked) byte memory comparisons on x86
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: x86
  • Submitted: 2018-05-22
  • Updated: 2018-06-07
  • Resolved: 2018-05-28
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
11 b16Fixed
Related Reports
Relates :  
Relates :  
Description
We found this during Shenandoah performance work. In GC barriers fastpath, we have the shape like (Set cr (CmpI (AndI (LoadUB op1) op2) opZ)), which compiles down to:

 mov $op2, %r1
 andb ($op1), %r1
 test %r1, %r1

...while it can be compiled to just:

 testb ($op1), $op2

...thus saving the %r1.

G1 SATB checks have similar shape, but without the mask, and they waste the register in the same way.
Comments
RFR: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2018-May/029079.html
22-05-2018