Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java @ 18109:b72ce1826bd0
Truffle: revert back to typed primitives, but make the primitive array an int[]
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 15 Oct 2014 19:25:43 +0200 |
parents | 7588156f5cf9 |
children |
rev | line source |
---|---|
0 | 1 /* |
1748 | 2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1040
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1040
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1040
diff
changeset
|
21 * questions. |
0 | 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; | |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
931
diff
changeset
|
39 private static CIntegerField objDecodeOffsetField; |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
40 private static CIntegerField pcFlagsField; |
3908
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
41 private static int reexecuteMask; |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
42 private static int isMethodHandleInvokeMask; |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
43 private static int returnOopMask; |
0 | 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"); | |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
931
diff
changeset
|
58 objDecodeOffsetField = type.getCIntegerField("_obj_decode_offset"); |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
59 pcFlagsField = type.getCIntegerField("_flags"); |
3908
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
60 |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
61 reexecuteMask = db.lookupIntConstant("PcDesc::PCDESC_reexecute"); |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
62 isMethodHandleInvokeMask = db.lookupIntConstant("PcDesc::PCDESC_is_method_handle_invoke"); |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
63 returnOopMask = db.lookupIntConstant("PcDesc::PCDESC_return_oop"); |
0 | 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 | |
1040
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
931
diff
changeset
|
80 public int getObjDecodeOffset() { |
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
931
diff
changeset
|
81 return ((int) objDecodeOffsetField.getValue(addr)); |
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
931
diff
changeset
|
82 } |
873ec3787992
6892186: SA does not dump debug info for scalar replaced objects
kvn
parents:
931
diff
changeset
|
83 |
0 | 84 public Address getRealPC(NMethod code) { |
1748 | 85 return code.codeBegin().addOffsetTo(getPCOffset()); |
0 | 86 } |
87 | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
88 |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
89 public boolean getReexecute() { |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
90 int flags = (int)pcFlagsField.getValue(addr); |
3908
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
91 return (flags & reexecuteMask) != 0; |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
92 } |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
93 |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
94 public boolean isMethodHandleInvoke() { |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
95 int flags = (int)pcFlagsField.getValue(addr); |
7588156f5cf9
7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)
never
parents:
1748
diff
changeset
|
96 return (flags & isMethodHandleInvokeMask) != 0; |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
97 } |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
98 |
0 | 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()); | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
111 tty.print(" reexecute=" + sd.getReexecute()); |
0 | 112 tty.println(); |
113 } | |
114 } | |
115 } |