equal
deleted
inserted
replaced
928 const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom; |
928 const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom; |
929 const uint64_t prev = Bsd::_max_abstime; |
929 const uint64_t prev = Bsd::_max_abstime; |
930 if (now <= prev) { |
930 if (now <= prev) { |
931 return prev; // same or retrograde time; |
931 return prev; // same or retrograde time; |
932 } |
932 } |
933 const uint64_t obsv = Atomic::cmpxchg(now, &Bsd::_max_abstime, prev); |
933 const uint64_t obsv = Atomic::cmpxchg(&Bsd::_max_abstime, prev, now); |
934 assert(obsv >= prev, "invariant"); // Monotonicity |
934 assert(obsv >= prev, "invariant"); // Monotonicity |
935 // If the CAS succeeded then we're done and return "now". |
935 // If the CAS succeeded then we're done and return "now". |
936 // If the CAS failed and the observed value "obsv" is >= now then |
936 // If the CAS failed and the observed value "obsv" is >= now then |
937 // we should return "obsv". If the CAS failed and now > obsv > prv then |
937 // we should return "obsv". If the CAS failed and now > obsv > prv then |
938 // some other thread raced this thread and installed a new value, in which case |
938 // some other thread raced this thread and installed a new value, in which case |
1831 |
1831 |
1832 static int check_pending_signals() { |
1832 static int check_pending_signals() { |
1833 for (;;) { |
1833 for (;;) { |
1834 for (int i = 0; i < NSIG + 1; i++) { |
1834 for (int i = 0; i < NSIG + 1; i++) { |
1835 jint n = pending_signals[i]; |
1835 jint n = pending_signals[i]; |
1836 if (n > 0 && n == Atomic::cmpxchg(n - 1, &pending_signals[i], n)) { |
1836 if (n > 0 && n == Atomic::cmpxchg(&pending_signals[i], n, n - 1)) { |
1837 return i; |
1837 return i; |
1838 } |
1838 } |
1839 } |
1839 } |
1840 JavaThread *thread = JavaThread::current(); |
1840 JavaThread *thread = JavaThread::current(); |
1841 ThreadBlockInVM tbivm(thread); |
1841 ThreadBlockInVM tbivm(thread); |
3235 |
3235 |
3236 for (uint i = 0; i < max_apic_ids; ++i) { |
3236 for (uint i = 0; i < max_apic_ids; ++i) { |
3237 mapping[i] = -1; |
3237 mapping[i] = -1; |
3238 } |
3238 } |
3239 |
3239 |
3240 if (!Atomic::replace_if_null(mapping, &apic_to_processor_mapping)) { |
3240 if (!Atomic::replace_if_null(&apic_to_processor_mapping, mapping)) { |
3241 FREE_C_HEAP_ARRAY(int, mapping); |
3241 FREE_C_HEAP_ARRAY(int, mapping); |
3242 mapping = Atomic::load_acquire(&apic_to_processor_mapping); |
3242 mapping = Atomic::load_acquire(&apic_to_processor_mapping); |
3243 } |
3243 } |
3244 } |
3244 } |
3245 |
3245 |
3261 |
3261 |
3262 uint apic_id = edx; |
3262 uint apic_id = edx; |
3263 int processor_id = Atomic::load(&mapping[apic_id]); |
3263 int processor_id = Atomic::load(&mapping[apic_id]); |
3264 |
3264 |
3265 while (processor_id < 0) { |
3265 while (processor_id < 0) { |
3266 if (Atomic::cmpxchg(-2, &mapping[apic_id], -1) == -1) { |
3266 if (Atomic::cmpxchg(&mapping[apic_id], -1, -2) == -1) { |
3267 Atomic::store(&mapping[apic_id], Atomic::add(&next_processor_id, 1) - 1); |
3267 Atomic::store(&mapping[apic_id], Atomic::add(&next_processor_id, 1) - 1); |
3268 } |
3268 } |
3269 processor_id = Atomic::load(&mapping[apic_id]); |
3269 processor_id = Atomic::load(&mapping[apic_id]); |
3270 } |
3270 } |
3271 |
3271 |