harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcfi...@apache.org
Subject svn commit: r651296 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363: base/context_base.cpp base/context_base.h base/context_x.cpp base/context_x.h java6/context_6.cpp
Date Thu, 24 Apr 2008 15:45:30 GMT
Author: mcfirst
Date: Thu Apr 24 08:45:21 2008
New Revision: 651296

URL: http://svn.apache.org/viewvc?rev=651296&view=rev
Log:
Applying the patch from HARMONY-5785 "[drlvm][verifier] fixed a type cast once again, this
time to uint16 / uint32 as earlier". This fixes regressions in verifier on VTSVM and other
test suites.

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp?rev=651296&r1=651295&r2=651296&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp Thu Apr
24 08:45:21 2008
@@ -280,8 +280,8 @@
 
     Address def_adr = (instr & (~3) ) + 4;
     if( opcode == OP_TABLESWITCH) {
-        int lowbyte = read_int32(m_bytecode + def_adr + 4);
-        int hibyte = read_int32(m_bytecode + def_adr + 8);
+        int lowbyte = read_uint32(m_bytecode + def_adr + 4);
+        int hibyte = read_uint32(m_bytecode + def_adr + 8);
 
         // protect from integer overflow
         if( hibyte < lowbyte || hibyte - lowbyte > 0x20000000) {
@@ -299,7 +299,7 @@
             return 0x20000123;
         }
 
-        unsigned npairs = read_int32(m_bytecode + def_adr + 4);
+        unsigned npairs = read_uint32(m_bytecode + def_adr + 4);
 
         // protect from integer overflow
         if( npairs > 0x20000000) {
@@ -310,11 +310,11 @@
         int next = def_adr + 8;
 
         if (npairs) {
-            int old_value = read_int32(m_bytecode + next);
+            int old_value = read_uint32(m_bytecode + next);
             next += 8;
             // integer values must be sorted - verify
             for( unsigned i = 1; i < npairs; i++) {
-                int new_value = read_int32(m_bytecode + next);
+                int new_value = read_uint32(m_bytecode + next);
                 next += 8;
                 if( old_value >= new_value ) {
                     // return some big value - error will occur later

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h?rev=651296&r1=651295&r2=651296&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h Thu Apr 24
08:45:21 2008
@@ -204,23 +204,23 @@
     int instr_get_len_compound(Address instr, OpCode opcode);
 
     //read two-byte value
-    static int16 read_int16(Byte* ptr) {
+    static uint16 read_uint16(Byte* ptr) {
         return (ptr[0] << 8) | ptr[1];
     }
 
     //read four-byte value
-    static int32 read_int32(Byte* ptr) {
+    static uint32 read_uint32(Byte* ptr) {
         return (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3];
     }
 
     //get a 16-bit jump target
     static Address instr_get_int16_target(Address instr, Byte* ptr) {
-        return (Address) (instr + read_int16(ptr));
+        return (Address) (instr + read_uint16(ptr));
     }
 
     //get a 32-bit jump target
     static Address instr_get_int32_target(Address instr, Byte* ptr) {
-        return (Address) (instr + read_int32(ptr));
+        return (Address) (instr + read_uint32(ptr));
     }
 
     //get properties specific for the given opcode

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp?rev=651296&r1=651295&r2=651296&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp Thu Apr 24
08:45:21 2008
@@ -422,7 +422,7 @@
 
         case OP_ALOAD: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //call macro
             CHECK_ALOAD( local_idx );
@@ -453,7 +453,7 @@
 
             //get OUT type
             SmConstant arrayref;
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             if( !tpool.cpool_get_array(cp_idx, &arrayref) ) return error(VF_ErrorConstantPool,
"incorrect type for anewarray");
 
             //push OUTs
@@ -485,7 +485,7 @@
 
         case OP_ASTORE: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //call MACRO
             CHECK_ASTORE( local_idx );
@@ -579,7 +579,7 @@
 
             //check instruction & create OUTs
             SmConstant outref;
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             if( !tpool.cpool_get_class(cp_idx, &outref) ) return error(VF_ErrorConstantPool,
"incorrect constantpool entry");
 
             //push OUTs
@@ -664,7 +664,7 @@
 
         case OP_DLOAD: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //call macro
             CHECK_xxLOAD( local_idx, SM_DOUBLE );
@@ -698,7 +698,7 @@
 
         case OP_DSTORE: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             CHECK_xxSTORE( local_idx, SM_DOUBLE );
 
@@ -942,7 +942,7 @@
 
         case OP_FLOAD: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //call macro
             CHECK_xLOAD( local_idx, SM_FLOAT );
@@ -976,7 +976,7 @@
 
         case OP_FSTORE: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             CHECK_xSTORE( local_idx, SM_FLOAT );
 
@@ -1117,7 +1117,7 @@
                              }
 
         case OP_IINC: {
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             if( !workmap_valid_local(local_idx) ) {
                 return error(VF_ErrorLocals, "invalid local index");
@@ -1132,7 +1132,7 @@
 
         case OP_ILOAD: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //call macro
             CHECK_xLOAD( local_idx, SM_INTEGER );
@@ -1159,7 +1159,7 @@
 
         case OP_INSTANCEOF: {
             //check instruction
-            unsigned cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned cp_idx = read_uint16(m_bytecode + instr + 1);
             if( !tpool.cpool_is_reftype(cp_idx) ) return error(VF_ErrorConstantPool, "incorrect
constantpool entry");
 
             POP_ref( tpool.sm_get_const_object() );
@@ -1178,7 +1178,7 @@
 
         case OP_ISTORE: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             CHECK_xSTORE( local_idx, SM_INTEGER );
 
@@ -1285,7 +1285,7 @@
 
         case OP_LDC_W: {
             //check instruction and create OUTs
-            unsigned cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned cp_idx = read_uint16(m_bytecode + instr + 1);
             SmConstant el = tpool.cpool_get_ldcarg(cp_idx);
             if( el == SM_BOGUS ) return error(VF_ErrorConstantPool, "incorrect constantpool
entry");
 
@@ -1299,7 +1299,7 @@
 
         case OP_LDC2_W: {
             //check instruction and create OUTs
-            unsigned cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned cp_idx = read_uint16(m_bytecode + instr + 1);
             SmConstant el = tpool.cpool_get_ldc2arg(cp_idx);
             if( el == SM_BOGUS ) return error(VF_ErrorConstantPool, "incorrect constantpool
entry");
 
@@ -1313,7 +1313,7 @@
 
         case OP_LLOAD: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //call macro
             CHECK_xxLOAD( local_idx, SM_LONG );
@@ -1347,7 +1347,7 @@
 
         case OP_LSTORE: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             CHECK_xxSTORE( local_idx, SM_LONG );
 
@@ -1392,7 +1392,7 @@
 
             //get OUT type
             SmConstant arrayref;
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             if( !tpool.cpool_get_class(cp_idx, &arrayref, (int)dims) ) {
                 return error(VF_ErrorConstantPool, "incorrect type for multianewarray");
             }
@@ -1404,7 +1404,7 @@
 
         case OP_NEW: {
             //check instruction
-            unsigned cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned cp_idx = read_uint16(m_bytecode + instr + 1);
 
             //TODO: unused variable?
             SmConstant new_type = SM_BOGUS;
@@ -1525,7 +1525,7 @@
 
         case OP_GETFIELD: {
             //check and resolve instruction
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             SmConstant ref, value;
             if( !tpool.cpool_get_field(cp_idx, &ref, &value) ) return error(VF_ErrorUnknown,
"incorrect constantpool entry");
 
@@ -1543,7 +1543,7 @@
 
         case OP_GETSTATIC: {
             //check and resolve instruction
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             SmConstant value;
             if( !tpool.cpool_get_field(cp_idx, 0, &value) ) return error(VF_ErrorUnknown,
"incorrect constantpool entry");
 
@@ -1555,7 +1555,7 @@
 
         case OP_PUTFIELD: {
             //check and resolve instruction
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             SmConstant expected_ref, expected_val;
             if( !tpool.cpool_get_field(cp_idx, &expected_ref, &expected_val) ) {
                 return error(VF_ErrorUnknown, "incorrect constantpool entry");
@@ -1590,7 +1590,7 @@
 
         case OP_PUTSTATIC: {
             //check and resolve instruction
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
             SmConstant expected_val;
             if( !tpool.cpool_get_field(cp_idx, 0, &expected_val) ) return error(VF_ErrorUnknown,
"incorrect constantpool entry");
 
@@ -1605,7 +1605,7 @@
         case OP_INVOKESTATIC:
         case OP_INVOKEVIRTUAL: {
             //check instruction
-            unsigned short cp_idx = read_int16(m_bytecode + instr + 1);
+            unsigned short cp_idx = read_uint16(m_bytecode + instr + 1);
 
             //parse constant pool entrance
             const char *state;
@@ -1767,7 +1767,7 @@
                      }
         case OP_RET: {
             //get local index from bytecode
-            unsigned local_idx = wide ? read_int16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
+            unsigned local_idx = wide ? read_uint16(m_bytecode + instr + 2) : m_bytecode[instr
+ 1];
 
             //check whether it is a valid local
             if( !workmap_valid_local(local_idx) ) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.h?rev=651296&r1=651295&r2=651296&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.h Thu Apr 24 08:45:21
2008
@@ -176,7 +176,7 @@
         if( uninit_value.isNewObject() ) {
             Address addr = uninit_value.getNewInstr();
 
-            unsigned cp_idx = read_int16(m_bytecode + addr + 1);
+            unsigned cp_idx = read_uint16(m_bytecode + addr + 1);
             SmConstant new_type;
             if( !tpool.cpool_get_class(cp_idx, &new_type) ) {
                 assert(0);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.cpp?rev=651296&r1=651295&r2=651296&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.cpp Thu Apr 24
08:45:21 2008
@@ -201,12 +201,12 @@
 
     read_ptr+=2; //skip uint16 attribute_name_index
 
-    uint32 attribute_length = read_int32(read_ptr); 
+    uint32 attribute_length = read_uint32(read_ptr); 
     read_ptr+=4;
     Byte *attribute_end = stackmaptable + attribute_length + 6;
 
     if( read_ptr + 2 > attribute_end ) return error(VF_ErrorStackmap, "corrupted StackMapTable");
-    uint16 number_of_entries = read_int16(read_ptr);
+    uint16 number_of_entries = read_uint16(read_ptr);
     read_ptr+=2;
 
     //create working copy fr previous stackmap frame, offeset, and number of locals
@@ -251,7 +251,7 @@
         } else if (frame_type == 247 ) {
             //same locals as previous, stack contains single element specified here. offset
is explicitely specified
             if( read_ptr + 2 > attribute_end ) return error(VF_ErrorStackmap, "corrupted
StackMapTable");
-            offset = read_int16(read_ptr);
+            offset = read_uint16(read_ptr);
             read_ptr+=2;
 
             unsigned k = 1; // k may change in read_types(): if it's LONG or DOUBLE stack
size will be '2'
@@ -276,21 +276,21 @@
             }
 
             if( read_ptr + 2 > attribute_end ) return error(VF_ErrorStackmap, "corrupted
StackMapTable");
-            offset = read_int16(read_ptr);
+            offset = read_uint16(read_ptr);
             read_ptr+=2;
 
             lastWorkmap->depth = 0;
         } else if (frame_type == 251 ) { // 251
             //same locals as previous, stack is empty. offset is explicitely specified
             if( read_ptr + 2 > attribute_end ) return error(VF_ErrorStackmap, "corrupted
StackMapTable");
-            offset = read_int16(read_ptr);
+            offset = read_uint16(read_ptr);
             read_ptr+=2;
 
             lastWorkmap->depth = 0;
         } else if (frame_type <= 254 ) { // 252-254
             //stack is empty, locals are extended
             if( read_ptr + 2 > attribute_end ) return error(VF_ErrorStackmap, "corrupted
StackMapTable");
-            offset = read_int16(read_ptr);
+            offset = read_uint16(read_ptr);
             read_ptr+=2;
 
             unsigned k = frame_type - 251; //may change in read_types()
@@ -305,10 +305,10 @@
             assert(frame_type == 255);
 
             if( read_ptr + 4 > attribute_end ) return error(VF_ErrorStackmap, "corrupted
StackMapTable");
-            offset = read_int16(read_ptr);
+            offset = read_uint16(read_ptr);
             read_ptr+=2;
 
-            last_maxlocals = read_int16(read_ptr); //may change in read_types()
+            last_maxlocals = read_uint16(read_ptr); //may change in read_types()
             read_ptr+=2;
 
             if( (tcr=read_types(&read_ptr, attribute_end, &lastWorkmap->elements[0],
&last_maxlocals, m_max_locals)) != VF_OK ) {
@@ -320,7 +320,7 @@
             }
 
             if( read_ptr + 2 > attribute_end ) return error(VF_ErrorStackmap, "corrupted
StackMapTable");
-            unsigned depth = read_int16(read_ptr); //may change in read_types()
+            unsigned depth = read_uint16(read_ptr); //may change in read_types()
             read_ptr+=2;
 
             if( (tcr=read_types(&read_ptr, attribute_end, &lastWorkmap->elements[m_stack_start],
&depth, m_max_stack)) != VF_OK ) {
@@ -412,7 +412,7 @@
                 break;
             case ITEM_OBJECT: {
                 if( (*attr) + 2 > end ) return error(VF_ErrorStackmap, "corrupted StackMapTable");
-                uint16 cp_idx = read_int16(*attr);
+                uint16 cp_idx = read_uint16(*attr);
                 (*attr)+=2;
 
                 SmConstant c;
@@ -423,7 +423,7 @@
                     }
             case ITEM_UNINITIALIZED: {
                 if( (*attr) + 2 > end ) return error(VF_ErrorStackmap, "corrupted StackMapTable");
-                uint16 address = read_int16(*attr);
+                uint16 address = read_uint16(*attr);
                 (*attr)+=2;
 
                 element[idx++].const_val = SmConstant::getNewObject(address);



Mime
View raw message