comparison src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @ 671:d0994e5bebce

6822204: volatile fences should prefer lock:addl to actual mfence instructions Reviewed-by: kvn, phh
author never
date Thu, 26 Mar 2009 14:31:45 -0700
parents 98cb887364d3
children bd02caa94611
comparison
equal deleted inserted replaced
668:90a66aa50514 671:d0994e5bebce
617 617
618 typedef jint xchg_func_t (jint, volatile jint*); 618 typedef jint xchg_func_t (jint, volatile jint*);
619 typedef jint cmpxchg_func_t (jint, volatile jint*, jint); 619 typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
620 typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong); 620 typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
621 typedef jint add_func_t (jint, volatile jint*); 621 typedef jint add_func_t (jint, volatile jint*);
622 typedef void fence_func_t ();
623 622
624 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { 623 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
625 // try to use the stub: 624 // try to use the stub:
626 xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry()); 625 xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
627 626
679 assert(Threads::number_of_threads() == 0, "for bootstrap only"); 678 assert(Threads::number_of_threads() == 0, "for bootstrap only");
680 679
681 return (*dest) += add_value; 680 return (*dest) += add_value;
682 } 681 }
683 682
684 void os::fence_bootstrap() {
685 // try to use the stub:
686 fence_func_t* func = CAST_TO_FN_PTR(fence_func_t*, StubRoutines::fence_entry());
687
688 if (func != NULL) {
689 os::fence_func = func;
690 (*func)();
691 return;
692 }
693 assert(Threads::number_of_threads() == 0, "for bootstrap only");
694
695 // don't have to do anything for a single thread
696 }
697
698 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap; 683 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
699 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; 684 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
700 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; 685 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
701 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap; 686 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
702 fence_func_t* os::fence_func = os::fence_bootstrap;
703 687
704 #endif // !_LP64 && !COMPILER2 688 #endif // !_LP64 && !COMPILER2
705 689
706 #if defined(__sparc) && defined(COMPILER2) && defined(_GNU_SOURCE) 690 #if defined(__sparc) && defined(COMPILER2) && defined(_GNU_SOURCE)
707 // See file build/solaris/makefiles/$compiler.make 691 // See file build/solaris/makefiles/$compiler.make