harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r509582 - in /harmony/enhanced/drlvm/trunk: src/test/regression/H2103/ vm/vmcore/src/verifier/
Date Tue, 20 Feb 2007 14:38:15 GMT
Author: gshimansky
Date: Tue Feb 20 06:38:14 2007
New Revision: 509582

URL: http://svn.apache.org/viewvc?view=rev&rev=509582
Log:
Applied HARMONY-3208 [drlvm][verifier] Adding a regression test and a bugfix of H-2103

Tests passed on Ubuntu6 x86, Windows 2003 server x86 and SuSE9 x86_64


Added:
    harmony/enhanced/drlvm/trunk/src/test/regression/H2103/
    harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SubClass.j   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SupClass.j   (with props)
    harmony/enhanced/drlvm/trunk/src/test/regression/H2103/Test.java   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_real.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SubClass.j
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SubClass.j?view=auto&rev=509582
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SubClass.j (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SubClass.j Tue Feb 20 06:38:14
2007
@@ -0,0 +1,17 @@
+.class public org/apache/harmony/drlvm/tests/regression/h2103/SubClass
+.super org/apache/harmony/drlvm/tests/regression/h2103/SupClass
+
+.method public <init>()V
+   aload_0
+   invokespecial org/apache/harmony/drlvm/tests/regression/h2103/SupClass/<init>()V
+   return
+.end method
+
+.method public test()I
+   .limit locals 2
+   .limit stack 2
+   sipush 105
+   ireturn
+.end method
+
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SubClass.j
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SupClass.j
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SupClass.j?view=auto&rev=509582
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SupClass.j (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SupClass.j Tue Feb 20 06:38:14
2007
@@ -0,0 +1,19 @@
+.class public org/apache/harmony/drlvm/tests/regression/h2103/SupClass
+.super java/lang/Object
+
+.method public <init>()V
+   aload_0
+   invokespecial java/lang/Object/<init>()V
+   return
+.end method
+
+.method public static test()I
+  .limit locals 3
+  .limit stack 3
+   new org/apache/harmony/drlvm/tests/regression/h2103/SubClass
+   dup
+   invokespecial org/apache/harmony/drlvm/tests/regression/h2103/SubClass/<init>()V
+   invokespecial org/apache/harmony/drlvm/tests/regression/h2103/SubClass/mth()I
+   ireturn
+.end method
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H2103/SupClass.j
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/src/test/regression/H2103/Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/regression/H2103/Test.java?view=auto&rev=509582
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/regression/H2103/Test.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/regression/H2103/Test.java Tue Feb 20 06:38:14 2007
@@ -0,0 +1,29 @@
+package org.apache.harmony.drlvm.tests.regression.h2103;
+
+import junit.framework.TestCase;
+
+/**
+ * Loads class and tries to invoke a method which should fail
+ * verification.
+ *
+ * SubClass contains an incorrect invokespecial instruction which invokes
+ * a method from a subclass of the current class, while only superclass
+ * constructors can be called using this instruction.
+ */
+public class Test extends TestCase {
+    public static void main(String args[]) {
+        (new Test()).test();
+    }
+
+    public void test() {
+        try {
+            SupClass.test();
+        } catch (VerifyError ve) {
+            return;
+        } catch (Exception e) {
+        }
+        fail("A method of SupClass class should throw VerifyError");
+    }
+}
+
+

Propchange: harmony/enhanced/drlvm/trunk/src/test/regression/H2103/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_real.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_real.h?view=diff&rev=509582&r1=509581&r2=509582
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_real.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_real.h Tue Feb 20 06:38:14 2007
@@ -71,12 +71,14 @@
         stream << error_message;                    \
         vf_set_error_message( stream, (context) );  \
     }
-#define VERIFY_REPORT_METHOD(context, error_message )               \
+#define VERIFY_REPORT_CLASS(context, method, error_message )        \
     VERIFY_REPORT(context,                                          \
         "(class: " << class_get_name( (context)->m_class )          \
-        << ", method: " << method_get_name( (context)->m_method )   \
-        << method_get_descriptor( (context)->m_method )             \
+        << ", method: " << method_get_name( method )                \
+        << method_get_descriptor( method )                          \
         << ") " << error_message )
+#define VERIFY_REPORT_METHOD(context, error_message )               \
+    VERIFY_REPORT_CLASS(context, (context)->m_method, error_message )
 
 /**
  * Define source code line and source file name parameters and arguments.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp?view=diff&rev=509582&r1=509581&r2=509582
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.cpp Tue Feb 20 06:38:14
2007
@@ -1007,12 +1007,8 @@
     case VF_CHECK_INVOKESPECIAL:    // check object for invokespecial instruction
         return vf_is_super_class( source, current )
                     && vf_is_super_class( current, target );
-    default:
-        LDIE(40, "Verifier: vf_is_valid: invalid check type" );
-        return false;
     }
-    // unreachable code
-    assert(0);
+    LDIE(40, "Verifier: vf_is_valid: invalid check type" );
 } // vf_is_valid
 
 /**
@@ -1026,42 +1022,39 @@
     switch( check )
     {
     case VF_CHECK_PARAM:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Incompatible argument for function" );
-        break;
+        return;
     case VF_CHECK_ASSIGN:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Incompatible types for field assignment" );
-        break;
+        return;
     case VF_CHECK_ASSIGN_WEAK:
-        VERIFY_REPORT_METHOD( ctex, 
+        VERIFY_REPORT_CLASS( ctex, method, 
             "Incompatible types for array assignment" );
-        break;
+        return;
     case VF_CHECK_SUPER:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Exception class not a subclass of Throwable" );
-        break;
+        return;
     case VF_CHECK_ACCESS_FIELD:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Bad access to protected field" );
-        break;
+        return;
     case VF_CHECK_ACCESS_METHOD:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Bad access to protected method" );
-        break;
+        return;
     case VF_CHECK_DIRECT_SUPER:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Call to wrong initialization method" );
-        break;
+        return;
     case VF_CHECK_INVOKESPECIAL:
-        VERIFY_REPORT_METHOD( ctex,
+        VERIFY_REPORT_CLASS( ctex, method,
             "Incompatible object argument for invokespecial" );
-        break;
-    default:
-        LDIE(41, "Verifier: vf_set_error: unknown check type" );
-        break;
+        return;
     }
-    return;
+    LDIE(41, "Verifier: vf_set_error: unknown check type" );
 } // vf_set_error
 
 /**



Mime
View raw message