Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalJavaAccess.hpp @ 2890:c23d45daff9b
Renamed cpp/hpp file directory.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 08 Jun 2011 13:40:25 +0200 |
parents | src/share/vm/c1x/graalJavaAccess.hpp@2fb867285938 |
children | 75a99b4f1c98 |
comparison
equal
deleted
inserted
replaced
2889:2fb867285938 | 2890:c23d45daff9b |
---|---|
1 /* | |
2 * Copyright (c) 2011, 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 void c1x_compute_offsets(); | |
25 | |
26 #include "classfile/systemDictionary.hpp" | |
27 #include "oops/instanceMirrorKlass.hpp" | |
28 | |
29 /* This macro defines the structure of the CiTargetMethod - classes. | |
30 * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. | |
31 * | |
32 * The public interface of these classes will look like this: | |
33 | |
34 * class CiStackSlot : AllStatic { | |
35 * public: | |
36 * static klassOop klass(); | |
37 * static jint index(oop obj); | |
38 * static jint index(Handle obj); | |
39 * static jint index(jobject obj); | |
40 * static void set_index(oop obj, jint x); | |
41 * static void set_index(Handle obj, jint x); | |
42 * static void set_index(jobject obj, jint x); | |
43 * }; | |
44 * | |
45 */ | |
46 | |
47 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, oop_field, static_oop_field) \ | |
48 start_class(HotSpotTypeResolved) \ | |
49 oop_field(HotSpotTypeResolved, compiler, "Lcom/oracle/max/graal/runtime/Compiler;") \ | |
50 oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;") \ | |
51 oop_field(HotSpotTypeResolved, simpleName, "Ljava/lang/String;") \ | |
52 int_field(HotSpotTypeResolved, accessFlags) \ | |
53 boolean_field(HotSpotTypeResolved, hasFinalizer) \ | |
54 boolean_field(HotSpotTypeResolved, hasSubclass) \ | |
55 boolean_field(HotSpotTypeResolved, hasFinalizableSubclass) \ | |
56 boolean_field(HotSpotTypeResolved, isInitialized) \ | |
57 boolean_field(HotSpotTypeResolved, isArrayClass) \ | |
58 boolean_field(HotSpotTypeResolved, isInstanceClass) \ | |
59 boolean_field(HotSpotTypeResolved, isInterface) \ | |
60 int_field(HotSpotTypeResolved, instanceSize) \ | |
61 oop_field(HotSpotTypeResolved, componentType, "Lcom/sun/cri/ri/RiType;") \ | |
62 end_class \ | |
63 start_class(HotSpotType) \ | |
64 oop_field(HotSpotType, name, "Ljava/lang/String;") \ | |
65 end_class \ | |
66 start_class(HotSpotField) \ | |
67 oop_field(HotSpotField, constant, "Lcom/sun/cri/ci/CiConstant;") \ | |
68 end_class \ | |
69 start_class(HotSpotMethodResolved) \ | |
70 long_field(HotSpotMethodResolved, vmId) \ | |
71 end_class \ | |
72 start_class(HotSpotProxy) \ | |
73 static_oop_field(HotSpotProxy, DUMMY_CONSTANT_OBJ, "Ljava/lang/Long;") \ | |
74 end_class \ | |
75 start_class(HotSpotTargetMethod) \ | |
76 oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \ | |
77 oop_field(HotSpotTargetMethod, method, "Lcom/oracle/max/graal/runtime/HotSpotMethodResolved;") \ | |
78 oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ | |
79 oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \ | |
80 oop_field(HotSpotTargetMethod, exceptionHandlers, "[Lcom/sun/cri/ci/CiTargetMethod$ExceptionHandler;") \ | |
81 end_class \ | |
82 start_class(HotSpotExceptionHandler) \ | |
83 int_field(HotSpotExceptionHandler, startBci) \ | |
84 int_field(HotSpotExceptionHandler, endBci) \ | |
85 int_field(HotSpotExceptionHandler, handlerBci) \ | |
86 int_field(HotSpotExceptionHandler, catchClassIndex) \ | |
87 oop_field(HotSpotExceptionHandler, catchClass, "Lcom/sun/cri/ri/RiType;") \ | |
88 end_class \ | |
89 start_class(CiTargetMethod) \ | |
90 int_field(CiTargetMethod, frameSize) \ | |
91 int_field(CiTargetMethod, customStackAreaOffset) \ | |
92 oop_field(CiTargetMethod, targetCode, "[B") \ | |
93 oop_field(CiTargetMethod, assumptions, "Lcom/sun/cri/ci/CiAssumptions;") \ | |
94 int_field(CiTargetMethod, targetCodeSize) \ | |
95 end_class \ | |
96 start_class(CiAssumptions) \ | |
97 oop_field(CiAssumptions, list, "[Lcom/sun/cri/ci/CiAssumptions$Assumption;") \ | |
98 end_class \ | |
99 start_class(CiAssumptions_ConcreteSubtype) \ | |
100 oop_field(CiAssumptions_ConcreteSubtype, context, "Lcom/sun/cri/ri/RiType;") \ | |
101 oop_field(CiAssumptions_ConcreteSubtype, subtype, "Lcom/sun/cri/ri/RiType;") \ | |
102 end_class \ | |
103 start_class(CiAssumptions_ConcreteMethod) \ | |
104 oop_field(CiAssumptions_ConcreteMethod, context, "Lcom/sun/cri/ri/RiMethod;") \ | |
105 oop_field(CiAssumptions_ConcreteMethod, method, "Lcom/sun/cri/ri/RiMethod;") \ | |
106 end_class \ | |
107 start_class(CiTargetMethod_Site) \ | |
108 int_field(CiTargetMethod_Site, pcOffset) \ | |
109 end_class \ | |
110 start_class(CiTargetMethod_Call) \ | |
111 oop_field(CiTargetMethod_Call, runtimeCall, "Lcom/sun/cri/ci/CiRuntimeCall;") \ | |
112 oop_field(CiTargetMethod_Call, method, "Lcom/sun/cri/ri/RiMethod;") \ | |
113 oop_field(CiTargetMethod_Call, symbol, "Ljava/lang/String;") \ | |
114 oop_field(CiTargetMethod_Call, globalStubID, "Ljava/lang/Object;") \ | |
115 oop_field(CiTargetMethod_Call, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ | |
116 end_class \ | |
117 start_class(CiTargetMethod_DataPatch) \ | |
118 oop_field(CiTargetMethod_DataPatch, constant, "Lcom/sun/cri/ci/CiConstant;") \ | |
119 end_class \ | |
120 start_class(CiTargetMethod_Safepoint) \ | |
121 oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ | |
122 end_class \ | |
123 start_class(CiTargetMethod_ExceptionHandler) \ | |
124 int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ | |
125 int_field(CiTargetMethod_ExceptionHandler, handlerBci) \ | |
126 int_field(CiTargetMethod_ExceptionHandler, bci) \ | |
127 int_field(CiTargetMethod_ExceptionHandler, scopeLevel) \ | |
128 oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\ | |
129 end_class \ | |
130 start_class(CiTargetMethod_Mark) \ | |
131 oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ | |
132 oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \ | |
133 end_class \ | |
134 start_class(CiDebugInfo) \ | |
135 oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;") \ | |
136 oop_field(CiDebugInfo, registerRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ | |
137 oop_field(CiDebugInfo, frameRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ | |
138 end_class \ | |
139 start_class(CiBitMap) \ | |
140 int_field(CiBitMap, size) \ | |
141 long_field(CiBitMap, low) \ | |
142 oop_field(CiBitMap, extra, "[J") \ | |
143 end_class \ | |
144 start_class(CiFrame) \ | |
145 oop_field(CiFrame, values, "[Lcom/sun/cri/ci/CiValue;") \ | |
146 int_field(CiFrame, numLocals) \ | |
147 int_field(CiFrame, numStack) \ | |
148 int_field(CiFrame, numLocks) \ | |
149 end_class \ | |
150 start_class(CiCodePos) \ | |
151 oop_field(CiCodePos, caller, "Lcom/sun/cri/ci/CiCodePos;") \ | |
152 oop_field(CiCodePos, method, "Lcom/sun/cri/ri/RiMethod;") \ | |
153 int_field(CiCodePos, bci) \ | |
154 end_class \ | |
155 start_class(CiConstant) \ | |
156 oop_field(CiConstant, kind, "Lcom/sun/cri/ci/CiKind;") \ | |
157 oop_field(CiConstant, object, "Ljava/lang/Object;") \ | |
158 long_field(CiConstant, primitive) \ | |
159 end_class \ | |
160 start_class(CiKind) \ | |
161 char_field(CiKind, typeChar) \ | |
162 static_oop_field(CiKind, Boolean, "Lcom/sun/cri/ci/CiKind;"); \ | |
163 static_oop_field(CiKind, Byte, "Lcom/sun/cri/ci/CiKind;"); \ | |
164 static_oop_field(CiKind, Char, "Lcom/sun/cri/ci/CiKind;"); \ | |
165 static_oop_field(CiKind, Short, "Lcom/sun/cri/ci/CiKind;"); \ | |
166 static_oop_field(CiKind, Int, "Lcom/sun/cri/ci/CiKind;"); \ | |
167 static_oop_field(CiKind, Long, "Lcom/sun/cri/ci/CiKind;"); \ | |
168 end_class \ | |
169 start_class(CiRuntimeCall) \ | |
170 static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
171 static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
172 static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
173 static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
174 static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
175 static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
176 static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
177 static_oop_field(CiRuntimeCall, ArithmethicLrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
178 static_oop_field(CiRuntimeCall, ArithmeticLdiv, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
179 static_oop_field(CiRuntimeCall, ArithmeticFrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
180 static_oop_field(CiRuntimeCall, ArithmeticDrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
181 static_oop_field(CiRuntimeCall, ArithmeticCos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
182 static_oop_field(CiRuntimeCall, ArithmeticTan, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
183 static_oop_field(CiRuntimeCall, ArithmeticLog, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
184 static_oop_field(CiRuntimeCall, ArithmeticLog10, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
185 static_oop_field(CiRuntimeCall, ArithmeticSin, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
186 static_oop_field(CiRuntimeCall, Deoptimize, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
187 end_class \ | |
188 start_class(RiMethod) \ | |
189 end_class \ | |
190 start_class(CiValue) \ | |
191 oop_field(CiValue, kind, "Lcom/sun/cri/ci/CiKind;") \ | |
192 static_oop_field(CiValue, IllegalValue, "Lcom/sun/cri/ci/CiValue;"); \ | |
193 end_class \ | |
194 start_class(CiRegisterValue) \ | |
195 oop_field(CiRegisterValue, reg, "Lcom/sun/cri/ci/CiRegister;") \ | |
196 end_class \ | |
197 start_class(CiRegister) \ | |
198 int_field(CiRegister, number) \ | |
199 end_class \ | |
200 start_class(CiStackSlot) \ | |
201 int_field(CiStackSlot, index) \ | |
202 end_class \ | |
203 /* end*/ | |
204 | |
205 | |
206 | |
207 | |
208 #define START_CLASS(name) \ | |
209 class name : AllStatic { \ | |
210 private: \ | |
211 friend class C1XCompiler; \ | |
212 static void check(oop obj) { assert(obj != NULL, "NULL field access of class " #name); assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected"); } \ | |
213 static void compute_offsets(); \ | |
214 public: \ | |
215 static klassOop klass() { return SystemDictionary::name##_klass(); } | |
216 | |
217 #define END_CLASS }; | |
218 | |
219 #define FIELD(name, type, accessor) \ | |
220 static int _##name##_offset; \ | |
221 static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \ | |
222 static type name(Handle obj) { check(obj()); return obj->accessor(_##name##_offset); } \ | |
223 static type name(jobject obj) { check(JNIHandles::resolve(obj)); return JNIHandles::resolve(obj)->accessor(_##name##_offset); } \ | |
224 static void set_##name(oop obj, type x) { check(obj); obj->accessor##_put(_##name##_offset, x); } \ | |
225 static void set_##name(Handle obj, type x) { check(obj()); obj->accessor##_put(_##name##_offset, x); } \ | |
226 static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } | |
227 | |
228 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) | |
229 #define INT_FIELD(klass, name) FIELD(name, jint, int_field) | |
230 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) | |
231 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) | |
232 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) | |
233 #define STATIC_OOP_FIELD(klassName, name, signature) \ | |
234 static int _##name##_offset; \ | |
235 static oop name() { \ | |
236 instanceKlass* ik = instanceKlass::cast(klassName::klass()); \ | |
237 address addr = ik->static_field_addr(_##name##_offset - instanceMirrorKlass::offset_of_static_fields()); \ | |
238 if (UseCompressedOops) { \ | |
239 return oopDesc::load_decode_heap_oop((narrowOop *)addr); \ | |
240 } else { \ | |
241 return oopDesc::load_decode_heap_oop((oop*)addr); \ | |
242 } \ | |
243 } \ | |
244 static void set_##name(oop x) { \ | |
245 instanceKlass* ik = instanceKlass::cast(klassName::klass()); \ | |
246 address addr = ik->static_field_addr(_##name##_offset - instanceMirrorKlass::offset_of_static_fields()); \ | |
247 if (UseCompressedOops) { \ | |
248 oopDesc::encode_store_heap_oop((narrowOop *)addr, x); \ | |
249 } else { \ | |
250 oopDesc::encode_store_heap_oop((oop*)addr, x); \ | |
251 } \ | |
252 } | |
253 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) | |
254 #undef START_CLASS | |
255 #undef END_CLASS | |
256 #undef FIELD | |
257 #undef CHAR_FIELD | |
258 #undef INT_FIELD | |
259 #undef BOOLEAN_FIELD | |
260 #undef LONG_FIELD | |
261 #undef OOP_FIELD | |
262 #undef STATIC_OOP_FIELD | |
263 | |
264 |