Mercurial > hg > graal-jvmci-8
comparison src/share/vm/jvmci/jvmciJavaAccess.hpp @ 22514:8e4949926ae5
jvmciJavaAccess fields can't be used until their type is linked
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 03 Sep 2015 13:34:52 -0700 |
parents | 82818d115a98 |
children | df053711614b |
comparison
equal
deleted
inserted
replaced
22513:82818d115a98 | 22514:8e4949926ae5 |
---|---|
311 #define STATIC_OOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, oop, signature) | 311 #define STATIC_OOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, oop, signature) |
312 #define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature) | 312 #define STATIC_OBJARRAYOOP_FIELD(klassName, name, signature) STATIC_OOPISH_FIELD(klassName, name, objArrayOop, signature) |
313 #define STATIC_OOPISH_FIELD(klassName, name, type, signature) \ | 313 #define STATIC_OOPISH_FIELD(klassName, name, type, signature) \ |
314 static int _##name##_offset; \ | 314 static int _##name##_offset; \ |
315 static type name() { \ | 315 static type name() { \ |
316 assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName); \ | 316 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ |
317 InstanceKlass* ik = klassName::klass(); \ | 317 InstanceKlass* ik = klassName::klass(); \ |
318 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | 318 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ |
319 if (UseCompressedOops) { \ | 319 if (UseCompressedOops) { \ |
320 return (type) oopDesc::load_decode_heap_oop((narrowOop *)addr); \ | 320 return (type) oopDesc::load_decode_heap_oop((narrowOop *)addr); \ |
321 } else { \ | 321 } else { \ |
322 return (type) oopDesc::load_decode_heap_oop((oop*)addr); \ | 322 return (type) oopDesc::load_decode_heap_oop((oop*)addr); \ |
323 } \ | 323 } \ |
324 } \ | 324 } \ |
325 static void set_##name(type x) { \ | 325 static void set_##name(type x) { \ |
326 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
326 assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName); \ | 327 assert(klassName::klass() != NULL, "Class not yet loaded: " #klassName); \ |
327 InstanceKlass* ik = klassName::klass(); \ | 328 InstanceKlass* ik = klassName::klass(); \ |
328 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | 329 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ |
329 if (UseCompressedOops) { \ | 330 if (UseCompressedOops) { \ |
330 oop_store((narrowOop *)addr, x); \ | 331 oop_store((narrowOop *)addr, x); \ |
333 } \ | 334 } \ |
334 } | 335 } |
335 #define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename) \ | 336 #define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename) \ |
336 static int _##name##_offset; \ | 337 static int _##name##_offset; \ |
337 static jtypename name() { \ | 338 static jtypename name() { \ |
339 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
338 InstanceKlass* ik = klassName::klass(); \ | 340 InstanceKlass* ik = klassName::klass(); \ |
339 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | 341 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ |
340 return *((jtypename *)addr); \ | 342 return *((jtypename *)addr); \ |
341 } \ | 343 } \ |
342 static void set_##name(jtypename x) { \ | 344 static void set_##name(jtypename x) { \ |
345 assert(klassName::klass() != NULL && klassName::klass()->is_linked(), "Class not yet linked: " #klassName); \ | |
343 InstanceKlass* ik = klassName::klass(); \ | 346 InstanceKlass* ik = klassName::klass(); \ |
344 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | 347 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ |
345 *((jtypename *)addr) = x; \ | 348 *((jtypename *)addr) = x; \ |
346 } | 349 } |
347 | 350 |