harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chunrong Lai (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6020) [DRLVM] Cyclical class dependency causes a failure not seen in RI
Date Tue, 30 Dec 2008 08:42:44 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659771#action_12659771

Chunrong Lai commented on HARMONY-6020:

 (1) The test case can be further reduced as below:

public class Main {
    public static void main(String[] args) {
        Child c = Parent.createChild();

class Parent {
    //private static final Child childCache = new Child();
    private static final Child[] childCache = new Child[5];
    public static Child createChild(){
        return childCache[0];
        //return childCache;

class Child {
    public static final Child ROOT = Parent.createChild();

 While the exception raises from jitted codes of DRLVM:

01F00406  mov         ecx,dword ptr ds:[34582A0h]   //REturn: childCache //Same as Non-Array
01F0040C  cmp         dword ptr [ecx+8],0           //If ArraySize is 0, throw an exception?
01F00410  ht ja       01F0043B                             //The exception raises from here
because the non-inited array has non-assigned length of 0
to JVM spec, we should just return null for non-inited field?
01F0043B  mov         edx,dword ptr [ecx+0Ch]       //Return childCache[0]
01F0043E  mov         eax,edx 
01F00440  mov         ebp,dword ptr [esp+0ACh]      //We are returning, Same as Non-Array

(2) If the cyclic dependence happens not in Array but in a normal object (comment the "Child[]
childCache" in Class Parent but uncomment the "Child childCache"), Harmony passes with an
exactly same behavior with RI (Child.Root=null, another valid Child object returns in main()).
 So I do not see harmony has problem for cyclic class loading itself.
      I checked the classloading code and class initialization code and saw it is compatiable
with JVM spec.

(3)   Anyway there are two valid fixes to me: the first is simply removing the two lines of
array length checking binaries (for getStatic). The second is enforcing an array length for
the static array field in the very beginning of class initialization. I prefer the first one
since I do not see corresponding part in JVM spec for the second approach.


> [DRLVM] Cyclical class dependency causes a failure not seen in RI
> -----------------------------------------------------------------
>                 Key: HARMONY-6020
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6020
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>    Affects Versions: 5.0M8
>         Environment: Win Vista 32-bit
>            Reporter: Nathan Beyer
>            Assignee: Chunrong Lai
>         Attachments: cycle-project.zip
> If two classes have a cyclical dependency, some unexpected results may occur, which are
not seen on RI (Sun 6u10).

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

View raw message