equal
deleted
inserted
replaced
49 #include "runtime/interfaceSupport.inline.hpp" |
49 #include "runtime/interfaceSupport.inline.hpp" |
50 #include "runtime/java.hpp" |
50 #include "runtime/java.hpp" |
51 #include "runtime/javaCalls.hpp" |
51 #include "runtime/javaCalls.hpp" |
52 #include "runtime/mutexLocker.hpp" |
52 #include "runtime/mutexLocker.hpp" |
53 #include "runtime/objectMonitor.hpp" |
53 #include "runtime/objectMonitor.hpp" |
54 #include "runtime/orderAccess.hpp" |
|
55 #include "runtime/osThread.hpp" |
54 #include "runtime/osThread.hpp" |
56 #include "runtime/perfMemory.hpp" |
55 #include "runtime/perfMemory.hpp" |
57 #include "runtime/semaphore.hpp" |
56 #include "runtime/semaphore.hpp" |
58 #include "runtime/sharedRuntime.hpp" |
57 #include "runtime/sharedRuntime.hpp" |
59 #include "runtime/statSampler.hpp" |
58 #include "runtime/statSampler.hpp" |
3207 #ifdef __APPLE__ |
3206 #ifdef __APPLE__ |
3208 static volatile int* volatile apic_to_processor_mapping = NULL; |
3207 static volatile int* volatile apic_to_processor_mapping = NULL; |
3209 static volatile int next_processor_id = 0; |
3208 static volatile int next_processor_id = 0; |
3210 |
3209 |
3211 static inline volatile int* get_apic_to_processor_mapping() { |
3210 static inline volatile int* get_apic_to_processor_mapping() { |
3212 volatile int* mapping = OrderAccess::load_acquire(&apic_to_processor_mapping); |
3211 volatile int* mapping = Atomic::load_acquire(&apic_to_processor_mapping); |
3213 if (mapping == NULL) { |
3212 if (mapping == NULL) { |
3214 // Calculate possible number space for APIC ids. This space is not necessarily |
3213 // Calculate possible number space for APIC ids. This space is not necessarily |
3215 // in the range [0, number_of_processors). |
3214 // in the range [0, number_of_processors). |
3216 uint total_bits = 0; |
3215 uint total_bits = 0; |
3217 for (uint i = 0;; ++i) { |
3216 for (uint i = 0;; ++i) { |
3238 mapping[i] = -1; |
3237 mapping[i] = -1; |
3239 } |
3238 } |
3240 |
3239 |
3241 if (!Atomic::replace_if_null(mapping, &apic_to_processor_mapping)) { |
3240 if (!Atomic::replace_if_null(mapping, &apic_to_processor_mapping)) { |
3242 FREE_C_HEAP_ARRAY(int, mapping); |
3241 FREE_C_HEAP_ARRAY(int, mapping); |
3243 mapping = OrderAccess::load_acquire(&apic_to_processor_mapping); |
3242 mapping = Atomic::load_acquire(&apic_to_processor_mapping); |
3244 } |
3243 } |
3245 } |
3244 } |
3246 |
3245 |
3247 return mapping; |
3246 return mapping; |
3248 } |
3247 } |