equal
deleted
inserted
replaced
26 #include "jfr/recorder/jfrRecorder.hpp" |
26 #include "jfr/recorder/jfrRecorder.hpp" |
27 #include "jfr/utilities/jfrAllocation.hpp" |
27 #include "jfr/utilities/jfrAllocation.hpp" |
28 #include "logging/log.hpp" |
28 #include "logging/log.hpp" |
29 #include "memory/allocation.inline.hpp" |
29 #include "memory/allocation.inline.hpp" |
30 #include "runtime/atomic.hpp" |
30 #include "runtime/atomic.hpp" |
31 #include "runtime/orderAccess.hpp" |
|
32 #include "runtime/vm_version.hpp" |
31 #include "runtime/vm_version.hpp" |
33 #include "utilities/debug.hpp" |
32 #include "utilities/debug.hpp" |
34 #include "utilities/macros.hpp" |
33 #include "utilities/macros.hpp" |
35 #include "utilities/nativeCallStack.hpp" |
34 #include "utilities/nativeCallStack.hpp" |
36 |
35 |
38 static jlong atomic_add_jlong(jlong value, jlong volatile* const dest) { |
37 static jlong atomic_add_jlong(jlong value, jlong volatile* const dest) { |
39 assert(VM_Version::supports_cx8(), "unsupported"); |
38 assert(VM_Version::supports_cx8(), "unsupported"); |
40 jlong compare_value; |
39 jlong compare_value; |
41 jlong exchange_value; |
40 jlong exchange_value; |
42 do { |
41 do { |
43 compare_value = OrderAccess::load_acquire(dest); |
42 compare_value = *dest; |
44 exchange_value = compare_value + value; |
43 exchange_value = compare_value + value; |
45 } while (Atomic::cmpxchg(exchange_value, dest, compare_value) != compare_value); |
44 } while (Atomic::cmpxchg(exchange_value, dest, compare_value) != compare_value); |
46 return exchange_value; |
45 return exchange_value; |
47 } |
46 } |
48 |
47 |