zscan 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/pack/pack-27.c +1 -0
- data/ext/pack/pack.c +1 -0
- data/ext/pack/ruby/backward/2/assume.h +43 -0
- data/ext/pack/ruby/backward/2/attributes.h +157 -0
- data/ext/pack/ruby/backward/2/bool.h +37 -0
- data/ext/pack/ruby/backward/2/extern.h +46 -0
- data/ext/pack/ruby/backward/2/gcc_version_since.h +38 -0
- data/ext/pack/ruby/backward/2/inttypes.h +132 -0
- data/ext/pack/ruby/backward/2/limits.h +100 -0
- data/ext/pack/ruby/backward/2/long_long.h +65 -0
- data/ext/pack/ruby/backward/2/r_cast.h +27 -0
- data/ext/pack/ruby/backward/2/rmodule.h +31 -0
- data/ext/pack/ruby/backward/2/stdalign.h +30 -0
- data/ext/pack/ruby/backward/2/stdarg.h +47 -0
- data/ext/pack/ruby/backward/classext.h +25 -0
- data/ext/pack/ruby/backward/rubyio.h +18 -0
- data/ext/pack/ruby/backward/rubysig.h +26 -0
- data/ext/pack/ruby/backward/st.h +18 -0
- data/ext/pack/ruby/backward/util.h +18 -0
- data/ext/pack/ruby/internal/anyargs.h +375 -0
- data/ext/pack/ruby/internal/arithmetic.h +38 -0
- data/ext/pack/ruby/internal/arithmetic/char.h +58 -0
- data/ext/pack/ruby/internal/arithmetic/double.h +39 -0
- data/ext/pack/ruby/internal/arithmetic/fixnum.h +44 -0
- data/ext/pack/ruby/internal/arithmetic/gid_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/int.h +163 -0
- data/ext/pack/ruby/internal/arithmetic/intptr_t.h +42 -0
- data/ext/pack/ruby/internal/arithmetic/long.h +244 -0
- data/ext/pack/ruby/internal/arithmetic/long_long.h +53 -0
- data/ext/pack/ruby/internal/arithmetic/mode_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/off_t.h +49 -0
- data/ext/pack/ruby/internal/arithmetic/pid_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/short.h +54 -0
- data/ext/pack/ruby/internal/arithmetic/size_t.h +51 -0
- data/ext/pack/ruby/internal/arithmetic/st_data_t.h +59 -0
- data/ext/pack/ruby/internal/arithmetic/uid_t.h +34 -0
- data/ext/pack/ruby/internal/assume.h +90 -0
- data/ext/pack/ruby/internal/attr/alloc_size.h +32 -0
- data/ext/pack/ruby/internal/attr/artificial.h +46 -0
- data/ext/pack/ruby/internal/attr/cold.h +37 -0
- data/ext/pack/ruby/internal/attr/const.h +46 -0
- data/ext/pack/ruby/internal/attr/constexpr.h +85 -0
- data/ext/pack/ruby/internal/attr/deprecated.h +59 -0
- data/ext/pack/ruby/internal/attr/diagnose_if.h +42 -0
- data/ext/pack/ruby/internal/attr/enum_extensibility.h +32 -0
- data/ext/pack/ruby/internal/attr/error.h +32 -0
- data/ext/pack/ruby/internal/attr/flag_enum.h +33 -0
- data/ext/pack/ruby/internal/attr/forceinline.h +40 -0
- data/ext/pack/ruby/internal/attr/format.h +38 -0
- data/ext/pack/ruby/internal/attr/maybe_unused.h +38 -0
- data/ext/pack/ruby/internal/attr/noalias.h +58 -0
- data/ext/pack/ruby/internal/attr/nodiscard.h +45 -0
- data/ext/pack/ruby/internal/attr/noexcept.h +91 -0
- data/ext/pack/ruby/internal/attr/noinline.h +35 -0
- data/ext/pack/ruby/internal/attr/nonnull.h +32 -0
- data/ext/pack/ruby/internal/attr/noreturn.h +48 -0
- data/ext/pack/ruby/internal/attr/pure.h +43 -0
- data/ext/pack/ruby/internal/attr/restrict.h +45 -0
- data/ext/pack/ruby/internal/attr/returns_nonnull.h +37 -0
- data/ext/pack/ruby/internal/attr/warning.h +32 -0
- data/ext/pack/ruby/internal/attr/weakref.h +32 -0
- data/ext/pack/ruby/internal/cast.h +53 -0
- data/ext/pack/ruby/internal/compiler_is.h +45 -0
- data/ext/pack/ruby/internal/compiler_is/apple.h +41 -0
- data/ext/pack/ruby/internal/compiler_is/clang.h +38 -0
- data/ext/pack/ruby/internal/compiler_is/gcc.h +46 -0
- data/ext/pack/ruby/internal/compiler_is/intel.h +41 -0
- data/ext/pack/ruby/internal/compiler_is/msvc.h +57 -0
- data/ext/pack/ruby/internal/compiler_is/sunpro.h +55 -0
- data/ext/pack/ruby/internal/compiler_since.h +61 -0
- data/ext/pack/ruby/internal/config.h +131 -0
- data/ext/pack/ruby/internal/constant_p.h +37 -0
- data/ext/pack/ruby/internal/core.h +35 -0
- data/ext/pack/ruby/internal/core/rarray.h +275 -0
- data/ext/pack/ruby/internal/core/rbasic.h +85 -0
- data/ext/pack/ruby/internal/core/rbignum.h +51 -0
- data/ext/pack/ruby/internal/core/rclass.h +47 -0
- data/ext/pack/ruby/internal/core/rdata.h +174 -0
- data/ext/pack/ruby/internal/core/rfile.h +36 -0
- data/ext/pack/ruby/internal/core/rhash.h +62 -0
- data/ext/pack/ruby/internal/core/rmatch.h +73 -0
- data/ext/pack/ruby/internal/core/robject.h +97 -0
- data/ext/pack/ruby/internal/core/rregexp.h +84 -0
- data/ext/pack/ruby/internal/core/rstring.h +215 -0
- data/ext/pack/ruby/internal/core/rstruct.h +73 -0
- data/ext/pack/ruby/internal/core/rtypeddata.h +184 -0
- data/ext/pack/ruby/internal/ctype.h +203 -0
- data/ext/pack/ruby/internal/dllexport.h +92 -0
- data/ext/pack/ruby/internal/dosish.h +63 -0
- data/ext/pack/ruby/internal/error.h +74 -0
- data/ext/pack/ruby/internal/eval.h +50 -0
- data/ext/pack/ruby/internal/event.h +75 -0
- data/ext/pack/ruby/internal/fl_type.h +469 -0
- data/ext/pack/ruby/internal/gc.h +35 -0
- data/ext/pack/ruby/internal/glob.h +35 -0
- data/ext/pack/ruby/internal/globals.h +159 -0
- data/ext/pack/ruby/internal/has/attribute.h +164 -0
- data/ext/pack/ruby/internal/has/builtin.h +105 -0
- data/ext/pack/ruby/internal/has/c_attribute.h +38 -0
- data/ext/pack/ruby/internal/has/cpp_attribute.h +79 -0
- data/ext/pack/ruby/internal/has/declspec_attribute.h +48 -0
- data/ext/pack/ruby/internal/has/extension.h +33 -0
- data/ext/pack/ruby/internal/has/feature.h +31 -0
- data/ext/pack/ruby/internal/has/warning.h +31 -0
- data/ext/pack/ruby/internal/intern/array.h +78 -0
- data/ext/pack/ruby/internal/intern/bignum.h +105 -0
- data/ext/pack/ruby/internal/intern/class.h +57 -0
- data/ext/pack/ruby/internal/intern/compar.h +34 -0
- data/ext/pack/ruby/internal/intern/complex.h +60 -0
- data/ext/pack/ruby/internal/intern/cont.h +40 -0
- data/ext/pack/ruby/internal/intern/dir.h +33 -0
- data/ext/pack/ruby/internal/intern/enum.h +33 -0
- data/ext/pack/ruby/internal/intern/enumerator.h +79 -0
- data/ext/pack/ruby/internal/intern/error.h +82 -0
- data/ext/pack/ruby/internal/intern/eval.h +59 -0
- data/ext/pack/ruby/internal/intern/file.h +44 -0
- data/ext/pack/ruby/internal/intern/gc.h +57 -0
- data/ext/pack/ruby/internal/intern/hash.h +59 -0
- data/ext/pack/ruby/internal/intern/io.h +70 -0
- data/ext/pack/ruby/internal/intern/load.h +39 -0
- data/ext/pack/ruby/internal/intern/marshal.h +35 -0
- data/ext/pack/ruby/internal/intern/numeric.h +42 -0
- data/ext/pack/ruby/internal/intern/object.h +90 -0
- data/ext/pack/ruby/internal/intern/parse.h +64 -0
- data/ext/pack/ruby/internal/intern/proc.h +53 -0
- data/ext/pack/ruby/internal/intern/process.h +46 -0
- data/ext/pack/ruby/internal/intern/random.h +45 -0
- data/ext/pack/ruby/internal/intern/range.h +35 -0
- data/ext/pack/ruby/internal/intern/rational.h +46 -0
- data/ext/pack/ruby/internal/intern/re.h +50 -0
- data/ext/pack/ruby/internal/intern/ruby.h +37 -0
- data/ext/pack/ruby/internal/intern/select.h +52 -0
- data/ext/pack/ruby/internal/intern/select/largesize.h +103 -0
- data/ext/pack/ruby/internal/intern/select/posix.h +82 -0
- data/ext/pack/ruby/internal/intern/select/win32.h +124 -0
- data/ext/pack/ruby/internal/intern/signal.h +40 -0
- data/ext/pack/ruby/internal/intern/sprintf.h +43 -0
- data/ext/pack/ruby/internal/intern/string.h +290 -0
- data/ext/pack/ruby/internal/intern/struct.h +47 -0
- data/ext/pack/ruby/internal/intern/thread.h +76 -0
- data/ext/pack/ruby/internal/intern/time.h +52 -0
- data/ext/pack/ruby/internal/intern/variable.h +83 -0
- data/ext/pack/ruby/internal/intern/vm.h +77 -0
- data/ext/pack/ruby/internal/interpreter.h +94 -0
- data/ext/pack/ruby/internal/iterator.h +65 -0
- data/ext/pack/ruby/internal/memory.h +286 -0
- data/ext/pack/ruby/internal/method.h +39 -0
- data/ext/pack/ruby/internal/module.h +39 -0
- data/ext/pack/ruby/internal/newobj.h +73 -0
- data/ext/pack/ruby/internal/rgengc.h +199 -0
- data/ext/pack/ruby/internal/scan_args.h +394 -0
- data/ext/pack/ruby/internal/special_consts.h +204 -0
- data/ext/pack/ruby/internal/static_assert.h +77 -0
- data/ext/pack/ruby/internal/stdalign.h +124 -0
- data/ext/pack/ruby/internal/stdbool.h +51 -0
- data/ext/pack/ruby/internal/symbol.h +114 -0
- data/ext/pack/ruby/internal/token_paste.h +75 -0
- data/ext/pack/ruby/internal/value.h +66 -0
- data/ext/pack/ruby/internal/value_type.h +354 -0
- data/ext/pack/ruby/internal/variable.h +62 -0
- data/ext/pack/ruby/internal/warning_push.h +91 -0
- data/ext/pack/ruby/internal/xmalloc.h +201 -0
- data/lib/zscan.rb +1 -1
- data/readme.md +2 -0
- data/zscan.gemspec +1 -1
- metadata +162 -2
@@ -0,0 +1,286 @@
|
|
1
|
+
#ifndef RBIMPL_MEMORY_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_MEMORY_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Memory management stuff.
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/config.h"
|
24
|
+
|
25
|
+
#ifdef STDC_HEADERS
|
26
|
+
# include <stddef.h>
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#ifdef HAVE_STRING_H
|
30
|
+
# include <string.h>
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#ifdef HAVE_STDINT_H
|
34
|
+
# include <stdint.h>
|
35
|
+
#endif
|
36
|
+
|
37
|
+
#ifdef HAVE_ALLOCA_H
|
38
|
+
# include <alloca.h>
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#if defined(_MSC_VER) && defined(_WIN64)
|
42
|
+
# include <intrin.h>
|
43
|
+
# pragma intrinsic(_umul128)
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#include "ruby/internal/attr/alloc_size.h"
|
47
|
+
#include "ruby/internal/attr/const.h"
|
48
|
+
#include "ruby/internal/attr/constexpr.h"
|
49
|
+
#include "ruby/internal/attr/noalias.h"
|
50
|
+
#include "ruby/internal/attr/nonnull.h"
|
51
|
+
#include "ruby/internal/attr/noreturn.h"
|
52
|
+
#include "ruby/internal/attr/restrict.h"
|
53
|
+
#include "ruby/internal/attr/returns_nonnull.h"
|
54
|
+
#include "ruby/internal/cast.h"
|
55
|
+
#include "ruby/internal/dllexport.h"
|
56
|
+
#include "ruby/internal/has/builtin.h"
|
57
|
+
#include "ruby/internal/stdalign.h"
|
58
|
+
#include "ruby/internal/stdbool.h"
|
59
|
+
#include "ruby/internal/xmalloc.h"
|
60
|
+
#include "ruby/backward/2/limits.h"
|
61
|
+
#include "ruby/backward/2/long_long.h"
|
62
|
+
#include "ruby/backward/2/assume.h"
|
63
|
+
#include "ruby/defines.h"
|
64
|
+
|
65
|
+
/* Make alloca work the best possible way. */
|
66
|
+
#if defined(alloca)
|
67
|
+
# /* Take that. */
|
68
|
+
#elif RBIMPL_HAS_BUILTIN(__builtin_alloca)
|
69
|
+
# define alloca __builtin_alloca
|
70
|
+
#elif defined(_AIX)
|
71
|
+
# pragma alloca
|
72
|
+
#elif defined(__cplusplus)
|
73
|
+
extern "C" void *alloca(size_t);
|
74
|
+
#else
|
75
|
+
extern void *alloca();
|
76
|
+
#endif
|
77
|
+
|
78
|
+
#if defined(HAVE_INT128_T) && SIZEOF_SIZE_T <= 8
|
79
|
+
# define DSIZE_T uint128_t
|
80
|
+
#elif SIZEOF_SIZE_T * 2 <= SIZEOF_LONG_LONG
|
81
|
+
# define DSIZE_T unsigned LONG_LONG
|
82
|
+
#endif
|
83
|
+
|
84
|
+
#ifdef C_ALLOCA
|
85
|
+
# define RUBY_ALLOCV_LIMIT 0
|
86
|
+
#else
|
87
|
+
# define RUBY_ALLOCV_LIMIT 1024
|
88
|
+
#endif
|
89
|
+
|
90
|
+
#ifdef __GNUC__
|
91
|
+
#define RB_GC_GUARD(v) \
|
92
|
+
(*__extension__ ({ \
|
93
|
+
volatile VALUE *rb_gc_guarded_ptr = &(v); \
|
94
|
+
__asm__("" : : "m"(rb_gc_guarded_ptr)); \
|
95
|
+
rb_gc_guarded_ptr; \
|
96
|
+
}))
|
97
|
+
#elif defined _MSC_VER
|
98
|
+
#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr(&(v)))
|
99
|
+
#else
|
100
|
+
#define HAVE_RB_GC_GUARDED_PTR_VAL 1
|
101
|
+
#define RB_GC_GUARD(v) (*rb_gc_guarded_ptr_val(&(v),(v)))
|
102
|
+
#endif
|
103
|
+
|
104
|
+
/* Casts needed because void* is NOT compaible with others in C++. */
|
105
|
+
#define RB_ALLOC_N(type,n) RBIMPL_CAST((type *)ruby_xmalloc2((n), sizeof(type)))
|
106
|
+
#define RB_ALLOC(type) RBIMPL_CAST((type *)ruby_xmalloc(sizeof(type)))
|
107
|
+
#define RB_ZALLOC_N(type,n) RBIMPL_CAST((type *)ruby_xcalloc((n), sizeof(type)))
|
108
|
+
#define RB_ZALLOC(type) (RB_ZALLOC_N(type, 1))
|
109
|
+
#define RB_REALLOC_N(var,type,n) \
|
110
|
+
((var) = RBIMPL_CAST((type *)ruby_xrealloc2((void *)(var), (n), sizeof(type))))
|
111
|
+
|
112
|
+
/* I don't know why but __builtin_alloca_with_align's second argument
|
113
|
+
takes bits rather than bytes. */
|
114
|
+
#if RBIMPL_HAS_BUILTIN(__builtin_alloca_with_align)
|
115
|
+
# define ALLOCA_N(type, n) \
|
116
|
+
RBIMPL_CAST((type *) \
|
117
|
+
__builtin_alloca_with_align( \
|
118
|
+
rbimpl_size_mul_or_raise(sizeof(type), (n)), \
|
119
|
+
RUBY_ALIGNOF(type) * CHAR_BIT))
|
120
|
+
#else
|
121
|
+
# define ALLOCA_N(type,n) \
|
122
|
+
RBIMPL_CAST((type *)alloca(rbimpl_size_mul_or_raise(sizeof(type), (n))))
|
123
|
+
#endif
|
124
|
+
|
125
|
+
/* allocates _n_ bytes temporary buffer and stores VALUE including it
|
126
|
+
* in _v_. _n_ may be evaluated twice. */
|
127
|
+
#define RB_ALLOCV(v, n) \
|
128
|
+
((n) < RUBY_ALLOCV_LIMIT ? \
|
129
|
+
((v) = 0, alloca(n)) : \
|
130
|
+
rb_alloc_tmp_buffer(&(v), (n)))
|
131
|
+
#define RB_ALLOCV_N(type, v, n) \
|
132
|
+
RBIMPL_CAST((type *) \
|
133
|
+
(((size_t)(n) < RUBY_ALLOCV_LIMIT / sizeof(type)) ? \
|
134
|
+
((v) = 0, alloca((n) * sizeof(type))) : \
|
135
|
+
rb_alloc_tmp_buffer2(&(v), (n), sizeof(type))))
|
136
|
+
#define RB_ALLOCV_END(v) rb_free_tmp_buffer(&(v))
|
137
|
+
|
138
|
+
#define MEMZERO(p,type,n) memset((p), 0, rbimpl_size_mul_or_raise(sizeof(type), (n)))
|
139
|
+
#define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), rbimpl_size_mul_or_raise(sizeof(type), (n)))
|
140
|
+
#define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), rbimpl_size_mul_or_raise(sizeof(type), (n)))
|
141
|
+
#define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), rbimpl_size_mul_or_raise(sizeof(type), (n)))
|
142
|
+
|
143
|
+
#define ALLOC_N RB_ALLOC_N
|
144
|
+
#define ALLOC RB_ALLOC
|
145
|
+
#define ZALLOC_N RB_ZALLOC_N
|
146
|
+
#define ZALLOC RB_ZALLOC
|
147
|
+
#define REALLOC_N RB_REALLOC_N
|
148
|
+
#define ALLOCV RB_ALLOCV
|
149
|
+
#define ALLOCV_N RB_ALLOCV_N
|
150
|
+
#define ALLOCV_END RB_ALLOCV_END
|
151
|
+
|
152
|
+
/* Expecting this struct to be eliminated by function inlinings */
|
153
|
+
struct rbimpl_size_mul_overflow_tag {
|
154
|
+
bool left;
|
155
|
+
size_t right;
|
156
|
+
};
|
157
|
+
|
158
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
159
|
+
RBIMPL_ATTR_RESTRICT()
|
160
|
+
RBIMPL_ATTR_RETURNS_NONNULL()
|
161
|
+
RBIMPL_ATTR_ALLOC_SIZE((2))
|
162
|
+
void *rb_alloc_tmp_buffer(volatile VALUE *store, long len);
|
163
|
+
|
164
|
+
RBIMPL_ATTR_RESTRICT()
|
165
|
+
RBIMPL_ATTR_RETURNS_NONNULL()
|
166
|
+
RBIMPL_ATTR_ALLOC_SIZE((2,3))
|
167
|
+
void *rb_alloc_tmp_buffer_with_count(volatile VALUE *store, size_t len,size_t count);
|
168
|
+
|
169
|
+
void rb_free_tmp_buffer(volatile VALUE *store);
|
170
|
+
|
171
|
+
RBIMPL_ATTR_NORETURN()
|
172
|
+
void ruby_malloc_size_overflow(size_t, size_t);
|
173
|
+
|
174
|
+
#ifdef HAVE_RB_GC_GUARDED_PTR_VAL
|
175
|
+
volatile VALUE *rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val);
|
176
|
+
#endif
|
177
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
178
|
+
|
179
|
+
#ifdef _MSC_VER
|
180
|
+
# pragma optimize("", off)
|
181
|
+
|
182
|
+
static inline volatile VALUE *
|
183
|
+
rb_gc_guarded_ptr(volatile VALUE *ptr)
|
184
|
+
{
|
185
|
+
return ptr;
|
186
|
+
}
|
187
|
+
|
188
|
+
# pragma optimize("", on)
|
189
|
+
#endif
|
190
|
+
|
191
|
+
/* Does anyone use it? Just here for backwards compatibility. */
|
192
|
+
static inline int
|
193
|
+
rb_mul_size_overflow(size_t a, size_t b, size_t max, size_t *c)
|
194
|
+
{
|
195
|
+
#ifdef DSIZE_T
|
196
|
+
RB_GNUC_EXTENSION DSIZE_T da, db, c2;
|
197
|
+
da = a;
|
198
|
+
db = b;
|
199
|
+
c2 = da * db;
|
200
|
+
if (c2 > max) return 1;
|
201
|
+
*c = RBIMPL_CAST((size_t)c2);
|
202
|
+
#else
|
203
|
+
if (b != 0 && a > max / b) return 1;
|
204
|
+
*c = a * b;
|
205
|
+
#endif
|
206
|
+
return 0;
|
207
|
+
}
|
208
|
+
|
209
|
+
#if RBIMPL_COMPILER_SINCE(GCC, 7, 0, 0)
|
210
|
+
RBIMPL_ATTR_CONSTEXPR(CXX14) /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70507 */
|
211
|
+
#elif RBIMPL_COMPILER_SINCE(Clang, 7, 0, 0)
|
212
|
+
RBIMPL_ATTR_CONSTEXPR(CXX14) /* https://bugs.llvm.org/show_bug.cgi?id=37633 */
|
213
|
+
#endif
|
214
|
+
RBIMPL_ATTR_CONST()
|
215
|
+
static inline struct rbimpl_size_mul_overflow_tag
|
216
|
+
rbimpl_size_mul_overflow(size_t x, size_t y)
|
217
|
+
{
|
218
|
+
struct rbimpl_size_mul_overflow_tag ret = { false, 0, };
|
219
|
+
|
220
|
+
#if RBIMPL_HAS_BUILTIN(__builtin_mul_overflow)
|
221
|
+
ret.left = __builtin_mul_overflow(x, y, &ret.right);
|
222
|
+
|
223
|
+
#elif defined(DSIZE_T)
|
224
|
+
RB_GNUC_EXTENSION DSIZE_T dx = x;
|
225
|
+
RB_GNUC_EXTENSION DSIZE_T dy = y;
|
226
|
+
RB_GNUC_EXTENSION DSIZE_T dz = dx * dy;
|
227
|
+
ret.left = dz > SIZE_MAX;
|
228
|
+
ret.right = RBIMPL_CAST((size_t)dz);
|
229
|
+
|
230
|
+
#elif defined(_MSC_VER) && defined(_WIN64)
|
231
|
+
unsigned __int64 dp = 0;
|
232
|
+
unsigned __int64 dz = _umul128(x, y, &dp);
|
233
|
+
ret.left = RBIMPL_CAST((bool)dp);
|
234
|
+
ret.right = RBIMPL_CAST((size_t)dz);
|
235
|
+
|
236
|
+
#else
|
237
|
+
/* https://wiki.sei.cmu.edu/confluence/display/c/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap */
|
238
|
+
ret.left = (y != 0) && (x > SIZE_MAX / y);
|
239
|
+
ret.right = x * y;
|
240
|
+
#endif
|
241
|
+
|
242
|
+
return ret;
|
243
|
+
}
|
244
|
+
|
245
|
+
static inline size_t
|
246
|
+
rbimpl_size_mul_or_raise(size_t x, size_t y)
|
247
|
+
{
|
248
|
+
struct rbimpl_size_mul_overflow_tag size =
|
249
|
+
rbimpl_size_mul_overflow(x, y);
|
250
|
+
|
251
|
+
if (RB_LIKELY(! size.left)) {
|
252
|
+
return size.right;
|
253
|
+
}
|
254
|
+
else {
|
255
|
+
ruby_malloc_size_overflow(x, y);
|
256
|
+
RBIMPL_UNREACHABLE_RETURN(0);
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
static inline void *
|
261
|
+
rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize)
|
262
|
+
{
|
263
|
+
return rb_alloc_tmp_buffer_with_count(
|
264
|
+
store, rbimpl_size_mul_or_raise(count, elsize), count);
|
265
|
+
}
|
266
|
+
|
267
|
+
RBIMPL_ATTR_NOALIAS()
|
268
|
+
RBIMPL_ATTR_NONNULL((1))
|
269
|
+
RBIMPL_ATTR_RETURNS_NONNULL()
|
270
|
+
/* At least since 2004, glibc's <string.h> annotates memcpy to be
|
271
|
+
* __attribute__((__nonnull__(1, 2))). However it is safe to pass NULL to the
|
272
|
+
* source pointer, if n is 0. Let's wrap memcpy. */
|
273
|
+
static inline void *
|
274
|
+
ruby_nonempty_memcpy(void *dest, const void *src, size_t n)
|
275
|
+
{
|
276
|
+
if (n) {
|
277
|
+
return memcpy(dest, src, n);
|
278
|
+
}
|
279
|
+
else {
|
280
|
+
return dest;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
#undef memcpy
|
284
|
+
#define memcpy ruby_nonempty_memcpy
|
285
|
+
|
286
|
+
#endif /* RBIMPL_MEMORY_H */
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#ifndef RBIMPL_METHOD_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_METHOD_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Creation and modification of Ruby methods.
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/dllexport.h"
|
24
|
+
#include "ruby/internal/value.h"
|
25
|
+
#include "ruby/backward/2/stdarg.h"
|
26
|
+
|
27
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
28
|
+
|
29
|
+
void rb_define_method(VALUE,const char*,VALUE(*)(ANYARGS),int);
|
30
|
+
void rb_define_module_function(VALUE,const char*,VALUE(*)(ANYARGS),int);
|
31
|
+
void rb_define_global_function(const char*,VALUE(*)(ANYARGS),int);
|
32
|
+
|
33
|
+
void rb_undef_method(VALUE,const char*);
|
34
|
+
void rb_define_alias(VALUE,const char*,const char*);
|
35
|
+
void rb_define_attr(VALUE,const char*,int,int);
|
36
|
+
|
37
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
38
|
+
|
39
|
+
#endif /* RBIMPL_METHOD_H */
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#ifndef RBIMPL_MODULE_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_MODULE_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Creation and modification of Ruby modules.
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/dllexport.h"
|
24
|
+
#include "ruby/internal/value.h"
|
25
|
+
|
26
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
27
|
+
|
28
|
+
VALUE rb_define_class(const char*,VALUE);
|
29
|
+
VALUE rb_define_module(const char*);
|
30
|
+
VALUE rb_define_class_under(VALUE, const char*, VALUE);
|
31
|
+
VALUE rb_define_module_under(VALUE, const char*);
|
32
|
+
|
33
|
+
void rb_include_module(VALUE,VALUE);
|
34
|
+
void rb_extend_object(VALUE,VALUE);
|
35
|
+
void rb_prepend_module(VALUE,VALUE);
|
36
|
+
|
37
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
38
|
+
|
39
|
+
#endif /* RBIMPL_MODULE_H */
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#ifndef RBIMPL_NEWOBJ_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_NEWOBJ_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief Defines #NEWOBJ.
|
22
|
+
*/
|
23
|
+
#include "ruby/internal/cast.h"
|
24
|
+
#include "ruby/internal/core/rbasic.h"
|
25
|
+
#include "ruby/internal/dllexport.h"
|
26
|
+
#include "ruby/internal/fl_type.h"
|
27
|
+
#include "ruby/internal/special_consts.h"
|
28
|
+
#include "ruby/internal/value.h"
|
29
|
+
#include "ruby/assert.h"
|
30
|
+
|
31
|
+
#define RB_NEWOBJ(obj,type) type *(obj) = RBIMPL_CAST((type *)rb_newobj())
|
32
|
+
#define RB_NEWOBJ_OF(obj,type,klass,flags) type *(obj) = RBIMPL_CAST((type *)rb_newobj_of(klass, flags))
|
33
|
+
|
34
|
+
#define NEWOBJ RB_NEWOBJ
|
35
|
+
#define NEWOBJ_OF RB_NEWOBJ_OF /* core has special NEWOBJ_OF() in internal.h */
|
36
|
+
#define OBJSETUP rb_obj_setup /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
|
37
|
+
#define CLONESETUP rb_clone_setup
|
38
|
+
#define DUPSETUP rb_dup_setup
|
39
|
+
|
40
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
41
|
+
VALUE rb_newobj(void);
|
42
|
+
VALUE rb_newobj_of(VALUE, VALUE);
|
43
|
+
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
|
44
|
+
VALUE rb_obj_class(VALUE);
|
45
|
+
VALUE rb_singleton_class_clone(VALUE);
|
46
|
+
void rb_singleton_class_attached(VALUE,VALUE);
|
47
|
+
void rb_copy_generic_ivar(VALUE,VALUE);
|
48
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
49
|
+
|
50
|
+
static inline void
|
51
|
+
rb_clone_setup(VALUE clone, VALUE obj)
|
52
|
+
{
|
53
|
+
RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj));
|
54
|
+
RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(clone));
|
55
|
+
|
56
|
+
const VALUE flags = RUBY_FL_PROMOTED0 | RUBY_FL_PROMOTED1 | RUBY_FL_FINALIZE;
|
57
|
+
rb_obj_setup(clone, rb_singleton_class_clone(obj),
|
58
|
+
RB_FL_TEST_RAW(obj, ~flags));
|
59
|
+
rb_singleton_class_attached(RBASIC_CLASS(clone), clone);
|
60
|
+
if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(clone, obj);
|
61
|
+
}
|
62
|
+
|
63
|
+
static inline void
|
64
|
+
rb_dup_setup(VALUE dup, VALUE obj)
|
65
|
+
{
|
66
|
+
RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj));
|
67
|
+
RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(dup));
|
68
|
+
|
69
|
+
rb_obj_setup(dup, rb_obj_class(obj), RB_FL_TEST_RAW(obj, RUBY_FL_DUPPED));
|
70
|
+
if (RB_FL_TEST(obj, RUBY_FL_EXIVAR)) rb_copy_generic_ivar(dup, obj);
|
71
|
+
}
|
72
|
+
|
73
|
+
#endif /* RBIMPL_NEWOBJ_H */
|
@@ -0,0 +1,199 @@
|
|
1
|
+
#ifndef RBIMPL_RGENGC_H /*-*-C++-*-vi:se ft=cpp:*/
|
2
|
+
#define RBIMPL_RGENGC_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
11
|
+
* implementation details. Don't take them as canon. They could
|
12
|
+
* rapidly appear then vanish. The name (path) of this header file
|
13
|
+
* is also an implementation detail. Do not expect it to persist
|
14
|
+
* at the place it is now. Developers are free to move it anywhere
|
15
|
+
* anytime at will.
|
16
|
+
* @note To ruby-core: remember that this header can be possibly
|
17
|
+
* recursively included from extension libraries written in C++.
|
18
|
+
* Do not expect for instance `__VA_ARGS__` is always available.
|
19
|
+
* We assume C99 for ruby itself but we don't assume languages of
|
20
|
+
* extension libraries. They could be written in C++98.
|
21
|
+
* @brief RGENGC write-barrier APIs.
|
22
|
+
* @see Sasada, K., "Gradual write-barrier insertion into a Ruby
|
23
|
+
* interpreter", in proceedings of the 2019 ACM SIGPLAN
|
24
|
+
* International Symposium on Memory Management (ISMM 2019), pp
|
25
|
+
* 115-121, 2019. https://doi.org/10.1145/3315573.3329986
|
26
|
+
*/
|
27
|
+
#include "ruby/internal/attr/artificial.h"
|
28
|
+
#include "ruby/internal/attr/pure.h"
|
29
|
+
#include "ruby/internal/dllexport.h"
|
30
|
+
#include "ruby/internal/special_consts.h"
|
31
|
+
#include "ruby/internal/stdbool.h"
|
32
|
+
#include "ruby/internal/value.h"
|
33
|
+
#include "ruby/assert.h"
|
34
|
+
#include "ruby/backward/2/attributes.h"
|
35
|
+
|
36
|
+
#undef USE_RGENGC
|
37
|
+
#define USE_RGENGC 1
|
38
|
+
|
39
|
+
#ifndef USE_RINCGC
|
40
|
+
# define USE_RINCGC 1
|
41
|
+
#endif
|
42
|
+
|
43
|
+
#ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
|
44
|
+
# define USE_RGENGC_LOGGING_WB_UNPROTECT 0
|
45
|
+
#endif
|
46
|
+
|
47
|
+
#ifndef RGENGC_WB_PROTECTED_ARRAY
|
48
|
+
# define RGENGC_WB_PROTECTED_ARRAY 1
|
49
|
+
#endif
|
50
|
+
|
51
|
+
#ifndef RGENGC_WB_PROTECTED_HASH
|
52
|
+
# define RGENGC_WB_PROTECTED_HASH 1
|
53
|
+
#endif
|
54
|
+
|
55
|
+
#ifndef RGENGC_WB_PROTECTED_STRUCT
|
56
|
+
# define RGENGC_WB_PROTECTED_STRUCT 1
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#ifndef RGENGC_WB_PROTECTED_STRING
|
60
|
+
# define RGENGC_WB_PROTECTED_STRING 1
|
61
|
+
#endif
|
62
|
+
|
63
|
+
#ifndef RGENGC_WB_PROTECTED_OBJECT
|
64
|
+
# define RGENGC_WB_PROTECTED_OBJECT 1
|
65
|
+
#endif
|
66
|
+
|
67
|
+
#ifndef RGENGC_WB_PROTECTED_REGEXP
|
68
|
+
# define RGENGC_WB_PROTECTED_REGEXP 1
|
69
|
+
#endif
|
70
|
+
|
71
|
+
#ifndef RGENGC_WB_PROTECTED_CLASS
|
72
|
+
# define RGENGC_WB_PROTECTED_CLASS 1
|
73
|
+
#endif
|
74
|
+
|
75
|
+
#ifndef RGENGC_WB_PROTECTED_FLOAT
|
76
|
+
# define RGENGC_WB_PROTECTED_FLOAT 1
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#ifndef RGENGC_WB_PROTECTED_COMPLEX
|
80
|
+
# define RGENGC_WB_PROTECTED_COMPLEX 1
|
81
|
+
#endif
|
82
|
+
|
83
|
+
#ifndef RGENGC_WB_PROTECTED_RATIONAL
|
84
|
+
# define RGENGC_WB_PROTECTED_RATIONAL 1
|
85
|
+
#endif
|
86
|
+
|
87
|
+
#ifndef RGENGC_WB_PROTECTED_BIGNUM
|
88
|
+
# define RGENGC_WB_PROTECTED_BIGNUM 1
|
89
|
+
#endif
|
90
|
+
|
91
|
+
#ifndef RGENGC_WB_PROTECTED_NODE_CREF
|
92
|
+
# define RGENGC_WB_PROTECTED_NODE_CREF 1
|
93
|
+
#endif
|
94
|
+
|
95
|
+
/**
|
96
|
+
* @name Write barrier (WB) interfaces:
|
97
|
+
* @{
|
98
|
+
*
|
99
|
+
* @note The following core interfaces can be changed in the future. Please
|
100
|
+
* catch up if you want to insert WB into C-extensions correctly.
|
101
|
+
*/
|
102
|
+
|
103
|
+
/**
|
104
|
+
* WB for new reference from `a' to `b'. Write `b' into `*slot'. `slot' is a
|
105
|
+
* pointer in `a'.
|
106
|
+
*/
|
107
|
+
#define RB_OBJ_WRITE(a, slot, b) \
|
108
|
+
RBIMPL_CAST(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
|
109
|
+
/**
|
110
|
+
* WB for new reference from `a' to `b'. This doesn't write any values, but
|
111
|
+
* only a WB declaration. `oldv' is replaced value with `b' (not used in
|
112
|
+
* current Ruby).
|
113
|
+
*/
|
114
|
+
#define RB_OBJ_WRITTEN(a, oldv, b) \
|
115
|
+
RBIMPL_CAST(rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__))
|
116
|
+
/** @} */
|
117
|
+
|
118
|
+
#define OBJ_PROMOTED_RAW RB_OBJ_PROMOTED_RAW
|
119
|
+
#define OBJ_PROMOTED RB_OBJ_PROMOTED
|
120
|
+
#define OBJ_WB_UNPROTECT RB_OBJ_WB_UNPROTECT
|
121
|
+
|
122
|
+
#define RB_OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
|
123
|
+
#define RB_OBJ_WB_UNPROTECT_FOR(type, obj) \
|
124
|
+
(RGENGC_WB_PROTECTED_##type ? OBJ_WB_UNPROTECT(obj) : obj)
|
125
|
+
#define RGENGC_LOGGING_WB_UNPROTECT rb_gc_unprotect_logging
|
126
|
+
|
127
|
+
/** @cond INTERNAL_MACRO */
|
128
|
+
#define RB_OBJ_PROMOTED_RAW RB_OBJ_PROMOTED_RAW
|
129
|
+
#define RB_OBJ_PROMOTED RB_OBJ_PROMOTED
|
130
|
+
/** @endcond */
|
131
|
+
|
132
|
+
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
133
|
+
void rb_gc_writebarrier(VALUE a, VALUE b);
|
134
|
+
void rb_gc_writebarrier_unprotect(VALUE obj);
|
135
|
+
#if USE_RGENGC_LOGGING_WB_UNPROTECT
|
136
|
+
void rb_gc_unprotect_logging(void *objptr, const char *filename, int line);
|
137
|
+
#endif
|
138
|
+
RBIMPL_SYMBOL_EXPORT_END()
|
139
|
+
|
140
|
+
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
141
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
142
|
+
static inline bool
|
143
|
+
RB_OBJ_PROMOTED_RAW(VALUE obj)
|
144
|
+
{
|
145
|
+
RBIMPL_ASSERT_OR_ASSUME(RB_FL_ABLE(obj));
|
146
|
+
return RB_FL_ANY_RAW(obj, RUBY_FL_PROMOTED);
|
147
|
+
}
|
148
|
+
|
149
|
+
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
150
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
151
|
+
static inline bool
|
152
|
+
RB_OBJ_PROMOTED(VALUE obj)
|
153
|
+
{
|
154
|
+
if (! RB_FL_ABLE(obj)) {
|
155
|
+
return false;
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
return RB_OBJ_PROMOTED_RAW(obj);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
static inline VALUE
|
163
|
+
rb_obj_wb_unprotect(VALUE x, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
|
164
|
+
{
|
165
|
+
#if USE_RGENGC_LOGGING_WB_UNPROTECT
|
166
|
+
RGENGC_LOGGING_WB_UNPROTECT(RBIMPL_CAST((void *)x), filename, line);
|
167
|
+
#endif
|
168
|
+
rb_gc_writebarrier_unprotect(x);
|
169
|
+
return x;
|
170
|
+
}
|
171
|
+
|
172
|
+
static inline VALUE
|
173
|
+
rb_obj_written(VALUE a, RB_UNUSED_VAR(VALUE oldv), VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
|
174
|
+
{
|
175
|
+
#if USE_RGENGC_LOGGING_WB_UNPROTECT
|
176
|
+
RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line);
|
177
|
+
#endif
|
178
|
+
|
179
|
+
if (!RB_SPECIAL_CONST_P(b)) {
|
180
|
+
rb_gc_writebarrier(a, b);
|
181
|
+
}
|
182
|
+
|
183
|
+
return a;
|
184
|
+
}
|
185
|
+
|
186
|
+
static inline VALUE
|
187
|
+
rb_obj_write(VALUE a, VALUE *slot, VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
|
188
|
+
{
|
189
|
+
#ifdef RGENGC_LOGGING_WRITE
|
190
|
+
RGENGC_LOGGING_WRITE(a, slot, b, filename, line);
|
191
|
+
#endif
|
192
|
+
|
193
|
+
*slot = b;
|
194
|
+
|
195
|
+
rb_obj_written(a, RUBY_Qundef /* ignore `oldv' now */, b, filename, line);
|
196
|
+
return a;
|
197
|
+
}
|
198
|
+
|
199
|
+
#endif /* RBIMPL_RGENGC_H */
|