--- a/src/hotspot/os/bsd/os_bsd.cpp Mon Nov 25 08:11:24 2019 +0100
+++ b/src/hotspot/os/bsd/os_bsd.cpp Mon Nov 25 09:10:41 2019 +0000
@@ -3264,12 +3264,14 @@
int processor_id = Atomic::load(&mapping[apic_id]);
while (processor_id < 0) {
- if (Atomic::cmpxchg(-2, &mapping[apic_id], -1)) {
+ if (Atomic::cmpxchg(-2, &mapping[apic_id], -1) == -1) {
Atomic::store(Atomic::add(1, &next_processor_id) - 1, &mapping[apic_id]);
}
processor_id = Atomic::load(&mapping[apic_id]);
}
+ assert(processor_id >= 0 && processor_id < os::processor_count(), "invalid processor id");
+
return (uint)processor_id;
}
#endif