< prev index next >

src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp

Print this page




 887 
 888 
 889 #ifdef AMD64
 890 void os::Solaris::init_thread_fpu_state(void) {
 891   // Nothing to do
 892 }
 893 #else
 894 // From solaris_i486.s
 895 extern "C" void fixcw();
 896 
 897 void os::Solaris::init_thread_fpu_state(void) {
 898   // Set fpu to 53 bit precision. This happens too early to use a stub.
 899   fixcw();
 900 }
 901 
 902 // These routines are the initial value of atomic_xchg_entry(),
 903 // atomic_cmpxchg_entry(), atomic_inc_entry() and fence_entry()
 904 // until initialization is complete.
 905 // TODO - replace with .il implementation when compiler supports it.
 906 
 907 typedef jint  xchg_func_t        (jint,  volatile jint*);
 908 typedef jint  cmpxchg_func_t     (jint,  volatile jint*,  jint);
 909 typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
 910 typedef jint  add_func_t         (jint,  volatile jint*);
 911 
 912 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
 913   // try to use the stub:
 914   xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
 915 
 916   if (func != NULL) {
 917     os::atomic_xchg_func = func;
 918     return (*func)(exchange_value, dest);
 919   }
 920   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 921 
 922   jint old_value = *dest;
 923   *dest = exchange_value;
 924   return old_value;
 925 }
 926 
 927 jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
 928   // try to use the stub:
 929   cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
 930 
 931   if (func != NULL) {
 932     os::atomic_cmpxchg_func = func;
 933     return (*func)(exchange_value, dest, compare_value);
 934   }
 935   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 936 
 937   jint old_value = *dest;
 938   if (old_value == compare_value)
 939     *dest = exchange_value;
 940   return old_value;
 941 }
 942 
 943 jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
 944   // try to use the stub:
 945   cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
 946 
 947   if (func != NULL) {
 948     os::atomic_cmpxchg_long_func = func;
 949     return (*func)(exchange_value, dest, compare_value);
 950   }
 951   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 952 
 953   jlong old_value = *dest;
 954   if (old_value == compare_value)
 955     *dest = exchange_value;
 956   return old_value;
 957 }
 958 
 959 jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
 960   // try to use the stub:
 961   add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
 962 
 963   if (func != NULL) {
 964     os::atomic_add_func = func;
 965     return (*func)(add_value, dest);
 966   }
 967   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 968 
 969   return (*dest) += add_value;
 970 }
 971 
 972 xchg_func_t*         os::atomic_xchg_func         = os::atomic_xchg_bootstrap;
 973 cmpxchg_func_t*      os::atomic_cmpxchg_func      = os::atomic_cmpxchg_bootstrap;
 974 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
 975 add_func_t*          os::atomic_add_func          = os::atomic_add_bootstrap;
 976 
 977 extern "C" void _solaris_raw_setup_fpu(address ptr);
 978 void os::setup_fpu() {
 979   address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std();


 887 
 888 
 889 #ifdef AMD64
 890 void os::Solaris::init_thread_fpu_state(void) {
 891   // Nothing to do
 892 }
 893 #else
 894 // From solaris_i486.s
 895 extern "C" void fixcw();
 896 
 897 void os::Solaris::init_thread_fpu_state(void) {
 898   // Set fpu to 53 bit precision. This happens too early to use a stub.
 899   fixcw();
 900 }
 901 
 902 // These routines are the initial value of atomic_xchg_entry(),
 903 // atomic_cmpxchg_entry(), atomic_inc_entry() and fence_entry()
 904 // until initialization is complete.
 905 // TODO - replace with .il implementation when compiler supports it.
 906 
 907 typedef int32_t  xchg_func_t        (int32_t,  volatile int32_t*);
 908 typedef int32_t  cmpxchg_func_t     (int32_t,  volatile int32_t*,  int32_t);
 909 typedef int64_t  cmpxchg_long_func_t(int64_t,  volatile int64_t*,  int64_t);
 910 typedef int32_t  add_func_t         (int32_t,  volatile int32_t*);
 911 
 912 int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
 913   // try to use the stub:
 914   xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
 915 
 916   if (func != NULL) {
 917     os::atomic_xchg_func = func;
 918     return (*func)(exchange_value, dest);
 919   }
 920   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 921 
 922   int32_t old_value = *dest;
 923   *dest = exchange_value;
 924   return old_value;
 925 }
 926 
 927 int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
 928   // try to use the stub:
 929   cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
 930 
 931   if (func != NULL) {
 932     os::atomic_cmpxchg_func = func;
 933     return (*func)(exchange_value, dest, compare_value);
 934   }
 935   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 936 
 937   int32_t old_value = *dest;
 938   if (old_value == compare_value)
 939     *dest = exchange_value;
 940   return old_value;
 941 }
 942 
 943 int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
 944   // try to use the stub:
 945   cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
 946 
 947   if (func != NULL) {
 948     os::atomic_cmpxchg_long_func = func;
 949     return (*func)(exchange_value, dest, compare_value);
 950   }
 951   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 952 
 953   int64_t old_value = *dest;
 954   if (old_value == compare_value)
 955     *dest = exchange_value;
 956   return old_value;
 957 }
 958 
 959 int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
 960   // try to use the stub:
 961   add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
 962 
 963   if (func != NULL) {
 964     os::atomic_add_func = func;
 965     return (*func)(add_value, dest);
 966   }
 967   assert(Threads::number_of_threads() == 0, "for bootstrap only");
 968 
 969   return (*dest) += add_value;
 970 }
 971 
 972 xchg_func_t*         os::atomic_xchg_func         = os::atomic_xchg_bootstrap;
 973 cmpxchg_func_t*      os::atomic_cmpxchg_func      = os::atomic_cmpxchg_bootstrap;
 974 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
 975 add_func_t*          os::atomic_add_func          = os::atomic_add_bootstrap;
 976 
 977 extern "C" void _solaris_raw_setup_fpu(address ptr);
 978 void os::setup_fpu() {
 979   address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std();
< prev index next >