Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/runtime/JavaCallWrapper.java @ 0:a61af66fc99e jdk7-b24
Initial load
author | duke |
---|---|
date | Sat, 01 Dec 2007 00:00:00 +0000 |
parents | |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a61af66fc99e |
---|---|
1 /* | |
2 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. | |
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.runtime; | |
26 | |
27 import java.util.*; | |
28 import sun.jvm.hotspot.debugger.*; | |
29 import sun.jvm.hotspot.types.*; | |
30 | |
31 /** <P> A JavaCallWrapper is constructed before each JavaCall and | |
32 destroyed after the call. Its purpose is to allocate/deallocate a | |
33 new handle block and to save/restore the last Java fp/sp. A | |
34 pointer to the JavaCallWrapper is stored on the stack. </P> | |
35 | |
36 <P> NOTE: this port is very minimal and is only designed to get | |
37 frame traversal working. FIXME: we will have to add platform- | |
38 specific stuff later and therefore a factory for these | |
39 objects. </P> */ | |
40 | |
41 public class JavaCallWrapper extends VMObject { | |
42 protected static AddressField anchorField; | |
43 private static AddressField lastJavaSPField; | |
44 private static AddressField lastJavaPCField; | |
45 | |
46 static { | |
47 VM.registerVMInitializedObserver(new Observer() { | |
48 public void update(Observable o, Object data) { | |
49 initialize(VM.getVM().getTypeDataBase()); | |
50 } | |
51 }); | |
52 } | |
53 | |
54 private static synchronized void initialize(TypeDataBase db) { | |
55 Type type = db.lookupType("JavaCallWrapper"); | |
56 Type anchorType = db.lookupType("JavaFrameAnchor"); | |
57 | |
58 anchorField = type.getAddressField("_anchor"); | |
59 lastJavaSPField = anchorType.getAddressField("_last_Java_sp"); | |
60 lastJavaPCField = anchorType.getAddressField("_last_Java_pc"); | |
61 } | |
62 | |
63 public JavaCallWrapper(Address addr) { | |
64 super(addr); | |
65 } | |
66 | |
67 public Address getLastJavaSP() { | |
68 return lastJavaSPField.getValue(addr.addOffsetTo(anchorField.getOffset())); | |
69 } | |
70 | |
71 public Address getLastJavaPC() { | |
72 return lastJavaPCField.getValue(addr.addOffsetTo(anchorField.getOffset())); | |
73 } | |
74 | |
75 } |