JDK-6480445 : Missed tree flatten opportunity in Direct ByteBuffer addressing
Type:Bug
Component:hotspot
Sub-Component:compiler
Affected Version:7
Priority:P4
Status:Resolved
Resolution:Fixed
OS:solaris_9
CPU:sparc
Submitted:2006-10-10
Updated:2010-05-08
Resolved:2006-11-14
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.
SUGGESTED FIX
*** /tmp/geta11449 Tue Oct 10 14:54:15 2006
--- addnode.cpp Tue Oct 10 14:49:43 2006
***************
*** 475,481 ****
// If the left input is an add of a constant, flatten the expression tree.
const Node *n = in(Address);
! if( n->is_AddP() && n->in(Base) != phase->C->top() ) {
const AddPNode *addp = n->as_AddP(); // Left input is an AddP
assert( !addp->in(Address)->is_AddP() ||
addp->in(Address)->as_AddP() != addp,
--- 475,481 ----
// If the left input is an add of a constant, flatten the expression tree.
const Node *n = in(Address);
! if( n->is_AddP() && n->in(Base) == in(Base) ) {
const AddPNode *addp = n->as_AddP(); // Left input is an AddP
assert( !addp->in(Address)->is_AddP() ||
addp->in(Address)->as_AddP() != addp,
10-10-2006
EVALUATION
Src:
private final FloatBuffer byteBuffer =
ByteBuffer.allocateDirect(40000).
order(ByteOrder.nativeOrder()).asFloatBuffer();
for (int i = 0; i < 10000; i++) {
byteBuffer.put(i, 1234.5678f);
}
Before:
0c0 B11: # B20 B12 <- B10 B12 Loop: B11-B12 inner stride: not constant main Freq: 291826
0c0 MOV [ESP + #28],EAX
0c4 LEA EDI,[EAX + ESI << #2]
0c7 MOV [EDI],#1234.567749 # store float
0cd LEA ECX,[EDI + #32]
0d0 MOV [EDI + #4],#1234.567749 # store float
0d7 LEA EBP,[ECX + #16]
0da LEA EBX,[ECX + #8]
0dd LEA EAX,[EBP + #8]
0e0 MOV [ESP + #32],EAX
0e4 LEA EAX,[EDI + #16]
0e7 LEA EDI,[EDI + #8]
0ea LEA EDX,[EAX + #8]
0ed MOV [EDI],#1234.567749 # store float
0f3 MOV [EDI + #4],#1234.567749 # store float
0fa MOV [EAX],#1234.567749 # store float
100 MOV [EAX + #4],#1234.567749 # store float
107 MOV [EDX],#1234.567749 # store float
10d MOV [EDX + #4],#1234.567749 # store float
114 MOV [ECX],#1234.567749 # store float
11a MOV [ECX + #4],#1234.567749 # store float
121 MOV [EBX],#1234.567749 # store float
127 MOV [EBX + #4],#1234.567749 # store float
12e MOV [EBP],#1234.567749 # store float
135 MOV [EBP + #4],#1234.567749 # store float
13c MOV EBX,[ESP + #32]
140 MOV [EBX],#1234.567749 # store float
146 MOV ECX,EBX
148 MOV [ECX + #4],#1234.567749 # store float
14f ADD ESI,#16
152 CMP ESI,[ESP + #44]
156 Jge B20 # Loop end P=0.000099 C=291840.000000
156
15c B12: # B11 <- B11 Freq: 335583
15c MOV EAX,[ESP + #28]
160 JMP B11
After:
0b0 B11: # B11 B12 <- B10 B11 Loop: B11-B11 inner stride: not constant main Freq: 371694
0b0 LEA ESI,[EAX + EBX << #2]
0b3 MOV [ESI],#1234.567749 # store float
0b9 MOV [ESI + #4],#1234.567749 # store float
0c0 MOV [ESI + #8],#1234.567749 # store float
0c7 MOV [ESI + #12],#1234.567749 # store float
0ce MOV [ESI + #16],#1234.567749 # store float
0d5 MOV [ESI + #20],#1234.567749 # store float
0dc MOV [ESI + #24],#1234.567749 # store float
0e3 MOV [ESI + #28],#1234.567749 # store float
0ea MOV [ESI + #32],#1234.567749 # store float
0f1 MOV [ESI + #36],#1234.567749 # store float
0f8 MOV [ESI + #40],#1234.567749 # store float
0ff MOV [ESI + #44],#1234.567749 # store float
106 MOV [ESI + #48],#1234.567749 # store float
10d MOV [ESI + #52],#1234.567749 # store float
114 MOV [ESI + #56],#1234.567749 # store float
11b MOV [ESI + #60],#1234.567749 # store float
122 ADD EBX,#16
125 CMP EBX,EBP
127 Jlt,s B11 P=0.999900 C=371712.000000