Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalJavaAccess.hpp @ 19799:00c4aa355659
Simplify STATIC_PRIMITIVE_FIELD macro
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 11 Mar 2015 16:06:35 -0700 |
parents | b3f566135b56 |
children | 3362ba500371 |
comparison
equal
deleted
inserted
replaced
19793:9cfcbadec537 | 19799:00c4aa355659 |
---|---|
315 oop_store((narrowOop *)addr, x); \ | 315 oop_store((narrowOop *)addr, x); \ |
316 } else { \ | 316 } else { \ |
317 oop_store((oop*)addr, x); \ | 317 oop_store((oop*)addr, x); \ |
318 } \ | 318 } \ |
319 } | 319 } |
320 #define STATIC_PRIMITIVE_FIELD(klassName, name, typename, jtypename, boolCompare) \ | 320 #define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename) \ |
321 static int _##name##_offset; \ | 321 static int _##name##_offset; \ |
322 static typename name() { \ | 322 static jtypename name() { \ |
323 InstanceKlass* ik = InstanceKlass::cast(klassName::klass()); \ | 323 InstanceKlass* ik = InstanceKlass::cast(klassName::klass()); \ |
324 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ | 324 address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \ |
325 return *((jtypename *)addr) boolCompare; \ | 325 return *((jtypename *)addr); \ |
326 } \ | 326 } \ |
327 static void set_##name(typename x) { \ | 327 static void set_##name(jtypename x) { \ |
328 InstanceKlass* ik = InstanceKlass::cast(klassName::klass()); \ | 328 InstanceKlass* ik = InstanceKlass::cast(klassName::klass()); \ |
329 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()); \ |
330 *((jtypename *)addr) = x; \ | 330 *((jtypename *)addr) = x; \ |
331 } | 331 } |
332 | 332 |
333 #define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, int, jint,) | 333 #define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint) |
334 #define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, bool, jboolean, != 0) | 334 #define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean) |
335 | 335 |
336 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_INT_FIELD, STATIC_BOOLEAN_FIELD) | 336 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_INT_FIELD, STATIC_BOOLEAN_FIELD) |
337 #undef START_CLASS | 337 #undef START_CLASS |
338 #undef END_CLASS | 338 #undef END_CLASS |
339 #undef FIELD | 339 #undef FIELD |