harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng, BuQi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5994) [HARMONY][JIT] inlined gc helper code not work in some situation
Date Wed, 08 Oct 2008 09:59:44 GMT

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

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

Since SD2 compilation is method based, so the generated code will be used only when the method
is called in next time. This is the current implementation of SD2. 

Regards!

Buqi

> [HARMONY][JIT] inlined gc helper code not work in some situation
> ----------------------------------------------------------------
>
>                 Key: HARMONY-5994
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5994
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>         Environment: Linux and Windows
>            Reporter: Cheng, BuQi
>
> Running in server mode.  After adding the Patch to generate helper code for gc_get_hashcode
in gc_helper.cpp
> We can find that in following test case, the helper code will not work even the binary
is generated for it. 
> public class Test {
>     public static void main(String[] args) {
>         long start = System.currentTimeMillis();        
>         runTest(1000000000, new Object());
>         long end = System.currentTimeMillis() - start;
>         System.out.println("completed in "+end);       
>     }
>     public static void runTest(int num, Object obj) {
>         for(int i=0; i<num; i++) {
>             System.identityHashCode(new Object());
>         }
>     }      
> }
> If we rewrite the test case like following, the helper code will work correctly.
> public class Test {
>     public static void main(String[] args) {
>         long start = System.currentTimeMillis();        
>         runTest(1000000000, new Object());
>         long end = System.currentTimeMillis() - start;
>         System.out.println("completed in "+end);       
>     }
>     public static void runTest(int num, Object obj) {
>         for(int i=0; i<num; i++) {
>             testHash();
>         }
>     }   
>     public static void testHash()
>     {
>     	System.identityHashCode(new Object());
>     }
> }
> The reason is simple. In SD2, the hot code will be re-generated and the helper code will
be invoked and inlined. However, in first case, since the helper code is inlined in the method
but the method will not be called except main which has been executed. So the generated new
code of runTest will not be called any more, although a better code is generated. In the second
case, the better generated testHash will be re-called in runTest. So we can see the work of
helper code. 
> A suggestion to solve the problem is that not inline the helper code in the situation
when the caller is called only once.
> Thanks!
> Buqi

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


Mime
View raw message