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

[jira] Updated: (HARMONY-2164) static initializer is not being called on 'new' bytecode

     [ http://issues.apache.org/jira/browse/HARMONY-2164?page=all ]

George Timoshenko updated HARMONY-2164:
---------------------------------------

    Attachment: testcase.tgz

This "optimization" works correctly until there is a cycle of staticinit calls. (see the testcase).

In the normal way we have the following sequence:

test()
    new A
    call A.<clinit>
        ; testFieldA ia 222 here
        new B
        call B.<clinit>
            new A ; without further A.<clinit> as it was called already
            copy A.testFieldA --> B.testFieldB ; the value is 222
         set A.testFieldA = 2000

    get B.testFieldB
    and ensure it is 222

But with the "optimization" B.<clinit> is being called _firstly_(!):

test()
    new A;
    call B.<clinit> ; before getstatic B.testFieldB
        new A
            new B ; without B.<clinit> !!!
            set A.testFieldA to 2000
        copy A.testFieldA into B.tesfFieldB ; BUT THE VALUE IS 2000 !!!
    check B.testFieldB 
    and see that it is not 222 :(

> static initializer is not being called on 'new' bytecode
> --------------------------------------------------------
>
>                 Key: HARMONY-2164
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2164
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: George Timoshenko
>         Attachments: testcase.tgz
>
>
> There is an "optimization" in DRLVM: staticinit is being called before each static use of a class.
> But the SPEC says it also should be called on each "new" bytecode.

-- 
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