You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Cheng, BuQi (JIRA)" <ji...@apache.org> on 2008/08/11 08:13:44 UTC

[jira] Commented: (HARMONY-2727) [drlvm][jit][opt] JIt generates duplicated code.

    [ https://issues.apache.org/jira/browse/HARMONY-2727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12621358#action_12621358 ] 

Cheng, BuQi commented on HARMONY-2727:
--------------------------------------

Hi, Nikolay:

   Would you like to give out the example to repeat the problem? A repeated example and associated compilation options will be helpful to solve the problem. 

Thanks!

Buqi

> [drlvm][jit][opt] JIt generates duplicated code.
> ------------------------------------------------
>
>                 Key: HARMONY-2727
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2727
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            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.
-
You can reply to this email to add a comment to the issue online.