You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/08/14 20:11:22 UTC

svn commit: r431390 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp

Author: geirm
Date: Mon Aug 14 11:11:21 2006
New Revision: 431390

URL: http://svn.apache.org/viewvc?rev=431390&view=rev
Log:
Patch #1 (14/Aug/06) by Pavel Rebriy applied from HARMONY-956.

This solves the reported problem with the Verifier, but shows a 
new issue, which will be added and referenced from HARMONY-956


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp?rev=431390&r1=431389&r2=431390&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp Mon Aug 14 11:11:21 2006
@@ -4155,9 +4155,10 @@
     
     /**
      * Allocate memory for codeInstr
+     * +1 more instruction is the end of exception handler
      */
     vf_Instr_t *codeInstr = (vf_Instr_t*)vf_alloc_pool_memory( ctex->m_pool,
-                                    len * sizeof(vf_Instr_t) );
+                                    (len + 1) * sizeof(vf_Instr_t) );
     /**
      * Create start-entry instruction
      */
@@ -5021,10 +5022,17 @@
     }
 
     /**
+     * Create end-entry instruction
+     */
+    code = ctex->m_code;
+    vf_create_end_entry( &code[codeNum], ctex );
+    codeInstr[index].m_instr = codeNum;
+    codeNum++;
+
+    /**
      * Set handler basic blocks
      */
     edges = 0;
-    code = ctex->m_code;
     for( index = 0; index < handlcount; index++ ) {
         // check instruction range
         unsigned short start_pc;
@@ -5033,7 +5041,7 @@
         unsigned short handler_cp_index;
         method_get_exc_handler_info( ctex->m_method, (unsigned short)index, &start_pc, &end_pc,
             &handler_pc, &handler_cp_index );
-        if( ( start_pc >= len ) || ( end_pc >= len ) || ( handler_pc >= len ) )
+        if( ( start_pc >= len ) || ( end_pc > len ) || ( handler_pc >= len ) )
         {
             VERIFY_REPORT( ctex, "(class: " << class_get_name( ctex->m_class ) 
                     << ", method: " << method_get_name( ctex->m_method )
@@ -5093,7 +5101,7 @@
          * Set handler branches to last instructions of basic blocks
          */
         for( count = start_pc + 1; count <= end_pc; count++ ) {
-            if( codeInstr[count].m_mark ) {
+            if( count < len && codeInstr[count].m_mark ) {
                 // calculate code instruction number
                 instr = codeInstr[count].m_instr - 1;
                 // check existen of handler array
@@ -5110,12 +5118,6 @@
             }
         }
     }
-
-    /**
-     * Create end-entry instruction
-     */
-    vf_create_end_entry( &code[codeNum], ctex );
-    codeNum++;
 
     /** 
      * Initialize basic block count