Community
Participate
Working Groups
This is a follow up defect for bug 184664 to track the problem specific to Sun JVM where IBM JVM can get all six allocation sites when profiling, while Sun JVM can just get four of them.
After modify hard-coded filter mechanism introduced by patch for reattach problem in bug 194081, IBM JVM can get all six allocation sites when profiling for reflection test case in bug 184664. However, Sun JVM can just get four allocation sites. I am investigating the problem with Sun JVM. After all six allocation sites can be gotten by both IBM' and Sun' JVM, I will submit the corresponding patch (The modification for hard-coded filter in CGProf tracker will be also included in this patch). Thanks, Chengrui
After investigation, the problem on SUN JVM is profiler can not get correct line number information from line number table. It seems that TPTP can not resolve SUN's class file line number table correctly. I am trying to find the exact position of the problem.
Java class source code line number table will be get by JVMTIInterface::GetLineNumberTable in TPTP. However, when try to get line number table of java/io/ObjectStreamClass.newInstance() with SUN JVM, it returns JVMTI_ERROR_ABSENT_INFORMATION(101). So allocation site information can not be available in CGProf with SUN JVM. Two allocation sites related with java/io/ObjectStreamClass.newInstance() are not shown to user, but this is reasonable (We can not get the information). I have checked java/io/ObjectStreamClass.newInstance() line number tables in SUN and IBM JRE: -------------------------------- SUN jre1.5.0_17:rt.jar java.lang.Object newInstance() throws java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.UnsupportedOperationException; LineNumberTable: line 894: 0 line 896: 7 line 897: 16 line 899: 17 line 902: 25 -------------------------------- IBM jre_5.0.3.sr8a_20080811b:core.jar java.lang.Object newInstance() throws java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.UnsupportedOperationException; LineNumberTable: line 950: 0 line 952: 7 line 953: 19 line 955: 20 line 958: 28 -------------------------------- Although both JREs include line number tables for java/io/ObjectStreamClass.newInstance(), only IBM JRE can return line number table info by JVMTI interface. Bug 282533 is related with JVMs implementation. I will submit a patch just for CGProf tracker class hard-coded filtering problem. It will make all six reflection allocation sites with IBM JRE to be shown. For SUN JVM, just four available allocation sites can be shown. Thanks, Chengrui
Created attachment 141393 [details] Modify CGProfTracker filtering patch At first I want to replace the hard-coded filtering mechanism for CGProfTracker with JPIAgent filtering. However, it is found JPIAgent filtering is used for user-defined filter. Classes which can not be instrumented in CGAdaptor are used for other purpose. For consistency, CGProfTracker should not report classes that are not instrumented in CGAdaptor. There is no simple solution to remove hard-coded filtering code. I modified CProfEnv::IsExcludedClass referring to CGAdaptor and add a comment into CGAdaptor::CanInstrumentClass. Besides the modification above, I rewrote CProfEnv::GetLineNumber(...) to make it clear. Dear committers, please help to review the patch code. Thanks, Chengrui
Created attachment 141394 [details] Profilers binary files for testing usage on WindowsXP As mentioned in comment #3, with this modified profilers: All six allocation sites can be gotten with IBM JRE on ReflectionTest. Only four allocation sites with SUN JRE can be availabe.
(In reply to comment #5) > Created an attachment (id=141394) [details] > Profilers binary files for testing usage on WindowsXP > > As mentioned in comment #3, with this modified profilers: All six allocation > sites can be gotten with IBM JRE on ReflectionTest. Only four allocation sites > with SUN JRE can be availabe. > I have tested the patch with IBM 1.5.0_SR9 IBM 1.6.0_SR4 SUN (IBM repackage) 1.5.0_18 SUN (IBM repackage) 1.6.0_13 and the right number of instance, ie all 6, are reported. I think the IBM repackaged SUN JREs have the line number resolved as in the IBM JREs. I also smoke test with Execution Analysis and the patch seems safe to me.
Jonathan, could you please also review the patch? (In reply to comment #4) > Created an attachment (id=141393) [details] > Modify CGProfTracker filtering patch
Patch is good.
Hi Chengrui, Please fill in the PMC approval template so that I could get this approved for TPTP 4.5.2.1 M3. Thanks!
Requesting PMC approval to include bug 282533 (Sun JVM does not get all allocation sites during reflection) for TPTP 4.5.2.1 Milestone 3. 1. Explain why you believe this is a stop-ship defect. How does the defect manifest itself, and how will users of TPTP / consuming products be affected if the defect is not fixed? Heap profiling can not get all objects allocation sites information during reflection with SUN JREs. It is found the problem is related with SUN JVM implementation. There is also a minor TPTP modification needed to show all reflection objects allocation sites with IBM JREs. 2. Is there a work-around? If so, why do you believe the work-around is insufficient? No. 3. Is this a regression or API breakage? Explain. No. 4. Does this require new API? No. 5. Who performed the code review? Eugene & Jonathan. 6. Is there a test case attached to the bugzilla record? Yes. The test case ReflectionTest is attached with bug 184664. 7. What is the nature of the fix? What is the scope of the fix? What is the risk associated with this fix? This fix just modifies the CGProfTracker filtering mechanism introduced in bug 194081. Because original CGProfTracker filtering mechanism shadows two reflection objects allocation information during reflection with IBM JREs. Additional comments are added into CGAdaptor::CanInstrumentClass for a note. The risk is low. 8. Is this fix related to any standards that TPTP adheres to? If so, who has validated that the fix continues to adhere to the standard? No.
Requesting PMC approval for TPTP 4.5.2.1 M3.
Approved assuming the test case is in the TPTP 4.5.2.1 test bucket.
Yes. We'll make sure that the reflection test case is run as part of TPTP 4.5.2.1 M3 testing. Jonathan, please check in the code to TPTP-4_5_2_1 branch.
Checked into 4521 branch w/ PMC approval.
Verified and closing.