You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Fursov (JIRA)" <ji...@apache.org> on 2007/04/16 09:24:15 UTC

[jira] Updated: (HARMONY-3658) [drlvm][jit] Incorrect class resolution / initialization order in JET and OPT compilers

     [ https://issues.apache.org/jira/browse/HARMONY-3658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikhail Fursov updated HARMONY-3658:
------------------------------------

    Description: 
While working on lazy resolution support in JIT I found the problem that both JET and OPT process 'new' bytecode incorrectly:
For the test below:

public class Hello {
    public static void main(String[] args) {
        int x = 1;
        try {
            new Foo(x=0);
        } catch (Error e) {
            System.out.println(x);
        }
    }
}

class Foo {
    static {
        exception();
    }

    static void exception() {
        throw new RuntimeException();
    }

    Foo(int x) {
        System.out.println("FAILED!");
    }
}


RI and interpreter print '0'
while JET and OPT print '1'



Disassembly:

    public static void main(String args[])
    {
        int i = 1;
    //    0    0:iconst_1        
    //    1    1:istore_1        
        try
        {
            new Foo(i = 0);
    //    2    2:new             #2   <Class Foo>
    //    3    5:dup             
    //    4    6:iconst_0        
    //    5    7:dup             
    //    6    8:istore_1        
    //    7    9:invokespecial   #3   <Method void Foo(int)>
    //    8   12:pop             
        }
    //*   9   13:goto            24
        catch(Error error)
    //*  10   16:astore_2        
        {
            System.out.println(i);
    //   11   17:getstatic       #5   <Field PrintStream System.out>
    //   12   20:iload_1         
    //   13   21:invokevirtual   #6   <Method void PrintStream.println(int)>
        }
    //   14   24:return          
    }


  was:
While working on lazy resolution support in JIT I found the problem that both JET and OPT process 'new' bytecode incorrectly:
For the test below:
public class Hello {
    public static void main(String[] args) {

        int x = 1;
        try {
            new Foo(x=0);
        } catch (Error e) {
            System.out.println(x);
        }
    }
}

class Foo {
    static {
        exception();
    }

    static void exception() {
        throw new RuntimeException();
    }

    Foo(int x) {
        System.out.println("FAILED!");
    }
}


RI and interpreter print '0'
while JET and OPT print '1'

    public static void main(String args[])
    {
        int i = 1;
    //    0    0:iconst_1        
    //    1    1:istore_1        
        try
        {
            new Foo(i = 0);
    //    2    2:new             #2   <Class Foo>
    //    3    5:dup             
    //    4    6:iconst_0        
    //    5    7:dup             
    //    6    8:istore_1        
    //    7    9:invokespecial   #3   <Method void Foo(int)>
    //    8   12:pop             
        }
    //*   9   13:goto            24
        catch(Error error)
    //*  10   16:astore_2        
        {
            System.out.println(i);
    //   11   17:getstatic       #5   <Field PrintStream System.out>
    //   12   20:iload_1         
    //   13   21:invokevirtual   #6   <Method void PrintStream.println(int)>
        }
    //   14   24:return          
    }



> [drlvm][jit] Incorrect class resolution / initialization order in JET and OPT compilers
> ---------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3658
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3658
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>
> While working on lazy resolution support in JIT I found the problem that both JET and OPT process 'new' bytecode incorrectly:
> For the test below:
> public class Hello {
>     public static void main(String[] args) {
>         int x = 1;
>         try {
>             new Foo(x=0);
>         } catch (Error e) {
>             System.out.println(x);
>         }
>     }
> }
> class Foo {
>     static {
>         exception();
>     }
>     static void exception() {
>         throw new RuntimeException();
>     }
>     Foo(int x) {
>         System.out.println("FAILED!");
>     }
> }
> RI and interpreter print '0'
> while JET and OPT print '1'
> Disassembly:
>     public static void main(String args[])
>     {
>         int i = 1;
>     //    0    0:iconst_1        
>     //    1    1:istore_1        
>         try
>         {
>             new Foo(i = 0);
>     //    2    2:new             #2   <Class Foo>
>     //    3    5:dup             
>     //    4    6:iconst_0        
>     //    5    7:dup             
>     //    6    8:istore_1        
>     //    7    9:invokespecial   #3   <Method void Foo(int)>
>     //    8   12:pop             
>         }
>     //*   9   13:goto            24
>         catch(Error error)
>     //*  10   16:astore_2        
>         {
>             System.out.println(i);
>     //   11   17:getstatic       #5   <Field PrintStream System.out>
>     //   12   20:iload_1         
>     //   13   21:invokevirtual   #6   <Method void PrintStream.println(int)>
>         }
>     //   14   24:return          
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.