debase-ruby_core_source 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Rakefile +9 -5
  4. data/lib/debase/ruby_core_source.rb +1 -0
  5. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/addr2line.h +21 -0
  6. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ccan/build_assert/build_assert.h +40 -0
  7. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ccan/check_type/check_type.h +63 -0
  8. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ccan/container_of/container_of.h +142 -0
  9. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ccan/list/list.h +773 -0
  10. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ccan/str/str.h +16 -0
  11. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/constant.h +50 -0
  12. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/dln.h +51 -0
  13. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/encindex.h +67 -0
  14. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/eval_intern.h +315 -0
  15. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/gc.h +114 -0
  16. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/id.h +220 -0
  17. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/id_table.h +31 -0
  18. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/insns.inc +112 -0
  19. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/insns_info.inc +796 -0
  20. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/internal.h +1757 -0
  21. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/iseq.h +252 -0
  22. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/known_errors.inc +746 -0
  23. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/method.h +213 -0
  24. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/node.h +520 -0
  25. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/node_name.inc +208 -0
  26. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/opt_sc.inc +774 -0
  27. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/optinsn.inc +83 -0
  28. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/optunifs.inc +129 -0
  29. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/parse.h +204 -0
  30. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/probes_helper.h +43 -0
  31. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/regenc.h +251 -0
  32. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/regint.h +927 -0
  33. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/regparse.h +369 -0
  34. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/revision.h +1 -0
  35. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ruby_assert.h +54 -0
  36. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/ruby_atomic.h +233 -0
  37. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/siphash.h +48 -0
  38. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/symbol.h +108 -0
  39. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/thread_pthread.h +54 -0
  40. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/thread_win32.h +36 -0
  41. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/timev.h +42 -0
  42. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/transcode_data.h +139 -0
  43. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/version.h +73 -0
  44. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm.inc +3412 -0
  45. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm_call_iseq_optimized.inc +212 -0
  46. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm_core.h +1644 -0
  47. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm_debug.h +37 -0
  48. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm_exec.h +182 -0
  49. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm_insnhelper.h +227 -0
  50. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vm_opts.h +57 -0
  51. data/lib/debase/ruby_core_source/ruby-2.4.0-rc1/vmtc.inc +110 -0
  52. data/lib/debase/ruby_core_source/version.rb +1 -1
  53. metadata +49 -2
