Mercurial > hg > graal-compiler
comparison src/share/vm/c1x/c1x_JavaAccess.hpp @ 2046:cf75612bdaa5
Renamed file.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:48:48 +0100 |
parents | src/share/vm/c1x/c1x_TargetMethod.hpp@00bc9eaf0e24 |
children | 177398c6147d |
comparison
equal
deleted
inserted
replaced
2045:9c96c873c42b | 2046:cf75612bdaa5 |
---|---|
1 /* | |
2 * Copyright 2000-2010 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 void c1x_compute_offsets(); | |
26 | |
27 /* This macro defines the structure of the CiTargetMethod - classes. | |
28 * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. | |
29 * | |
30 * The public interface of these classes will look like this: | |
31 | |
32 * class CiStackSlot : AllStatic { | |
33 * public: | |
34 * static klassOop klass(); | |
35 * static jint index(oop obj); | |
36 * static jint index(Handle obj); | |
37 * static jint index(jobject obj); | |
38 * static void set_index(oop obj, jint x); | |
39 * static void set_index(Handle obj, jint x); | |
40 * static void set_index(jobject obj, jint x); | |
41 * }; | |
42 * | |
43 */ | |
44 | |
45 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, oop_field, static_oop_field) \ | |
46 start_class(HotSpotTypeResolved) \ | |
47 oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;") \ | |
48 oop_field(HotSpotTypeResolved, name, "Ljava/lang/String;") \ | |
49 int_field(HotSpotTypeResolved, accessFlags) \ | |
50 boolean_field(HotSpotTypeResolved, hasFinalizer) \ | |
51 boolean_field(HotSpotTypeResolved, hasSubclass) \ | |
52 boolean_field(HotSpotTypeResolved, hasFinalizableSubclass) \ | |
53 boolean_field(HotSpotTypeResolved, isInitialized) \ | |
54 boolean_field(HotSpotTypeResolved, isArrayClass) \ | |
55 boolean_field(HotSpotTypeResolved, isInstanceClass) \ | |
56 boolean_field(HotSpotTypeResolved, isInterface) \ | |
57 int_field(HotSpotTypeResolved, instanceSize) \ | |
58 oop_field(HotSpotTypeResolved, componentType, "Lcom/sun/cri/ri/RiType;") \ | |
59 end_class \ | |
60 start_class(HotSpotField) \ | |
61 oop_field(HotSpotField, constant, "Lcom/sun/cri/ci/CiConstant;") \ | |
62 end_class \ | |
63 start_class(HotSpotMethodResolved) \ | |
64 long_field(HotSpotMethodResolved, vmId) \ | |
65 end_class \ | |
66 start_class(HotSpotProxy) \ | |
67 static_oop_field(HotSpotProxy, DUMMY_CONSTANT_OBJ, "Ljava/lang/Long;") \ | |
68 end_class \ | |
69 start_class(HotSpotTargetMethod) \ | |
70 oop_field(HotSpotTargetMethod, targetMethod, "Lcom/sun/cri/ci/CiTargetMethod;") \ | |
71 oop_field(HotSpotTargetMethod, method, "Lcom/sun/hotspot/c1x/HotSpotMethodResolved;")\ | |
72 oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ | |
73 oop_field(HotSpotTargetMethod, sites, "[Lcom/sun/cri/ci/CiTargetMethod$Site;") \ | |
74 oop_field(HotSpotTargetMethod, exceptionHandlers, "[Lcom/sun/cri/ci/CiTargetMethod$ExceptionHandler;") \ | |
75 end_class \ | |
76 start_class(HotSpotExceptionHandler) \ | |
77 int_field(HotSpotExceptionHandler, startBci) \ | |
78 int_field(HotSpotExceptionHandler, endBci) \ | |
79 int_field(HotSpotExceptionHandler, handlerBci) \ | |
80 int_field(HotSpotExceptionHandler, catchClassIndex) \ | |
81 oop_field(HotSpotExceptionHandler, catchClass, "Lcom/sun/cri/ri/RiType;") \ | |
82 end_class \ | |
83 start_class(CiTargetMethod) \ | |
84 int_field(CiTargetMethod, frameSize) \ | |
85 int_field(CiTargetMethod, customStackAreaOffset) \ | |
86 oop_field(CiTargetMethod, targetCode, "[B") \ | |
87 int_field(CiTargetMethod, targetCodeSize) \ | |
88 end_class \ | |
89 start_class(CiTargetMethod_Site) \ | |
90 int_field(CiTargetMethod_Site, pcOffset) \ | |
91 end_class \ | |
92 start_class(CiTargetMethod_Call) \ | |
93 oop_field(CiTargetMethod_Call, runtimeCall, "Lcom/sun/cri/ci/CiRuntimeCall;") \ | |
94 oop_field(CiTargetMethod_Call, method, "Lcom/sun/cri/ri/RiMethod;") \ | |
95 oop_field(CiTargetMethod_Call, symbol, "Ljava/lang/String;") \ | |
96 oop_field(CiTargetMethod_Call, globalStubID, "Ljava/lang/Object;") \ | |
97 oop_field(CiTargetMethod_Call, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ | |
98 end_class \ | |
99 start_class(CiTargetMethod_DataPatch) \ | |
100 oop_field(CiTargetMethod_DataPatch, constant, "Lcom/sun/cri/ci/CiConstant;") \ | |
101 end_class \ | |
102 start_class(CiTargetMethod_Safepoint) \ | |
103 oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/sun/cri/ci/CiDebugInfo;") \ | |
104 end_class \ | |
105 start_class(CiTargetMethod_ExceptionHandler) \ | |
106 int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ | |
107 int_field(CiTargetMethod_ExceptionHandler, handlerBci) \ | |
108 int_field(CiTargetMethod_ExceptionHandler, bci) \ | |
109 int_field(CiTargetMethod_ExceptionHandler, scopeLevel) \ | |
110 oop_field(CiTargetMethod_ExceptionHandler, exceptionType, "Lcom/sun/cri/ri/RiType;")\ | |
111 end_class \ | |
112 start_class(CiTargetMethod_Mark) \ | |
113 oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ | |
114 oop_field(CiTargetMethod_Mark, references, "[Lcom/sun/cri/ci/CiTargetMethod$Mark;") \ | |
115 end_class \ | |
116 start_class(CiDebugInfo) \ | |
117 oop_field(CiDebugInfo, codePos, "Lcom/sun/cri/ci/CiCodePos;") \ | |
118 oop_field(CiDebugInfo, registerRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ | |
119 oop_field(CiDebugInfo, frameRefMap, "Lcom/sun/cri/ci/CiBitMap;") \ | |
120 end_class \ | |
121 start_class(CiBitMap) \ | |
122 int_field(CiBitMap, size) \ | |
123 long_field(CiBitMap, low) \ | |
124 oop_field(CiBitMap, extra, "[J") \ | |
125 end_class \ | |
126 start_class(CiDebugInfo_Frame) \ | |
127 oop_field(CiDebugInfo_Frame, values, "[Lcom/sun/cri/ci/CiValue;") \ | |
128 int_field(CiDebugInfo_Frame, numLocals) \ | |
129 int_field(CiDebugInfo_Frame, numStack) \ | |
130 int_field(CiDebugInfo_Frame, numLocks) \ | |
131 end_class \ | |
132 start_class(CiCodePos) \ | |
133 oop_field(CiCodePos, caller, "Lcom/sun/cri/ci/CiCodePos;") \ | |
134 oop_field(CiCodePos, method, "Lcom/sun/cri/ri/RiMethod;") \ | |
135 int_field(CiCodePos, bci) \ | |
136 end_class \ | |
137 start_class(CiConstant) \ | |
138 oop_field(CiConstant, kind, "Lcom/sun/cri/ci/CiKind;") \ | |
139 oop_field(CiConstant, object, "Ljava/lang/Object;") \ | |
140 long_field(CiConstant, primitive) \ | |
141 end_class \ | |
142 start_class(CiKind) \ | |
143 char_field(CiKind, typeChar) \ | |
144 static_oop_field(CiKind, Boolean, "Lcom/sun/cri/ci/CiKind;"); \ | |
145 static_oop_field(CiKind, Byte, "Lcom/sun/cri/ci/CiKind;"); \ | |
146 static_oop_field(CiKind, Char, "Lcom/sun/cri/ci/CiKind;"); \ | |
147 static_oop_field(CiKind, Short, "Lcom/sun/cri/ci/CiKind;"); \ | |
148 static_oop_field(CiKind, Int, "Lcom/sun/cri/ci/CiKind;"); \ | |
149 static_oop_field(CiKind, Long, "Lcom/sun/cri/ci/CiKind;"); \ | |
150 end_class \ | |
151 start_class(CiRuntimeCall) \ | |
152 static_oop_field(CiRuntimeCall, UnwindException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
153 static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
154 static_oop_field(CiRuntimeCall, HandleException, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
155 static_oop_field(CiRuntimeCall, OSRMigrationEnd, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
156 static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
157 static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
158 static_oop_field(CiRuntimeCall, Debug, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
159 static_oop_field(CiRuntimeCall, ArithmethicLrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
160 static_oop_field(CiRuntimeCall, ArithmeticLdiv, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
161 static_oop_field(CiRuntimeCall, ArithmeticFrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
162 static_oop_field(CiRuntimeCall, ArithmeticDrem, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
163 static_oop_field(CiRuntimeCall, ArithmeticCos, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
164 static_oop_field(CiRuntimeCall, ArithmeticTan, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
165 static_oop_field(CiRuntimeCall, ArithmeticLog, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
166 static_oop_field(CiRuntimeCall, ArithmeticLog10, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
167 static_oop_field(CiRuntimeCall, ArithmeticSin, "Lcom/sun/cri/ci/CiRuntimeCall;"); \ | |
168 end_class \ | |
169 start_class(RiMethod) \ | |
170 end_class \ | |
171 start_class(CiValue) \ | |
172 oop_field(CiValue, kind, "Lcom/sun/cri/ci/CiKind;") \ | |
173 static_oop_field(CiValue, IllegalValue, "Lcom/sun/cri/ci/CiValue;"); \ | |
174 end_class \ | |
175 start_class(CiRegisterValue) \ | |
176 oop_field(CiRegisterValue, reg, "Lcom/sun/cri/ci/CiRegister;") \ | |
177 end_class \ | |
178 start_class(CiRegister) \ | |
179 int_field(CiRegister, number) \ | |
180 end_class \ | |
181 start_class(CiStackSlot) \ | |
182 int_field(CiStackSlot, index) \ | |
183 end_class \ | |
184 /* end*/ | |
185 | |
186 | |
187 | |
188 | |
189 #define START_CLASS(name) \ | |
190 class name : AllStatic { \ | |
191 private: \ | |
192 friend class C1XCompiler; \ | |
193 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"); } \ | |
194 static void compute_offsets(); \ | |
195 public: \ | |
196 static klassOop klass() { return SystemDictionary::name##_klass(); } | |
197 | |
198 #define END_CLASS }; | |
199 | |
200 #define FIELD(name, type, accessor) \ | |
201 static int _##name##_offset; \ | |
202 static type name(oop obj) { check(obj); return obj->accessor(_##name##_offset); } \ | |
203 static type name(Handle obj) { check(obj()); return obj->accessor(_##name##_offset); } \ | |
204 static type name(jobject obj) { check(JNIHandles::resolve(obj)); return JNIHandles::resolve(obj)->accessor(_##name##_offset); } \ | |
205 static void set_##name(oop obj, type x) { check(obj); obj->accessor##_put(_##name##_offset, x); } \ | |
206 static void set_##name(Handle obj, type x) { check(obj()); obj->accessor##_put(_##name##_offset, x); } \ | |
207 static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } | |
208 | |
209 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) | |
210 #define INT_FIELD(klass, name) FIELD(name, jint, int_field) | |
211 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) | |
212 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) | |
213 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) | |
214 #define STATIC_OOP_FIELD(klassName, name, signature) \ | |
215 static int _##name##_offset; \ | |
216 static oop name() { return klassName::klass()->obj_field(_##name##_offset); } \ | |
217 static void set_##name(oop x) { klassName::klass()->obj_field_put(_##name##_offset, x); } | |
218 | |
219 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) | |
220 #undef START_CLASS | |
221 #undef END_CLASS | |
222 #undef FIELD | |
223 #undef CHAR_FIELD | |
224 #undef INT_FIELD | |
225 #undef BOOLEAN_FIELD | |
226 #undef LONG_FIELD | |
227 #undef OOP_FIELD | |
228 #undef STATIC_OOP_FIELD | |
229 | |
230 |