You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2006/11/08 10:46:51 UTC

[jira] Created: (HARMONY-2103) [drlvm][jit] Jitrino/OPT does not reject class which uses incorrect invokespecial instruction

[drlvm][jit] Jitrino/OPT does not reject class which uses incorrect invokespecial instruction
---------------------------------------------------------------------------------------------

                 Key: HARMONY-2103
                 URL: http://issues.apache.org/jira/browse/HARMONY-2103
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: Windows and Linux
            Reporter: Vera Petrashkova


Jitrino/OPT does not reject some class which incorrect invokespecial 
instruction which uses method from an subclass of the current class.
But according to J2SE VM specifications of invokespecial instruction
the resolved method is selected for invocation unless all of the following conditions are true:
    - the ACC_SUPER flag is set for the current class
    - the class of the resolved method is a superclass of the current class
    - the resolved method is not an instance initialization method


Interpreter and Jitrino/JET throws VerifyError in this case.

To reproduce this issue run the following testInvokeSpecial which invokes classes testSupClass and testSubClass
created from jasmin source code.
--------------testInvokeSpecial.java-------------
public class testInvokeSpecial  {
    public static void main(String[] args) {
        try {
            System.out.println("Test failed: " + testSupClass.test());
        } catch (VerifyError e ) {
            System.out.println("Test passes");
            e.printStackTrace();
        } catch (Throwable e ) {
            System.out.println("Test fails: unexpected error");
            e.printStackTrace();
        }
    }
}
--------------testSupClass.jj----------------
.class public testSupClass
.super java/lang/Object
;
; standard initializer
.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 testSubClass
   dup
   invokespecial testSubClass/<init>()V
   invokespecial testSubClass/mth()I
   ireturn
.end method
--------------------testSubClass.jj-----------------
.class public testSubClass
.super testSupClass
;
; standard initializer
.method public <init>()V
   aload_0
   invokespecial testSupClass/<init>()V
   return
.end method
;
.method public mth()I
   .limit locals 2
   .limit stack 2
   sipush 105
   ireturn
.end method
----------------------------------------------
Create testSupClass and testSubClass classes using jasmin.jar or use classes from attachment

java -jar jasmin.jar testSupClass.jj
java -jar jasmin.jar testSubClass.jj


Output on Harmony (Interpreter and Jitrino/JET)
=====================
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony
Test passes
java.lang.VerifyError: (class: testSupClass, method: test()I) Incompatible object argument
 for invokespecial
        at testInvokeSpecial.main(testInvokeSpecial.java:4)

Output on Harmony (Jitrino/OPT)
========================
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0" 
pre-alpha : not complete or compatible
svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
http://incubator.apache.org/harmony
Test failed: 105


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2103) [drlvm][jit] Jitrino/OPT does not reject class which uses incorrect invokespecial instruction

Posted by "Vera Petrashkova (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2103?page=all ]

Vera Petrashkova updated HARMONY-2103:
--------------------------------------

    Attachment: testInvokeSpecial.zip

testInvokeSpecial.zip file contains test source code and class files

> [drlvm][jit] Jitrino/OPT does not reject class which uses incorrect invokespecial instruction
> ---------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2103
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2103
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: testInvokeSpecial.zip
>
>
> Jitrino/OPT does not reject some class which incorrect invokespecial 
> instruction which uses method from an subclass of the current class.
> But according to J2SE VM specifications of invokespecial instruction
> the resolved method is selected for invocation unless all of the following conditions are true:
>     - the ACC_SUPER flag is set for the current class
>     - the class of the resolved method is a superclass of the current class
>     - the resolved method is not an instance initialization method
> Interpreter and Jitrino/JET throws VerifyError in this case.
> To reproduce this issue run the following testInvokeSpecial which invokes classes testSupClass and testSubClass
> created from jasmin source code.
> --------------testInvokeSpecial.java-------------
> public class testInvokeSpecial  {
>     public static void main(String[] args) {
>         try {
>             System.out.println("Test failed: " + testSupClass.test());
>         } catch (VerifyError e ) {
>             System.out.println("Test passes");
>             e.printStackTrace();
>         } catch (Throwable e ) {
>             System.out.println("Test fails: unexpected error");
>             e.printStackTrace();
>         }
>     }
> }
> --------------testSupClass.jj----------------
> .class public testSupClass
> .super java/lang/Object
> ;
> ; standard initializer
> .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 testSubClass
>    dup
>    invokespecial testSubClass/<init>()V
>    invokespecial testSubClass/mth()I
>    ireturn
> .end method
> --------------------testSubClass.jj-----------------
> .class public testSubClass
> .super testSupClass
> ;
> ; standard initializer
> .method public <init>()V
>    aload_0
>    invokespecial testSupClass/<init>()V
>    return
> .end method
> ;
> .method public mth()I
>    .limit locals 2
>    .limit stack 2
>    sipush 105
>    ireturn
> .end method
> ----------------------------------------------
> Create testSupClass and testSubClass classes using jasmin.jar or use classes from attachment
> java -jar jasmin.jar testSupClass.jj
> java -jar jasmin.jar testSubClass.jj
> Output on Harmony (Interpreter and Jitrino/JET)
> =====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passes
> java.lang.VerifyError: (class: testSupClass, method: test()I) Incompatible object argument
>  for invokespecial
>         at testInvokeSpecial.main(testInvokeSpecial.java:4)
> Output on Harmony (Jitrino/OPT)
> ========================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> Test failed: 105

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira