I've been thinking about what to do about this bug fix. It has only ever AFAIK been seen in one method. So, I was tempted not to back- port it to OpenJDK6.
However, I've looked at it in detail, and there is nothing special about this method. It is a long-running method with nested loops, and it is compiled as an OSR method, with an entry point inside the outermost loop. Apart from that there is nothing special about it, and it seems to me that this bug could trigger with all sorts of code. I don't really know why it does not. It may be that there is some other factor which I can't see. So, it now seems to me that the risk of not applying this patch to OpenJDK 6 is greater than the risk of applying it, and that the patch should be applied to all live versions of OpenJDK. Andrew. net/sf/jasperreports/engine/export/JRGridLayout.horizontallyMergeEmptyCells(IIII)V interpreter_invocation_count: 1 invocation_counter: 10000 backedge_counter: 5020 0 iload_1 1 istore #5 3 fast_iload #5 5 iload_3 6 if_icmpge 174 0 bci: 6 BranchData taken(1) displacement(616) not taken(751) 9 iconst_m1 10 istore #6 12 iconst_0 13 istore #7 15 iload_2 16 istore #8 18 fast_iload2 #8 20 fast_iload #4 22 if_icmpge 124 32 bci: 22 BranchData taken(752) displacement(400) not taken(22547) 25 fast_aaccess_0 26 fast_agetfield 53 <net/sf/jasperreports/engine/export/JRGridLayout.grid/[[Lnet/sf/jasperreports/engine/export/JRExporterGridCell;> 29 fast_iload #5 31 aaload 32 fast_iload #8 34 aaload 35 astore #9 37 aload #9 39 invokevirtual 100 <net/sf/jasperreports/engine/export/JRExporterGridCell.isEmpty()Z> 64 bci: 39 VirtualCallData count(8245) entries(2) 'net/sf/jasperreports/engine/export/EmptyGridCell'(12423 0.55) 'net/sf/jasperreports/engine/export/ElementGridCell'(1879 0.08) 42 ifeq 68 112 bci: 42 BranchData taken(10124) displacement(136) not taken(12423) 45 fast_iload #6 47 iconst_m1 48 if_icmpne 55 144 bci: 48 BranchData taken(11292) displacement(32) not taken(1131) 51 fast_iload #8 53 istore #6 55 fast_iload #7 57 aload #9 59 invokevirtual 101 <net/sf/jasperreports/engine/export/JRExporterGridCell.getWidth()I> 176 bci: 59 VirtualCallData count(0) entries(1) 'net/sf/jasperreports/engine/export/EmptyGridCell'(12423 1.00) 62 iadd 63 istore #7 65 goto 118 224 bci: 65 JumpData taken(12423) displacement(184) 68 fast_iload #6 70 iconst_m1 71 if_icmpeq 112 248 bci: 71 BranchData taken(9744) displacement(160) not taken(380) 74 fast_iload2 #8 76 fast_iload #6 78 isub 79 iconst_1 80 if_icmple 112 280 bci: 80 BranchData taken(377) displacement(128) not taken(3) 83 fast_aaccess_0 84 fast_agetfield 53 <net/sf/jasperreports/engine/export/JRGridLayout.grid/[[Lnet/sf/jasperreports/engine/export/JRExporterGridCell;> 87 fast_iload #5 89 aaload 90 fast_iload #6 92 aaload 93 astore #10 95 aload #10 97 fast_iload2 #8 99 fast_iload #6 101 isub 102 invokevirtual 102 <net/sf/jasperreports/engine/export/JRExporterGridCell.setColSpan(I)V> 312 bci: 102 VirtualCallData count(0) entries(1) 'net/sf/jasperreports/engine/export/EmptyGridCell'(3 1.00) 105 aload #10 107 fast_iload #7 109 invokevirtual 103 <net/sf/jasperreports/engine/export/JRExporterGridCell.setWidth(I)V> 360 bci: 109 VirtualCallData count(0) entries(1) 'net/sf/jasperreports/engine/export/EmptyGridCell'(3 1.00) 112 iconst_m1 113 istore #6 115 iconst_0 116 istore #7 118 iinc #8 1 121 goto 18 408 bci: 121 JumpData taken(22547) displacement(-376) 124 fast_iload #6 126 iconst_m1 127 if_icmpeq 168 432 bci: 127 BranchData taken(0) displacement(160) not taken(752) 130 fast_iload2 #8 132 fast_iload #6 134 isub 135 iconst_1 136 if_icmple 168 464 bci: 136 BranchData taken(0) displacement(128) not taken(752) 139 fast_aaccess_0 140 fast_agetfield 53 <net/sf/jasperreports/engine/export/JRGridLayout.grid/[[Lnet/sf/jasperreports/engine/export/JRExporterGridCell;> 143 fast_iload #5 145 aaload 146 fast_iload #6 148 aaload 149 astore #9 151 aload #9 153 fast_iload2 #8 155 fast_iload #6 157 isub 158 invokevirtual 102 <net/sf/jasperreports/engine/export/JRExporterGridCell.setColSpan(I)V> 496 bci: 158 VirtualCallData count(0) entries(1) 'net/sf/jasperreports/engine/export/EmptyGridCell'(752 1.00) 161 aload #9 163 fast_iload #7 165 invokevirtual 103 <net/sf/jasperreports/engine/export/JRExporterGridCell.setWidth(I)V> 544 bci: 165 VirtualCallData count(0) entries(1) 'net/sf/jasperreports/engine/export/EmptyGridCell'(752 1.00) 168 iinc #5 1 171 goto 3 592 bci: 171 JumpData taken(752) displacement(-592) 174 return ------------------------------------------------------------------------ 6664 172 net.sf.jasperreports.engine.base.JRBaseStyle::getStyle (5 bytes)