debase-ruby_core_source 0.10.11 → 0.10.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/builtin.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/debug_counter.h +38 -4
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/eval_intern.h +16 -5
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/gc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/insns.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/insns_info.inc +93 -89
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/array.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/bignum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/bits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/class.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/compar.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/compilers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/complex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/cont.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/dir.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/enc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/encoding.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/enum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/enumerator.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/error.h +0 -7
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/eval.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/file.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/fixnum.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/gc.h +9 -2
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/hash.h +2 -1
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/imemo.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/inits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/io.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/load.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/loadpath.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/math.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/missing.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/numeric.h +4 -1
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/object.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/parse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/proc.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/process.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/random.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/range.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/rational.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/re.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/sanitizers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/scheduler.h +9 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/serial.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/signal.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/static_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/string.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/struct.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/thread.h +0 -6
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/time.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/transcode.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/util.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/variable.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/vm.h +7 -6
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/internal/warnings.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/iseq.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/method.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/mjit.h +37 -14
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/mjit_compile.inc +715 -557
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/node.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/opt_sc.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/parse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1/ractor.h → ruby-3.0.0-p0/ractor_core.h} +97 -25
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/regenc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/regint.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/revision.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/ruby_assert.h +0 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/thread_pthread.h +23 -14
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/thread_win32.h +5 -10
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/transient_heap.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/variable.h +2 -1
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/version.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm.inc +94 -99
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_call_iseq_optimized.inc +48 -48
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_callinfo.h +2 -3
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_core.h +96 -25
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_insnhelper.h +1 -4
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vm_sync.h +44 -5
- data/lib/debase/ruby_core_source/{ruby-3.0.0-preview1 → ruby-3.0.0-p0}/vmtc.inc +0 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +111 -113
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/mjit.h +0 -29
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor_pub.h +0 -50
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/revision.h +0 -2
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_atomic.h +0 -236
@@ -1,236 +0,0 @@
|
|
1
|
-
#ifndef RUBY_ATOMIC_H
|
2
|
-
#define RUBY_ATOMIC_H
|
3
|
-
|
4
|
-
/*
|
5
|
-
* - ATOMIC_CAS, ATOMIC_EXCHANGE, ATOMIC_FETCH_*:
|
6
|
-
* return the old * value.
|
7
|
-
* - ATOMIC_ADD, ATOMIC_SUB, ATOMIC_INC, ATOMIC_DEC, ATOMIC_OR, ATOMIC_SET:
|
8
|
-
* may be void.
|
9
|
-
*/
|
10
|
-
#if 0
|
11
|
-
#elif defined HAVE_GCC_ATOMIC_BUILTINS
|
12
|
-
typedef unsigned int rb_atomic_t;
|
13
|
-
# define ATOMIC_FETCH_ADD(var, val) __atomic_fetch_add(&(var), (val), __ATOMIC_SEQ_CST)
|
14
|
-
# define ATOMIC_FETCH_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
|
15
|
-
# define ATOMIC_OR(var, val) __atomic_fetch_or(&(var), (val), __ATOMIC_SEQ_CST)
|
16
|
-
# define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
|
17
|
-
# define ATOMIC_CAS(var, oldval, newval) RB_GNUC_EXTENSION_BLOCK( \
|
18
|
-
__typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
|
19
|
-
__atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
|
20
|
-
oldvaldup )
|
21
|
-
|
22
|
-
# define RUBY_ATOMIC_GENERIC_MACRO 1
|
23
|
-
|
24
|
-
#elif defined HAVE_GCC_SYNC_BUILTINS
|
25
|
-
/* @shyouhei hack to support atomic operations in case of gcc. Gcc
|
26
|
-
* has its own pseudo-insns to support them. See info, or
|
27
|
-
* http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html */
|
28
|
-
|
29
|
-
typedef unsigned int rb_atomic_t; /* Anything OK */
|
30
|
-
# define ATOMIC_FETCH_ADD(var, val) __sync_fetch_and_add(&(var), (val))
|
31
|
-
# define ATOMIC_FETCH_SUB(var, var) __sync_fetch_and_sub(&(var), (val))
|
32
|
-
# define ATOMIC_OR(var, val) __sync_fetch_and_or(&(var), (val))
|
33
|
-
# define ATOMIC_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
|
34
|
-
# define ATOMIC_CAS(var, oldval, newval) __sync_val_compare_and_swap(&(var), (oldval), (newval))
|
35
|
-
|
36
|
-
# define RUBY_ATOMIC_GENERIC_MACRO 1
|
37
|
-
|
38
|
-
#elif defined _WIN32
|
39
|
-
#if MSC_VERSION_SINCE(1300)
|
40
|
-
#pragma intrinsic(_InterlockedOr)
|
41
|
-
#endif
|
42
|
-
typedef LONG rb_atomic_t;
|
43
|
-
|
44
|
-
# define ATOMIC_SET(var, val) InterlockedExchange(&(var), (val))
|
45
|
-
# define ATOMIC_INC(var) InterlockedIncrement(&(var))
|
46
|
-
# define ATOMIC_DEC(var) InterlockedDecrement(&(var))
|
47
|
-
# define ATOMIC_FETCH_ADD(var, val) InterlockedExchangeAdd(&(var), (val))
|
48
|
-
# define ATOMIC_FETCH_SUB(var, val) InterlockedExchangeAdd(&(var), -(LONG)(val))
|
49
|
-
#if defined __GNUC__
|
50
|
-
# define ATOMIC_OR(var, val) __asm__("lock\n\t" "orl\t%1, %0" : "=m"(var) : "Ir"(val))
|
51
|
-
#elif MSC_VERSION_BEFORE(1300)
|
52
|
-
# define ATOMIC_OR(var, val) rb_w32_atomic_or(&(var), (val))
|
53
|
-
static inline void
|
54
|
-
rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
|
55
|
-
{
|
56
|
-
#ifdef _M_IX86
|
57
|
-
__asm mov eax, var;
|
58
|
-
__asm mov ecx, val;
|
59
|
-
__asm lock or [eax], ecx;
|
60
|
-
#else
|
61
|
-
#error unsupported architecture
|
62
|
-
#endif
|
63
|
-
}
|
64
|
-
#else
|
65
|
-
# define ATOMIC_OR(var, val) _InterlockedOr(&(var), (val))
|
66
|
-
#endif
|
67
|
-
# define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val))
|
68
|
-
# define ATOMIC_CAS(var, oldval, newval) InterlockedCompareExchange(&(var), (newval), (oldval))
|
69
|
-
# if MSC_VERSION_BEFORE(1300)
|
70
|
-
static inline rb_atomic_t
|
71
|
-
rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval)
|
72
|
-
{
|
73
|
-
return (rb_atomic_t)InterlockedCompareExchange((PVOID *)var, (PVOID)newval, (PVOID)oldval);
|
74
|
-
}
|
75
|
-
# undef ATOMIC_CAS
|
76
|
-
# define ATOMIC_CAS(var, oldval, newval) rb_w32_atomic_cas(&(var), (oldval), (newval))
|
77
|
-
# endif
|
78
|
-
# ifdef _M_AMD64
|
79
|
-
# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64((LONG_LONG *)&(var), (val))
|
80
|
-
# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd64((LONG_LONG *)&(var), -(LONG)(val))
|
81
|
-
# define ATOMIC_SIZE_INC(var) InterlockedIncrement64(&(var))
|
82
|
-
# define ATOMIC_SIZE_DEC(var) InterlockedDecrement64(&(var))
|
83
|
-
# define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange64(&(var), (val))
|
84
|
-
# define ATOMIC_SIZE_CAS(var, oldval, newval) InterlockedCompareExchange64(&(var), (newval), (oldval))
|
85
|
-
# else
|
86
|
-
# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd((LONG *)&(var), (val))
|
87
|
-
# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(LONG)(val))
|
88
|
-
# define ATOMIC_SIZE_INC(var) InterlockedIncrement((LONG *)&(var))
|
89
|
-
# define ATOMIC_SIZE_DEC(var) InterlockedDecrement((LONG *)&(var))
|
90
|
-
# define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange((LONG *)&(var), (val))
|
91
|
-
# endif
|
92
|
-
|
93
|
-
# ifdef InterlockedExchangePointer
|
94
|
-
# define ATOMIC_PTR_EXCHANGE(var, val) InterlockedExchangePointer((PVOID volatile *)&(var), (PVOID)(val))
|
95
|
-
# endif /* See below for definitions of other situations */
|
96
|
-
|
97
|
-
#elif defined(__sun) && defined(HAVE_ATOMIC_H)
|
98
|
-
#include <atomic.h>
|
99
|
-
typedef unsigned int rb_atomic_t;
|
100
|
-
|
101
|
-
# define ATOMIC_INC(var) atomic_inc_uint(&(var))
|
102
|
-
# define ATOMIC_DEC(var) atomic_dec_uint(&(var))
|
103
|
-
# define ATOMIC_FETCH_ADD(var, val) rb_atomic_fetch_add(&(var), (val))
|
104
|
-
# define ATOMIC_FETCH_SUB(var, val) rb_atomic_fetch_sub(&(var), (val))
|
105
|
-
# define ATOMIC_ADD(var, val) atomic_add_uint(&(var), (val))
|
106
|
-
# define ATOMIC_SUB(var, val) atomic_sub_uint(&(var), (val))
|
107
|
-
# define ATOMIC_OR(var, val) atomic_or_uint(&(var), (val))
|
108
|
-
# define ATOMIC_EXCHANGE(var, val) atomic_swap_uint(&(var), (val))
|
109
|
-
# define ATOMIC_CAS(var, oldval, newval) atomic_cas_uint(&(var), (oldval), (newval))
|
110
|
-
|
111
|
-
static inline rb_atomic_t
|
112
|
-
rb_atomic_fetch_add(volatile rb_atomic_t *var, rb_atomic_t val)
|
113
|
-
{
|
114
|
-
return atomic_add_int_nv(var, val) - val;
|
115
|
-
}
|
116
|
-
|
117
|
-
static inline rb_atomic_t
|
118
|
-
rb_atomic_fetch_sub(volatile rb_atomic_t *var, rb_atomic_t val)
|
119
|
-
{
|
120
|
-
return atomic_add_int_nv(var, (rb_atomic_t)(-(int)val)) + val;
|
121
|
-
}
|
122
|
-
|
123
|
-
# if defined(_LP64) || defined(_I32LPx)
|
124
|
-
# define ATOMIC_SIZE_ADD(var, val) atomic_add_long(&(var), (val))
|
125
|
-
# define ATOMIC_SIZE_SUB(var, val) atomic_add_long(&(var), -(val))
|
126
|
-
# define ATOMIC_SIZE_INC(var) atomic_inc_ulong(&(var))
|
127
|
-
# define ATOMIC_SIZE_DEC(var) atomic_dec_ulong(&(var))
|
128
|
-
# define ATOMIC_SIZE_EXCHANGE(var, val) atomic_swap_ulong(&(var), (val))
|
129
|
-
# define ATOMIC_SIZE_CAS(var, oldval, val) atomic_cas_ulong(&(var), (oldval), (val))
|
130
|
-
# else
|
131
|
-
# define ATOMIC_SIZE_ADD(var, val) atomic_add_int(&(var), (val))
|
132
|
-
# define ATOMIC_SIZE_SUB(var, val) atomic_add_int(&(var), -(val))
|
133
|
-
# define ATOMIC_SIZE_INC(var) atomic_inc_uint(&(var))
|
134
|
-
# define ATOMIC_SIZE_DEC(var) atomic_dec_uint(&(var))
|
135
|
-
# define ATOMIC_SIZE_EXCHANGE(var, val) atomic_swap_uint(&(var), (val))
|
136
|
-
# endif
|
137
|
-
|
138
|
-
#else
|
139
|
-
# error No atomic operation found
|
140
|
-
#endif
|
141
|
-
|
142
|
-
#ifndef ATOMIC_SET
|
143
|
-
# define ATOMIC_SET(var, val) (void)ATOMIC_EXCHANGE(var, val)
|
144
|
-
#endif
|
145
|
-
|
146
|
-
#ifndef ATOMIC_ADD
|
147
|
-
# define ATOMIC_ADD(var, val) (void)ATOMIC_FETCH_ADD(var, val)
|
148
|
-
#endif
|
149
|
-
|
150
|
-
#ifndef ATOMIC_SUB
|
151
|
-
# define ATOMIC_SUB(var, val) (void)ATOMIC_FETCH_SUB(var, val)
|
152
|
-
#endif
|
153
|
-
|
154
|
-
#ifndef ATOMIC_INC
|
155
|
-
# define ATOMIC_INC(var) ATOMIC_ADD(var, 1)
|
156
|
-
#endif
|
157
|
-
|
158
|
-
#ifndef ATOMIC_DEC
|
159
|
-
# define ATOMIC_DEC(var) ATOMIC_SUB(var, 1)
|
160
|
-
#endif
|
161
|
-
|
162
|
-
#ifndef ATOMIC_SIZE_INC
|
163
|
-
# define ATOMIC_SIZE_INC(var) ATOMIC_INC(var)
|
164
|
-
#endif
|
165
|
-
|
166
|
-
#ifndef ATOMIC_SIZE_DEC
|
167
|
-
# define ATOMIC_SIZE_DEC(var) ATOMIC_DEC(var)
|
168
|
-
#endif
|
169
|
-
|
170
|
-
#ifndef ATOMIC_SIZE_EXCHANGE
|
171
|
-
# define ATOMIC_SIZE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
|
172
|
-
#endif
|
173
|
-
|
174
|
-
#ifndef ATOMIC_SIZE_CAS
|
175
|
-
# define ATOMIC_SIZE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
|
176
|
-
#endif
|
177
|
-
|
178
|
-
#ifndef ATOMIC_SIZE_ADD
|
179
|
-
# define ATOMIC_SIZE_ADD(var, val) ATOMIC_ADD(var, val)
|
180
|
-
#endif
|
181
|
-
|
182
|
-
#ifndef ATOMIC_SIZE_SUB
|
183
|
-
# define ATOMIC_SIZE_SUB(var, val) ATOMIC_SUB(var, val)
|
184
|
-
#endif
|
185
|
-
|
186
|
-
#if RUBY_ATOMIC_GENERIC_MACRO
|
187
|
-
# ifndef ATOMIC_PTR_EXCHANGE
|
188
|
-
# define ATOMIC_PTR_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
|
189
|
-
# endif
|
190
|
-
|
191
|
-
# ifndef ATOMIC_PTR_CAS
|
192
|
-
# define ATOMIC_PTR_CAS(var, oldval, newval) ATOMIC_CAS(var, oldval, newval)
|
193
|
-
# endif
|
194
|
-
|
195
|
-
# ifndef ATOMIC_VALUE_EXCHANGE
|
196
|
-
# define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
|
197
|
-
# endif
|
198
|
-
|
199
|
-
# ifndef ATOMIC_VALUE_CAS
|
200
|
-
# define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
|
201
|
-
# endif
|
202
|
-
#endif
|
203
|
-
|
204
|
-
#ifndef ATOMIC_PTR_EXCHANGE
|
205
|
-
# if SIZEOF_VOIDP == SIZEOF_SIZE_T
|
206
|
-
# define ATOMIC_PTR_EXCHANGE(var, val) (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
|
207
|
-
# else
|
208
|
-
# error No atomic exchange for void*
|
209
|
-
# endif
|
210
|
-
#endif
|
211
|
-
|
212
|
-
#ifndef ATOMIC_PTR_CAS
|
213
|
-
# if SIZEOF_VOIDP == SIZEOF_SIZE_T
|
214
|
-
# define ATOMIC_PTR_CAS(var, oldval, val) (void *)ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
|
215
|
-
# else
|
216
|
-
# error No atomic compare-and-set for void*
|
217
|
-
# endif
|
218
|
-
#endif
|
219
|
-
|
220
|
-
#ifndef ATOMIC_VALUE_EXCHANGE
|
221
|
-
# if SIZEOF_VALUE == SIZEOF_SIZE_T
|
222
|
-
# define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
|
223
|
-
# else
|
224
|
-
# error No atomic exchange for VALUE
|
225
|
-
# endif
|
226
|
-
#endif
|
227
|
-
|
228
|
-
#ifndef ATOMIC_VALUE_CAS
|
229
|
-
# if SIZEOF_VALUE == SIZEOF_SIZE_T
|
230
|
-
# define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
|
231
|
-
# else
|
232
|
-
# error No atomic compare-and-set for VALUE
|
233
|
-
# endif
|
234
|
-
#endif
|
235
|
-
|
236
|
-
#endif /* RUBY_ATOMIC_H */
|