harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2103) [drlvm][jit] Jitrino/OPT does not reject class which uses incorrect invokespecial instruction
Date Tue, 13 Feb 2007 13:15:06 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472641
] 

Alexey Varlamov commented on HARMONY-2103:
------------------------------------------

Shouldn't we include the test to regression suite? The patch is welcomed ;)

> [drlvm][jit] Jitrino/OPT does not reject class which uses incorrect invokespecial instruction
> ---------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2103
>                 URL: https://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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message