1 /* |
|
2 * Copyright (c) 2003, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 package sun.jvm.hotspot.runtime.ia64; |
|
26 |
|
27 import java.util.*; |
|
28 // import sun.jvm.hotspot.asm.ia64.*; |
|
29 import sun.jvm.hotspot.code.*; |
|
30 import sun.jvm.hotspot.compiler.*; |
|
31 import sun.jvm.hotspot.debugger.*; |
|
32 import sun.jvm.hotspot.oops.*; |
|
33 import sun.jvm.hotspot.runtime.*; |
|
34 import sun.jvm.hotspot.types.*; |
|
35 import sun.jvm.hotspot.utilities.*; |
|
36 |
|
37 /** Specialization of and implementation of abstract methods of the |
|
38 Frame class for the ia64 family of CPUs. */ |
|
39 |
|
40 public class cInterpreter extends VMObject { |
|
41 private static final boolean DEBUG = true; |
|
42 |
|
43 private static AddressField bcpField; |
|
44 private static AddressField localsField; |
|
45 private static AddressField constantsField; |
|
46 private static AddressField methodField; |
|
47 private static AddressField stackField; // i.e. tos |
|
48 private static AddressField stackBaseField; // ultimate bottom of stack |
|
49 private static AddressField stackLimitField; // ultimate top of stack |
|
50 private static AddressField monitorBaseField; |
|
51 private static CIntegerField messageField; |
|
52 private static AddressField prevFieldField; |
|
53 private static AddressField wrapperField; |
|
54 private static AddressField prevField; |
|
55 |
|
56 private static int NO_REQUEST; |
|
57 private static int INITIALIZE; |
|
58 private static int METHOD_ENTRY; |
|
59 private static int METHOD_RESUME; |
|
60 private static int GOT_MONITORS; |
|
61 private static int RETHROW_EXCEPTION; |
|
62 private static int CALL_METHOD; |
|
63 private static int RETURN_FROM_METHOD; |
|
64 private static int RETRY_METHOD; |
|
65 private static int MORE_MONITORS; |
|
66 private static int THROWING_EXCEPTION; |
|
67 private static int POPPING_FRAME; |
|
68 |
|
69 static { |
|
70 VM.registerVMInitializedObserver(new Observer() { |
|
71 public void update(Observable o, Object data) { |
|
72 initialize(VM.getVM().getTypeDataBase()); |
|
73 } |
|
74 }); |
|
75 } |
|
76 |
|
77 private static synchronized void initialize(TypeDataBase db) { |
|
78 |
|
79 Type cInterpreterType = db.lookupType("cInterpreter"); |
|
80 bcpField = cInterpreterType.getAddressField("_bcp"); |
|
81 localsField = cInterpreterType.getAddressField("_locals"); |
|
82 constantsField = cInterpreterType.getAddressField("_constants"); |
|
83 methodField = cInterpreterType.getAddressField("_method"); |
|
84 stackField = cInterpreterType.getAddressField("_stack"); |
|
85 stackBaseField = cInterpreterType.getAddressField("_stack_base"); |
|
86 stackLimitField = cInterpreterType.getAddressField("_stack_limit"); |
|
87 monitorBaseField = cInterpreterType.getAddressField("_monitor_base"); |
|
88 // messageField = cInterpreterType.getCIntegerField("_msg"); |
|
89 messageField = null; |
|
90 wrapperField = cInterpreterType.getAddressField("_wrapper"); |
|
91 prevField = cInterpreterType.getAddressField("_prev_link"); |
|
92 |
|
93 /* |
|
94 NO_REQUEST = db.lookupIntConstant("no_request").intValue(); |
|
95 INITIALIZE = db.lookupIntConstant("initialize").intValue(); |
|
96 METHOD_ENTRY = db.lookupIntConstant("method_entry").intValue(); |
|
97 METHOD_RESUME = db.lookupIntConstant("method_resume").intValue(); |
|
98 GOT_MONITORS = db.lookupIntConstant("got_monitors").intValue(); |
|
99 RETHROW_EXCEPTION = db.lookupIntConstant("rethrow_exception").intValue(); |
|
100 CALL_METHOD = db.lookupIntConstant("call_method").intValue(); |
|
101 RETURN_FROM_METHOD = db.lookupIntConstant("return_from_method").intValue(); |
|
102 RETRY_METHOD = db.lookupIntConstant("retry_method").intValue(); |
|
103 MORE_MONITORS = db.lookupIntConstant("more_monitors").intValue(); |
|
104 THROWING_EXCEPTION = db.lookupIntConstant("throwing_exception").intValue(); |
|
105 POPPING_FRAME = db.lookupIntConstant("popping_frame").intValue(); |
|
106 */ |
|
107 } |
|
108 |
|
109 |
|
110 public cInterpreter(Address addr) { |
|
111 super(addr); |
|
112 } |
|
113 |
|
114 public Address prev() { |
|
115 return prevField.getValue(addr); |
|
116 } |
|
117 |
|
118 public Address locals() { |
|
119 |
|
120 Address val = localsField.getValue(addr); |
|
121 return val; |
|
122 } |
|
123 |
|
124 public Address localsAddr() { |
|
125 |
|
126 Address localsAddr = localsField.getValue(addr); |
|
127 return localsAddr; |
|
128 } |
|
129 |
|
130 public Address bcp() { |
|
131 |
|
132 Address val = bcpField.getValue(addr); |
|
133 return val; |
|
134 } |
|
135 |
|
136 public Address bcpAddr() { |
|
137 |
|
138 Address bcpAddr = addr.addOffsetTo(bcpField.getOffset()); |
|
139 return bcpAddr; |
|
140 } |
|
141 |
|
142 public Address constants() { |
|
143 |
|
144 Address val = constantsField.getValue(addr); |
|
145 return val; |
|
146 } |
|
147 |
|
148 public Address constantsAddr() { |
|
149 |
|
150 Address constantsAddr = constantsField.getValue(addr); |
|
151 return constantsAddr; |
|
152 } |
|
153 |
|
154 public Address method() { |
|
155 |
|
156 Address val = methodField.getValue(addr); |
|
157 return val; |
|
158 } |
|
159 public Address methodAddr() { |
|
160 |
|
161 Address methodAddr = addr.addOffsetTo(methodField.getOffset()); |
|
162 return methodAddr; |
|
163 } |
|
164 |
|
165 public Address stack() { |
|
166 |
|
167 Address val = stackField.getValue(addr); |
|
168 return val; |
|
169 } |
|
170 |
|
171 public Address stackBase() { |
|
172 |
|
173 Address val = stackBaseField.getValue(addr); |
|
174 return val; |
|
175 } |
|
176 |
|
177 public Address stackLimit() { |
|
178 |
|
179 Address val = stackLimitField.getValue(addr); |
|
180 return val; |
|
181 } |
|
182 |
|
183 public Address monitorBase() { |
|
184 |
|
185 Address val = monitorBaseField.getValue(addr); |
|
186 return val; |
|
187 } |
|
188 |
|
189 public Address wrapper() { |
|
190 |
|
191 return wrapperField.getValue(addr); |
|
192 } |
|
193 |
|
194 public int message() { |
|
195 int val = (int) messageField.getValue(addr); |
|
196 return val; |
|
197 } |
|
198 |
|
199 } |
|