author | never |
Mon, 05 Sep 2011 17:09:05 -0700 | |
changeset 10517 | f92c9ff3a15f |
parent 6418 | 6671edbd230e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
6418 | 2 |
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4095
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4095
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4095
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
package sun.jvm.hotspot.code; |
|
26 |
||
27 |
import java.io.*; |
|
28 |
import java.util.*; |
|
29 |
import sun.jvm.hotspot.debugger.*; |
|
30 |
import sun.jvm.hotspot.runtime.*; |
|
31 |
import sun.jvm.hotspot.types.*; |
|
32 |
||
33 |
/** PcDescs map a physical PC (given as offset from start of nmethod) |
|
34 |
to the corresponding source scope and byte code index. */ |
|
35 |
||
36 |
public class PCDesc extends VMObject { |
|
37 |
private static CIntegerField pcOffsetField; |
|
38 |
private static CIntegerField scopeDecodeOffsetField; |
|
4095
6e0acfda1d47
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
3686
diff
changeset
|
39 |
private static CIntegerField objDecodeOffsetField; |
3686
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
40 |
private static CIntegerField pcFlagsField; |
10517
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
41 |
private static int reexecuteMask; |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
42 |
private static int isMethodHandleInvokeMask; |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
43 |
private static int returnOopMask; |
1 | 44 |
|
45 |
static { |
|
46 |
VM.registerVMInitializedObserver(new Observer() { |
|
47 |
public void update(Observable o, Object data) { |
|
48 |
initialize(VM.getVM().getTypeDataBase()); |
|
49 |
} |
|
50 |
}); |
|
51 |
} |
|
52 |
||
53 |
private static void initialize(TypeDataBase db) { |
|
54 |
Type type = db.lookupType("PcDesc"); |
|
55 |
||
56 |
pcOffsetField = type.getCIntegerField("_pc_offset"); |
|
57 |
scopeDecodeOffsetField = type.getCIntegerField("_scope_decode_offset"); |
|
4095
6e0acfda1d47
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
3686
diff
changeset
|
58 |
objDecodeOffsetField = type.getCIntegerField("_obj_decode_offset"); |
3686
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
59 |
pcFlagsField = type.getCIntegerField("_flags"); |
10517
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
60 |
|
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
61 |
reexecuteMask = db.lookupIntConstant("PcDesc::PCDESC_reexecute"); |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
62 |
isMethodHandleInvokeMask = db.lookupIntConstant("PcDesc::PCDESC_is_method_handle_invoke"); |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
63 |
returnOopMask = db.lookupIntConstant("PcDesc::PCDESC_return_oop"); |
1 | 64 |
} |
65 |
||
66 |
public PCDesc(Address addr) { |
|
67 |
super(addr); |
|
68 |
} |
|
69 |
||
70 |
// FIXME: add additional constructor probably needed for ScopeDesc::sender() |
|
71 |
||
72 |
public int getPCOffset() { |
|
73 |
return (int) pcOffsetField.getValue(addr); |
|
74 |
} |
|
75 |
||
76 |
public int getScopeDecodeOffset() { |
|
77 |
return ((int) scopeDecodeOffsetField.getValue(addr)); |
|
78 |
} |
|
79 |
||
4095
6e0acfda1d47
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
3686
diff
changeset
|
80 |
public int getObjDecodeOffset() { |
6e0acfda1d47
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
3686
diff
changeset
|
81 |
return ((int) objDecodeOffsetField.getValue(addr)); |
6e0acfda1d47
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
3686
diff
changeset
|
82 |
} |
6e0acfda1d47
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
3686
diff
changeset
|
83 |
|
1 | 84 |
public Address getRealPC(NMethod code) { |
6418 | 85 |
return code.codeBegin().addOffsetTo(getPCOffset()); |
1 | 86 |
} |
87 |
||
3686
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
88 |
|
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
89 |
public boolean getReexecute() { |
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
90 |
int flags = (int)pcFlagsField.getValue(addr); |
10517
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
91 |
return (flags & reexecuteMask) != 0; |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
92 |
} |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
93 |
|
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
94 |
public boolean isMethodHandleInvoke() { |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
95 |
int flags = (int)pcFlagsField.getValue(addr); |
f92c9ff3a15f
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
6418
diff
changeset
|
96 |
return (flags & isMethodHandleInvokeMask) != 0; |
3686
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
97 |
} |
69c1b5228547
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
3600
diff
changeset
|
98 |
|
1 | 99 |
public void print(NMethod code) { |
100 |
printOn(System.out, code); |
|
101 |
} |
|
102 |
||
103 |
public void printOn(PrintStream tty, NMethod code) { |
|
104 |
tty.println("PCDesc(" + getRealPC(code) + "):"); |
|
105 |
for (ScopeDesc sd = code.getScopeDescAt(getRealPC(code)); |
|
106 |
sd != null; |
|
107 |
sd = sd.sender()) { |
|
108 |
tty.print(" "); |
|
109 |
sd.getMethod().printValueOn(tty); |
|
110 |
tty.print(" @" + sd.getBCI()); |
|
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
1
diff
changeset
|
111 |
tty.print(" reexecute=" + sd.getReexecute()); |
1 | 112 |
tty.println(); |
113 |
} |
|
114 |
} |
|
115 |
} |