SUGGESTED FIX
src/share/vm/opto/gcm.cpp Fri May 22 18:20:43 2009 -0700
@@ -595,6 +595,9 @@ Block* PhaseCFG::insert_anti_dependences
assert(!LCA_orig->dominates(pred_block) ||
early->dominates(pred_block), "early is high enough");
must_raise_LCA = true;
+ } else {
+ // anti-dependent upon PHI pinned below 'early', no edge needed
+ LCA = early; // but can not schedule below 'early'
}
}
}
|
EVALUATION
Fix for 6384206 may hided the problem. The regression was introduced with next changes:
6510732: Compute consistent block frequencies
But even that change may only expose a pre-existing problem.
The root of the exception is GCM moved the next load inside the loop
Item last = item.prev;
which is wrong since during call to linkOut() item.prev = null. The comment in the test is correct -
it is the null which produce the exception on the next loop iteration.
025 B2: # B3 <- B1 Freq: 3267.82
025 MOV EDI,EAX
027 MOV [ESP + #8],EAX
02b XOR EDX,EDX
02d
02d B3: # B25 B4 <- B2 B28 Loop: B3-B28 Freq: 3667.9
02d TEST EDX,EDX
02f Jne B25 P=0.471259 C=4645.000000
02f
035 B4: # B33 B5 <- B3 Freq: 1939.37
035 MOV [ESP + #0],ECX
038 MOV EBX,[EAX + #16] ! Field Test$Item.prev <<<<<<<<<<<<<< incorrectly placed inside the loop
03b MOV [ESP + #4],EBX
03f MOV EBX,[EBX + #12] ! Field Test$Item.next <<<<<<<<<<<<<< EBX == NULL
042 NullCheck EBX
With 6384206 fix it is:
025 B2: # B3 <- B1 Freq: 3267.82
025 MOV ESI,[EDI + #16] ! Field Test$Item.prev <<<<<<<<<< correctly placed before the loop
028 XOR EBP,EBP
02a
02a B3: # B22 B4 <- B2 B20 Loop: B3-B20 Freq: 6534.11
02a TEST EBP,EBP
02c Jne B22 P=0.471259 C=4645.000000
02c
032 B4: # B27 B5 <- B3 Freq: 3454.85
032 MOV EAX,[ESI + #12] ! Field Test$Item.next
035 NullCheck ESI
But we could be simply "lucky" since the load is placed into the lowest-fequency block.
B2:Freq > B4:Freq in the failing case and B2:Freq < B4:Freq in the passing case.
Note, the load has the control edge before the loop:
31 IfTrue === 28 [[ 325 37 ]] #1 !jvms: Test::removeItems @ bci:6
37 LoadP === 31 7 36 [[ 330 98 154 280 330 ]] @Test$Item+16 *, name=prev, idx=5; #Test$Item * Oop:Test$Item * !orig=[52] !jvms: Test::removeItems @ bci:11
325 Loop === 325 31 427 [[ 325 324 321 59 322 323 61 66 379 ]] !orig=[55] !jvms: Test::removeItems @ bci:35
|