harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Sidelnikov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2727) [drlvm][jit][opt] JIt generates duplicated code.
Date Fri, 15 Dec 2006 07:15:21 GMT
[drlvm][jit][opt] JIt generates duplicated code.
------------------------------------------------

                 Key: HARMONY-2727
                 URL: http://issues.apache.org/jira/browse/HARMONY-2727
             Project: Harmony
          Issue Type: Bug
            Reporter: Nikolay Sidelnikov


java.util.TreeMap.successor()
Java code of the method:
    static TreeMapEntry successor(TreeMapEntry x) {
        if (x.right != null)
            return minimum(x.right);
        TreeMapEntry y = x.parent;
        while (y != null && x == y.right) {
            x = y;
            y = y.parent;
        }
        return y;
    }
Also method "minimum" was inlined. Its code:
    static TreeMapEntry minimum(TreeMapEntry x) {
        while (x.left != null)
            x = x.left;
        return x;
    }

The generated asm code the follwoing:

line address    code                    
1       B7EE60: push        ebx
2       B7EE61: push        ebp
3       B7EE62: mov         eax,dword ptr [esp+0Ch]
4       B7EE66: mov         ebp,eax
5       B7EE68: mov         ebx,dword ptr [eax+14h]
6       B7EE6B: test        ebx,ebx
7       B7EE6D: je          00B7EEA8
8       B7EE73: mov         ebp,dword ptr fs:[00000014h]
9       B7EE7A: mov         eax,ebx
10      B7EE7C: mov         ebx,dword ptr [eax+18h]
11      B7EE7F: test        ebx,ebx
12      B7EE81: je          00B7EEF2
13      B7EE87: mov         ebp,dword ptr fs:[00000014h]
14      B7EE8E: cmp         dword ptr [ebp+00000270h],0
15      B7EE98: je          00B7EE7A
16      B7EE9E: call        00A96850
17      B7EEA3: jmp         00B7EE7A
18      B7EEA8: mov         ebx,dword ptr [eax+1Ch]
19      B7EEAB: mov         eax,dword ptr fs:[00000014h]
20      B7EEB2: mov         eax,ebx
21      B7EEB4: test        eax,eax
22      B7EEB6: je          00B7EEED
23      B7EEBC: cmp         ebp,dword ptr [eax+14h]
24      B7EEBF: jne         00B7EEED
25      B7EEC5: mov         ebp,eax
26      B7EEC7: mov         eax,dword ptr [eax+1Ch]
27      B7EECA: mov         ebx,eax
28      B7EECC: mov         eax,dword ptr fs:[00000014h]
29      B7EED3: cmp         dword ptr [eax+00000270h],0
30      B7EEDD: je          00B7EEB2
31      B7EEE3: call        00A96850
32      B7EEE8: jmp         00B7EEB2
33      B7EEED: pop         ebp
34      B7EEEE: pop         ebx
35      B7EEEF: ret         4
36      B7EEF2: pop         ebp
37      B7EEF3: pop         ebx
38      B7EEF4: ret         4
------------------------------------
Code in lines 33-35 and 36-38 are identical. The first one is return from the
second cycle and the second is return from the first cycle. In order to make
code less this code should be combined.

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

        

Mime
View raw message