comparison src/os_cpu/solaris_x86/vm/os_solaris_x86.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 7bb995fbd3c0
children 3f5b7efb9642
comparison
equal deleted inserted replaced
668:90a66aa50514 671:d0994e5bebce
792 792
793 typedef jint xchg_func_t (jint, volatile jint*); 793 typedef jint xchg_func_t (jint, volatile jint*);
794 typedef jint cmpxchg_func_t (jint, volatile jint*, jint); 794 typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
795 typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong); 795 typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
796 typedef jint add_func_t (jint, volatile jint*); 796 typedef jint add_func_t (jint, volatile jint*);
797 typedef void fence_func_t ();
798 797
799 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { 798 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
800 // try to use the stub: 799 // try to use the stub:
801 xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry()); 800 xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
802 801
854 assert(Threads::number_of_threads() == 0, "for bootstrap only"); 853 assert(Threads::number_of_threads() == 0, "for bootstrap only");
855 854
856 return (*dest) += add_value; 855 return (*dest) += add_value;
857 } 856 }
858 857
859 void os::fence_bootstrap() {
860 // try to use the stub:
861 fence_func_t* func = CAST_TO_FN_PTR(fence_func_t*, StubRoutines::fence_entry());
862
863 if (func != NULL) {
864 os::fence_func = func;
865 (*func)();
866 return;
867 }
868 assert(Threads::number_of_threads() == 0, "for bootstrap only");
869
870 // don't have to do anything for a single thread
871 }
872
873 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap; 858 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
874 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; 859 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
875 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; 860 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
876 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap; 861 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
877 fence_func_t* os::fence_func = os::fence_bootstrap;
878 862
879 extern "C" _solaris_raw_setup_fpu(address ptr); 863 extern "C" _solaris_raw_setup_fpu(address ptr);
880 void os::setup_fpu() { 864 void os::setup_fpu() {
881 address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std(); 865 address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std();
882 _solaris_raw_setup_fpu(fpu_cntrl); 866 _solaris_raw_setup_fpu(fpu_cntrl);