changeset 7952:334ddf3b101f

7154889: Non-zero padding is still not allowed in the tableswitch/lookupswitch instructions. Summary: Do not check that the padding bytes are zero if class file format version >=51. Reviewed-by: dholmes, coleenp, mullan, kvn Contributed-by: harold.seigel@oracle.com
author coleenp
date Tue, 12 Mar 2013 10:35:44 -0400
parents 230bafd05509
children 6379415d8fca f5fbd8065920
files src/share/native/common/check_code.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/common/check_code.c	Sat Mar 09 17:27:58 2013 +0800
+++ b/src/share/native/common/check_code.c	Tue Mar 12 10:35:44 2013 -0400
@@ -206,6 +206,8 @@
 
 #define LDC_METHOD_HANDLE_MAJOR_VERSION 51
 
+#define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51
+
 #define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION  52
 
 #define ALLOC_STACK_SIZE 16 /* big enough */
@@ -1146,11 +1148,14 @@
         int *saved_operand;
         int keys;
         int k, delta;
-        /* 4639449, 4647081: Padding bytes must be zero. */
-        unsigned char* bptr = (unsigned char*) (code + offset + 1);
-        for (; bptr < (unsigned char*)lpc; bptr++) {
-            if (*bptr != 0) {
-                CCerror(context, "Non zero padding bytes in switch");
+
+        if (context->major_version < NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION) {
+            /* 4639449, 4647081: Padding bytes must be zero. */
+            unsigned char* bptr = (unsigned char*) (code + offset + 1);
+            for (; bptr < (unsigned char*)lpc; bptr++) {
+                if (*bptr != 0) {
+                    CCerror(context, "Non zero padding bytes in switch");
+                }
             }
         }
         if (opcode == JVM_OPC_tableswitch) {