comparison src/share/vm/prims/unsafe.cpp @ 10235:6b388e7d4905

8013633: Cleanup platform ifdefs in unsafe.cpp Summary: Replace ifdefs with SUPPORTS_NATIVE_CX8 set in platform include file Reviewed-by: dholmes, dlong
author bpittore
date Tue, 07 May 2013 10:19:33 -0400
parents 16885e702c88
children 609aad72004a
comparison
equal deleted inserted replaced
10172:e01e02a9fcb6 10235:6b388e7d4905
313 oop_store((oop*)addr, x); 313 oop_store((oop*)addr, x);
314 } 314 }
315 OrderAccess::fence(); 315 OrderAccess::fence();
316 UNSAFE_END 316 UNSAFE_END
317 317
318 #if defined(SPARC) || defined(X86) 318 #ifndef SUPPORTS_NATIVE_CX8
319 // Sparc and X86 have atomic jlong (8 bytes) instructions
320
321 #else
322 // Keep old code for platforms which may not have atomic jlong (8 bytes) instructions 319 // Keep old code for platforms which may not have atomic jlong (8 bytes) instructions
323 320
324 // Volatile long versions must use locks if !VM_Version::supports_cx8(). 321 // Volatile long versions must use locks if !VM_Version::supports_cx8().
325 // support_cx8 is a surrogate for 'supports atomic long memory ops'. 322 // support_cx8 is a surrogate for 'supports atomic long memory ops'.
326 323
354 *addr = x; 351 *addr = x;
355 } 352 }
356 } 353 }
357 UNSAFE_END 354 UNSAFE_END
358 355
359 #endif // not SPARC and not X86 356 #endif // not SUPPORTS_NATIVE_CX8
360 357
361 #define DEFINE_GETSETOOP(jboolean, Boolean) \ 358 #define DEFINE_GETSETOOP(jboolean, Boolean) \
362 \ 359 \
363 UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean##140(JNIEnv *env, jobject unsafe, jobject obj, jint offset)) \ 360 UNSAFE_ENTRY(jboolean, Unsafe_Get##Boolean##140(JNIEnv *env, jobject unsafe, jobject obj, jint offset)) \
364 UnsafeWrapper("Unsafe_Get"#Boolean); \ 361 UnsafeWrapper("Unsafe_Get"#Boolean); \
418 DEFINE_GETSETOOP_VOLATILE(jchar, Char); 415 DEFINE_GETSETOOP_VOLATILE(jchar, Char);
419 DEFINE_GETSETOOP_VOLATILE(jint, Int); 416 DEFINE_GETSETOOP_VOLATILE(jint, Int);
420 DEFINE_GETSETOOP_VOLATILE(jfloat, Float); 417 DEFINE_GETSETOOP_VOLATILE(jfloat, Float);
421 DEFINE_GETSETOOP_VOLATILE(jdouble, Double); 418 DEFINE_GETSETOOP_VOLATILE(jdouble, Double);
422 419
423 #if defined(SPARC) || defined(X86) 420 #ifdef SUPPORTS_NATIVE_CX8
424 // Sparc and X86 have atomic jlong (8 bytes) instructions
425 DEFINE_GETSETOOP_VOLATILE(jlong, Long); 421 DEFINE_GETSETOOP_VOLATILE(jlong, Long);
426 #endif 422 #endif
427 423
428 #undef DEFINE_GETSETOOP_VOLATILE 424 #undef DEFINE_GETSETOOP_VOLATILE
429 425
448 OrderAccess::fence(); 444 OrderAccess::fence();
449 UNSAFE_END 445 UNSAFE_END
450 446
451 UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) 447 UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x))
452 UnsafeWrapper("Unsafe_SetOrderedLong"); 448 UnsafeWrapper("Unsafe_SetOrderedLong");
453 #if defined(SPARC) || defined(X86) 449 #ifdef SUPPORTS_NATIVE_CX8
454 // Sparc and X86 have atomic jlong (8 bytes) instructions
455 SET_FIELD_VOLATILE(obj, offset, jlong, x); 450 SET_FIELD_VOLATILE(obj, offset, jlong, x);
456 #else 451 #else
457 // Keep old code for platforms which may not have atomic long (8 bytes) instructions 452 // Keep old code for platforms which may not have atomic long (8 bytes) instructions
458 { 453 {
459 if (VM_Version::supports_cx8()) { 454 if (VM_Version::supports_cx8()) {