Optimizing byte reverse code for int value

Andrew Haley aph at redhat.com
Fri Apr 7 08:36:13 UTC 2017

On 07/04/17 06:49, Michihiro Horie wrote:
> Would you please review our change for JDK10 on ppc64?
> Issue: https://bugs.openjdk.java.net/browse/JDK-8178294
> Webrev: http://cr.openjdk.java.net/~horii/8178294/webrev.00/
> This change adds two conversion rules of reversing contiguous 4 bytes for
> int value.
> The first conversion rule finds a pattern below and emits a lwz instruction
> instead.

Surely the source code needs fixing.  It could be:

public float readFloat(InputStream in) throws IOException {
  readFully(in, aByteBuffer, 0, 4);
  int val = aByteBuffer.getInt(0);

  return Float.intBitsToFloat(val);

Then there would be no need for a special ppc64 pattern.


More information about the hotspot-dev mailing list