Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
Linux and Windows
Description
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)
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++)
}
public static void testHash()
}
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
Attachments
Issue Links
- blocks
-
HARMONY-5713 [drlvm][performance] Implementation of System.identityHashCode() on magics
- Closed