File tree Expand file tree Collapse file tree 5 files changed +38
-0
lines changed
nativeaot/Runtime/eventpipe Expand file tree Collapse file tree 5 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,12 @@ ep_rt_aot_atomic_dec_int64_t (volatile int64_t *value) {
331331 return (currentValue - 1 );
332332}
333333
334+ int64_t
335+ ep_rt_aot_atomic_compare_exchange_int64_t (volatile int64_t *target, int64_t expected, int64_t value) {
336+ STATIC_CONTRACT_NOTHROW;
337+ return static_cast <int64_t >(PalInterlockedCompareExchange64 ((volatile int64_t *)target, (int64_t )value, (int64_t )expected));
338+ }
339+
334340size_t
335341ep_rt_aot_atomic_compare_exchange_size_t (volatile size_t *target, size_t expected, size_t value) {
336342 STATIC_CONTRACT_NOTHROW;
Original file line number Diff line number Diff line change @@ -224,6 +224,16 @@ ep_rt_atomic_dec_int64_t (volatile int64_t *value)
224224 return ep_rt_aot_atomic_dec_int64_t (value );
225225}
226226
227+ static
228+ inline
229+ int64_t
230+ ep_rt_atomic_compare_exchange_int64_t (volatile int64_t * target , int64_t expected , int64_t value )
231+ {
232+ STATIC_CONTRACT_NOTHROW ;
233+ extern int64_t ep_rt_aot_atomic_compare_exchange_int64_t (volatile int64_t * target , int64_t expected , int64_t value );
234+ return ep_rt_aot_atomic_compare_exchange_int64_t (target , expected , value );
235+ }
236+
227237static
228238inline
229239size_t
Original file line number Diff line number Diff line change @@ -229,6 +229,15 @@ ep_rt_atomic_dec_int64_t (volatile int64_t *value)
229229 return static_cast <int64_t >(InterlockedDecrement64 ((volatile LONG64 *)(value)));
230230}
231231
232+ static
233+ inline
234+ int64_t
235+ ep_rt_atomic_compare_exchange_int64_t (volatile int64_t *target, int64_t expected, int64_t value)
236+ {
237+ STATIC_CONTRACT_NOTHROW;
238+ return static_cast <int64_t >(InterlockedCompareExchangeT<int64_t > (target, value, expected));
239+ }
240+
232241static
233242inline
234243size_t
Original file line number Diff line number Diff line change @@ -355,6 +355,15 @@ ep_rt_atomic_dec_int64_t (volatile int64_t *value)
355355 return (int64_t )mono_atomic_dec_i64 ((volatile gint64 * )value );
356356}
357357
358+ static
359+ inline
360+ int64_t
361+ ep_rt_atomic_compare_exchange_int64_t (volatile int64_t * target , int64_t expected , int64_t value )
362+ {
363+ STATIC_CONTRACT_NOTHROW ;
364+ return (int64_t )(mono_atomic_cas_i64 ((volatile gint64 * )(target ), (gint64 )(value ), (gint64 )(expected )));
365+ }
366+
358367static
359368inline
360369size_t
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ static
7979int64_t
8080ep_rt_atomic_dec_int64_t (volatile int64_t * value );
8181
82+ static
83+ int64_t
84+ ep_rt_atomic_compare_exchange_int64_t (volatile int64_t * target , int64_t expected , int64_t value );
85+
8286static
8387size_t
8488ep_rt_atomic_compare_exchange_size_t (volatile size_t * target , size_t expected , size_t value );
You can’t perform that action at this time.
0 commit comments