Mercurial > hg > graal-jvmci-8
comparison src/share/vm/jvmci/jvmciJavaClasses.hpp @ 22548:02fc27dc1da7
Rename jvmciJavaAccess.* to jvmciJavaClasses.*
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 09 Sep 2015 17:56:30 -0700 |
parents | src/share/vm/jvmci/jvmciJavaAccess.hpp@dc1aeef79e7e |
children | 6821ef65ef4c |
comparison
equal
deleted
inserted
replaced
22547:10a9e989850e | 22548:02fc27dc1da7 |
---|---|
1 /* | |
2 * Copyright (c) 2011, 2015, 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 #ifndef SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP | |
25 #define SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP | |
26 | |
27 void jvmci_compute_offsets(); | |
28 | |
29 #include "classfile/systemDictionary.hpp" | |
30 #include "oops/instanceMirrorKlass.hpp" | |
31 | |
32 /* This macro defines the structure of the CompilationResult - classes. | |
33 * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. | |
34 * | |
35 * The public interface of these classes will look like this: | |
36 | |
37 * class StackSlot : AllStatic { | |
38 * public: | |
39 * static Klass* klass(); | |
40 * static jint index(oop obj); | |
41 * static jint index(Handle obj); | |
42 * static jint index(jobject obj); | |
43 * static void set_index(oop obj, jint x); | |
44 * static void set_index(Handle obj, jint x); | |
45 * static void set_index(jobject obj, jint x); | |
46 * }; | |
47 * | |
48 */ | |
49 | |
50 #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, typeArrayOop_field, objArrayOop_field, static_oop_field, static_objArrayOop_field, static_int_field, static_boolean_field) \ | |
51 start_class(Architecture) \ | |
52 oop_field(Architecture, wordKind, "Ljdk/internal/jvmci/meta/PlatformKind;") \ | |
53 end_class \ | |
54 start_class(TargetDescription) \ | |
55 oop_field(TargetDescription, arch, "Ljdk/internal/jvmci/code/Architecture;") \ | |
56 end_class \ | |
57 start_class(HotSpotResolvedObjectTypeImpl) \ | |
58 oop_field(HotSpotResolvedObjectTypeImpl, javaClass, "Ljava/lang/Class;") \ | |
59 end_class \ | |
60 start_class(HotSpotResolvedJavaMethodImpl) \ | |
61 long_field(HotSpotResolvedJavaMethodImpl, metaspaceMethod) \ | |
62 end_class \ | |
63 start_class(InstalledCode) \ | |
64 long_field(InstalledCode, address) \ | |
65 long_field(InstalledCode, version) \ | |
66 oop_field(InstalledCode, name, "Ljava/lang/String;") \ | |
67 end_class \ | |
68 start_class(HotSpotInstalledCode) \ | |
69 int_field(HotSpotInstalledCode, size) \ | |
70 long_field(HotSpotInstalledCode, codeStart) \ | |
71 int_field(HotSpotInstalledCode, codeSize) \ | |
72 end_class \ | |
73 start_class(HotSpotNmethod) \ | |
74 boolean_field(HotSpotNmethod, isDefault) \ | |
75 end_class \ | |
76 start_class(HotSpotCompiledCode) \ | |
77 oop_field(HotSpotCompiledCode, name, "Ljava/lang/String;") \ | |
78 objArrayOop_field(HotSpotCompiledCode, sites, "[Ljdk/internal/jvmci/code/CompilationResult$Site;") \ | |
79 objArrayOop_field(HotSpotCompiledCode, exceptionHandlers, "[Ljdk/internal/jvmci/code/CompilationResult$ExceptionHandler;") \ | |
80 objArrayOop_field(HotSpotCompiledCode, comments, "[Ljdk/internal/jvmci/hotspot/HotSpotCompiledCode$Comment;") \ | |
81 objArrayOop_field(HotSpotCompiledCode, assumptions, "[Ljdk/internal/jvmci/meta/Assumptions$Assumption;") \ | |
82 typeArrayOop_field(HotSpotCompiledCode, targetCode, "[B") \ | |
83 int_field(HotSpotCompiledCode, targetCodeSize) \ | |
84 typeArrayOop_field(HotSpotCompiledCode, dataSection, "[B") \ | |
85 int_field(HotSpotCompiledCode, dataSectionAlignment) \ | |
86 objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Ljdk/internal/jvmci/code/CompilationResult$DataPatch;") \ | |
87 int_field(HotSpotCompiledCode, totalFrameSize) \ | |
88 int_field(HotSpotCompiledCode, customStackAreaOffset) \ | |
89 objArrayOop_field(HotSpotCompiledCode, methods, "[Ljdk/internal/jvmci/meta/ResolvedJavaMethod;") \ | |
90 end_class \ | |
91 start_class(HotSpotCompiledCode_Comment) \ | |
92 oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;") \ | |
93 int_field(HotSpotCompiledCode_Comment, pcOffset) \ | |
94 end_class \ | |
95 start_class(HotSpotCompiledNmethod) \ | |
96 oop_field(HotSpotCompiledNmethod, method, "Ljdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethod;") \ | |
97 oop_field(HotSpotCompiledNmethod, installationFailureMessage, "Ljava/lang/String;") \ | |
98 int_field(HotSpotCompiledNmethod, entryBCI) \ | |
99 int_field(HotSpotCompiledNmethod, id) \ | |
100 long_field(HotSpotCompiledNmethod, jvmciEnv) \ | |
101 boolean_field(HotSpotCompiledNmethod, hasUnsafeAccess) \ | |
102 end_class \ | |
103 start_class(HotSpotJVMCIMetaAccessContext) \ | |
104 static_objArrayOop_field(HotSpotJVMCIMetaAccessContext, allContexts, "[Ljava/lang/ref/WeakReference;") \ | |
105 objArrayOop_field(HotSpotJVMCIMetaAccessContext, metadataRoots, "[Ljava/lang/Object;") \ | |
106 end_class \ | |
107 start_class(HotSpotForeignCallTarget) \ | |
108 long_field(HotSpotForeignCallTarget, address) \ | |
109 end_class \ | |
110 start_class(Assumptions_NoFinalizableSubclass) \ | |
111 oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ | |
112 end_class \ | |
113 start_class(Assumptions_ConcreteSubtype) \ | |
114 oop_field(Assumptions_ConcreteSubtype, context, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ | |
115 oop_field(Assumptions_ConcreteSubtype, subtype, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ | |
116 end_class \ | |
117 start_class(Assumptions_LeafType) \ | |
118 oop_field(Assumptions_LeafType, context, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ | |
119 end_class \ | |
120 start_class(Assumptions_ConcreteMethod) \ | |
121 oop_field(Assumptions_ConcreteMethod, method, "Ljdk/internal/jvmci/meta/ResolvedJavaMethod;") \ | |
122 oop_field(Assumptions_ConcreteMethod, context, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ | |
123 oop_field(Assumptions_ConcreteMethod, impl, "Ljdk/internal/jvmci/meta/ResolvedJavaMethod;") \ | |
124 end_class \ | |
125 start_class(Assumptions_CallSiteTargetValue) \ | |
126 oop_field(Assumptions_CallSiteTargetValue, callSite, "Ljava/lang/invoke/CallSite;") \ | |
127 oop_field(Assumptions_CallSiteTargetValue, methodHandle, "Ljava/lang/invoke/MethodHandle;") \ | |
128 end_class \ | |
129 start_class(CompilationResult_Site) \ | |
130 int_field(CompilationResult_Site, pcOffset) \ | |
131 end_class \ | |
132 start_class(CompilationResult_Call) \ | |
133 oop_field(CompilationResult_Call, target, "Ljdk/internal/jvmci/meta/InvokeTarget;") \ | |
134 oop_field(CompilationResult_Call, debugInfo, "Ljdk/internal/jvmci/code/DebugInfo;") \ | |
135 end_class \ | |
136 start_class(CompilationResult_DataPatch) \ | |
137 oop_field(CompilationResult_DataPatch, reference, "Ljdk/internal/jvmci/code/CompilationResult$Reference;") \ | |
138 end_class \ | |
139 start_class(CompilationResult_ConstantReference) \ | |
140 oop_field(CompilationResult_ConstantReference, constant, "Ljdk/internal/jvmci/meta/VMConstant;") \ | |
141 end_class \ | |
142 start_class(CompilationResult_DataSectionReference) \ | |
143 int_field(CompilationResult_DataSectionReference, offset) \ | |
144 end_class \ | |
145 start_class(InfopointReason) \ | |
146 static_oop_field(InfopointReason, UNKNOWN, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
147 static_oop_field(InfopointReason, SAFEPOINT, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
148 static_oop_field(InfopointReason, CALL, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
149 static_oop_field(InfopointReason, IMPLICIT_EXCEPTION, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
150 static_oop_field(InfopointReason, METHOD_START, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
151 static_oop_field(InfopointReason, METHOD_END, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
152 static_oop_field(InfopointReason, LINE_NUMBER, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
153 end_class \ | |
154 start_class(CompilationResult_Infopoint) \ | |
155 oop_field(CompilationResult_Infopoint, debugInfo, "Ljdk/internal/jvmci/code/DebugInfo;") \ | |
156 oop_field(CompilationResult_Infopoint, reason, "Ljdk/internal/jvmci/code/InfopointReason;") \ | |
157 end_class \ | |
158 start_class(CompilationResult_ExceptionHandler) \ | |
159 int_field(CompilationResult_ExceptionHandler, handlerPos) \ | |
160 end_class \ | |
161 start_class(CompilationResult_Mark) \ | |
162 oop_field(CompilationResult_Mark, id, "Ljava/lang/Object;") \ | |
163 end_class \ | |
164 start_class(DebugInfo) \ | |
165 oop_field(DebugInfo, bytecodePosition, "Ljdk/internal/jvmci/code/BytecodePosition;") \ | |
166 oop_field(DebugInfo, referenceMap, "Ljdk/internal/jvmci/code/ReferenceMap;") \ | |
167 oop_field(DebugInfo, calleeSaveInfo, "Ljdk/internal/jvmci/code/RegisterSaveLayout;") \ | |
168 objArrayOop_field(DebugInfo, virtualObjectMapping, "[Ljdk/internal/jvmci/code/VirtualObject;") \ | |
169 end_class \ | |
170 start_class(HotSpotReferenceMap) \ | |
171 objArrayOop_field(HotSpotReferenceMap, objects, "[Ljdk/internal/jvmci/code/Location;") \ | |
172 objArrayOop_field(HotSpotReferenceMap, derivedBase, "[Ljdk/internal/jvmci/code/Location;") \ | |
173 typeArrayOop_field(HotSpotReferenceMap, sizeInBytes, "[I") \ | |
174 int_field(HotSpotReferenceMap, maxRegisterSize) \ | |
175 end_class \ | |
176 start_class(RegisterSaveLayout) \ | |
177 objArrayOop_field(RegisterSaveLayout, registers, "[Ljdk/internal/jvmci/code/Register;") \ | |
178 typeArrayOop_field(RegisterSaveLayout, slots, "[I") \ | |
179 end_class \ | |
180 start_class(BytecodeFrame) \ | |
181 objArrayOop_field(BytecodeFrame, values, "[Ljdk/internal/jvmci/meta/JavaValue;") \ | |
182 objArrayOop_field(BytecodeFrame, slotKinds, "[Ljdk/internal/jvmci/meta/JavaKind;") \ | |
183 int_field(BytecodeFrame, numLocals) \ | |
184 int_field(BytecodeFrame, numStack) \ | |
185 int_field(BytecodeFrame, numLocks) \ | |
186 boolean_field(BytecodeFrame, rethrowException) \ | |
187 boolean_field(BytecodeFrame, duringCall) \ | |
188 static_int_field(BytecodeFrame, BEFORE_BCI) \ | |
189 end_class \ | |
190 start_class(BytecodePosition) \ | |
191 oop_field(BytecodePosition, caller, "Ljdk/internal/jvmci/code/BytecodePosition;") \ | |
192 oop_field(BytecodePosition, method, "Ljdk/internal/jvmci/meta/ResolvedJavaMethod;") \ | |
193 int_field(BytecodePosition, bci) \ | |
194 end_class \ | |
195 start_class(JavaConstant) \ | |
196 end_class \ | |
197 start_class(PrimitiveConstant) \ | |
198 oop_field(PrimitiveConstant, kind, "Ljdk/internal/jvmci/meta/JavaKind;") \ | |
199 long_field(PrimitiveConstant, primitive) \ | |
200 end_class \ | |
201 start_class(RawConstant) \ | |
202 long_field(RawConstant, primitive) \ | |
203 end_class \ | |
204 start_class(NullConstant) \ | |
205 end_class \ | |
206 start_class(HotSpotCompressedNullConstant) \ | |
207 end_class \ | |
208 start_class(HotSpotObjectConstantImpl) \ | |
209 oop_field(HotSpotObjectConstantImpl, object, "Ljava/lang/Object;") \ | |
210 boolean_field(HotSpotObjectConstantImpl, compressed) \ | |
211 end_class \ | |
212 start_class(HotSpotMetaspaceConstantImpl) \ | |
213 long_field(HotSpotMetaspaceConstantImpl, primitive) \ | |
214 oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljava/lang/Object;") \ | |
215 boolean_field(HotSpotMetaspaceConstantImpl, compressed) \ | |
216 end_class \ | |
217 start_class(JavaKind) \ | |
218 char_field(JavaKind, typeChar) \ | |
219 static_oop_field(JavaKind, Boolean, "Ljdk/internal/jvmci/meta/JavaKind;"); \ | |
220 static_oop_field(JavaKind, Byte, "Ljdk/internal/jvmci/meta/JavaKind;"); \ | |
221 static_oop_field(JavaKind, Char, "Ljdk/internal/jvmci/meta/JavaKind;"); \ | |
222 static_oop_field(JavaKind, Short, "Ljdk/internal/jvmci/meta/JavaKind;"); \ | |
223 static_oop_field(JavaKind, Int, "Ljdk/internal/jvmci/meta/JavaKind;"); \ | |
224 static_oop_field(JavaKind, Long, "Ljdk/internal/jvmci/meta/JavaKind;"); \ | |
225 end_class \ | |
226 start_class(LIRKind) \ | |
227 oop_field(LIRKind, platformKind, "Ljdk/internal/jvmci/meta/PlatformKind;") \ | |
228 int_field(LIRKind, referenceMask) \ | |
229 end_class \ | |
230 start_class(Value) \ | |
231 oop_field(Value, lirKind, "Ljdk/internal/jvmci/meta/LIRKind;") \ | |
232 static_oop_field(Value, ILLEGAL, "Ljdk/internal/jvmci/meta/AllocatableValue;"); \ | |
233 end_class \ | |
234 start_class(RegisterValue) \ | |
235 oop_field(RegisterValue, reg, "Ljdk/internal/jvmci/code/Register;") \ | |
236 end_class \ | |
237 start_class(code_Location) \ | |
238 oop_field(code_Location, reg, "Ljdk/internal/jvmci/code/Register;") \ | |
239 int_field(code_Location, offset) \ | |
240 end_class \ | |
241 start_class(code_Register) \ | |
242 int_field(code_Register, number) \ | |
243 int_field(code_Register, encoding) \ | |
244 end_class \ | |
245 start_class(StackSlot) \ | |
246 int_field(StackSlot, offset) \ | |
247 boolean_field(StackSlot, addFrameSize) \ | |
248 end_class \ | |
249 start_class(VirtualObject) \ | |
250 int_field(VirtualObject, id) \ | |
251 oop_field(VirtualObject, type, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ | |
252 objArrayOop_field(VirtualObject, values, "[Ljdk/internal/jvmci/meta/JavaValue;") \ | |
253 objArrayOop_field(VirtualObject, slotKinds, "[Ljdk/internal/jvmci/meta/JavaKind;") \ | |
254 end_class \ | |
255 start_class(StackLockValue) \ | |
256 oop_field(StackLockValue, owner, "Ljdk/internal/jvmci/meta/JavaValue;") \ | |
257 oop_field(StackLockValue, slot, "Ljdk/internal/jvmci/code/StackSlotValue;") \ | |
258 boolean_field(StackLockValue, eliminated) \ | |
259 end_class \ | |
260 start_class(SpeculationLog) \ | |
261 oop_field(SpeculationLog, lastFailed, "Ljava/lang/Object;") \ | |
262 end_class \ | |
263 start_class(HotSpotStackFrameReference) \ | |
264 oop_field(HotSpotStackFrameReference, compilerToVM, "Ljdk/internal/jvmci/hotspot/CompilerToVM;") \ | |
265 long_field(HotSpotStackFrameReference, stackPointer) \ | |
266 int_field(HotSpotStackFrameReference, frameNumber) \ | |
267 int_field(HotSpotStackFrameReference, bci) \ | |
268 oop_field(HotSpotStackFrameReference, method, "Ljdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethod;") \ | |
269 objArrayOop_field(HotSpotStackFrameReference, locals, "[Ljava/lang/Object;") \ | |
270 typeArrayOop_field(HotSpotStackFrameReference, localIsVirtual, "[Z") \ | |
271 end_class \ | |
272 start_class(HotSpotConstantPool) \ | |
273 long_field(HotSpotConstantPool, metaspaceConstantPool) \ | |
274 end_class \ | |
275 /* end*/ | |
276 | |
277 #define START_CLASS(name) \ | |
278 class name : AllStatic { \ | |
279 private: \ | |
280 friend class JVMCICompiler; \ | |
281 static void check(oop obj, const char* field_name, int offset) { \ | |
282 assert(obj != NULL, err_msg("NULL field access of %s.%s", #name, field_name)); \ | |
283 assert(obj->is_a(SystemDictionary::name##_klass()), err_msg("wrong class, " #name " expected, found %s", obj->klass()->external_name())); \ | |
284 assert(offset != 0, "must be valid offset"); \ | |
285 } \ | |
286 static void compute_offsets(); \ | |
287 public: \ | |
288 static InstanceKlass* klass() { return SystemDictionary::name##_klass() == NULL ? NULL : InstanceKlass::cast(SystemDictionary::name##_klass()); } | |
289 | |
290 #define END_CLASS }; | |
291 | |
292 #define FIELD(name, type, accessor, cast) \ | |
293 static int _##name##_offset; \ | |
294 static type name(oop obj) { check(obj, #name, _##name##_offset); return cast obj->accessor(_##name##_offset); } \ | |
295 static type name(Handle& obj) { check(obj(), #name, _##name##_offset); return cast obj->accessor(_##name##_offset); } \ | |
296 static type name(jobject obj) { check(JNIHandles::resolve(obj), #name, _##name##_offset); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); } \ | |
297 static void set_##name(oop obj, type x) { check(obj, #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); } \ | |
298 static void set_##name(Handle& obj, type x) { check(obj(), #name, _##name##_offset); obj->accessor##_put(_##name##_offset, x); } \ | |
299 static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name, _##name##_offset); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); } | |
300 | |
301 #define EMPTY_CAST | |
302 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST) | |
303 #define INT_FIELD(klass, name) FIELD(name, jint, int_field, EMPTY_CAST) | |
304 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field, EMPTY_CAST) | |
305 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field, EMPTY_CAST) | |
306 #define FLOAT_FIELD(klass, name) FIELD(name, jfloat, float_field, EMPTY_CAST) | |
307 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field, EMPTY_CAST) | |
308 #define OBJARRAYOOP_FIELD(klass, name, signature) FIELD(name, objArrayOop, obj_field, (objArrayOop)) | |
309 #define TYPEARRAYOOP_FIELD(klass, name, signature) FIELD(name, typeArrayOop, obj_field, (typeArrayOop)) | |
310 #define STATIC_OOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, oop, signature) | |
311 #define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature) | |
312 #define STATIC_OOPISH_FIELD(klassName, name, type, signature) \ | |
313 static int _##name##_offset; \ | |
314 static type name() { \ | |
315 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
316 InstanceKlass* ik = klassName::klass(); \ | |
317 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | |
318 if (UseCompressedOops) { \ | |
319 return (type) oopDesc::load_decode_heap_oop((narrowOop *)addr); \ | |
320 } else { \ | |
321 return (type) oopDesc::load_decode_heap_oop((oop*)addr); \ | |
322 } \ | |
323 } \ | |
324 static void set_##name(type x) { \ | |
325 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
326 assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName); \ | |
327 InstanceKlass* ik = klassName::klass(); \ | |
328 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | |
329 if (UseCompressedOops) { \ | |
330 oop_store((narrowOop *)addr, x); \ | |
331 } else { \ | |
332 oop_store((oop*)addr, x); \ | |
333 } \ | |
334 } | |
335 #define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename) \ | |
336 static int _##name##_offset; \ | |
337 static jtypename name() { \ | |
338 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
339 InstanceKlass* ik = klassName::klass(); \ | |
340 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | |
341 return *((jtypename *)addr); \ | |
342 } \ | |
343 static void set_##name(jtypename x) { \ | |
344 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
345 InstanceKlass* ik = klassName::klass(); \ | |
346 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | |
347 *((jtypename *)addr) = x; \ | |
348 } | |
349 | |
350 #define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint) | |
351 #define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean) | |
352 | |
353 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, TYPEARRAYOOP_FIELD, OBJARRAYOOP_FIELD, STATIC_OOP_FIELD, STATIC_OBJARRAYOOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD) | |
354 #undef START_CLASS | |
355 #undef END_CLASS | |
356 #undef FIELD | |
357 #undef CHAR_FIELD | |
358 #undef INT_FIELD | |
359 #undef BOOLEAN_FIELD | |
360 #undef LONG_FIELD | |
361 #undef FLOAT_FIELD | |
362 #undef OOP_FIELD | |
363 #undef TYPEARRAYOOP_FIELD | |
364 #undef OBJARRAYOOP_FIELD | |
365 #undef STATIC_OOPISH_FIELD | |
366 #undef STATIC_OOP_FIELD | |
367 #undef STATIC_OBJARRAYOOP_FIELD | |
368 #undef STATIC_INT_FIELD | |
369 #undef STATIC_BOOLEAN_FIELD | |
370 #undef EMPTY_CAST | |
371 | |
372 void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field); | |
373 | |
374 #endif // SHARE_VM_JVMCI_JVMCIJAVACLASSES_HPP |