12 #ifndef RUBY_INTERNAL_H 13 #define RUBY_INTERNAL_H 1 19 #if defined(__cplusplus) 30 #ifndef __bool_true_false_are_defined 35 # define bool signed char 38 # define __bool_true_false_are_defined 1 42 #define LIKELY(x) RB_LIKELY(x) 43 #define UNLIKELY(x) RB_UNLIKELY(x) 46 # define MAYBE_UNUSED(x) x 49 #ifndef WARN_UNUSED_RESULT 50 # define WARN_UNUSED_RESULT(x) x 53 #ifdef HAVE_VALGRIND_MEMCHECK_H 54 # include <valgrind/memcheck.h> 55 # ifndef VALGRIND_MAKE_MEM_DEFINED 56 # define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n)) 58 # ifndef VALGRIND_MAKE_MEM_UNDEFINED 59 # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n)) 62 # define VALGRIND_MAKE_MEM_DEFINED(p, n) 0 63 # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0 66 #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0]))) 69 # define __has_feature(x) 0 72 #ifndef __has_extension 73 # define __has_extension __has_feature 76 #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert) 77 # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr) 79 # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)] 82 #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1) 83 #define SIGNED_INTEGER_MAX(sint_type) \ 85 ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \ 86 ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1)) 87 #define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1) 88 #define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0) 90 #if SIGNEDNESS_OF_TIME_T < 0 91 # define TIMET_MAX SIGNED_INTEGER_MAX(time_t) 92 # define TIMET_MIN SIGNED_INTEGER_MIN(time_t) 93 #elif SIGNEDNESS_OF_TIME_T > 0 94 # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t) 95 # define TIMET_MIN ((time_t)0) 97 #define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1)) 99 #ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P 100 #define MUL_OVERFLOW_P(a, b) \ 101 __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0) 102 #elif defined HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW 103 #define MUL_OVERFLOW_P(a, b) \ 104 ({__typeof__(a) c; __builtin_mul_overflow((a), (b), &c);}) 107 #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \ 109 (a) == -1 ? (b) < -(max) : \ 111 ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \ 112 ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b))) 114 #ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P 117 #define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \ 118 struct { long fixnum : SIZEOF_LONG * CHAR_BIT - 1; } c; \ 119 __builtin_mul_overflow_p((a), (b), c.fixnum); \ 122 #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX) 125 #ifdef MUL_OVERFLOW_P 126 #define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b) 127 #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b) 128 #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b) 130 #define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX) 131 #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX) 132 #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX) 136 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP16 137 # define swap16(x) __builtin_bswap16(x) 142 # define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF))) 146 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP32 147 # define swap32(x) __builtin_bswap32(x) 152 # define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \ 154 |(((x)&0x0000FF00)<<8) \ 155 |(((x)&0x00FF0000)>>8) )) 159 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP64 160 # define swap64(x) __builtin_bswap64(x) 166 # define byte_in_64bit(n) ((uint64_t)0xff << (n)) 167 # define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \ 169 |(((x)&byte_in_64bit(8))<<40) \ 170 |(((x)&byte_in_64bit(48))>>40) \ 171 |(((x)&byte_in_64bit(16))<<24) \ 172 |(((x)&byte_in_64bit(40))>>24) \ 173 |(((x)&byte_in_64bit(24))<<8) \ 174 |(((x)&byte_in_64bit(32))>>8))) 178 static inline unsigned int 179 nlz_int(
unsigned int x)
181 #if defined(HAVE_BUILTIN___BUILTIN_CLZ) 182 if (x == 0)
return SIZEOF_INT *
CHAR_BIT;
183 return (
unsigned int)__builtin_clz(x);
186 # if 64 < SIZEOF_INT * CHAR_BIT 187 unsigned int n = 128;
188 # elif 32 < SIZEOF_INT * CHAR_BIT 193 # if 64 < SIZEOF_INT * CHAR_BIT 194 y = x >> 64;
if (y) {n -= 64; x = y;}
196 # if 32 < SIZEOF_INT * CHAR_BIT 197 y = x >> 32;
if (y) {n -= 32; x = y;}
199 y = x >> 16;
if (y) {n -= 16; x = y;}
200 y = x >> 8;
if (y) {n -= 8; x = y;}
201 y = x >> 4;
if (y) {n -= 4; x = y;}
202 y = x >> 2;
if (y) {n -= 2; x = y;}
203 y = x >> 1;
if (y) {
return n - 2;}
204 return (
unsigned int)(n - x);
208 static inline unsigned int 209 nlz_long(
unsigned long x)
211 #if defined(HAVE_BUILTIN___BUILTIN_CLZL) 212 if (x == 0)
return SIZEOF_LONG *
CHAR_BIT;
213 return (
unsigned int)__builtin_clzl(x);
216 # if 64 < SIZEOF_LONG * CHAR_BIT 217 unsigned int n = 128;
218 # elif 32 < SIZEOF_LONG * CHAR_BIT 223 # if 64 < SIZEOF_LONG * CHAR_BIT 224 y = x >> 64;
if (y) {n -= 64; x = y;}
226 # if 32 < SIZEOF_LONG * CHAR_BIT 227 y = x >> 32;
if (y) {n -= 32; x = y;}
229 y = x >> 16;
if (y) {n -= 16; x = y;}
230 y = x >> 8;
if (y) {n -= 8; x = y;}
231 y = x >> 4;
if (y) {n -= 4; x = y;}
232 y = x >> 2;
if (y) {n -= 2; x = y;}
233 y = x >> 1;
if (y) {
return n - 2;}
234 return (
unsigned int)(n - x);
238 #ifdef HAVE_LONG_LONG 239 static inline unsigned int 240 nlz_long_long(
unsigned LONG_LONG x)
242 #if defined(HAVE_BUILTIN___BUILTIN_CLZLL) 243 if (x == 0)
return SIZEOF_LONG_LONG *
CHAR_BIT;
244 return (
unsigned int)__builtin_clzll(x);
246 unsigned LONG_LONG y;
247 # if 64 < SIZEOF_LONG_LONG * CHAR_BIT 248 unsigned int n = 128;
249 # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT 254 # if 64 < SIZEOF_LONG_LONG * CHAR_BIT 255 y = x >> 64;
if (y) {n -= 64; x = y;}
257 # if 32 < SIZEOF_LONG_LONG * CHAR_BIT 258 y = x >> 32;
if (y) {n -= 32; x = y;}
260 y = x >> 16;
if (y) {n -= 16; x = y;}
261 y = x >> 8;
if (y) {n -= 8; x = y;}
262 y = x >> 4;
if (y) {n -= 4; x = y;}
263 y = x >> 2;
if (y) {n -= 2; x = y;}
264 y = x >> 1;
if (y) {
return n - 2;}
265 return (
unsigned int)(n - x);
270 #ifdef HAVE_UINT128_T 271 static inline unsigned int 272 nlz_int128(uint128_t x)
275 unsigned int n = 128;
276 y = x >> 64;
if (y) {n -= 64; x = y;}
277 y = x >> 32;
if (y) {n -= 32; x = y;}
278 y = x >> 16;
if (y) {n -= 16; x = y;}
279 y = x >> 8;
if (y) {n -= 8; x = y;}
280 y = x >> 4;
if (y) {n -= 4; x = y;}
281 y = x >> 2;
if (y) {n -= 2; x = y;}
282 y = x >> 1;
if (y) {
return n - 2;}
283 return (
unsigned int)(n - x);
287 static inline unsigned int 290 #if SIZEOF_VOIDP == 8 291 return nlz_long_long(x);
292 #elif SIZEOF_VOIDP == 4 297 static inline unsigned int 300 #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT 301 return (
unsigned int)__builtin_popcount(x);
303 x = (x & 0x55555555) + (x >> 1 & 0x55555555);
304 x = (x & 0x33333333) + (x >> 2 & 0x33333333);
305 x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
306 x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
307 return (x & 0x0000003f) + (x >>16 & 0x0000003f);
314 #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT 315 return __builtin_popcountll(x);
317 x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
318 x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
319 x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
320 x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
321 x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
322 return (x & 0x7f) + (x >>32 & 0x7f);
329 #if SIZEOF_VOIDP == 8 330 return rb_popcount64(x);
331 #elif SIZEOF_VOIDP == 4 332 return rb_popcount32(x);
339 #ifdef HAVE_BUILTIN___BUILTIN_CTZ 340 return __builtin_ctz(x);
342 return rb_popcount32((~x) & (x-1));
349 #ifdef HAVE_BUILTIN___BUILTIN_CTZLL 350 return __builtin_ctzll(x);
352 return rb_popcount64((~x) & (x-1));
359 #if SIZEOF_VOIDP == 8 361 #elif SIZEOF_VOIDP == 4 366 #if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG 367 # define DLONG LONG_LONG 368 # define DL2NUM(x) LL2NUM(x) 369 #elif defined(HAVE_INT128_T) 370 # define DLONG int128_t 371 # define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x)) 372 VALUE rb_int128t2big(int128_t n);
376 rb_overflowed_fix_to_int(
long x)
378 return (
long)((
unsigned long)(x >> 1) ^ (1LU << (SIZEOF_LONG *
CHAR_BIT - 1)));
384 #ifdef HAVE_BUILTIN___BUILTIN_ADD_OVERFLOW 406 if (__builtin_add_overflow((
long)x, (
long)y-1, &lz)) {
407 return rb_int2big(rb_overflowed_fix_to_int(lz));
421 #ifdef HAVE_BUILTIN___BUILTIN_SUB_OVERFLOW 423 if (__builtin_sub_overflow((
long)x, (
long)y-1, &lz)) {
424 return rb_int2big(rb_overflowed_fix_to_int(lz));
442 return DL2NUM((DLONG)lx * (DLONG)ly);
474 if (y > 0 ? mod < 0 : mod > 0) {
489 rb_fix_divmod_fix(x, y, &div,
NULL);
500 rb_fix_divmod_fix(x, y,
NULL, &mod);
504 #if defined(HAVE_UINT128_T) 505 # define bit_length(x) \ 507 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \ 508 sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \ 509 sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \ 510 SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x))) 511 #elif defined(HAVE_LONG_LONG) 512 # define bit_length(x) \ 514 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \ 515 sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \ 516 SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x))) 518 # define bit_length(x) \ 520 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \ 521 SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x))) 525 # if SIZEOF_INT*2 <= SIZEOF_LONG_LONG 526 # define BDIGIT unsigned int 527 # define SIZEOF_BDIGIT SIZEOF_INT 528 # define BDIGIT_DBL unsigned LONG_LONG 529 # define BDIGIT_DBL_SIGNED LONG_LONG 530 # define PRI_BDIGIT_PREFIX "" 531 # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX 532 # elif SIZEOF_INT*2 <= SIZEOF_LONG 533 # define BDIGIT unsigned int 534 # define SIZEOF_BDIGIT SIZEOF_INT 535 # define BDIGIT_DBL unsigned long 536 # define BDIGIT_DBL_SIGNED long 537 # define PRI_BDIGIT_PREFIX "" 538 # define PRI_BDIGIT_DBL_PREFIX "l" 539 # elif SIZEOF_SHORT*2 <= SIZEOF_LONG 540 # define BDIGIT unsigned short 541 # define SIZEOF_BDIGIT SIZEOF_SHORT 542 # define BDIGIT_DBL unsigned long 543 # define BDIGIT_DBL_SIGNED long 544 # define PRI_BDIGIT_PREFIX "h" 545 # define PRI_BDIGIT_DBL_PREFIX "l" 547 # define BDIGIT unsigned short 548 # define SIZEOF_BDIGIT (SIZEOF_LONG/2) 549 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG 550 # define BDIGIT_DBL unsigned long 551 # define BDIGIT_DBL_SIGNED long 552 # define PRI_BDIGIT_PREFIX "h" 553 # define PRI_BDIGIT_DBL_PREFIX "l" 556 #ifndef SIZEOF_ACTUAL_BDIGIT 557 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT 560 #ifdef PRI_BDIGIT_PREFIX 561 # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d" 562 # define PRIiBDIGIT PRI_BDIGIT_PREFIX"i" 563 # define PRIoBDIGIT PRI_BDIGIT_PREFIX"o" 564 # define PRIuBDIGIT PRI_BDIGIT_PREFIX"u" 565 # define PRIxBDIGIT PRI_BDIGIT_PREFIX"x" 566 # define PRIXBDIGIT PRI_BDIGIT_PREFIX"X" 569 #ifdef PRI_BDIGIT_DBL_PREFIX 570 # define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d" 571 # define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i" 572 # define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o" 573 # define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u" 574 # define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x" 575 # define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X" 578 #define BIGNUM_EMBED_LEN_NUMBITS 3 579 #ifndef BIGNUM_EMBED_LEN_MAX 580 # if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1 581 # define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) 583 # define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1) 597 #define BIGNUM_SIGN_BIT ((VALUE)FL_USER1) 599 #define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0) 600 #define BIGNUM_SET_SIGN(b,sign) \ 601 ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \ 602 : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT)) 603 #define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b) 604 #define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b)) 605 #define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT) 607 #define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2) 608 #define BIGNUM_EMBED_LEN_MASK ((VALUE)(FL_USER5|FL_USER4|FL_USER3)) 609 #define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS) 610 #define BIGNUM_LEN(b) \ 611 ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \ 612 (size_t)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \ 613 (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \ 614 RBIGNUM(b)->as.heap.len) 616 #define BIGNUM_DIGITS(b) \ 617 ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \ 618 RBIGNUM(b)->as.ary : \ 619 RBIGNUM(b)->as.heap.digits) 620 #define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b)) 622 #define RBIGNUM(obj) (R_CAST(RBignum)(obj)) 630 #define RRATIONAL(obj) (R_CAST(RRational)(obj)) 631 #define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n)) 632 #define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d)) 639 #define RFLOAT(obj) (R_CAST(RFloat)(obj)) 647 #define RCOMPLEX(obj) (R_CAST(RComplex)(obj)) 649 #ifdef RCOMPLEX_SET_REAL 650 #undef RCOMPLEX_SET_REAL 651 #undef RCOMPLEX_SET_IMAG 652 #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r)) 653 #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i)) 663 #define RHASH(obj) (R_CAST(RHash)(obj)) 665 #ifdef RHASH_ITER_LEV 666 #undef RHASH_ITER_LEV 669 #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev) 670 #define RHASH_IFNONE(h) (RHASH(h)->ifnone) 671 #define RHASH_SIZE(h) (RHASH(h)->ntbl ? RHASH(h)->ntbl->num_entries : (st_index_t)0) 675 #ifndef HAVE_SETPROCTITLE 679 #define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX 680 #define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK 681 #define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT 705 #define RSTRUCT_EMBED_LEN(st) \ 706 (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \ 707 (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT)) 708 #define RSTRUCT_LEN(st) rb_struct_len(st) 709 #define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st)) 710 #define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st) 711 #define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st))) 712 #define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v)) 713 #define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx]) 714 #define RSTRUCT(obj) (R_CAST(RStruct)(obj)) 717 rb_struct_len(
VALUE st)
723 static inline const VALUE *
724 rb_struct_const_ptr(
VALUE st)
744 #if defined(HAVE_LONG_LONG) 746 #define SERIALT2NUM ULL2NUM 747 #elif defined(HAVE_UINT64_T) 749 #define SERIALT2NUM SIZET2NUM 752 #define SERIALT2NUM ULONG2NUM 788 #define RCLASS_EXT(c) (RCLASS(c)->ptr) 789 #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl) 790 #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl) 791 #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl) 792 #define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl) 793 #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl) 794 #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_) 795 #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class) 796 #define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial) 798 #define RICLASS_IS_ORIGIN FL_USER5 811 return RCLASS(klass)->super;
827 #define IMEMO_DEBUG 0 849 #define IMEMO_MASK 0x0f 865 return expected_type == (
RBASIC(imemo)->flags & mask);
873 #define IMEMO_FL_USHIFT (FL_USHIFT + 4) 874 #define IMEMO_FL_USER0 FL_USER4 875 #define IMEMO_FL_USER1 FL_USER5 876 #define IMEMO_FL_USER2 FL_USER6 877 #define IMEMO_FL_USER3 FL_USER7 878 #define IMEMO_FL_USER4 FL_USER8 892 #define THROW_DATA_CONSUMED IMEMO_FL_USER0 903 #define THROW_DATA_P(err) RB_TYPE_P((VALUE)(err), T_IMEMO) 908 #if SIZEOF_INT * 2 > SIZEOF_VALUE 925 #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0)) 958 #define MEMO_V1_SET(m, v) RB_OBJ_WRITE((m), &(m)->v1, (v)) 959 #define MEMO_V2_SET(m, v) RB_OBJ_WRITE((m), &(m)->v2, (v)) 961 #define MEMO_CAST(m) ((struct MEMO *)m) 963 #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0)) 965 #define roomof(x, y) (((x) + (y) - 1) / (y)) 966 #define type_roomof(x, y) roomof(sizeof(x), sizeof(y)) 967 #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value)) 968 #define NEW_MEMO_FOR(type, value) \ 969 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value)) 970 #define NEW_PARTIAL_MEMO_FOR(type, value, member) \ 971 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \ 972 rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \ 973 MEMO_FOR(type, value)) 975 #define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString) 977 #ifdef RUBY_INTEGER_UNIFICATION 978 # define rb_cFixnum rb_cInteger 979 # define rb_cBignum rb_cInteger 994 #define NEW_CMP_OPT_MEMO(type, value) \ 995 NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt) 996 #define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type)) 997 #define CMP_OPTIMIZABLE(data, type) \ 998 (((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \ 999 ((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \ 1000 (((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \ 1001 rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \ 1002 ((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type)))) 1004 #define OPTIMIZED_CMP(a, b, data) \ 1005 ((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \ 1006 (((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \ 1007 (STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \ 1008 rb_str_cmp(a, b) : \ 1009 (RB_FLOAT_TYPE_P(a) && RB_FLOAT_TYPE_P(b) && CMP_OPTIMIZABLE(data, Float)) ? \ 1010 rb_float_cmp(a, b) : \ 1011 rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b)) 1037 #define rb_ary_new_from_args(n, ...) \ 1039 const VALUE args_to_new_ary[] = {__VA_ARGS__}; \ 1040 if (__builtin_constant_p(n)) { \ 1041 STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \ 1043 rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \ 1149 PRINTF_ARGS(
void rb_sys_warn(
const char *fmt, ...), 1, 2);
1150 PRINTF_ARGS(
void rb_syserr_warn(
int err,
const char *fmt, ...), 2, 3);
1155 PRINTF_ARGS(
void rb_syserr_warning(
int err,
const char *fmt, ...), 2, 3);
1160 #define rb_raise_cstr(etype, mesg) \ 1161 rb_exc_raise(rb_exc_new_str(etype, rb_str_new_cstr(mesg))) 1162 #define rb_raise_static(etype, mesg) \ 1163 rb_exc_raise(rb_exc_new_str(etype, rb_str_new_static(mesg, rb_strlen_lit(mesg)))) 1166 #define rb_name_err_raise_str(mesg, recv, name) \ 1167 rb_exc_raise(rb_name_err_new(mesg, recv, name)) 1168 #define rb_name_err_raise(mesg, recv, name) \ 1169 rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name)) 1171 #define rb_key_err_raise(mesg, recv, name) \ 1172 rb_exc_raise(rb_key_err_new(mesg, recv, name)) 1174 #define DEPRECATED_INTERNAL_FEATURE(func) \ 1175 (ruby_deprecated_internal_feature(func), UNREACHABLE) 1204 #ifdef RUBY_FUNCTION_NAME_STRING 1205 # if defined __GNUC__ && __GNUC__ >= 4 1206 # pragma GCC visibility push(default) 1208 NORETURN(
void rb_sys_fail_path_in(
const char *func_name,
VALUE path));
1209 NORETURN(
void rb_syserr_fail_path_in(
const char *func_name,
int err,
VALUE path));
1210 # if defined __GNUC__ && __GNUC__ >= 4 1211 # pragma GCC visibility pop 1213 # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path) 1214 # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path)) 1216 # define rb_sys_fail_path(path) rb_sys_fail_str(path) 1217 # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path)) 1230 #define rb_gc_writebarrier_remember(obj) 0 1235 #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32) 1236 #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size) 1237 #define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size) 1238 #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr) 1239 #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n) 1244 #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type))) 1250 #define RB_NEWOBJ_OF(obj,type,klass,flags) \ 1251 type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \ 1252 rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \ 1253 rb_wb_unprotected_newobj_of(klass, flags)) 1254 #define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags) 1268 #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h) 1273 #define HASH_PROC_DEFAULT FL_USER2 1316 #define FIXNUM_POSITIVE_P(num) ((SIGNED_VALUE)(num) > (SIGNED_VALUE)INT2FIX(0)) 1317 #define FIXNUM_NEGATIVE_P(num) ((SIGNED_VALUE)(num) < 0) 1318 #define FIXNUM_ZERO_P(num) ((num) == INT2FIX(0)) 1320 #define INT_NEGATIVE_P(x) (FIXNUM_P(x) ? FIXNUM_NEGATIVE_P(x) : BIGNUM_NEGATIVE_P(x)) 1322 #ifndef ROUND_DEFAULT 1323 # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP 1331 #define ROUND_TO(mode, even, up, down) \ 1332 ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \ 1333 (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down) 1334 #define ROUND_FUNC(mode, name) \ 1335 ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down) 1336 #define ROUND_CALL(mode, name, args) \ 1337 ROUND_TO(mode, name##_half_even args, \ 1338 name##_half_up args, name##_half_down args) 1378 #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n))) 1379 #define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n))) 1382 static inline double 1383 rb_float_flonum_value(
VALUE v)
1386 if (v != (
VALUE)0x8000000000000002) {
1392 VALUE b63 = (v >> 63);
1403 static inline double 1404 rb_float_noflonum_value(
VALUE v)
1406 return ((
struct RFloat *)v)->float_value;
1409 static inline double 1410 rb_float_value_inline(
VALUE v)
1413 return rb_float_flonum_value(v);
1415 return rb_float_noflonum_value(v);
1419 rb_float_new_inline(
double d)
1429 bits = (int)((
VALUE)(t.v >> 60) & 0x7);
1435 if (t.v != 0x3000000000000000 &&
1436 !((bits-3) & ~0x01)) {
1439 else if (t.v == (
VALUE)0) {
1441 return 0x8000000000000002;
1448 #define rb_float_value(v) rb_float_value_inline(v) 1449 #define rb_float_new(d) rb_float_new_inline(d) 1469 #define RBASIC_CLEAR_CLASS(obj) memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(VALUE)) 1470 #define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE)) 1471 #define RBASIC_SET_CLASS(obj, cls) do { \ 1472 VALUE _obj_ = (obj); \ 1473 RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \ 1477 #ifndef USE_SYMBOL_GC 1478 #define USE_SYMBOL_GC 1 1514 #define RB_MAX_GROUPS (65536) 1563 #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2) 1564 #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1) 1598 #ifdef RUBY_ENCODING_H 1600 const struct vtm *vtm,
struct timespec *ts,
int gmt);
1602 const struct vtm *vtm,
VALUE timev,
int gmt);
1608 #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str)) 1609 #define rb_fstring_literal(str) rb_fstring_lit(str) 1611 #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P 1612 # define rb_fstring_cstr(str) RB_GNUC_EXTENSION_BLOCK( \ 1613 (__builtin_constant_p(str)) ? \ 1614 rb_fstring_new((str), (long)strlen(str)) : \ 1615 rb_fstring_cstr(str) \ 1618 #ifdef RUBY_ENCODING_H 1620 #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc)) 1621 #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc) 1623 # ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P 1624 # define rb_fstring_enc_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \ 1625 (__builtin_constant_p(str)) ? \ 1626 rb_fstring_enc_new((str), (long)strlen(str), (enc)) : \ 1627 rb_fstring_enc_cstr(str, enc) \ 1635 #define QUOTE(str) rb_str_quote_unprintable(str) 1636 #define QUOTE_ID(id) rb_id_quote_unprintable(id) 1643 #ifdef RUBY_ENCODING_H 1650 #define STR_NOEMBED FL_USER1 1651 #define STR_SHARED FL_USER2 1652 #define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED)) 1653 #define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED) 1654 #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) 1655 #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) 1663 #ifdef RUBY_ENCODING_H 1667 #define rb_sym_intern_cstr(ptr, enc) __extension__ ( \ 1669 (__builtin_constant_p(ptr)) ? \ 1670 rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \ 1671 rb_sym_intern_cstr((ptr), (enc)); \ 1678 #define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \ 1680 (__builtin_constant_p(ptr)) ? \ 1681 rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \ 1682 rb_sym_intern_ascii_cstr(ptr); \ 1694 #define COVERAGE_INDEX_LINES 0 1695 #define COVERAGE_INDEX_BRANCHES 1 1696 #define COVERAGE_INDEX_METHODS 2 1697 #define COVERAGE_TARGET_LINES 1 1698 #define COVERAGE_TARGET_BRANCHES 2 1699 #define COVERAGE_TARGET_METHODS 4 1728 char *
ruby_dtoa(
double d_,
int mode,
int ndigits,
int *decpt,
int *sign,
char **rve);
1729 char *
ruby_hdtoa(
double d,
const char *xdigs,
int ndigits,
int *decpt,
int *sign,
char **rve);
1828 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) 1832 VALUE rb_str2big_gmp(
VALUE arg,
int base,
int badcheck);
1847 #define Check_Type(v, t) \ 1848 (!RB_TYPE_P((VALUE)(v), (t)) || \ 1849 ((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \ 1850 rb_unexpected_type((VALUE)(v), (t)) : (void)0) 1853 #ifdef HAVE_READLINK 1857 VALUE rb_str_normalize_ospath(
const char *ptr,
long len);
1874 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);
1888 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) 1893 #ifdef RUBY_ENCODING_H 1904 extern unsigned long ruby_scan_digits(
const char *str, ssize_t
len,
int base,
size_t *retlen,
int *overflow);
1919 #define RB_OBJ_GC_FLAGS_MAX 5 1925 #define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__) 1932 #define RUBY_DTRACE_CREATE_HOOK(name, arg) \ 1933 RUBY_DTRACE_HOOK(name##_CREATE, arg) 1934 #define RUBY_DTRACE_HOOK(name, arg) \ 1936 if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \ 1938 const char *dtrace_file = rb_source_loc(&dtrace_line); \ 1939 if (!dtrace_file) dtrace_file = ""; \ 1940 RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \ 1944 #define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj) 1945 #define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj) 1947 #define rb_obj_builtin_type(obj) \ 1949 VALUE arg_obj = (obj); \ 1950 RB_SPECIAL_CONST_P(arg_obj) ? -1 : \ 1951 RB_BUILTIN_TYPE(arg_obj); \ 1955 rb_obj_builtin_type(
VALUE obj)
1962 #if defined(__cplusplus)
VALUE rb_int_plus(VALUE x, VALUE y)
#define RSTRUCT_EMBED_LEN(st)
VALUE rb_rational_cmp(VALUE self, VALUE other)
double ruby_float_mod(double x, double y)
void rb_class_remove_from_super_subclasses(VALUE)
st_table * rb_init_identtable_with_size(st_index_t size)
int rb_stderr_tty_p(void)
VALUE rb_int_cmp(VALUE x, VALUE y)
VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc)
void rb_execarg_setenv(VALUE execarg_obj, VALUE env)
void rb_hash_bulk_insert(long, const VALUE *, VALUE)
double rb_big_fdiv_double(VALUE x, VALUE y)
void rb_class_detach_subclasses(VALUE)
VALUE rb_int_uminus(VALUE num)
int rb_method_defined_by(VALUE obj, ID mid, VALUE(*cfunc)(ANYARGS))
VALUE rb_hash_new_with_size(st_index_t size)
VALUE rb_math_sqrt(VALUE)
void rb_vm_inc_const_missing_count(void)
VALUE rb_parser_get_yydebug(VALUE)
VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info)
VALUE rb_get_path_check(VALUE, int)
VALUE rb_big_mul_balance(VALUE x, VALUE y)
struct st_table * iv_index_tbl
VALUE(* rb_block_call_func_t)(ANYARGS)
rb_encoding * rb_enc_get_from_index(int index)
VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc)
int rb_encdb_alias(const char *alias, const char *orig)
VALUE rb_insns_name_array(void)
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline)
VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl)
VALUE rb_gvar_get(struct rb_global_entry *)
VALUE rb_big_remainder(VALUE x, VALUE y)
void rb_gc_free_dsymbol(VALUE)
void void ruby_sized_xfree(void *x, size_t size)
CONSTFUNC(const char *rb_insns_name(int i))
int rb_block_min_max_arity(int *max)
int rb_is_global_name(VALUE name)
VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj)
int rb_is_instance_name(VALUE name)
void * ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2))
const char ruby_exec_prefix[]
VALUE rb_cstr_to_rat(const char *, int)
VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
void rb_str_tmp_frozen_release(VALUE str, VALUE tmp)
rb_subclass_entry_t * next
void rb_gc_mark_values(long n, const VALUE *values)
VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc)
#define FIX_CONST_VALUE_PTR(x)
void ruby_set_inplace_mode(const char *)
VALUE rb_yield_force_blockarg(VALUE values)
VALUE rb_hash_values(VALUE hash)
const VALUE cref_or_me
class reference or rb_method_entry_t
VALUE rb_big2str_generic(VALUE x, int base)
int rb_float_cmp(VALUE x, VALUE y)
VALUE rb_fstring_cstr(const char *str)
int rb_is_attrset_sym(VALUE sym)
void rb_class_remove_from_module_subclasses(VALUE)
struct vm_ifunc * rb_vm_ifunc_new(VALUE(*func)(ANYARGS), const void *data, int min_argc, int max_argc)
struct rb_id_table * const_tbl
VALUE rb_obj_is_thread(VALUE obj)
VALUE rb_reg_check_preprocess(VALUE)
VALUE rb_current_realfilepath(void)
VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode)
#define RSTRUCT_EMBED_LEN_SHIFT
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char *errmsg, size_t errmsg_buflen)
VALUE rb_backtrace_to_location_ary(VALUE obj)
size_t rb_big_size(VALUE)
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen)
int rb_is_method_name(VALUE name)
VALUE rb_str_quote_unprintable(VALUE)
VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc)
VALUE rb_struct_init_copy(VALUE copy, VALUE s)
VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2)
call-seq: obj != other -> true or false
VALUE rb_int_equal(VALUE x, VALUE y)
VALUE rb_float_abs(VALUE flt)
struct st_table * rb_hash_tbl_raw(VALUE hash)
unsigned unsetenv_others_given
VALUE rb_suppress_tracing(VALUE(*func)(VALUE), VALUE arg)
void ruby_debug_printf(const char *format,...)
VALUE * ruby_initial_gc_stress_ptr
VALUE rb_big_size_m(VALUE big)
bool rb_reg_start_with_p(VALUE re, VALUE str)
rb_subclass_entry_t * subclasses
VALUE rb_default_coverage(int)
const char * ruby_get_inplace_mode(void)
VALUE rb_check_convert_type_with_id(VALUE, int, const char *, ID)
void rb_ary_set_len(VALUE, long)
VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, struct timespec *ts, int gmt)
VALUE rb_complex_abs(VALUE x)
#define RB_SPECIAL_CONST_P(x)
void rb_backtrace_each(VALUE(*iter)(VALUE recv, VALUE str), VALUE output)
void * ruby_mimmalloc(size_t size)
VALUE rb_lcm(VALUE x, VALUE y)
int rb_encdb_replicate(const char *alias, const char *orig)
rb_pid_t rb_fork_ruby(int *status)
VALUE rb_int_minus(VALUE x, VALUE y)
VALUE rb_str_locktmp_ensure(VALUE str, VALUE(*func)(VALUE), VALUE arg)
void Init_class_hierarchy(void)
VALUE rb_int_mul(VALUE x, VALUE y)
int rb_gc_for_fd(int err)
int rb_is_global_sym(VALUE sym)
VALUE rb_default_home_dir(VALUE result)
char * rb_str_fill_terminator(VALUE str, const int termlen)
VALUE rb_parser_set_yydebug(VALUE, VALUE)
VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, VALUE timev, int gmt)
VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc)
void Init_vm_objects(void)
void rb_vm_check_redefinition_by_prepend(VALUE klass)
VALUE rb_file_expand_path_fast(VALUE, VALUE)
const void ** rb_vm_get_insns_address_table(void)
int ruby_thread_has_gvl_p(void)
VALUE rb_readlink(VALUE path, rb_encoding *resultenc)
size_t rb_io_memsize(const rb_io_t *)
VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell)
#define RUBY_BIT_ROTL(v, n)
void Init_vm_backtrace(void)
void * ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd)
void rb_mutex_allow_trap(VALUE self, int val)
VALUE rb_int_divmod(VALUE x, VALUE y)
VALUE rb_int_gt(VALUE x, VALUE y)
VALUE rb_math_sinh(VALUE)
VALUE rb_attr_delete(VALUE, ID)
struct RBignum::@76::@77 heap
VALUE rb_refinement_module_get_refined_class(VALUE module)
size_t rb_ary_memsize(VALUE)
VALUE rb_big_le(VALUE x, VALUE y)
unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
void rb_enc_set_base(const char *name, const char *orig)
int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val)
double rb_int_fdiv_double(VALUE x, VALUE y)
const char * rb_source_loc(int *pline)
rb_subclass_entry_t ** parent_subclasses
#define RUBY_ATTR_ALLOC_SIZE(params)
rb_encoding OnigEncodingUS_ASCII
VALUE rb_big_mul_karatsuba(VALUE x, VALUE y)
void rb_load_fail(VALUE path, const char *err)
int rb_file_load_ok(const char *)
int rb_match_count(VALUE match)
enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts)
VALUE rb_equal_opt(VALUE obj1, VALUE obj2)
VALUE rb_dir_getwd_ospath(void)
int rb_local_defined(ID, const struct rb_block *)
#define RSTRUCT_EMBED_LEN_MAX
#define BIGNUM_EMBED_LEN_MAX
VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc)
VALUE rb_check_backtrace(VALUE)
VALUE rb_warning_warn(VALUE mod, VALUE str)
VALUE rb_ary_tmp_new_fill(long capa)
unsigned unsetenv_others_do
int rb_is_junk_sym(VALUE sym)
VALUE rb_big_mul_normal(VALUE x, VALUE y)
VALUE rb_gvar_set(struct rb_global_entry *, VALUE)
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE)
VALUE rb_float_equal(VALUE x, VALUE y)
void rb_encdb_set_unicode(int index)
void ruby_register_rollback_func_for_ensure(VALUE(*ensure_func)(ANYARGS), VALUE(*rollback_func)(ANYARGS))
void rb_vm_change_state(void)
void * rb_parser_load_file(VALUE parser, VALUE name)
#define RUBY_BIT_ROTR(v, n)
VALUE rb_parser_set_context(VALUE, const struct rb_block *, int)
VALUE rb_ary_last(int, const VALUE *, VALUE)
VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck)
VALUE rb_int_idiv(VALUE x, VALUE y)
int rb_str_symname_p(VALUE)
unsigned long long uint64_t
VALUE rb_class_inherited(VALUE, VALUE)
Calls Class::inherited.
struct rb_id_table * callable_m_tbl
VALUE rb_get_path_check_convert(VALUE, VALUE, int)
struct rb_execarg * rb_execarg_get(VALUE execarg_obj)
VALUE rb_ident_hash_new(void)
int rb_data_is_encoding(VALUE obj)
VALUE rb_big_bit_length(VALUE big)
rb_encoding * rb_enc_check_str(VALUE str1, VALUE str2)
VALUE rb_str_chomp_string(VALUE str, VALUE chomp)
const char * rb_insns_name(int i)
void rb_vm_mark(void *ptr)
VALUE rb_convert_type_with_id(VALUE, int, const char *, ID)
size_t rb_generic_ivar_memsize(VALUE)
VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval)
VALUE rb_big_aref(VALUE x, VALUE y)
VALUE rb_gvar_defined(struct rb_global_entry *)
void rb_async_bug_errno(const char *mesg, int errno_arg)
BDIGIT ary[BIGNUM_EMBED_LEN_MAX]
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
double rb_num_to_dbl(VALUE val)
VALUE rb_special_singleton_class(VALUE)
VALUE rb_int_ge(VALUE x, VALUE y)
VALUE rb_get_coverages(void)
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict)
int rb_num_negative_p(VALUE)
VALUE rb_thread_shield_release(VALUE self)
VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc)
VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc)
int rb_class_has_methods(VALUE c)
VALUE rb_id_quote_unprintable(ID)
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash)
VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
int rb_require_internal(VALUE fname, int safe)
rb_encoding OnigEncodingUTF_8
void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE)
int rb_match_nth_defined(int nth, VALUE match)
VALUE rb_sym_intern_ascii(const char *ptr, long len)
struct rb_imemo_alloc_struct * next
VALUE rb_int2str(VALUE num, int base)
VALUE rb_complex_sqrt(VALUE x)
void rb_class_subclass_add(VALUE super, VALUE klass)
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)
void rb_encdb_declare(const char *name)
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags)
VALUE rb_obj_is_mutex(VALUE obj)
VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE)
VALUE rb_cstr_parse_inum(const char *str, ssize_t len, char **endp, int base)
VALUE rb_int_and(VALUE x, VALUE y)
st_table * rb_vm_fstring_table(void)
int rb_dvar_defined(ID, const struct rb_block *)
VALUE rb_io_flush_raw(VALUE, int)
VALUE rb_int_lshift(VALUE x, VALUE y)
VALUE rb_struct_lookup(VALUE s, VALUE idx)
VALUE rb_str_eql(VALUE str1, VALUE str2)
const char * rb_builtin_type_name(int t)
VALUE rb_proc_location(VALUE self)
void rb_file_const(const char *, VALUE)
VALUE rb_float_eql(VALUE x, VALUE y)
VALUE rb_immutable_obj_clone(int, VALUE *, VALUE)
int rb_is_class_sym(VALUE sym)
void rb_obj_copy_ivar(VALUE dest, VALUE obj)
VALUE rb_hash_compare_by_id_p(VALUE hash)
VALUE rb_int_pred(VALUE num)
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
char * ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve)
VALUE rb_int_abs(VALUE num)
VALUE rb_float_new_in_heap(double)
int rb_backtrace_p(VALUE obj)
void rb_sys_enc_warning(rb_encoding *enc, const char *fmt,...)
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements)
VALUE rb_invcmp(VALUE, VALUE)
void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
int rb_is_local_sym(VALUE sym)
VALUE rb_int_modulo(VALUE x, VALUE y)
VALUE rb_float_gt(VALUE x, VALUE y)
VALUE rb_backtrace_to_str_ary(VALUE obj)
VALUE rb_int_succ(VALUE num)
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval)
unsigned close_others_given
VALUE rb_get_load_path(void)
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg)
VALUE rb_hash_keys(VALUE hash)
long rb_reg_search0(VALUE, VALUE, long, int, int)
void rb_deprecate_constant(VALUE mod, const char *name)
#define MUL_OVERFLOW_FIXNUM_P(a, b)
void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE, VALUE), VALUE)
void rb_last_status_clear(void)
int rb_encdb_dummy(const char *name)
VALUE rb_hash_has_key(VALUE hash, VALUE key)
unsigned long rb_serial_t
VALUE rb_complex_plus(VALUE, VALUE)
int rb_get_next_signal(void)
void rb_execarg_parent_start(VALUE execarg_obj)
VALUE rb_big_mul_toom3(VALUE x, VALUE y)
int rb_is_const_name(VALUE name)
#define RICLASS_IS_ORIGIN
VALUE rb_math_atan2(VALUE, VALUE)
VALUE rb_include_class_new(VALUE, VALUE)
void rb_print_backtrace(void)
VALUE rb_const_missing(VALUE klass, VALUE name)
VALUE rb_class_search_ancestor(VALUE klass, VALUE super)
#define RUBY_SYMBOL_EXPORT_END
void rb_mark_end_proc(void)
char * ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve)
size_t rb_str_memsize(VALUE)
void rb_thread_execute_interrupts(VALUE th)
VALUE rb_thread_shield_destroy(VALUE self)
void rb_call_end_proc(VALUE data)
unsigned char buf[MIME_BUF_SIZE]
void rb_vm_pop_cfunc_frame(void)
VALUE rb_fix_plus(VALUE x, VALUE y)
PUREFUNC(int rb_data_is_encoding(VALUE obj))
const signed char ruby_digit36_to_number_table[]
const char ruby_digitmap[]
unsigned new_pgroup_given
VALUE rb_sym_to_proc(VALUE sym)
IFUNC (Internal FUNCtion)
VALUE rb_integer_float_eq(VALUE x, VALUE y)
size_t rb_econv_memsize(rb_econv_t *)
VALUE rb_big_mul(VALUE x, VALUE y)
#define RSTRUCT_EMBED_LEN_MASK
VALUE rb_vm_top_self(void)
void rb_undef_methods_from(VALUE klass, VALUE super)
void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args)
VALUE rb_big_ge(VALUE x, VALUE y)
VALUE rb_str2big_normal(VALUE arg, int base, int badcheck)
const char ruby_initial_load_paths[]
VALUE rb_check_realpath(VALUE basedir, VALUE path)
VALUE rb_int_div(VALUE x, VALUE y)
#define RUBY_SYMBOL_EXPORT_BEGIN
void Init_native_thread(void)
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
VALUE rb_make_metaclass(VALUE, VALUE)
void ruby_mimfree(void *ptr)
VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
int rb_is_class_name(VALUE name)
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv)
VALUE rb_math_cosh(VALUE)
int Init_enc_set_filesystem_encoding(void)
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding *, const char *, va_list)
int rb_sigaltstack_size(void)
void rb_unexpected_type(VALUE x, int t)
VALUE rb_uninterruptible(VALUE(*b_proc)(ANYARGS), VALUE data)
VALUE rb_blocking_function_t(void *)
int rb_is_const_sym(VALUE sym)
void rb_class_detach_module_subclasses(VALUE)
VALUE rb_cEncodingConverter
VALUE rb_fstring_new(const char *ptr, long len)
struct rb_global_variable * var
VALUE rb_sym_intern_ascii_cstr(const char *ptr)
VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary)
const char * rb_builtin_class_name(VALUE x)
int rb_thread_to_be_killed(VALUE thread)
VALUE rb_wb_protected_newobj_of(VALUE, VALUE)
VALUE rb_eql_opt(VALUE obj1, VALUE obj2)
void rb_write_error_str(VALUE mesg)
VALUE rb_rational_plus(VALUE self, VALUE other)
#define RB_OBJ_WRITE(a, slot, b)
void rb_thread_recycle_stack_release(VALUE *)
VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc)
VALUE rb_thread_shield_new(void)
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p)
VALUE rb_get_backtrace(VALUE info)
VALUE rb_make_backtrace(void)
void rb_mark_generic_ivar(VALUE)
VALUE rb_hash_rehash(VALUE hash)
void rb_fiber_reset_root_local_storage(VALUE)
#define UNLIMITED_ARGUMENTS
VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck)
const struct rb_control_frame_struct * catch_frame
VALUE rb_float_pow(VALUE x, VALUE y)
VALUE rb_hash_delete_entry(VALUE hash, VALUE key)
int rb_is_instance_sym(VALUE sym)
void ruby_gc_set_params(int safe_level)
VALUE rb_int_positive_pow(long x, unsigned long y)
VALUE rb_rational_reciprocal(VALUE x)
void rb_ary_delete_same(VALUE, VALUE)
VALUE rb_hash_default_value(VALUE hash, VALUE key)
int rb_class_ivar_set(VALUE klass, ID vid, VALUE value)
size_t rb_obj_memsize_of(VALUE)
void rb_gc_verify_internal_consistency(void)
VALUE rb_warning_string(const char *fmt,...)
VALUE rb_big_sq_fast(VALUE x)
VALUE rb_gcd_normal(VALUE self, VALUE other)
VALUE rb_singleton_class_get(VALUE obj)
Returns the singleton class of obj, or nil if obj is not a singleton object.
VALUE rb_rational_uminus(VALUE self)
st_table * rb_init_identtable(void)
long rb_objid_hash(st_index_t index)
VALUE rb_big_lt(VALUE x, VALUE y)
st_table * rb_st_copy(VALUE obj, struct st_table *orig_tbl)
rb_subclass_entry_t ** module_subclasses
In the case that this is an ICLASS, module_subclasses points to the link in the module's subclasses l...
VALUE rb_int_pow(VALUE x, VALUE y)
int rb_is_local_name(VALUE name)
int rb_singleton_class_internal_p(VALUE sklass)
#define RB_BUILTIN_TYPE(x)
VALUE rb_big_even_p(VALUE)
VALUE rb_rational_abs(VALUE self)
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val)
VALUE rb_reg_match_p(VALUE re, VALUE str, long pos)
VALUE rb_get_expanded_load_path(void)
VALUE rb_big_abs(VALUE x)
VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
void rb_backref_set_string(VALUE string, long pos, long len)
VALUE rb_ary_at(VALUE, VALUE)
VALUE rb_int2big(SIGNED_VALUE n)
VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, int min_argc, int max_argc, VALUE data2)
void rb_enc_warn(rb_encoding *enc, const char *fmt,...)
size_t rb_obj_gc_flags(VALUE, ID[], size_t)
int rb_bug_reporter_add(void(*func)(FILE *, void *), void *data)
VALUE rb_gcd(VALUE x, VALUE y)
VALUE rb_thread_shield_wait(VALUE self)
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc)
VALUE rb_yield_1(VALUE val)
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
NORETURN(void rb_async_bug_errno(const char *, int))
int rb_enc_set_dummy(int index)
void rb_autoload_str(VALUE mod, ID id, VALUE file)
VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, int ecflags, VALUE ecopts)
void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt,...)
VALUE rb_big2str_poweroftwo(VALUE x, int base)
void rb_gc_mark_global_tbl(void)
VALUE rb_source_location(int *pline)
VALUE rb_numeric_quo(VALUE x, VALUE y)
rb_serial_t rb_next_class_serial(void)
VALUE rb_dbl_hash(double d)
void rb_gc_writebarrier_remember(VALUE obj)
struct timeval rb_time_timeval(VALUE)
VALUE rb_str_tmp_frozen_acquire(VALUE str)
rb_alloc_func_t allocator
void rb_execarg_parent_end(VALUE execarg_obj)
int rb_divert_reserved_fd(int fd)
VALUE rb_home_dir_of(VALUE user, VALUE result)
void rb_backtrace_print_as_bugreport(void)
int rb_num_to_uint(VALUE val, unsigned int *ret)
VALUE rb_math_hypot(VALUE, VALUE)
VALUE rb_big_comp(VALUE x)
VALUE ruby_vm_special_exception_copy(VALUE)
long rb_dbl_long_hash(double d)
void rb_stdio_set_default_encoding(void)
st_index_t rb_hash_proc(st_index_t hash, VALUE proc)
VALUE rb_get_path_check_to_string(VALUE, int)
VALUE rb_math_log(int argc, const VALUE *argv)
struct rb_id_table * m_tbl
void ruby_init_setproctitle(int argc, char *argv[])
void ruby_deprecated_internal_feature(const char *func)
const char ruby_hexdigits[]
void rb_gc_mark_encodings(void)
void rb_clear_trace_func(void)
struct rb_imemo_alloc_struct rb_imemo_alloc_t
VALUE(* rb_alloc_func_t)(VALUE)
int rb_vm_add_root_module(ID id, VALUE module)
struct rb_global_entry * rb_global_entry(ID)
VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
VALUE rb_integer_float_cmp(VALUE x, VALUE y)
VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE)
int rb_is_junk_name(VALUE name)
VALUE rb_complex_mul(VALUE, VALUE)
VALUE rb_search_class_path(VALUE)
RUBY_SYMBOL_EXPORT_BEGIN const char * rb_objspace_data_type_name(VALUE obj)
VALUE rb_big_uminus(VALUE x)
void rb_objspace_set_event_hook(const rb_event_flag_t event)
void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen)
VALUE rb_class_boot(VALUE)
A utility function that wraps class_alloc.
VALUE rb_big_gt(VALUE x, VALUE y)
VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE name)
void rb_maygvl_fd_fix_cloexec(int fd)
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
ID rb_make_internal_id(void)
char * rb_str_to_cstr(VALUE str)
VALUE rb_mutex_owned_p(VALUE self)
VALUE rb_sourcefilename(void)
void rb_sys_warning(const char *fmt,...)
VALUE rb_obj_is_fiber(VALUE)
VALUE rb_big_divrem_normal(VALUE x, VALUE y)
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
VALUE rb_float_uminus(VALUE num)
ssize_t rb_io_bufread(VALUE io, void *buf, size_t size)
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
int rb_is_attrset_name(VALUE name)
int ruby_is_fd_loadable(int fd)
PRINTF_ARGS(void ruby_debug_printf(const char *,...), 1, 2)
void Init_eval_method(void)
VALUE rb_big_odd_p(VALUE)