Mercurial > hg > graal-compiler
annotate agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java @ 989:148e5441d916
6863023: need non-perm oops in code cache for JSR 292
Summary: Make a special root-list for those few nmethods which might contain non-perm oops.
Reviewed-by: twisti, kvn, never, jmasa, ysr
author | jrose |
---|---|
date | Tue, 15 Sep 2009 21:53:47 -0700 |
parents | 72088be4b386 |
children | 873ec3787992 |
rev | line source |
---|---|
0 | 1 /* |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
2 * Copyright 2000-2009 Sun Microsystems, Inc. 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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
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; | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
39 private static CIntegerField pcFlagsField; |
0 | 40 |
41 static { | |
42 VM.registerVMInitializedObserver(new Observer() { | |
43 public void update(Observable o, Object data) { | |
44 initialize(VM.getVM().getTypeDataBase()); | |
45 } | |
46 }); | |
47 } | |
48 | |
49 private static void initialize(TypeDataBase db) { | |
50 Type type = db.lookupType("PcDesc"); | |
51 | |
52 pcOffsetField = type.getCIntegerField("_pc_offset"); | |
53 scopeDecodeOffsetField = type.getCIntegerField("_scope_decode_offset"); | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
54 pcFlagsField = type.getCIntegerField("_flags"); |
0 | 55 } |
56 | |
57 public PCDesc(Address addr) { | |
58 super(addr); | |
59 } | |
60 | |
61 // FIXME: add additional constructor probably needed for ScopeDesc::sender() | |
62 | |
63 public int getPCOffset() { | |
64 return (int) pcOffsetField.getValue(addr); | |
65 } | |
66 | |
67 public int getScopeDecodeOffset() { | |
68 return ((int) scopeDecodeOffsetField.getValue(addr)); | |
69 } | |
70 | |
71 public Address getRealPC(NMethod code) { | |
72 return code.instructionsBegin().addOffsetTo(getPCOffset()); | |
73 } | |
74 | |
931
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
75 |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
76 public boolean getReexecute() { |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
77 int flags = (int)pcFlagsField.getValue(addr); |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
78 return ((flags & 0x1)== 1); //first is the reexecute bit |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
79 } |
72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents:
900
diff
changeset
|
80 |
0 | 81 public void print(NMethod code) { |
82 printOn(System.out, code); | |
83 } | |
84 | |
85 public void printOn(PrintStream tty, NMethod code) { | |
86 tty.println("PCDesc(" + getRealPC(code) + "):"); | |
87 for (ScopeDesc sd = code.getScopeDescAt(getRealPC(code)); | |
88 sd != null; | |
89 sd = sd.sender()) { | |
90 tty.print(" "); | |
91 sd.getMethod().printValueOn(tty); | |
92 tty.print(" @" + sd.getBCI()); | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
93 tty.print(" reexecute=" + sd.getReexecute()); |
0 | 94 tty.println(); |
95 } | |
96 } | |
97 } |