@@ -0,0 +1,1757 @@
1
+ /**********************************************************************
2
+
3
+ internal.h -
4
+
5
+ $Author$
6
+ created at: Tue May 17 11:42:20 JST 2011
7
+
8
+ Copyright (C) 2011 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_INTERNAL_H
13
+ #define RUBY_INTERNAL_H 1
14
+
15
+ #include "ruby.h"
16
+ #include "ruby/encoding.h"
17
+ #include "ruby/io.h"
18
+
19
+ #if defined(__cplusplus)
20
+ extern "C" {
21
+ #if 0
22
+ } /* satisfy cc-mode */
23
+ #endif
24
+ #endif
25
+
26
+ #define LIKELY(x) RB_LIKELY(x)
27
+ #define UNLIKELY(x) RB_UNLIKELY(x)
28
+
29
+ #ifndef MAYBE_UNUSED
30
+ # define MAYBE_UNUSED(x) x
31
+ #endif
32
+
33
+ #ifndef WARN_UNUSED_RESULT
34
+ # define WARN_UNUSED_RESULT(x) x
35
+ #endif
36
+
37
+ #ifdef HAVE_VALGRIND_MEMCHECK_H
38
+ # include <valgrind/memcheck.h>
39
+ # ifndef VALGRIND_MAKE_MEM_DEFINED
40
+ # define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
41
+ # endif
42
+ # ifndef VALGRIND_MAKE_MEM_UNDEFINED
43
+ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
44
+ # endif
45
+ #else
46
+ # define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
47
+ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
48
+ #endif
49
+
50
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
51
+
52
+ #ifndef __has_feature
53
+ # define __has_feature(x) 0
54
+ #endif
55
+
56
+ #ifndef __has_extension
57
+ # define __has_extension __has_feature
58
+ #endif
59
+
60
+ #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
61
+ # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
62
+ #else
63
+ # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
64
+ #endif
65
+
66
+ #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
67
+ #define SIGNED_INTEGER_MAX(sint_type) \
68
+ (sint_type) \
69
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \
70
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1))
71
+ #define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1)
72
+ #define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0)
73
+
74
+ #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
75
+ # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
76
+ # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
77
+ #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
78
+ # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
79
+ # define TIMET_MIN ((time_t)0)
80
+ #endif
81
+ #define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
82
+
83
+ #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
84
+ (a) == 0 ? 0 : \
85
+ (a) == -1 ? (b) < -(max) : \
86
+ (a) > 0 ? \
87
+ ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
88
+ ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
89
+ #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
90
+ #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
91
+ #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
92
+
93
+ #ifndef swap16
94
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
95
+ # define swap16(x) __builtin_bswap16(x)
96
+ # endif
97
+ #endif
98
+
99
+ #ifndef swap16
100
+ # define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
101
+ #endif
102
+
103
+ #ifndef swap32
104
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP32
105
+ # define swap32(x) __builtin_bswap32(x)
106
+ # endif
107
+ #endif
108
+
109
+ #ifndef swap32
110
+ # define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
111
+ |(((x)>>24)&0xFF) \
112
+ |(((x)&0x0000FF00)<<8) \
113
+ |(((x)&0x00FF0000)>>8) ))
114
+ #endif
115
+
116
+ #ifndef swap64
117
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP64
118
+ # define swap64(x) __builtin_bswap64(x)
119
+ # endif
120
+ #endif
121
+
122
+ #ifndef swap64
123
+ # ifdef HAVE_INT64_T
124
+ # define byte_in_64bit(n) ((uint64_t)0xff << (n))
125
+ # define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
126
+ |(((x)>>56)&0xFF) \
127
+ |(((x)&byte_in_64bit(8))<<40) \
128
+ |(((x)&byte_in_64bit(48))>>40) \
129
+ |(((x)&byte_in_64bit(16))<<24) \
130
+ |(((x)&byte_in_64bit(40))>>24) \
131
+ |(((x)&byte_in_64bit(24))<<8) \
132
+ |(((x)&byte_in_64bit(32))>>8)))
133
+ # endif
134
+ #endif
135
+
136
+ static inline int
137
+ nlz_int(unsigned int x)
138
+ {
139
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZ)
140
+ if (x == 0) return SIZEOF_INT * CHAR_BIT;
141
+ return __builtin_clz(x);
142
+ #else
143
+ unsigned int y;
144
+ # if 64 < SIZEOF_INT * CHAR_BIT
145
+ int n = 128;
146
+ # elif 32 < SIZEOF_INT * CHAR_BIT
147
+ int n = 64;
148
+ # else
149
+ int n = 32;
150
+ # endif
151
+ # if 64 < SIZEOF_INT * CHAR_BIT
152
+ y = x >> 64; if (y) {n -= 64; x = y;}
153
+ # endif
154
+ # if 32 < SIZEOF_INT * CHAR_BIT
155
+ y = x >> 32; if (y) {n -= 32; x = y;}
156
+ # endif
157
+ y = x >> 16; if (y) {n -= 16; x = y;}
158
+ y = x >> 8; if (y) {n -= 8; x = y;}
159
+ y = x >> 4; if (y) {n -= 4; x = y;}
160
+ y = x >> 2; if (y) {n -= 2; x = y;}
161
+ y = x >> 1; if (y) {return n - 2;}
162
+ return (int)(n - x);
163
+ #endif
164
+ }
165
+
166
+ static inline int
167
+ nlz_long(unsigned long x)
168
+ {
169
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZL)
170
+ if (x == 0) return SIZEOF_LONG * CHAR_BIT;
171
+ return __builtin_clzl(x);
172
+ #else
173
+ unsigned long y;
174
+ # if 64 < SIZEOF_LONG * CHAR_BIT
175
+ int n = 128;
176
+ # elif 32 < SIZEOF_LONG * CHAR_BIT
177
+ int n = 64;
178
+ # else
179
+ int n = 32;
180
+ # endif
181
+ # if 64 < SIZEOF_LONG * CHAR_BIT
182
+ y = x >> 64; if (y) {n -= 64; x = y;}
183
+ # endif
184
+ # if 32 < SIZEOF_LONG * CHAR_BIT
185
+ y = x >> 32; if (y) {n -= 32; x = y;}
186
+ # endif
187
+ y = x >> 16; if (y) {n -= 16; x = y;}
188
+ y = x >> 8; if (y) {n -= 8; x = y;}
189
+ y = x >> 4; if (y) {n -= 4; x = y;}
190
+ y = x >> 2; if (y) {n -= 2; x = y;}
191
+ y = x >> 1; if (y) {return n - 2;}
192
+ return (int)(n - x);
193
+ #endif
194
+ }
195
+
196
+ #ifdef HAVE_LONG_LONG
197
+ static inline int
198
+ nlz_long_long(unsigned LONG_LONG x)
199
+ {
200
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
201
+ if (x == 0) return SIZEOF_LONG_LONG * CHAR_BIT;
202
+ return __builtin_clzll(x);
203
+ #else
204
+ unsigned LONG_LONG y;
205
+ # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
206
+ int n = 128;
207
+ # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
208
+ int n = 64;
209
+ # else
210
+ int n = 32;
211
+ # endif
212
+ # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
213
+ y = x >> 64; if (y) {n -= 64; x = y;}
214
+ # endif
215
+ # if 32 < SIZEOF_LONG_LONG * CHAR_BIT
216
+ y = x >> 32; if (y) {n -= 32; x = y;}
217
+ # endif
218
+ y = x >> 16; if (y) {n -= 16; x = y;}
219
+ y = x >> 8; if (y) {n -= 8; x = y;}
220
+ y = x >> 4; if (y) {n -= 4; x = y;}
221
+ y = x >> 2; if (y) {n -= 2; x = y;}
222
+ y = x >> 1; if (y) {return n - 2;}
223
+ return (int)(n - x);
224
+ #endif
225
+ }
226
+ #endif
227
+
228
+ #ifdef HAVE_UINT128_T
229
+ static inline int
230
+ nlz_int128(uint128_t x)
231
+ {
232
+ uint128_t y;
233
+ int n = 128;
234
+ y = x >> 64; if (y) {n -= 64; x = y;}
235
+ y = x >> 32; if (y) {n -= 32; x = y;}
236
+ y = x >> 16; if (y) {n -= 16; x = y;}
237
+ y = x >> 8; if (y) {n -= 8; x = y;}
238
+ y = x >> 4; if (y) {n -= 4; x = y;}
239
+ y = x >> 2; if (y) {n -= 2; x = y;}
240
+ y = x >> 1; if (y) {return n - 2;}
241
+ return (int)(n - x);
242
+ }
243
+ #endif
244
+
245
+ static inline int
246
+ nlz_intptr(uintptr_t x) {
247
+ #if SIZEOF_VOIDP == 8
248
+ return nlz_long_long(x);
249
+ #elif SIZEOF_VOIDP == 4
250
+ return nlz_int(x);
251
+ #endif
252
+ }
253
+
254
+ static inline int
255
+ rb_popcount32(uint32_t x) {
256
+ #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
257
+ return __builtin_popcount(x);
258
+ #else
259
+ x = (x & 0x55555555) + (x >> 1 & 0x55555555);
260
+ x = (x & 0x33333333) + (x >> 2 & 0x33333333);
261
+ x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
262
+ x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
263
+ return (x & 0x0000003f) + (x >>16 & 0x0000003f);
264
+ #endif
265
+ }
266
+
267
+ static inline int
268
+ rb_popcount64(uint64_t x) {
269
+ #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
270
+ return __builtin_popcountll(x);
271
+ #else
272
+ x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
273
+ x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
274
+ x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
275
+ x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
276
+ x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
277
+ return (x & 0x7f) + (x >>32 & 0x7f);
278
+ #endif
279
+ }
280
+
281
+ static inline int
282
+ rb_popcount_intptr(uintptr_t x) {
283
+ #if SIZEOF_VOIDP == 8
284
+ return rb_popcount64(x);
285
+ #elif SIZEOF_VOIDP == 4
286
+ return rb_popcount32(x);
287
+ #endif
288
+ }
289
+
290
+ static inline int
291
+ ntz_int32(uint32_t x) {
292
+ #ifdef HAVE_BUILTIN___BUILTIN_CTZ
293
+ return __builtin_ctz(x);
294
+ #else
295
+ return rb_popcount32((~x) & (x-1));
296
+ #endif
297
+ }
298
+
299
+ static inline int
300
+ ntz_int64(uint64_t x) {
301
+ #ifdef HAVE_BUILTIN___BUILTIN_CTZLL
302
+ return __builtin_ctzll(x);
303
+ #else
304
+ return rb_popcount64((~x) & (x-1));
305
+ #endif
306
+ }
307
+
308
+ static inline int
309
+ ntz_intptr(uintptr_t x) {
310
+ #if SIZEOF_VOIDP == 8
311
+ return ntz_int64(x);
312
+ #elif SIZEOF_VOIDP == 4
313
+ return ntz_int32(x);
314
+ #endif
315
+ }
316
+
317
+ #if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG
318
+ # define DLONG LONG_LONG
319
+ # define DL2NUM(x) LL2NUM(x)
320
+ #elif defined(HAVE_INT128_T)
321
+ # define DLONG int128_t
322
+ # define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x))
323
+ VALUE rb_int128t2big(int128_t n);
324
+ #endif
325
+
326
+ #define ST2FIX(h) LONG2FIX((long)(h))
327
+
328
+
329
+ /* arguments must be Fixnum */
330
+ static inline VALUE
331
+ rb_fix_mul_fix(VALUE x, VALUE y)
332
+ {
333
+ long lx = FIX2LONG(x);
334
+ long ly = FIX2LONG(y);
335
+ #ifdef DLONG
336
+ return DL2NUM((DLONG)lx * (DLONG)ly);
337
+ #else
338
+ if (MUL_OVERFLOW_FIXNUM_P(lx, ly)) {
339
+ return rb_big_mul(rb_int2big(lx), rb_int2big(ly));
340
+ }
341
+ else {
342
+ return LONG2FIX(lx * ly);
343
+ }
344
+ #endif
345
+ }
346
+
347
+ /*
348
+ * This behaves different from C99 for negative arguments.
349
+ * Note that div may overflow fixnum.
350
+ */
351
+ static inline void
352
+ rb_fix_divmod_fix(VALUE a, VALUE b, VALUE *divp, VALUE *modp)
353
+ {
354
+ /* assume / and % comply C99.
355
+ * ldiv(3) won't be inlined by GCC and clang.
356
+ * I expect / and % are compiled as single idiv.
357
+ */
358
+ long x = FIX2LONG(a);
359
+ long y = FIX2LONG(b);
360
+ long div, mod;
361
+ if (x == FIXNUM_MIN && y == -1) {
362
+ if (divp) *divp = LONG2NUM(-FIXNUM_MIN);
363
+ if (modp) *modp = LONG2FIX(0);
364
+ return;
365
+ }
366
+ div = x / y;
367
+ mod = x % y;
368
+ if (y > 0 ? mod < 0 : mod > 0) {
369
+ mod += y;
370
+ div -= 1;
371
+ }
372
+ if (divp) *divp = LONG2FIX(div);
373
+ if (modp) *modp = LONG2FIX(mod);
374
+ }
375
+
376
+ /* div() for Ruby
377
+ * This behaves different from C99 for negative arguments.
378
+ */
379
+ static inline VALUE
380
+ rb_fix_div_fix(VALUE x, VALUE y)
381
+ {
382
+ VALUE div;
383
+ rb_fix_divmod_fix(x, y, &div, NULL);
384
+ return div;
385
+ }
386
+
387
+ /* mod() for Ruby
388
+ * This behaves different from C99 for negative arguments.
389
+ */
390
+ static inline VALUE
391
+ rb_fix_mod_fix(VALUE x, VALUE y)
392
+ {
393
+ VALUE mod;
394
+ rb_fix_divmod_fix(x, y, NULL, &mod);
395
+ return mod;
396
+ }
397
+
398
+ #if defined(HAVE_UINT128_T)
399
+ # define bit_length(x) \
400
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
401
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
402
+ sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
403
+ SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
404
+ #elif defined(HAVE_LONG_LONG)
405
+ # define bit_length(x) \
406
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
407
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
408
+ SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
409
+ #else
410
+ # define bit_length(x) \
411
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
412
+ SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
413
+ #endif
414
+
415
+ #ifndef BDIGIT
416
+ # if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
417
+ # define BDIGIT unsigned int
418
+ # define SIZEOF_BDIGIT SIZEOF_INT
419
+ # define BDIGIT_DBL unsigned LONG_LONG
420
+ # define BDIGIT_DBL_SIGNED LONG_LONG
421
+ # define PRI_BDIGIT_PREFIX ""
422
+ # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
423
+ # elif SIZEOF_INT*2 <= SIZEOF_LONG
424
+ # define BDIGIT unsigned int
425
+ # define SIZEOF_BDIGIT SIZEOF_INT
426
+ # define BDIGIT_DBL unsigned long
427
+ # define BDIGIT_DBL_SIGNED long
428
+ # define PRI_BDIGIT_PREFIX ""
429
+ # define PRI_BDIGIT_DBL_PREFIX "l"
430
+ # elif SIZEOF_SHORT*2 <= SIZEOF_LONG
431
+ # define BDIGIT unsigned short
432
+ # define SIZEOF_BDIGIT SIZEOF_SHORT
433
+ # define BDIGIT_DBL unsigned long
434
+ # define BDIGIT_DBL_SIGNED long
435
+ # define PRI_BDIGIT_PREFIX "h"
436
+ # define PRI_BDIGIT_DBL_PREFIX "l"
437
+ # else
438
+ # define BDIGIT unsigned short
439
+ # define SIZEOF_BDIGIT (SIZEOF_LONG/2)
440
+ # define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
441
+ # define BDIGIT_DBL unsigned long
442
+ # define BDIGIT_DBL_SIGNED long
443
+ # define PRI_BDIGIT_PREFIX "h"
444
+ # define PRI_BDIGIT_DBL_PREFIX "l"
445
+ # endif
446
+ #endif
447
+ #ifndef SIZEOF_ACTUAL_BDIGIT
448
+ # define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT
449
+ #endif
450
+
451
+ #ifdef PRI_BDIGIT_PREFIX
452
+ # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
453
+ # define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
454
+ # define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
455
+ # define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
456
+ # define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
457
+ # define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
458
+ #endif
459
+
460
+ #ifdef PRI_BDIGIT_DBL_PREFIX
461
+ # define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
462
+ # define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
463
+ # define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
464
+ # define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
465
+ # define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
466
+ # define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
467
+ #endif
468
+
469
+ #define BIGNUM_EMBED_LEN_NUMBITS 3
470
+ #ifndef BIGNUM_EMBED_LEN_MAX
471
+ # if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
472
+ # define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
473
+ # else
474
+ # define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
475
+ # endif
476
+ #endif
477
+
478
+ struct RBignum {
479
+ struct RBasic basic;
480
+ union {
481
+ struct {
482
+ size_t len;
483
+ BDIGIT *digits;
484
+ } heap;
485
+ BDIGIT ary[BIGNUM_EMBED_LEN_MAX];
486
+ } as;
487
+ };
488
+ #define BIGNUM_SIGN_BIT FL_USER1
489
+ /* sign: positive:1, negative:0 */
490
+ #define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
491
+ #define BIGNUM_SET_SIGN(b,sign) \
492
+ ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \
493
+ : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
494
+ #define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
495
+ #define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
496
+ #define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT)
497
+
498
+ #define BIGNUM_EMBED_FLAG FL_USER2
499
+ #define BIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
500
+ #define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS)
501
+ #define BIGNUM_LEN(b) \
502
+ ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
503
+ (long)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
504
+ (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
505
+ RBIGNUM(b)->as.heap.len)
506
+ /* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
507
+ #define BIGNUM_DIGITS(b) \
508
+ ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
509
+ RBIGNUM(b)->as.ary : \
510
+ RBIGNUM(b)->as.heap.digits)
511
+ #define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b))
512
+
513
+ #define RBIGNUM(obj) (R_CAST(RBignum)(obj))
514
+
515
+ struct RRational {
516
+ struct RBasic basic;
517
+ const VALUE num;
518
+ const VALUE den;
519
+ };
520
+
521
+ #define RRATIONAL(obj) (R_CAST(RRational)(obj))
522
+ #define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
523
+ #define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
524
+
525
+ struct RFloat {
526
+ struct RBasic basic;
527
+ double float_value;
528
+ };
529
+
530
+ #define RFLOAT(obj) (R_CAST(RFloat)(obj))
531
+
532
+ struct RComplex {
533
+ struct RBasic basic;
534
+ const VALUE real;
535
+ const VALUE imag;
536
+ };
537
+
538
+ #define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
539
+
540
+ #ifdef RCOMPLEX_SET_REAL /* shortcut macro for internal only */
541
+ #undef RCOMPLEX_SET_REAL
542
+ #undef RCOMPLEX_SET_IMAG
543
+ #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
544
+ #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
545
+ #endif
546
+
547
+ struct RHash {
548
+ struct RBasic basic;
549
+ struct st_table *ntbl; /* possibly 0 */
550
+ int iter_lev;
551
+ const VALUE ifnone;
552
+ };
553
+
554
+ #define RHASH(obj) (R_CAST(RHash)(obj))
555
+
556
+ #ifdef RHASH_ITER_LEV
557
+ #undef RHASH_ITER_LEV
558
+ #undef RHASH_IFNONE
559
+ #undef RHASH_SIZE
560
+ #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
561
+ #define RHASH_IFNONE(h) (RHASH(h)->ifnone)
562
+ #define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
563
+ #endif
564
+
565
+ /* missing/setproctitle.c */
566
+ #ifndef HAVE_SETPROCTITLE
567
+ extern void ruby_init_setproctitle(int argc, char *argv[]);
568
+ #endif
569
+
570
+ #define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX
571
+ #define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK
572
+ #define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
573
+ enum {
574
+ RSTRUCT_EMBED_LEN_MAX = 3,
575
+ RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
576
+ RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
577
+
578
+ RSTRUCT_ENUM_END
579
+ };
580
+
581
+ struct RStruct {
582
+ struct RBasic basic;
583
+ union {
584
+ struct {
585
+ long len;
586
+ const VALUE *ptr;
587
+ } heap;
588
+ const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
589
+ } as;
590
+ };
591
+
592
+ #undef RSTRUCT_LEN
593
+ #undef RSTRUCT_PTR
594
+ #undef RSTRUCT_SET
595
+ #undef RSTRUCT_GET
596
+ #define RSTRUCT_EMBED_LEN(st) \
597
+ (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
598
+ (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT))
599
+ #define RSTRUCT_LEN(st) rb_struct_len(st)
600
+ #define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st))
601
+ #define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st)
602
+ #define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st)))
603
+ #define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
604
+ #define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
605
+ #define RSTRUCT(obj) (R_CAST(RStruct)(obj))
606
+
607
+ static inline long
608
+ rb_struct_len(VALUE st)
609
+ {
610
+ return (RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
611
+ RSTRUCT_EMBED_LEN(st) : RSTRUCT(st)->as.heap.len;
612
+ }
613
+
614
+ static inline const VALUE *
615
+ rb_struct_const_ptr(VALUE st)
616
+ {
617
+ return FIX_CONST_VALUE_PTR((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
618
+ RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
619
+ }
620
+
621
+ /* class.c */
622
+
623
+ struct rb_deprecated_classext_struct {
624
+ char conflict[sizeof(VALUE) * 3];
625
+ };
626
+
627
+ struct rb_subclass_entry;
628
+ typedef struct rb_subclass_entry rb_subclass_entry_t;
629
+
630
+ struct rb_subclass_entry {
631
+ VALUE klass;
632
+ rb_subclass_entry_t *next;
633
+ };
634
+
635
+ #if defined(HAVE_LONG_LONG)
636
+ typedef unsigned LONG_LONG rb_serial_t;
637
+ #define SERIALT2NUM ULL2NUM
638
+ #elif defined(HAVE_UINT64_T)
639
+ typedef uint64_t rb_serial_t;
640
+ #define SERIALT2NUM SIZET2NUM
641
+ #else
642
+ typedef unsigned long rb_serial_t;
643
+ #define SERIALT2NUM ULONG2NUM
644
+ #endif
645
+
646
+ struct rb_classext_struct {
647
+ struct st_table *iv_index_tbl;
648
+ struct st_table *iv_tbl;
649
+ struct rb_id_table *const_tbl;
650
+ struct rb_id_table *callable_m_tbl;
651
+ rb_subclass_entry_t *subclasses;
652
+ rb_subclass_entry_t **parent_subclasses;
653
+ /**
654
+ * In the case that this is an `ICLASS`, `module_subclasses` points to the link
655
+ * in the module's `subclasses` list that indicates that the klass has been
656
+ * included. Hopefully that makes sense.
657
+ */
658
+ rb_subclass_entry_t **module_subclasses;
659
+ rb_serial_t class_serial;
660
+ const VALUE origin_;
661
+ VALUE refined_class;
662
+ rb_alloc_func_t allocator;
663
+ };
664
+
665
+ typedef struct rb_classext_struct rb_classext_t;
666
+
667
+ #undef RClass
668
+ struct RClass {
669
+ struct RBasic basic;
670
+ VALUE super;
671
+ rb_classext_t *ptr;
672
+ struct rb_id_table *m_tbl;
673
+ };
674
+
675
+ void rb_class_subclass_add(VALUE super, VALUE klass);
676
+ void rb_class_remove_from_super_subclasses(VALUE);
677
+ int rb_singleton_class_internal_p(VALUE sklass);
678
+
679
+ #define RCLASS_EXT(c) (RCLASS(c)->ptr)
680
+ #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
681
+ #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
682
+ #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
683
+ #define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
684
+ #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
685
+ #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
686
+ #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
687
+ #define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
688
+
689
+ #define RICLASS_IS_ORIGIN FL_USER5
690
+
691
+ static inline void
692
+ RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
693
+ {
694
+ RB_OBJ_WRITE(klass, &RCLASS_ORIGIN(klass), origin);
695
+ if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN);
696
+ }
697
+
698
+ #undef RCLASS_SUPER
699
+ static inline VALUE
700
+ RCLASS_SUPER(VALUE klass)
701
+ {
702
+ return RCLASS(klass)->super;
703
+ }
704
+
705
+ static inline VALUE
706
+ RCLASS_SET_SUPER(VALUE klass, VALUE super)
707
+ {
708
+ if (super) {
709
+ rb_class_remove_from_super_subclasses(klass);
710
+ rb_class_subclass_add(super, klass);
711
+ }
712
+ RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
713
+ return super;
714
+ }
715
+ /* IMEMO: Internal memo object */
716
+
717
+ #ifndef IMEMO_DEBUG
718
+ #define IMEMO_DEBUG 0
719
+ #endif
720
+
721
+ struct RIMemo {
722
+ VALUE flags;
723
+ VALUE v0;
724
+ VALUE v1;
725
+ VALUE v2;
726
+ VALUE v3;
727
+ };
728
+
729
+ enum imemo_type {
730
+ imemo_env = 0,
731
+ imemo_cref = 1,
732
+ imemo_svar = 2,
733
+ imemo_throw_data = 3,
734
+ imemo_ifunc = 4,
735
+ imemo_memo = 5,
736
+ imemo_ment = 6,
737
+ imemo_iseq = 7,
738
+ imemo_mask = 0x07
739
+ };
740
+
741
+ static inline enum imemo_type
742
+ imemo_type(VALUE imemo)
743
+ {
744
+ return (RBASIC(imemo)->flags >> FL_USHIFT) & imemo_mask;
745
+ }
746
+
747
+ /* FL_USER0 to FL_USER2 is for type */
748
+ #define IMEMO_FL_USHIFT (FL_USHIFT + 3)
749
+ #define IMEMO_FL_USER0 FL_USER3
750
+ #define IMEMO_FL_USER1 FL_USER4
751
+ #define IMEMO_FL_USER2 FL_USER5
752
+ #define IMEMO_FL_USER3 FL_USER6
753
+ #define IMEMO_FL_USER4 FL_USER7
754
+
755
+ /* CREF in method.h */
756
+
757
+ /* SVAR */
758
+
759
+ struct vm_svar {
760
+ VALUE flags;
761
+ const VALUE cref_or_me;
762
+ const VALUE lastline;
763
+ const VALUE backref;
764
+ const VALUE others;
765
+ };
766
+
767
+ /* THROW_DATA */
768
+
769
+ struct vm_throw_data {
770
+ VALUE flags;
771
+ VALUE reserved;
772
+ const VALUE throw_obj;
773
+ const struct rb_control_frame_struct *catch_frame;
774
+ VALUE throw_state;
775
+ };
776
+
777
+ #define THROW_DATA_P(err) RB_TYPE_P((err), T_IMEMO)
778
+
779
+ /* IFUNC */
780
+
781
+ struct vm_ifunc {
782
+ VALUE flags;
783
+ VALUE reserved;
784
+ VALUE (*func)(ANYARGS);
785
+ const void *data;
786
+ ID id;
787
+ };
788
+
789
+ #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
790
+
791
+ /* MEMO */
792
+
793
+ struct MEMO {
794
+ VALUE flags;
795
+ VALUE reserved;
796
+ const VALUE v1;
797
+ const VALUE v2;
798
+ union {
799
+ long cnt;
800
+ long state;
801
+ const VALUE value;
802
+ VALUE (*func)(ANYARGS);
803
+ } u3;
804
+ };
805
+
806
+ #define MEMO_V1_SET(m, v) RB_OBJ_WRITE((m), &(m)->v1, (v))
807
+ #define MEMO_V2_SET(m, v) RB_OBJ_WRITE((m), &(m)->v2, (v))
808
+
809
+ #define MEMO_CAST(m) ((struct MEMO *)m)
810
+
811
+ #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
812
+
813
+ #define roomof(x, y) (((x) + (y) - 1) / (y))
814
+ #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
815
+ #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
816
+ #define NEW_MEMO_FOR(type, value) \
817
+ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
818
+ #define NEW_PARTIAL_MEMO_FOR(type, value, member) \
819
+ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
820
+ rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
821
+ MEMO_FOR(type, value))
822
+
823
+ #define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
824
+
825
+ #ifdef RUBY_INTEGER_UNIFICATION
826
+ # define rb_cFixnum rb_cInteger
827
+ # define rb_cBignum rb_cInteger
828
+ #endif
829
+
830
+ enum {
831
+ cmp_opt_Fixnum,
832
+ cmp_opt_String,
833
+ cmp_optimizable_count
834
+ };
835
+
836
+ struct cmp_opt_data {
837
+ int opt_methods;
838
+ int opt_inited;
839
+ };
840
+
841
+ #define NEW_CMP_OPT_MEMO(type, value) \
842
+ NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt)
843
+ #define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type))
844
+ #define CMP_OPTIMIZABLE(data, type) \
845
+ (((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \
846
+ ((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \
847
+ (((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \
848
+ rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \
849
+ ((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type))))
850
+
851
+ #define OPTIMIZED_CMP(a, b, data) \
852
+ ((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \
853
+ (((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
854
+ (STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
855
+ rb_str_cmp(a, b) : \
856
+ rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b))
857
+
858
+ /* ment is in method.h */
859
+
860
+ /* global variable */
861
+
862
+ struct rb_global_entry {
863
+ struct rb_global_variable *var;
864
+ ID id;
865
+ };
866
+
867
+ struct rb_global_entry *rb_global_entry(ID);
868
+ VALUE rb_gvar_get(struct rb_global_entry *);
869
+ VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
870
+ VALUE rb_gvar_defined(struct rb_global_entry *);
871
+
872
+ struct vtm; /* defined by timev.h */
873
+
874
+ /* array.c */
875
+ VALUE rb_ary_last(int, const VALUE *, VALUE);
876
+ void rb_ary_set_len(VALUE, long);
877
+ void rb_ary_delete_same(VALUE, VALUE);
878
+ VALUE rb_ary_tmp_new_fill(long capa);
879
+ VALUE rb_ary_at(VALUE, VALUE);
880
+ size_t rb_ary_memsize(VALUE);
881
+ #ifdef __GNUC__
882
+ #define rb_ary_new_from_args(n, ...) \
883
+ __extension__ ({ \
884
+ const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
885
+ if (__builtin_constant_p(n)) { \
886
+ STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
887
+ } \
888
+ rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
889
+ })
890
+ #endif
891
+
892
+ /* bignum.c */
893
+ extern const char ruby_digitmap[];
894
+ double rb_big_fdiv_double(VALUE x, VALUE y);
895
+ VALUE rb_big_uminus(VALUE x);
896
+ VALUE rb_big_hash(VALUE);
897
+ VALUE rb_big_odd_p(VALUE);
898
+ VALUE rb_big_even_p(VALUE);
899
+ size_t rb_big_size(VALUE);
900
+ VALUE rb_integer_float_cmp(VALUE x, VALUE y);
901
+ VALUE rb_integer_float_eq(VALUE x, VALUE y);
902
+ VALUE rb_cstr_parse_inum(const char *str, ssize_t len, char **endp, int base);
903
+ VALUE rb_big_comp(VALUE x);
904
+ VALUE rb_big_aref(VALUE x, VALUE y);
905
+ VALUE rb_big_abs(VALUE x);
906
+ VALUE rb_big_size_m(VALUE big);
907
+ VALUE rb_big_bit_length(VALUE big);
908
+ VALUE rb_big_remainder(VALUE x, VALUE y);
909
+ VALUE rb_big_gt(VALUE x, VALUE y);
910
+ VALUE rb_big_ge(VALUE x, VALUE y);
911
+ VALUE rb_big_lt(VALUE x, VALUE y);
912
+ VALUE rb_big_le(VALUE x, VALUE y);
913
+
914
+ /* class.c */
915
+ VALUE rb_class_boot(VALUE);
916
+ VALUE rb_class_inherited(VALUE, VALUE);
917
+ VALUE rb_make_metaclass(VALUE, VALUE);
918
+ VALUE rb_include_class_new(VALUE, VALUE);
919
+ void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
920
+ void rb_class_detach_subclasses(VALUE);
921
+ void rb_class_detach_module_subclasses(VALUE);
922
+ void rb_class_remove_from_module_subclasses(VALUE);
923
+ VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
924
+ VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
925
+ VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
926
+ VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
927
+ int rb_obj_basic_to_s_p(VALUE);
928
+ VALUE rb_special_singleton_class(VALUE);
929
+ VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
930
+ VALUE rb_singleton_class_get(VALUE obj);
931
+ void Init_class_hierarchy(void);
932
+
933
+ int rb_class_has_methods(VALUE c);
934
+ void rb_undef_methods_from(VALUE klass, VALUE super);
935
+
936
+ /* compar.c */
937
+ VALUE rb_invcmp(VALUE, VALUE);
938
+
939
+ /* compile.c */
940
+ struct rb_block;
941
+ int rb_dvar_defined(ID, const struct rb_block *);
942
+ int rb_local_defined(ID, const struct rb_block *);
943
+ CONSTFUNC(const char * rb_insns_name(int i));
944
+ VALUE rb_insns_name_array(void);
945
+
946
+ /* complex.c */
947
+ VALUE rb_complex_plus(VALUE, VALUE);
948
+ VALUE rb_complex_mul(VALUE, VALUE);
949
+ VALUE rb_complex_abs(VALUE x);
950
+ VALUE rb_complex_sqrt(VALUE x);
951
+
952
+ /* cont.c */
953
+ VALUE rb_obj_is_fiber(VALUE);
954
+ void rb_fiber_reset_root_local_storage(VALUE);
955
+ void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
956
+
957
+ /* debug.c */
958
+ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
959
+
960
+ /* dmyext.c */
961
+ void Init_enc(void);
962
+ void Init_ext(void);
963
+
964
+ /* encoding.c */
965
+ ID rb_id_encoding(void);
966
+ CONSTFUNC(void rb_gc_mark_encodings(void));
967
+ rb_encoding *rb_enc_get_from_index(int index);
968
+ rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
969
+ int rb_encdb_replicate(const char *alias, const char *orig);
970
+ int rb_encdb_alias(const char *alias, const char *orig);
971
+ int rb_encdb_dummy(const char *name);
972
+ void rb_encdb_declare(const char *name);
973
+ void rb_enc_set_base(const char *name, const char *orig);
974
+ int rb_enc_set_dummy(int index);
975
+ void rb_encdb_set_unicode(int index);
976
+ PUREFUNC(int rb_data_is_encoding(VALUE obj));
977
+
978
+ /* enum.c */
979
+ VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
980
+ VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary);
981
+
982
+ /* error.c */
983
+ extern VALUE rb_eEAGAIN;
984
+ extern VALUE rb_eEWOULDBLOCK;
985
+ extern VALUE rb_eEINPROGRESS;
986
+ void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args);
987
+ PRINTF_ARGS(void rb_compile_error_str(VALUE file, int line, void *enc, const char *fmt, ...), 4, 5);
988
+ VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
989
+ VALUE rb_check_backtrace(VALUE);
990
+ NORETURN(void rb_async_bug_errno(const char *,int));
991
+ const char *rb_builtin_type_name(int t);
992
+ const char *rb_builtin_class_name(VALUE x);
993
+ PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
994
+ PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
995
+ PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
996
+ VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
997
+ #define rb_name_err_raise_str(mesg, recv, name) \
998
+ rb_exc_raise(rb_name_err_new(mesg, recv, name))
999
+ #define rb_name_err_raise(mesg, recv, name) \
1000
+ rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
1001
+ NORETURN(void ruby_only_for_internal_use(const char *));
1002
+ #define ONLY_FOR_INTERNAL_USE(func) ruby_only_for_internal_use(func)
1003
+
1004
+ /* eval.c */
1005
+ VALUE rb_refinement_module_get_refined_class(VALUE module);
1006
+
1007
+ /* eval_error.c */
1008
+ void ruby_error_print(void);
1009
+ VALUE rb_get_backtrace(VALUE info);
1010
+
1011
+ /* eval_jump.c */
1012
+ void rb_call_end_proc(VALUE data);
1013
+ void rb_mark_end_proc(void);
1014
+
1015
+ /* file.c */
1016
+ VALUE rb_home_dir_of(VALUE user, VALUE result);
1017
+ VALUE rb_default_home_dir(VALUE result);
1018
+ VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
1019
+ void rb_file_const(const char*, VALUE);
1020
+ int rb_file_load_ok(const char *);
1021
+ VALUE rb_file_expand_path_fast(VALUE, VALUE);
1022
+ VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
1023
+ VALUE rb_get_path_check_to_string(VALUE, int);
1024
+ VALUE rb_get_path_check_convert(VALUE, VALUE, int);
1025
+ void Init_File(void);
1026
+ int ruby_is_fd_loadable(int fd);
1027
+
1028
+ #ifdef RUBY_FUNCTION_NAME_STRING
1029
+ # if defined __GNUC__ && __GNUC__ >= 4
1030
+ # pragma GCC visibility push(default)
1031
+ # endif
1032
+ NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path));
1033
+ NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path));
1034
+ # if defined __GNUC__ && __GNUC__ >= 4
1035
+ # pragma GCC visibility pop
1036
+ # endif
1037
+ # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
1038
+ # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
1039
+ #else
1040
+ # define rb_sys_fail_path(path) rb_sys_fail_str(path)
1041
+ # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
1042
+ #endif
1043
+
1044
+ /* gc.c */
1045
+ extern VALUE *ruby_initial_gc_stress_ptr;
1046
+ extern int ruby_disable_gc;
1047
+ void Init_heap(void);
1048
+ void *ruby_mimmalloc(size_t size);
1049
+ void ruby_mimfree(void *ptr);
1050
+ void rb_objspace_set_event_hook(const rb_event_flag_t event);
1051
+ #if USE_RGENGC
1052
+ void rb_gc_writebarrier_remember(VALUE obj);
1053
+ #else
1054
+ #define rb_gc_writebarrier_remember(obj) 0
1055
+ #endif
1056
+ void ruby_gc_set_params(int safe_level);
1057
+ void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
1058
+
1059
+ #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
1060
+ #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
1061
+ #define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size)
1062
+ #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
1063
+ #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
1064
+ #else
1065
+ void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
1066
+ void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2, 3));
1067
+ void ruby_sized_xfree(void *x, size_t size);
1068
+ #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type)))
1069
+ #endif
1070
+
1071
+ void rb_gc_resurrect(VALUE ptr);
1072
+
1073
+ /* optimized version of NEWOBJ() */
1074
+ #undef NEWOBJF_OF
1075
+ #undef RB_NEWOBJ_OF
1076
+ #define RB_NEWOBJ_OF(obj,type,klass,flags) \
1077
+ type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \
1078
+ rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \
1079
+ rb_wb_unprotected_newobj_of(klass, flags))
1080
+ #define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
1081
+
1082
+ /* hash.c */
1083
+ struct st_table *rb_hash_tbl_raw(VALUE hash);
1084
+ VALUE rb_hash_has_key(VALUE hash, VALUE key);
1085
+ VALUE rb_hash_default_value(VALUE hash, VALUE key);
1086
+ VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
1087
+ long rb_objid_hash(st_index_t index);
1088
+ long rb_dbl_long_hash(double d);
1089
+ st_table *rb_init_identtable(void);
1090
+ st_table *rb_init_identtable_with_size(st_index_t size);
1091
+
1092
+ #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
1093
+ VALUE rb_hash_keys(VALUE hash);
1094
+ VALUE rb_hash_values(VALUE hash);
1095
+ VALUE rb_hash_rehash(VALUE hash);
1096
+ int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val);
1097
+ #define HASH_DELETED FL_USER1
1098
+ #define HASH_PROC_DEFAULT FL_USER2
1099
+
1100
+ /* inits.c */
1101
+ void rb_call_inits(void);
1102
+
1103
+ /* io.c */
1104
+ const char *ruby_get_inplace_mode(void);
1105
+ void ruby_set_inplace_mode(const char *);
1106
+ ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
1107
+ void rb_stdio_set_default_encoding(void);
1108
+ VALUE rb_io_flush_raw(VALUE, int);
1109
+ size_t rb_io_memsize(const rb_io_t *);
1110
+
1111
+ /* load.c */
1112
+ VALUE rb_get_load_path(void);
1113
+ VALUE rb_get_expanded_load_path(void);
1114
+ int rb_require_internal(VALUE fname, int safe);
1115
+ NORETURN(void rb_load_fail(VALUE, const char*));
1116
+
1117
+ /* loadpath.c */
1118
+ extern const char ruby_exec_prefix[];
1119
+ extern const char ruby_initial_load_paths[];
1120
+
1121
+ /* localeinit.c */
1122
+ int Init_enc_set_filesystem_encoding(void);
1123
+
1124
+ /* math.c */
1125
+ VALUE rb_math_atan2(VALUE, VALUE);
1126
+ VALUE rb_math_cos(VALUE);
1127
+ VALUE rb_math_cosh(VALUE);
1128
+ VALUE rb_math_exp(VALUE);
1129
+ VALUE rb_math_hypot(VALUE, VALUE);
1130
+ VALUE rb_math_log(int argc, const VALUE *argv);
1131
+ VALUE rb_math_sin(VALUE);
1132
+ VALUE rb_math_sinh(VALUE);
1133
+ VALUE rb_math_sqrt(VALUE);
1134
+
1135
+ /* newline.c */
1136
+ void Init_newline(void);
1137
+
1138
+ /* numeric.c */
1139
+
1140
+ #define FIXNUM_POSITIVE_P(num) ((SIGNED_VALUE)(num) > (SIGNED_VALUE)INT2FIX(0))
1141
+ #define FIXNUM_NEGATIVE_P(num) ((SIGNED_VALUE)(num) < 0)
1142
+ #define FIXNUM_ZERO_P(num) ((num) == INT2FIX(0))
1143
+
1144
+ #define INT_NEGATIVE_P(x) (FIXNUM_P(x) ? FIXNUM_NEGATIVE_P(x) : BIGNUM_NEGATIVE_P(x))
1145
+
1146
+ #ifndef ROUND_DEFAULT
1147
+ # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP
1148
+ #endif
1149
+ enum ruby_num_rounding_mode {
1150
+ RUBY_NUM_ROUND_HALF_UP,
1151
+ RUBY_NUM_ROUND_HALF_EVEN,
1152
+ RUBY_NUM_ROUND_HALF_DOWN,
1153
+ RUBY_NUM_ROUND_DEFAULT = ROUND_DEFAULT
1154
+ };
1155
+ #define ROUND_TO(mode, even, up, down) \
1156
+ ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \
1157
+ (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down)
1158
+ #define ROUND_FUNC(mode, name) \
1159
+ ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down)
1160
+ #define ROUND_CALL(mode, name, args) \
1161
+ ROUND_TO(mode, name##_half_even args, \
1162
+ name##_half_up args, name##_half_down args)
1163
+
1164
+ int rb_num_to_uint(VALUE val, unsigned int *ret);
1165
+ VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
1166
+ int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
1167
+ double ruby_float_mod(double x, double y);
1168
+ int rb_num_negative_p(VALUE);
1169
+ VALUE rb_int_succ(VALUE num);
1170
+ VALUE rb_int_pred(VALUE num);
1171
+ VALUE rb_int_uminus(VALUE num);
1172
+ VALUE rb_float_uminus(VALUE num);
1173
+ VALUE rb_int_plus(VALUE x, VALUE y);
1174
+ VALUE rb_int_minus(VALUE x, VALUE y);
1175
+ VALUE rb_int_mul(VALUE x, VALUE y);
1176
+ VALUE rb_int_idiv(VALUE x, VALUE y);
1177
+ VALUE rb_int_modulo(VALUE x, VALUE y);
1178
+ VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode);
1179
+ VALUE rb_int2str(VALUE num, int base);
1180
+ VALUE rb_dbl_hash(double d);
1181
+ VALUE rb_fix_plus(VALUE x, VALUE y);
1182
+ VALUE rb_int_gt(VALUE x, VALUE y);
1183
+ VALUE rb_float_gt(VALUE x, VALUE y);
1184
+ VALUE rb_int_ge(VALUE x, VALUE y);
1185
+ enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts);
1186
+ double rb_int_fdiv_double(VALUE x, VALUE y);
1187
+ VALUE rb_int_pow(VALUE x, VALUE y);
1188
+ VALUE rb_float_pow(VALUE x, VALUE y);
1189
+ VALUE rb_int_cmp(VALUE x, VALUE y);
1190
+ VALUE rb_int_equal(VALUE x, VALUE y);
1191
+ VALUE rb_int_divmod(VALUE x, VALUE y);
1192
+ VALUE rb_int_and(VALUE x, VALUE y);
1193
+ VALUE rb_int_lshift(VALUE x, VALUE y);
1194
+ VALUE rb_int_div(VALUE x, VALUE y);
1195
+ VALUE rb_int_abs(VALUE num);
1196
+ VALUE rb_float_abs(VALUE flt);
1197
+
1198
+ #if USE_FLONUM
1199
+ #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
1200
+ #define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
1201
+ #endif
1202
+
1203
+ static inline double
1204
+ rb_float_flonum_value(VALUE v)
1205
+ {
1206
+ #if USE_FLONUM
1207
+ if (v != (VALUE)0x8000000000000002) { /* LIKELY */
1208
+ union {
1209
+ double d;
1210
+ VALUE v;
1211
+ } t;
1212
+
1213
+ VALUE b63 = (v >> 63);
1214
+ /* e: xx1... -> 011... */
1215
+ /* xx0... -> 100... */
1216
+ /* ^b63 */
1217
+ t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
1218
+ return t.d;
1219
+ }
1220
+ #endif
1221
+ return 0.0;
1222
+ }
1223
+
1224
+ static inline double
1225
+ rb_float_noflonum_value(VALUE v)
1226
+ {
1227
+ return ((struct RFloat *)v)->float_value;
1228
+ }
1229
+
1230
+ static inline double
1231
+ rb_float_value_inline(VALUE v)
1232
+ {
1233
+ if (FLONUM_P(v)) {
1234
+ return rb_float_flonum_value(v);
1235
+ }
1236
+ return rb_float_noflonum_value(v);
1237
+ }
1238
+
1239
+ static inline VALUE
1240
+ rb_float_new_inline(double d)
1241
+ {
1242
+ #if USE_FLONUM
1243
+ union {
1244
+ double d;
1245
+ VALUE v;
1246
+ } t;
1247
+ int bits;
1248
+
1249
+ t.d = d;
1250
+ bits = (int)((VALUE)(t.v >> 60) & 0x7);
1251
+ /* bits contains 3 bits of b62..b60. */
1252
+ /* bits - 3 = */
1253
+ /* b011 -> b000 */
1254
+ /* b100 -> b001 */
1255
+
1256
+ if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
1257
+ !((bits-3) & ~0x01)) {
1258
+ return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
1259
+ }
1260
+ else if (t.v == (VALUE)0) {
1261
+ /* +0.0 */
1262
+ return 0x8000000000000002;
1263
+ }
1264
+ /* out of range */
1265
+ #endif
1266
+ return rb_float_new_in_heap(d);
1267
+ }
1268
+
1269
+ #define rb_float_value(v) rb_float_value_inline(v)
1270
+ #define rb_float_new(d) rb_float_new_inline(d)
1271
+
1272
+ /* object.c */
1273
+ void rb_obj_copy_ivar(VALUE dest, VALUE obj);
1274
+ CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2));
1275
+ CONSTFUNC(VALUE rb_obj_not(VALUE obj));
1276
+ VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
1277
+ NORETURN(void rb_undefined_alloc(VALUE klass));
1278
+ double rb_num_to_dbl(VALUE val);
1279
+ VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
1280
+
1281
+ struct RBasicRaw {
1282
+ VALUE flags;
1283
+ VALUE klass;
1284
+ };
1285
+
1286
+ #define RBASIC_CLEAR_CLASS(obj) memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(VALUE))
1287
+ #define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE))
1288
+ #define RBASIC_SET_CLASS(obj, cls) do { \
1289
+ VALUE _obj_ = (obj); \
1290
+ RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
1291
+ } while (0)
1292
+
1293
+ /* parse.y */
1294
+ #ifndef USE_SYMBOL_GC
1295
+ #define USE_SYMBOL_GC 1
1296
+ #endif
1297
+ VALUE rb_parser_get_yydebug(VALUE);
1298
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
1299
+ VALUE rb_parser_set_context(VALUE, const struct rb_block *, int);
1300
+ void *rb_parser_load_file(VALUE parser, VALUE name);
1301
+ int rb_is_const_name(VALUE name);
1302
+ int rb_is_class_name(VALUE name);
1303
+ int rb_is_global_name(VALUE name);
1304
+ int rb_is_instance_name(VALUE name);
1305
+ int rb_is_attrset_name(VALUE name);
1306
+ int rb_is_local_name(VALUE name);
1307
+ int rb_is_method_name(VALUE name);
1308
+ int rb_is_junk_name(VALUE name);
1309
+ PUREFUNC(int rb_is_const_sym(VALUE sym));
1310
+ PUREFUNC(int rb_is_class_sym(VALUE sym));
1311
+ PUREFUNC(int rb_is_global_sym(VALUE sym));
1312
+ PUREFUNC(int rb_is_instance_sym(VALUE sym));
1313
+ PUREFUNC(int rb_is_attrset_sym(VALUE sym));
1314
+ PUREFUNC(int rb_is_local_sym(VALUE sym));
1315
+ PUREFUNC(int rb_is_method_sym(VALUE sym));
1316
+ PUREFUNC(int rb_is_junk_sym(VALUE sym));
1317
+ ID rb_make_internal_id(void);
1318
+ void rb_gc_free_dsymbol(VALUE);
1319
+ ID rb_id_attrget(ID id);
1320
+
1321
+ /* proc.c */
1322
+ VALUE rb_proc_location(VALUE self);
1323
+ st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
1324
+ int rb_block_arity(void);
1325
+ VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
1326
+ VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val);
1327
+
1328
+ /* process.c */
1329
+ #define RB_MAX_GROUPS (65536)
1330
+
1331
+ struct rb_execarg {
1332
+ union {
1333
+ struct {
1334
+ VALUE shell_script;
1335
+ } sh;
1336
+ struct {
1337
+ VALUE command_name;
1338
+ VALUE command_abspath; /* full path string or nil */
1339
+ VALUE argv_str;
1340
+ VALUE argv_buf;
1341
+ } cmd;
1342
+ } invoke;
1343
+ VALUE redirect_fds;
1344
+ VALUE envp_str;
1345
+ VALUE envp_buf;
1346
+ VALUE dup2_tmpbuf;
1347
+ unsigned use_shell : 1;
1348
+ unsigned pgroup_given : 1;
1349
+ unsigned umask_given : 1;
1350
+ unsigned unsetenv_others_given : 1;
1351
+ unsigned unsetenv_others_do : 1;
1352
+ unsigned close_others_given : 1;
1353
+ unsigned close_others_do : 1;
1354
+ unsigned chdir_given : 1;
1355
+ unsigned new_pgroup_given : 1;
1356
+ unsigned new_pgroup_flag : 1;
1357
+ unsigned uid_given : 1;
1358
+ unsigned gid_given : 1;
1359
+ rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
1360
+ VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
1361
+ mode_t umask_mask;
1362
+ rb_uid_t uid;
1363
+ rb_gid_t gid;
1364
+ int close_others_maxhint;
1365
+ VALUE fd_dup2;
1366
+ VALUE fd_close;
1367
+ VALUE fd_open;
1368
+ VALUE fd_dup2_child;
1369
+ VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
1370
+ VALUE path_env;
1371
+ VALUE chdir_dir;
1372
+ };
1373
+
1374
+ /* argv_str contains extra two elements.
1375
+ * The beginning one is for /bin/sh used by exec_with_sh.
1376
+ * The last one for terminating NULL used by execve.
1377
+ * See rb_exec_fillarg() in process.c. */
1378
+ #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
1379
+ #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
1380
+
1381
+ rb_pid_t rb_fork_ruby(int *status);
1382
+ void rb_last_status_clear(void);
1383
+
1384
+ /* rational.c */
1385
+ VALUE rb_rational_uminus(VALUE self);
1386
+ VALUE rb_rational_plus(VALUE self, VALUE other);
1387
+ VALUE rb_lcm(VALUE x, VALUE y);
1388
+ VALUE rb_rational_reciprocal(VALUE x);
1389
+ VALUE rb_cstr_to_rat(const char *, int);
1390
+ VALUE rb_rational_abs(VALUE self);
1391
+ VALUE rb_rational_cmp(VALUE self, VALUE other);
1392
+
1393
+ /* re.c */
1394
+ VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
1395
+ VALUE rb_reg_check_preprocess(VALUE);
1396
+ long rb_reg_search0(VALUE, VALUE, long, int, int);
1397
+ VALUE rb_reg_match_p(VALUE re, VALUE str, long pos);
1398
+ void rb_backref_set_string(VALUE string, long pos, long len);
1399
+ int rb_match_count(VALUE match);
1400
+ int rb_match_nth_defined(int nth, VALUE match);
1401
+
1402
+ /* signal.c */
1403
+ extern int ruby_enable_coredump;
1404
+ int rb_get_next_signal(void);
1405
+ int rb_sigaltstack_size(void);
1406
+
1407
+ /* strftime.c */
1408
+ #ifdef RUBY_ENCODING_H
1409
+ VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
1410
+ const struct vtm *vtm, struct timespec *ts, int gmt);
1411
+ VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
1412
+ const struct vtm *vtm, VALUE timev, int gmt);
1413
+ #endif
1414
+
1415
+ /* string.c */
1416
+ void Init_frozen_strings(void);
1417
+ VALUE rb_fstring(VALUE);
1418
+ VALUE rb_fstring_new(const char *ptr, long len);
1419
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
1420
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
1421
+ VALUE rb_fstring_cstr(const char *str);
1422
+ #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
1423
+ # define rb_fstring_cstr(str) RB_GNUC_EXTENSION_BLOCK( \
1424
+ (__builtin_constant_p(str)) ? \
1425
+ rb_fstring_new((str), (long)strlen(str)) : \
1426
+ rb_fstring_cstr(str) \
1427
+ )
1428
+ #endif
1429
+ #ifdef RUBY_ENCODING_H
1430
+ VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
1431
+ #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
1432
+ #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
1433
+ VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc);
1434
+ # ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
1435
+ # define rb_fstring_enc_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \
1436
+ (__builtin_constant_p(str)) ? \
1437
+ rb_fstring_enc_new((str), (long)strlen(str), (enc)) : \
1438
+ rb_fstring_enc_cstr(str, enc) \
1439
+ )
1440
+ # endif
1441
+ #endif
1442
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
1443
+ int rb_str_symname_p(VALUE);
1444
+ VALUE rb_str_quote_unprintable(VALUE);
1445
+ VALUE rb_id_quote_unprintable(ID);
1446
+ #define QUOTE(str) rb_str_quote_unprintable(str)
1447
+ #define QUOTE_ID(id) rb_id_quote_unprintable(id)
1448
+ char *rb_str_fill_terminator(VALUE str, const int termlen);
1449
+ void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
1450
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
1451
+ VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
1452
+ #ifdef RUBY_ENCODING_H
1453
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
1454
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
1455
+ rb_encoding *from, int ecflags, VALUE ecopts);
1456
+ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
1457
+ #endif
1458
+ #define STR_NOEMBED FL_USER1
1459
+ #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
1460
+ #define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED))
1461
+ #define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED)
1462
+ #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
1463
+ #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
1464
+ size_t rb_str_memsize(VALUE);
1465
+ VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc);
1466
+ VALUE rb_sym_to_proc(VALUE sym);
1467
+
1468
+ /* symbol.c */
1469
+ #ifdef RUBY_ENCODING_H
1470
+ VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
1471
+ VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc);
1472
+ #ifdef __GNUC__
1473
+ #define rb_sym_intern_cstr(ptr, enc) __extension__ ( \
1474
+ { \
1475
+ (__builtin_constant_p(ptr)) ? \
1476
+ rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \
1477
+ rb_sym_intern_cstr((ptr), (enc)); \
1478
+ })
1479
+ #endif
1480
+ #endif
1481
+ VALUE rb_sym_intern_ascii(const char *ptr, long len);
1482
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
1483
+ #ifdef __GNUC__
1484
+ #define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \
1485
+ { \
1486
+ (__builtin_constant_p(ptr)) ? \
1487
+ rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
1488
+ rb_sym_intern_ascii_cstr(ptr); \
1489
+ })
1490
+ #endif
1491
+
1492
+ /* struct.c */
1493
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
1494
+ VALUE rb_struct_lookup(VALUE s, VALUE idx);
1495
+
1496
+ /* time.c */
1497
+ struct timeval rb_time_timeval(VALUE);
1498
+
1499
+ /* thread.c */
1500
+ VALUE rb_obj_is_mutex(VALUE obj);
1501
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
1502
+ void rb_thread_execute_interrupts(VALUE th);
1503
+ void rb_clear_trace_func(void);
1504
+ VALUE rb_get_coverages(void);
1505
+ VALUE rb_thread_shield_new(void);
1506
+ VALUE rb_thread_shield_wait(VALUE self);
1507
+ VALUE rb_thread_shield_release(VALUE self);
1508
+ VALUE rb_thread_shield_destroy(VALUE self);
1509
+ int rb_thread_to_be_killed(VALUE thread);
1510
+ void rb_mutex_allow_trap(VALUE self, int val);
1511
+ VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
1512
+ VALUE rb_mutex_owned_p(VALUE self);
1513
+ void ruby_kill(rb_pid_t pid, int sig);
1514
+
1515
+ /* thread_pthread.c, thread_win32.c */
1516
+ void Init_native_thread(void);
1517
+ int rb_divert_reserved_fd(int fd);
1518
+
1519
+ /* transcode.c */
1520
+ extern VALUE rb_cEncodingConverter;
1521
+ size_t rb_econv_memsize(rb_econv_t *);
1522
+
1523
+ /* us_ascii.c */
1524
+ extern rb_encoding OnigEncodingUS_ASCII;
1525
+
1526
+ /* util.c */
1527
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
1528
+ char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
1529
+
1530
+ /* utf_8.c */
1531
+ extern rb_encoding OnigEncodingUTF_8;
1532
+
1533
+ /* variable.c */
1534
+ void rb_gc_mark_global_tbl(void);
1535
+ size_t rb_generic_ivar_memsize(VALUE);
1536
+ VALUE rb_search_class_path(VALUE);
1537
+ VALUE rb_attr_delete(VALUE, ID);
1538
+ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
1539
+ void rb_autoload_str(VALUE mod, ID id, VALUE file);
1540
+ void rb_deprecate_constant(VALUE mod, const char *name);
1541
+
1542
+ /* version.c */
1543
+ extern const char ruby_engine[];
1544
+
1545
+ /* vm_insnhelper.h */
1546
+ rb_serial_t rb_next_class_serial(void);
1547
+
1548
+ /* vm.c */
1549
+ VALUE rb_obj_is_thread(VALUE obj);
1550
+ void rb_vm_mark(void *ptr);
1551
+ void Init_BareVM(void);
1552
+ void Init_vm_objects(void);
1553
+ PUREFUNC(VALUE rb_vm_top_self(void));
1554
+ void rb_thread_recycle_stack_release(VALUE *);
1555
+ void rb_vm_change_state(void);
1556
+ void rb_vm_inc_const_missing_count(void);
1557
+ void rb_thread_mark(void *th);
1558
+ const void **rb_vm_get_insns_address_table(void);
1559
+ VALUE rb_sourcefilename(void);
1560
+ VALUE rb_source_location(int *pline);
1561
+ const char *rb_source_loc(int *pline);
1562
+ void rb_vm_pop_cfunc_frame(void);
1563
+ int rb_vm_add_root_module(ID id, VALUE module);
1564
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
1565
+ VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
1566
+ VALUE ruby_vm_sysstack_error_copy(void);
1567
+ PUREFUNC(st_table *rb_vm_fstring_table(void));
1568
+
1569
+
1570
+ /* vm_dump.c */
1571
+ void rb_print_backtrace(void);
1572
+
1573
+ /* vm_eval.c */
1574
+ void Init_vm_eval(void);
1575
+ VALUE rb_current_realfilepath(void);
1576
+ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
1577
+ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
1578
+ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
1579
+ rb_check_funcall_hook *hook, VALUE arg);
1580
+ VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
1581
+ VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
1582
+ VALUE rb_yield_1(VALUE val);
1583
+
1584
+ /* vm_insnhelper.c */
1585
+ VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
1586
+
1587
+ /* vm_method.c */
1588
+ void Init_eval_method(void);
1589
+ int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
1590
+
1591
+ /* miniprelude.c, prelude.c */
1592
+ void Init_prelude(void);
1593
+
1594
+ /* vm_backtrace.c */
1595
+ void Init_vm_backtrace(void);
1596
+ VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
1597
+ VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
1598
+
1599
+ VALUE rb_make_backtrace(void);
1600
+ void rb_backtrace_print_as_bugreport(void);
1601
+ int rb_backtrace_p(VALUE obj);
1602
+ VALUE rb_backtrace_to_str_ary(VALUE obj);
1603
+ VALUE rb_backtrace_to_location_ary(VALUE obj);
1604
+ void rb_backtrace_print_to(VALUE output);
1605
+ VALUE rb_vm_backtrace_object(void);
1606
+
1607
+ RUBY_SYMBOL_EXPORT_BEGIN
1608
+ const char *rb_objspace_data_type_name(VALUE obj);
1609
+
1610
+ /* Temporary. This API will be removed (renamed). */
1611
+ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
1612
+
1613
+ /* bignum.c (export) */
1614
+ VALUE rb_big_mul_normal(VALUE x, VALUE y);
1615
+ VALUE rb_big_mul_balance(VALUE x, VALUE y);
1616
+ VALUE rb_big_mul_karatsuba(VALUE x, VALUE y);
1617
+ VALUE rb_big_mul_toom3(VALUE x, VALUE y);
1618
+ VALUE rb_big_sq_fast(VALUE x);
1619
+ VALUE rb_big_divrem_normal(VALUE x, VALUE y);
1620
+ VALUE rb_big2str_poweroftwo(VALUE x, int base);
1621
+ VALUE rb_big2str_generic(VALUE x, int base);
1622
+ VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck);
1623
+ VALUE rb_str2big_normal(VALUE arg, int base, int badcheck);
1624
+ VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck);
1625
+ #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1626
+ VALUE rb_big_mul_gmp(VALUE x, VALUE y);
1627
+ VALUE rb_big_divrem_gmp(VALUE x, VALUE y);
1628
+ VALUE rb_big2str_gmp(VALUE x, int base);
1629
+ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
1630
+ #endif
1631
+
1632
+ /* error.c (export) */
1633
+ int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
1634
+ NORETURN(void rb_unexpected_type(VALUE,int));
1635
+ #undef Check_Type
1636
+ #define Check_Type(v, t) \
1637
+ (!RB_TYPE_P((VALUE)(v), (t)) || \
1638
+ ((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \
1639
+ rb_unexpected_type((VALUE)(v), (t)) : (void)0)
1640
+
1641
+ /* file.c (export) */
1642
+ #ifdef HAVE_READLINK
1643
+ VALUE rb_readlink(VALUE path, rb_encoding *enc);
1644
+ #endif
1645
+ #ifdef __APPLE__
1646
+ VALUE rb_str_normalize_ospath(const char *ptr, long len);
1647
+ #endif
1648
+
1649
+ /* hash.c (export) */
1650
+ VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
1651
+ VALUE rb_ident_hash_new(void);
1652
+
1653
+ /* io.c (export) */
1654
+ void rb_maygvl_fd_fix_cloexec(int fd);
1655
+ int rb_gc_for_fd(int err);
1656
+ void rb_write_error_str(VALUE mesg);
1657
+
1658
+ /* numeric.c (export) */
1659
+ VALUE rb_int_positive_pow(long x, unsigned long y);
1660
+
1661
+ /* process.c (export) */
1662
+ int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
1663
+ rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
1664
+ VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
1665
+ struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
1666
+ VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
1667
+ int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
1668
+ void rb_execarg_parent_start(VALUE execarg_obj);
1669
+ void rb_execarg_parent_end(VALUE execarg_obj);
1670
+ int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
1671
+ VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
1672
+ void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
1673
+
1674
+ /* rational.c (export) */
1675
+ VALUE rb_gcd_normal(VALUE self, VALUE other);
1676
+ #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1677
+ VALUE rb_gcd_gmp(VALUE x, VALUE y);
1678
+ #endif
1679
+
1680
+ /* string.c (export) */
1681
+ #ifdef RUBY_ENCODING_H
1682
+ /* internal use */
1683
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
1684
+ #endif
1685
+
1686
+ /* thread.c (export) */
1687
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
1688
+
1689
+ /* util.c (export) */
1690
+ extern const signed char ruby_digit36_to_number_table[];
1691
+ extern const char ruby_hexdigits[];
1692
+ extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
1693
+
1694
+ /* variable.c (export) */
1695
+ void rb_mark_generic_ivar(VALUE);
1696
+ VALUE rb_const_missing(VALUE klass, VALUE name);
1697
+ int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
1698
+ st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
1699
+
1700
+ /* gc.c (export) */
1701
+ VALUE rb_wb_protected_newobj_of(VALUE, VALUE);
1702
+ VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE);
1703
+
1704
+ size_t rb_obj_memsize_of(VALUE);
1705
+ void rb_gc_verify_internal_consistency(void);
1706
+
1707
+ #define RB_OBJ_GC_FLAGS_MAX 5
1708
+ size_t rb_obj_gc_flags(VALUE, ID[], size_t);
1709
+ void rb_gc_mark_values(long n, const VALUE *values);
1710
+
1711
+ #if IMEMO_DEBUG
1712
+ VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
1713
+ #define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
1714
+ #else
1715
+ VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
1716
+ #endif
1717
+
1718
+ RUBY_SYMBOL_EXPORT_END
1719
+
1720
+ #define RUBY_DTRACE_CREATE_HOOK(name, arg) \
1721
+ RUBY_DTRACE_HOOK(name##_CREATE, arg)
1722
+ #define RUBY_DTRACE_HOOK(name, arg) \
1723
+ do { \
1724
+ if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
1725
+ int dtrace_line; \
1726
+ const char *dtrace_file = rb_source_loc(&dtrace_line); \
1727
+ if (!dtrace_file) dtrace_file = ""; \
1728
+ RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
1729
+ } \
1730
+ } while (0)
1731
+
1732
+ #define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
1733
+ #define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
1734
+ #ifdef __GNUC__
1735
+ #define rb_obj_builtin_type(obj) \
1736
+ __extension__({ \
1737
+ VALUE arg_obj = (obj); \
1738
+ RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
1739
+ RB_BUILTIN_TYPE(arg_obj); \
1740
+ })
1741
+ #else
1742
+ static inline int
1743
+ rb_obj_builtin_type(VALUE obj)
1744
+ {
1745
+ return RB_SPECIAL_CONST_P(obj) ? -1 :
1746
+ RB_BUILTIN_TYPE(obj);
1747
+ }
1748
+ #endif
1749
+
1750
+ #if defined(__cplusplus)
1751
+ #if 0
1752
+ { /* satisfy cc-mode */
1753
+ #endif
1754
+ } /* extern "C" { */
1755
+ #endif
1756
+
1757
+ #endif /* RUBY_INTERNAL_H */