Mercurial > hg > graal-jvmci-8
comparison src/os_cpu/windows_x86/vm/os_windows_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 | 9ee9cf798b59 |
children | bd02caa94611 |
comparison
equal
deleted
inserted
replaced
668:90a66aa50514 | 671:d0994e5bebce |
---|---|
194 typedef intptr_t xchg_ptr_func_t (intptr_t, volatile intptr_t*); | 194 typedef intptr_t xchg_ptr_func_t (intptr_t, volatile intptr_t*); |
195 typedef jint cmpxchg_func_t (jint, volatile jint*, jint); | 195 typedef jint cmpxchg_func_t (jint, volatile jint*, jint); |
196 typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong); | 196 typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong); |
197 typedef jint add_func_t (jint, volatile jint*); | 197 typedef jint add_func_t (jint, volatile jint*); |
198 typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*); | 198 typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*); |
199 typedef void fence_func_t (); | |
200 | 199 |
201 #ifdef AMD64 | 200 #ifdef AMD64 |
202 | 201 |
203 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { | 202 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { |
204 // try to use the stub: | 203 // try to use the stub: |
289 } | 288 } |
290 assert(Threads::number_of_threads() == 0, "for bootstrap only"); | 289 assert(Threads::number_of_threads() == 0, "for bootstrap only"); |
291 | 290 |
292 return (*dest) += add_value; | 291 return (*dest) += add_value; |
293 } | 292 } |
294 | |
295 void os::fence_bootstrap() { | |
296 // try to use the stub: | |
297 fence_func_t* func = CAST_TO_FN_PTR(fence_func_t*, StubRoutines::fence_entry()); | |
298 | |
299 if (func != NULL) { | |
300 os::fence_func = func; | |
301 (*func)(); | |
302 return; | |
303 } | |
304 assert(Threads::number_of_threads() == 0, "for bootstrap only"); | |
305 | |
306 // don't have to do anything for a single thread | |
307 } | |
308 | |
309 | 293 |
310 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap; | 294 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap; |
311 xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap; | 295 xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap; |
312 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; | 296 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; |
313 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap; | 297 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap; |
314 add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap; | 298 add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap; |
315 fence_func_t* os::fence_func = os::fence_bootstrap; | |
316 | 299 |
317 #endif // AMD64 | 300 #endif // AMD64 |
318 | 301 |
319 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; | 302 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; |
320 | 303 |