Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/runtime/linux_ia64/LinuxIA64JavaThreadPDAccess.java @ 3960:f08d439fab8c
7089790: integrate bsd-port changes
Reviewed-by: kvn, twisti, jrose
Contributed-by: Kurt Miller <kurt@intricatesoftware.com>, Greg Lewis <glewis@eyesbeyond.com>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, Landon Fuller <landonf@plausible.coop>, The FreeBSD Foundation <board@freebsdfoundation.org>, Michael Franz <mvfranz@gmail.com>, Roger Hoover <rhoover@apple.com>, Alexander Strange <astrange@apple.com>
author | never |
---|---|
date | Sun, 25 Sep 2011 16:03:29 -0700 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2003, 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:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
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:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.runtime.linux_ia64; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.debugger.*; | |
30 import sun.jvm.hotspot.debugger.ia64.*; | |
31 import sun.jvm.hotspot.runtime.*; | |
32 import sun.jvm.hotspot.runtime.ia64.*; | |
33 import sun.jvm.hotspot.types.*; | |
34 import sun.jvm.hotspot.utilities.*; | |
35 | |
36 public class LinuxIA64JavaThreadPDAccess implements JavaThreadPDAccess { | |
37 // private static AddressField lastJavaPCField; | |
38 // private static AddressField lastJavaFPField; | |
39 private static AddressField lastJavaIFrameField; | |
40 private static AddressField osThreadField; | |
41 | |
42 // Field from OSThread | |
43 private static CIntegerField osThreadPThreadIDField; | |
44 | |
45 // This is currently unneeded but is being kept in case we change | |
46 // the currentFrameGuess algorithm | |
47 private static final long GUESS_SCAN_RANGE = 128 * 1024; | |
48 | |
49 static { | |
50 VM.registerVMInitializedObserver(new Observer() { | |
51 public void update(Observable o, Object data) { | |
52 initialize(VM.getVM().getTypeDataBase()); | |
53 } | |
54 }); | |
55 } | |
56 | |
57 private static synchronized void initialize(TypeDataBase db) { | |
58 Type type = db.lookupType("JavaThread"); | |
59 | |
60 lastJavaIFrameField = type.getAddressField("_last_Java_iframe"); | |
61 osThreadField = type.getAddressField("_osthread"); | |
62 | |
63 type = db.lookupType("OSThread"); | |
64 osThreadPThreadIDField = type.getCIntegerField("_pthread_id"); | |
65 } | |
66 | |
67 public Address getLastJavaIFrame(Address addr) { | |
68 return lastJavaIFrameField.getValue(addr); | |
69 } | |
70 | |
71 | |
72 public Address getBaseOfStackPointer(Address addr) { | |
73 return null; | |
74 } | |
75 | |
76 public Address getLastJavaFP(Address addr) { | |
77 return null; // Not in 1.4.1 | |
78 } | |
79 | |
80 public Address getLastJavaPC(Address addr) { | |
81 return null; // Not in 1.4.1 | |
82 } | |
83 | |
84 public boolean isInterpretedFrame() { | |
85 | |
86 // In 1.4.1 there are only interpreted frames | |
87 // and there is no pc | |
88 return true; | |
89 } | |
90 | |
91 public Frame getLastFramePD(JavaThread thread, Address addr) { | |
92 // The thread is the JavaThread that contains "this" | |
93 // so we don't need any new accessor at the JavaThread level | |
94 Address iframe = getLastJavaIFrame(addr); | |
95 Address pc = thread.getLastJavaPC(); | |
96 if (iframe == null) { | |
97 return null; // no information | |
98 } | |
99 return new IA64Frame(thread.getLastJavaSP(), iframe, pc); | |
100 } | |
101 | |
102 public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap) { | |
103 return new IA64RegisterMap(thread, updateMap); | |
104 } | |
105 | |
106 public Frame getCurrentFrameGuess(JavaThread thread, Address addr) { | |
107 return getLastFramePD(thread, addr); | |
108 } | |
109 | |
110 public void printThreadIDOn(Address addr, PrintStream tty) { | |
111 tty.print(getThreadProxy(addr)); | |
112 } | |
113 | |
114 public void printInfoOn(Address threadAddr, PrintStream tty) { | |
115 tty.print("Thread id: "); | |
116 printThreadIDOn(threadAddr, tty); | |
117 tty.println("\nLastJavaIFrame: " + getLastJavaIFrame(threadAddr)); | |
118 } | |
119 | |
120 public Address getLastSP(Address addr) { | |
121 ThreadProxy t = getThreadProxy(addr); | |
122 IA64ThreadContext context = (IA64ThreadContext) t.getContext(); | |
123 return context.getRegisterAsAddress(IA64ThreadContext.SP); | |
124 } | |
125 | |
126 public ThreadProxy getThreadProxy(Address addr) { | |
127 // Addr is the address of the JavaThread. | |
128 // Fetch the OSThread (for now and for simplicity, not making a | |
129 // separate "OSThread" class in this package) | |
130 Address osThreadAddr = osThreadField.getValue(addr); | |
131 // Get the address of the _pthread_id from the OSThread | |
132 Address pthreadIdAddr = osThreadAddr.addOffsetTo(osThreadPThreadIDField.getOffset()); | |
133 | |
134 JVMDebugger debugger = VM.getVM().getDebugger(); | |
135 return debugger.getThreadForIdentifierAddress(pthreadIdAddr); | |
136 } | |
137 } |