changeset 5153:af178153a503

Merge
author asaha
date Tue, 11 Mar 2014 14:50:14 -0700
parents eb797fab50d3 58499c7a5175
children 4c7632e49838
files .hgtags make/hotspot_version src/share/vm/classfile/classFileParser.cpp
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Mar 05 13:36:11 2014 -0800
+++ b/.hgtags	Tue Mar 11 14:50:14 2014 -0700
@@ -623,6 +623,7 @@
 573d8d080af9eff48aa3b8f0696d8874ce36fbb1 jdk7u55-b09
 36f8bd4dd467ae4183340842fd7158ac3309b826 jdk7u55-b10
 49cada8e39b9215b9fd8b9183743f92625587cfc jdk7u55-b11
+aadc864abd1ced3049bf59ce32786a07997ba190 jdk7u55-b12
 ae4adc1492d1c90a70bd2d139a939fc0c8329be9 jdk7u60-b00
 af1fc2868a2b919727bfbb0858449bd991bbee4a jdk7u40-b60
 cc83359f5e5eb46dd9176b0a272390b1a0a51fdc hs24.60-b01
--- a/src/share/vm/opto/output.cpp	Wed Mar 05 13:36:11 2014 -0800
+++ b/src/share/vm/opto/output.cpp	Tue Mar 11 14:50:14 2014 -0700
@@ -345,6 +345,11 @@
   uint*      jmp_offset = NEW_RESOURCE_ARRAY(uint,nblocks);
   uint*      jmp_size   = NEW_RESOURCE_ARRAY(uint,nblocks);
   int*       jmp_nidx   = NEW_RESOURCE_ARRAY(int ,nblocks);
+
+  // Collect worst case block paddings
+  int* block_worst_case_pad = NEW_RESOURCE_ARRAY(int, nblocks);
+  memset(block_worst_case_pad, 0, nblocks * sizeof(int));
+
   DEBUG_ONLY( uint *jmp_target = NEW_RESOURCE_ARRAY(uint,nblocks); )
   DEBUG_ONLY( uint *jmp_rule = NEW_RESOURCE_ARRAY(uint,nblocks); )
 
@@ -461,6 +466,7 @@
           last_avoid_back_to_back_adr += max_loop_pad;
         }
         blk_size += max_loop_pad;
+        block_worst_case_pad[i + 1] = max_loop_pad;
       }
     }
 
@@ -500,9 +506,16 @@
         if (bnum > i) { // adjust following block's offset
           offset -= adjust_block_start;
         }
+
+        // This block can be a loop header, account for the padding
+        // in the previous block.
+        int block_padding = block_worst_case_pad[i];
+        assert(i == 0 || block_padding == 0 || br_offs >= block_padding, "Should have at least a padding on top");
         // In the following code a nop could be inserted before
         // the branch which will increase the backward distance.
-        bool needs_padding = ((uint)br_offs == last_may_be_short_branch_adr);
+        bool needs_padding = ((uint)(br_offs - block_padding) == last_may_be_short_branch_adr);
+        assert(!needs_padding || jmp_offset[i] == 0, "padding only branches at the beginning of block");
+
         if (needs_padding && offset <= 0)
           offset -= nop_size;