United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7079626 x64 emits unnecessary REX prefix
7079626 : x64 emits unnecessary REX prefix

Details
Type:
Enhancement
Submit Date:
2011-08-16
Status:
Closed
Updated Date:
2012-01-10
Project Name:
JDK
Resolved Date:
2011-11-25
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs22
Fixed Versions:
hs22

Related Reports
Backport:

Sub Tasks

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
                                     
2011-09-12
EVALUATION

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

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/381bf869f784
                                     
2011-08-17
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);
       }
     }
                                     
2011-08-16
EVALUATION

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



Hardware and Software, Engineered to Work Together