Mercurial > hg > graal-compiler
comparison src/share/vm/c1x/c1x_JavaAccess.hpp @ 2492:4e5515d09314
Fixed merge issues.
- Accessing static fields from the java.lang.Class object instead of the klassOop (1-line-change)
- Fixed issue with RiField object caching (the caching was only taking the offset as a field ID, but need to take offset+is_static)
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 22 Apr 2011 19:00:07 +0200 |
parents | 569d3fe7d65c |
children | 6594e6d8bfe7 |
comparison
equal
deleted
inserted
replaced
2491:0654ee04b214 | 2492:4e5515d09314 |
---|---|
21 * have any questions. | 21 * have any questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 void c1x_compute_offsets(); | 25 void c1x_compute_offsets(); |
26 | |
27 #include "oops/instanceMirrorKlass.hpp" | |
26 | 28 |
27 /* This macro defines the structure of the CiTargetMethod - classes. | 29 /* 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. | 30 * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. |
29 * | 31 * |
30 * The public interface of these classes will look like this: | 32 * The public interface of these classes will look like this: |
226 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) | 228 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field) |
227 #define INT_FIELD(klass, name) FIELD(name, jint, int_field) | 229 #define INT_FIELD(klass, name) FIELD(name, jint, int_field) |
228 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) | 230 #define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field) |
229 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) | 231 #define LONG_FIELD(klass, name) FIELD(name, jlong, long_field) |
230 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) | 232 #define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field) |
231 #define STATIC_OOP_FIELD(klassName, name, signature) \ | 233 #define STATIC_OOP_FIELD(klassName, name, signature) \ |
232 static int _##name##_offset; \ | 234 static int _##name##_offset; \ |
233 static oop name() { return klassName::klass()->obj_field(_##name##_offset); } \ | 235 static oop name() { \ |
234 static void set_##name(oop x) { klassName::klass()->obj_field_put(_##name##_offset, x); } | 236 instanceKlass* ik = instanceKlass::cast(klassName::klass()); \ |
235 | 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 } | |
236 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) | 253 COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, OOP_FIELD, STATIC_OOP_FIELD) |
237 #undef START_CLASS | 254 #undef START_CLASS |
238 #undef END_CLASS | 255 #undef END_CLASS |
239 #undef FIELD | 256 #undef FIELD |
240 #undef CHAR_FIELD | 257 #undef CHAR_FIELD |