JDK-7079626 : x64 emits unnecessary REX prefix
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs22
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-08-16
  • Updated: 2012-01-10
  • Resolved: 2011-11-25
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 7 Other
7u2Fixed hs22Fixed
Description
While investigating some other bug we found out that on x64 we sometimes emit unnecessary REX prefixes like:

  0xfffffd7ffa65f00f: rex mov    0x10(%rsi),%edi  ;*getfield offset
                                                ; - java.lang.String::hashCode@17 (line 1497)
  0xfffffd7ffa65f013: rex mov    0xc(%rsi),%ebp  ;*getfield value
                                                ; - java.lang.String::hashCode@22 (line 1498)

Comments
EVALUATION See main CR
12-09-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/381bf869f784
23-08-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/381bf869f784
17-08-2011

SUGGESTED FIX diff -r cfcf2ba8f3eb src/cpu/x86/vm/assembler_x86.cpp --- a/src/cpu/x86/vm/assembler_x86.cpp +++ b/src/cpu/x86/vm/assembler_x86.cpp @@ -3674,7 +3674,7 @@ void Assembler::prefix(Address adr, Regi } else { if (adr.index_needs_rex()) { prefix(REX_X); - } else if (reg->encoding() >= 4 ) { + } else if (byteinst && reg->encoding() >= 4 ) { prefix(REX); } }
16-08-2011

EVALUATION In Assembler::prefix we don't check byteinst argument as we do in Assembler::prefix_and_encode.
16-08-2011