< prev index next > src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
Print this page
#endif // AMD64
return true;
}
- // Atomics and Stub Functions
-
- typedef int32_t xchg_func_t (int32_t, volatile int32_t*);
- typedef int64_t xchg_long_func_t (int64_t, volatile int64_t*);
- typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t);
- typedef int8_t cmpxchg_byte_func_t (int8_t, volatile int8_t*, int8_t);
- typedef int64_t cmpxchg_long_func_t (int64_t, volatile int64_t*, int64_t);
- typedef int32_t add_func_t (int32_t, volatile int32_t*);
- typedef int64_t add_long_func_t (int64_t, volatile int64_t*);
-
- #ifdef AMD64
-
- int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
- // try to use the stub:
- xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
-
- if (func != NULL) {
- os::atomic_xchg_func = func;
- return (*func)(exchange_value, dest);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- int32_t old_value = *dest;
- *dest = exchange_value;
- return old_value;
- }
-
- int64_t os::atomic_xchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest) {
- // try to use the stub:
- xchg_long_func_t* func = CAST_TO_FN_PTR(xchg_long_func_t*, StubRoutines::atomic_xchg_long_entry());
-
- if (func != NULL) {
- os::atomic_xchg_long_func = func;
- return (*func)(exchange_value, dest);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- int64_t old_value = *dest;
- *dest = exchange_value;
- return old_value;
- }
-
-
- int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
- // try to use the stub:
- cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
-
- if (func != NULL) {
- os::atomic_cmpxchg_func = func;
- return (*func)(exchange_value, dest, compare_value);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- int32_t old_value = *dest;
- if (old_value == compare_value)
- *dest = exchange_value;
- return old_value;
- }
-
- int8_t os::atomic_cmpxchg_byte_bootstrap(int8_t exchange_value, volatile int8_t* dest, int8_t compare_value) {
- // try to use the stub:
- cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry());
-
- if (func != NULL) {
- os::atomic_cmpxchg_byte_func = func;
- return (*func)(exchange_value, dest, compare_value);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- int8_t old_value = *dest;
- if (old_value == compare_value)
- *dest = exchange_value;
- return old_value;
- }
-
- #endif // AMD64
-
- int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
- // try to use the stub:
- cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
-
- if (func != NULL) {
- os::atomic_cmpxchg_long_func = func;
- return (*func)(exchange_value, dest, compare_value);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- int64_t old_value = *dest;
- if (old_value == compare_value)
- *dest = exchange_value;
- return old_value;
- }
-
- #ifdef AMD64
-
- int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
- // try to use the stub:
- add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
-
- if (func != NULL) {
- os::atomic_add_func = func;
- return (*func)(add_value, dest);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- return (*dest) += add_value;
- }
-
- int64_t os::atomic_add_long_bootstrap(int64_t add_value, volatile int64_t* dest) {
- // try to use the stub:
- add_long_func_t* func = CAST_TO_FN_PTR(add_long_func_t*, StubRoutines::atomic_add_long_entry());
-
- if (func != NULL) {
- os::atomic_add_long_func = func;
- return (*func)(add_value, dest);
- }
- assert(Threads::number_of_threads() == 0, "for bootstrap only");
-
- return (*dest) += add_value;
- }
-
- xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
- xchg_long_func_t* os::atomic_xchg_long_func = os::atomic_xchg_long_bootstrap;
- cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
- cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap;
- add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
- add_long_func_t* os::atomic_add_long_func = os::atomic_add_long_bootstrap;
-
- #endif // AMD64
-
- cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
-
#ifdef AMD64
/*
* Windows/x64 does not use stack frames the way expected by Java:
* [1] in most cases, there is no frame pointer. All locals are addressed via RSP
* [2] in rare cases, when alloca() is used, a frame pointer is used, but this may
< prev index next >