United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6892186 SA does not dump debug info for scalar replaced objects.
JDK-6892186 : SA does not dump debug info for scalar replaced objects.

Details
Type:
Bug
Submit Date:
2009-10-15
Status:
Resolved
Updated Date:
2010-12-22
Project Name:
JDK
Resolved Date:
2009-11-11
Component:
hotspot
OS:
solaris,windows_xp
Sub-Component:
compiler
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs17,6u18
Fixed Versions:
hs17 (b05)

Related Reports
Backport:
Backport:
Duplicate:

Sub Tasks

Description
SA does not dump debug info for scalar replaced objects in codecache dump:

 0xfa8d207b:    call	0xfa8ab060
static int test() @0xb65b3110 of public class sleep @0xb65b3160 @ bci = 18, line = 15
locals ([0], unknown scope value sun.jvm.hotspot.code.ObjectValue@9980d5) ([1], oop 0xb65b32b0) ([2], illegal) 
monitors (owner = oop 0xb65b32b0, lock = stack[16], normal) 
OopMap: 

Here is simple test:

public class sleep {
 int iii;
 public static void main(String[] args) throws Exception {
     int ii = 0;
     for (int i = 0; i < 2000000; i++) {
         ii += test2();
     }
 }
 static int test2() throws Exception {
     return test();
 }
 static int test() throws Exception {
     sleep sl = new sleep();
     synchronized (sleep.class) {
         sleep.class.wait(1);
     }
     return sl.iii;
 }
}

% java -XX:CompileThreshold=1000 sleep &
% pwd
<hotspot_rep>/agent/make
% sh clhsdbproc.sh <pid>
% dumpcodecache >ccdump.txt

Node: the instruction "dumpcodecache" will be implemented by this bug fix.

With the fix the dump will be:

0xfa8d207b:    call	0xfa8ab060
            static int test() @0xb65b3110 of public class sleep @0xb65b3160 @ bci = 18, line = 15
            locals ([0], #ScObj0) ([1], oop 0xb65b32b0) ([2], illegal) 
            monitors (owner = oop 0xb65b32b0, lock = stack[16], normal) 
            #ScObj0 sleep{ [iii :0]=#int 0 }
            OopMap:

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/873ec3787992
                                     
2009-10-21
PUBLIC COMMENTS

Problem:
Part of these changes are from Tom's SA disassembler work.
Dumping nmethods with scalar replaced objects results in
exceptions from the SA since it was not implemented.

Solution:
Implement scalar replaced objects debug info dump in SA.
Fix PrintOptoAssembly output for such info since it was not correct.
Add missing NULL checks in SA dump code.
Reformat SA debug info output to easy read.
Add "dumpcodecache" instruction to SA to dump all nmethods in codecache.

Here is OptoAssembly output:

177       CALL,static  java.lang.Object::wait
        # sleep::test @ bci:126  L[0]=#ScObj0 L[1]=#ScObj1 L[2]=#ScObj2 L[3]=#ScObj3 L[4]=#ScObj4 L[5]=#Ptr0x080cffd8 L[6]=_ MON-BOX0=esp+32 MON-OBJ[0]=#Ptr0x080cffd8
        # ScObj0 sleep={ [iii :0]=#12 }
        # ScObj1 int[2]={ [0]=#0 , [1]=#34 }
        # ScObj2 sleep[2]={ [0]=#ScObj0 , [1]=esp + #12 }
        # ScObj3 int[2][]={ [0]=esp + #16 , [1]=#ScObj1 }
        # ScObj4 sleep[2][]={ [0]=esp + #8 , [1]=#ScObj2 }
        # OopMap{[8]=Oop [12]=Oop [16]=Oop [20]=Derived_oop_[8] off=380}

here is SA:

0xfa4d24b7:    call    0xfa4d0dd0
            static int test() @0xb61b3228 of public class sleep @0xb61b3278 @ bci = 126, line = 31
            locals ([0], #ScObj0) ([1], #ScObj1) ([2], #ScObj2) ([3], #ScObj3) ([4], #ScObj4) ([5], oop 0xb61b33c8) ([6], illegal)
            monitors (owner = oop 0xb61b33c8, lock = stack[32], normal)
            ScObj0 sleep={ [iii :0]=(#int 12) }
            ScObj1 int[2]={ [0]=(#int 0) [1]=(#int 34) }
            ScObj2 sleep[2]={ [0]=(##ScObj0) [1]=(#stack[12], oop) }
            ScObj3 int[2][]={ [0]=(#stack[16], oop) [1]=(##ScObj1) }
            ScObj4 sleep[2][]={ [0]=(#stack[8], oop) [1]=(##ScObj2) }
OopMap:
Oops:[8]  [12]  [16]
Derived oops:[20] = [8]

and here the java source:

     sleep sl = new sleep();
     sl.iii = 12;
     int[] ia = new int[2];
     ia[1] = 34;
     sleep[] sa = new sleep[2];
     sa[0] = sl;
     sa[1] = new sleep();
     sa[1].iii = 56;
     int[][] ia2 = new int[2][];
     ia2[0] = new int[1];
     ia2[1] = ia;
     ia2[0][0] = 78;
     sleep[][] sa2 = new sleep[2][];
     sa2[0] = new sleep[1];
     sa2[1] = sa;
     sa2[0][0] = new sleep();
     sa2[0][0].iii = 90;
     synchronized (sleep.class) {
         sleep.class.wait(1);
     }
                                     
2009-10-21



Hardware and Software, Engineered to Work Together