12 #ifndef RUBY_INTERNAL_H 13 #define RUBY_INTERNAL_H 1 19 #if defined(__cplusplus) 26 #define LIKELY(x) RB_LIKELY(x) 27 #define UNLIKELY(x) RB_UNLIKELY(x) 30 # define MAYBE_UNUSED(x) x 33 #ifndef WARN_UNUSED_RESULT 34 # define WARN_UNUSED_RESULT(x) x 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)) 42 # ifndef VALGRIND_MAKE_MEM_UNDEFINED 43 # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n)) 46 # define VALGRIND_MAKE_MEM_DEFINED(p, n) 0 47 # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0 50 #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0]))) 53 # define __has_feature(x) 0 56 #ifndef __has_extension 57 # define __has_extension __has_feature 60 #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert) 61 # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr) 63 # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)] 66 #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1) 67 #define SIGNED_INTEGER_MAX(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) 74 #if SIGNEDNESS_OF_TIME_T < 0 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 78 # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t) 79 # define TIMET_MIN ((time_t)0) 81 #define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1)) 83 #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \ 85 (a) == -1 ? (b) < -(max) : \ 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) 94 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP16 95 # define swap16(x) __builtin_bswap16(x) 100 # define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF))) 104 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP32 105 # define swap32(x) __builtin_bswap32(x) 110 # define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \ 112 |(((x)&0x0000FF00)<<8) \ 113 |(((x)&0x00FF0000)>>8) )) 117 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP64 118 # define swap64(x) __builtin_bswap64(x) 124 # define byte_in_64bit(n) ((uint64_t)0xff << (n)) 125 # define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \ 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))) 136 static inline unsigned int 139 #if defined(HAVE_BUILTIN___BUILTIN_CLZ) 140 if (x == 0)
return SIZEOF_INT *
CHAR_BIT;
141 return (
unsigned int)__builtin_clz(x);
144 # if 64 < SIZEOF_INT * CHAR_BIT 145 unsigned int n = 128;
146 # elif 32 < SIZEOF_INT * CHAR_BIT 151 # if 64 < SIZEOF_INT * CHAR_BIT 152 y = x >> 64;
if (y) {n -= 64; x = y;}
154 # if 32 < SIZEOF_INT * CHAR_BIT 155 y = x >> 32;
if (y) {n -= 32; x = y;}
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 (
unsigned int)(n - x);
166 static inline unsigned int 169 #if defined(HAVE_BUILTIN___BUILTIN_CLZL) 170 if (x == 0)
return SIZEOF_LONG *
CHAR_BIT;
171 return (
unsigned int)__builtin_clzl(x);
174 # if 64 < SIZEOF_LONG * CHAR_BIT 175 unsigned int n = 128;
176 # elif 32 < SIZEOF_LONG * CHAR_BIT 181 # if 64 < SIZEOF_LONG * CHAR_BIT 182 y = x >> 64;
if (y) {n -= 64; x = y;}
184 # if 32 < SIZEOF_LONG * CHAR_BIT 185 y = x >> 32;
if (y) {n -= 32; x = y;}
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 (
unsigned int)(n - x);
196 #ifdef HAVE_LONG_LONG 197 static inline unsigned int 198 nlz_long_long(
unsigned LONG_LONG x)
200 #if defined(HAVE_BUILTIN___BUILTIN_CLZLL) 201 if (x == 0)
return SIZEOF_LONG_LONG *
CHAR_BIT;
202 return (
unsigned int)__builtin_clzll(x);
204 unsigned LONG_LONG y;
205 # if 64 < SIZEOF_LONG_LONG * CHAR_BIT 206 unsigned int n = 128;
207 # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT 212 # if 64 < SIZEOF_LONG_LONG * CHAR_BIT 213 y = x >> 64;
if (y) {n -= 64; x = y;}
215 # if 32 < SIZEOF_LONG_LONG * CHAR_BIT 216 y = x >> 32;
if (y) {n -= 32; x = y;}
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 (
unsigned int)(n - x);
228 #ifdef HAVE_UINT128_T 229 static inline unsigned int 230 nlz_int128(uint128_t x)
233 unsigned 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 (
unsigned int)(n - x);
245 static inline unsigned int 248 #if SIZEOF_VOIDP == 8 249 return nlz_long_long(x);
250 #elif SIZEOF_VOIDP == 4 255 static inline unsigned int 258 #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT 259 return (
unsigned int)__builtin_popcount(x);
261 x = (x & 0x55555555) + (x >> 1 & 0x55555555);
262 x = (x & 0x33333333) + (x >> 2 & 0x33333333);
263 x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
264 x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
265 return (x & 0x0000003f) + (x >>16 & 0x0000003f);
272 #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT 273 return __builtin_popcountll(x);
275 x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
276 x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
277 x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
278 x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
279 x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
280 return (x & 0x7f) + (x >>32 & 0x7f);
287 #if SIZEOF_VOIDP == 8 289 #elif SIZEOF_VOIDP == 4 297 #ifdef HAVE_BUILTIN___BUILTIN_CTZ 298 return __builtin_ctz(x);
307 #ifdef HAVE_BUILTIN___BUILTIN_CTZLL 308 return __builtin_ctzll(x);
317 #if SIZEOF_VOIDP == 8 319 #elif SIZEOF_VOIDP == 4 324 #if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG 325 # define DLONG LONG_LONG 326 # define DL2NUM(x) LL2NUM(x) 327 #elif defined(HAVE_INT128_T) 328 # define DLONG int128_t 329 # define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x)) 330 VALUE rb_int128t2big(int128_t n);
341 return DL2NUM((DLONG)lx * (DLONG)ly);
373 if (y > 0 ? mod < 0 : mod > 0) {
403 #if defined(HAVE_UINT128_T) 404 # 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(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \ 409 SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x))) 410 #elif defined(HAVE_LONG_LONG) 411 # define bit_length(x) \ 413 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \ 414 sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \ 415 SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x))) 417 # define bit_length(x) \ 419 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \ 420 SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x))) 424 # if SIZEOF_INT*2 <= SIZEOF_LONG_LONG 425 # define BDIGIT unsigned int 426 # define SIZEOF_BDIGIT SIZEOF_INT 427 # define BDIGIT_DBL unsigned LONG_LONG 428 # define BDIGIT_DBL_SIGNED LONG_LONG 429 # define PRI_BDIGIT_PREFIX "" 430 # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX 431 # elif SIZEOF_INT*2 <= SIZEOF_LONG 432 # define BDIGIT unsigned int 433 # define SIZEOF_BDIGIT SIZEOF_INT 434 # define BDIGIT_DBL unsigned long 435 # define BDIGIT_DBL_SIGNED long 436 # define PRI_BDIGIT_PREFIX "" 437 # define PRI_BDIGIT_DBL_PREFIX "l" 438 # elif SIZEOF_SHORT*2 <= SIZEOF_LONG 439 # define BDIGIT unsigned short 440 # define SIZEOF_BDIGIT SIZEOF_SHORT 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" 446 # define BDIGIT unsigned short 447 # define SIZEOF_BDIGIT (SIZEOF_LONG/2) 448 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG 449 # define BDIGIT_DBL unsigned long 450 # define BDIGIT_DBL_SIGNED long 451 # define PRI_BDIGIT_PREFIX "h" 452 # define PRI_BDIGIT_DBL_PREFIX "l" 455 #ifndef SIZEOF_ACTUAL_BDIGIT 456 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT 459 #ifdef PRI_BDIGIT_PREFIX 460 # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d" 461 # define PRIiBDIGIT PRI_BDIGIT_PREFIX"i" 462 # define PRIoBDIGIT PRI_BDIGIT_PREFIX"o" 463 # define PRIuBDIGIT PRI_BDIGIT_PREFIX"u" 464 # define PRIxBDIGIT PRI_BDIGIT_PREFIX"x" 465 # define PRIXBDIGIT PRI_BDIGIT_PREFIX"X" 468 #ifdef PRI_BDIGIT_DBL_PREFIX 469 # define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d" 470 # define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i" 471 # define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o" 472 # define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u" 473 # define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x" 474 # define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X" 477 #define BIGNUM_EMBED_LEN_NUMBITS 3 478 #ifndef BIGNUM_EMBED_LEN_MAX 479 # if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1 480 # define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) 482 # define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1) 496 #define BIGNUM_SIGN_BIT ((VALUE)FL_USER1) 498 #define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0) 499 #define BIGNUM_SET_SIGN(b,sign) \ 500 ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \ 501 : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT)) 502 #define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b) 503 #define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b)) 504 #define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT) 506 #define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2) 507 #define BIGNUM_EMBED_LEN_MASK ((VALUE)(FL_USER5|FL_USER4|FL_USER3)) 508 #define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS) 509 #define BIGNUM_LEN(b) \ 510 ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \ 511 (size_t)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \ 512 (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \ 513 RBIGNUM(b)->as.heap.len) 515 #define BIGNUM_DIGITS(b) \ 516 ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \ 517 RBIGNUM(b)->as.ary : \ 518 RBIGNUM(b)->as.heap.digits) 519 #define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b)) 521 #define RBIGNUM(obj) (R_CAST(RBignum)(obj)) 529 #define RRATIONAL(obj) (R_CAST(RRational)(obj)) 530 #define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n)) 531 #define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d)) 538 #define RFLOAT(obj) (R_CAST(RFloat)(obj)) 546 #define RCOMPLEX(obj) (R_CAST(RComplex)(obj)) 548 #ifdef RCOMPLEX_SET_REAL 549 #undef RCOMPLEX_SET_REAL 550 #undef RCOMPLEX_SET_IMAG 551 #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r)) 552 #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i)) 562 #define RHASH(obj) (R_CAST(RHash)(obj)) 564 #ifdef RHASH_ITER_LEV 565 #undef RHASH_ITER_LEV 568 #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev) 569 #define RHASH_IFNONE(h) (RHASH(h)->ifnone) 570 #define RHASH_SIZE(h) (RHASH(h)->ntbl ? RHASH(h)->ntbl->num_entries : (st_index_t)0) 574 #ifndef HAVE_SETPROCTITLE 578 #define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX 579 #define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK 580 #define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT 604 #define RSTRUCT_EMBED_LEN(st) \ 605 (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \ 606 (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT)) 607 #define RSTRUCT_LEN(st) rb_struct_len(st) 608 #define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st)) 609 #define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st) 610 #define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st))) 611 #define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v)) 612 #define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx]) 613 #define RSTRUCT(obj) (R_CAST(RStruct)(obj)) 622 static inline const VALUE *
643 #if defined(HAVE_LONG_LONG) 645 #define SERIALT2NUM ULL2NUM 646 #elif defined(HAVE_UINT64_T) 648 #define SERIALT2NUM SIZET2NUM 651 #define SERIALT2NUM ULONG2NUM 687 #define RCLASS_EXT(c) (RCLASS(c)->ptr) 688 #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl) 689 #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl) 690 #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl) 691 #define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl) 692 #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl) 693 #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_) 694 #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class) 695 #define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial) 697 #define RICLASS_IS_ORIGIN FL_USER5 710 return RCLASS(klass)->super;
726 #define IMEMO_DEBUG 0 756 #define IMEMO_FL_USHIFT (FL_USHIFT + 3) 757 #define IMEMO_FL_USER0 FL_USER3 758 #define IMEMO_FL_USER1 FL_USER4 759 #define IMEMO_FL_USER2 FL_USER5 760 #define IMEMO_FL_USER3 FL_USER6 761 #define IMEMO_FL_USER4 FL_USER7 777 #define THROW_DATA_CONSUMED IMEMO_FL_USER0 787 #define THROW_DATA_P(err) RB_TYPE_P(((VALUE)err), T_IMEMO) 792 #if SIZEOF_INT * 2 > SIZEOF_VALUE 808 #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0)) 831 #define MEMO_V1_SET(m, v) RB_OBJ_WRITE((m), &(m)->v1, (v)) 832 #define MEMO_V2_SET(m, v) RB_OBJ_WRITE((m), &(m)->v2, (v)) 834 #define MEMO_CAST(m) ((struct MEMO *)m) 836 #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0)) 838 #define roomof(x, y) (((x) + (y) - 1) / (y)) 839 #define type_roomof(x, y) roomof(sizeof(x), sizeof(y)) 840 #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value)) 841 #define NEW_MEMO_FOR(type, value) \ 842 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value)) 843 #define NEW_PARTIAL_MEMO_FOR(type, value, member) \ 844 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \ 845 rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \ 846 MEMO_FOR(type, value)) 848 #define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString) 850 #ifdef RUBY_INTEGER_UNIFICATION 851 # define rb_cFixnum rb_cInteger 852 # define rb_cBignum rb_cInteger 866 #define NEW_CMP_OPT_MEMO(type, value) \ 867 NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt) 868 #define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type)) 869 #define CMP_OPTIMIZABLE(data, type) \ 870 (((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \ 871 ((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \ 872 (((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \ 873 rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \ 874 ((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type)))) 876 #define OPTIMIZED_CMP(a, b, data) \ 877 ((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \ 878 (((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \ 879 (STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \ 881 rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b)) 907 #define rb_ary_new_from_args(n, ...) \ 909 const VALUE args_to_new_ary[] = {__VA_ARGS__}; \ 910 if (__builtin_constant_p(n)) { \ 911 STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \ 913 rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \ 1012 PRINTF_ARGS(
void rb_compile_error_str(
VALUE file,
int line,
void *enc,
const char *fmt, ...), 4, 5);
1022 #define rb_name_err_raise_str(mesg, recv, name) \ 1023 rb_exc_raise(rb_name_err_new(mesg, recv, name)) 1024 #define rb_name_err_raise(mesg, recv, name) \ 1025 rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name)) 1027 #define ONLY_FOR_INTERNAL_USE(func) ruby_only_for_internal_use(func) 1053 #ifdef RUBY_FUNCTION_NAME_STRING 1054 # if defined __GNUC__ && __GNUC__ >= 4 1055 # pragma GCC visibility push(default) 1057 NORETURN(
void rb_sys_fail_path_in(
const char *func_name,
VALUE path));
1058 NORETURN(
void rb_syserr_fail_path_in(
const char *func_name,
int err,
VALUE path));
1059 # if defined __GNUC__ && __GNUC__ >= 4 1060 # pragma GCC visibility pop 1062 # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path) 1063 # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path)) 1065 # define rb_sys_fail_path(path) rb_sys_fail_str(path) 1066 # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path)) 1079 #define rb_gc_writebarrier_remember(obj) 0 1084 #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32) 1085 #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size) 1086 #define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size) 1087 #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr) 1088 #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n) 1093 #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type))) 1101 #define RB_NEWOBJ_OF(obj,type,klass,flags) \ 1102 type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \ 1103 rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \ 1104 rb_wb_unprotected_newobj_of(klass, flags)) 1105 #define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags) 1118 #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h) 1123 #define HASH_DELETED FL_USER1 1124 #define HASH_PROC_DEFAULT FL_USER2 1166 #define FIXNUM_POSITIVE_P(num) ((SIGNED_VALUE)(num) > (SIGNED_VALUE)INT2FIX(0)) 1167 #define FIXNUM_NEGATIVE_P(num) ((SIGNED_VALUE)(num) < 0) 1168 #define FIXNUM_ZERO_P(num) ((num) == INT2FIX(0)) 1170 #define INT_NEGATIVE_P(x) (FIXNUM_P(x) ? FIXNUM_NEGATIVE_P(x) : BIGNUM_NEGATIVE_P(x)) 1172 #ifndef ROUND_DEFAULT 1173 # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP 1181 #define ROUND_TO(mode, even, up, down) \ 1182 ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \ 1183 (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down) 1184 #define ROUND_FUNC(mode, name) \ 1185 ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down) 1186 #define ROUND_CALL(mode, name, args) \ 1187 ROUND_TO(mode, name##_half_even args, \ 1188 name##_half_up args, name##_half_down args) 1225 #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n))) 1226 #define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n))) 1229 static inline double 1233 if (v != (
VALUE)0x8000000000000002) {
1239 VALUE b63 = (v >> 63);
1250 static inline double 1253 return ((
struct RFloat *)v)->float_value;
1256 static inline double 1276 bits = (int)((
VALUE)(t.v >> 60) & 0x7);
1282 if (t.v != 0x3000000000000000 &&
1283 !((bits-3) & ~0x01)) {
1286 else if (t.v == (
VALUE)0) {
1288 return 0x8000000000000002;
1295 #define rb_float_value(v) rb_float_value_inline(v) 1296 #define rb_float_new(d) rb_float_new_inline(d) 1312 #define RBASIC_CLEAR_CLASS(obj) memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(VALUE)) 1313 #define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE)) 1314 #define RBASIC_SET_CLASS(obj, cls) do { \ 1315 VALUE _obj_ = (obj); \ 1316 RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \ 1320 #ifndef USE_SYMBOL_GC 1321 #define USE_SYMBOL_GC 1 1356 #define RB_MAX_GROUPS (65536) 1405 #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2) 1406 #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1) 1435 #ifdef RUBY_ENCODING_H 1437 const struct vtm *vtm,
struct timespec *ts,
int gmt);
1439 const struct vtm *vtm,
VALUE timev,
int gmt);
1445 #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str)) 1446 #define rb_fstring_literal(str) rb_fstring_lit(str) 1448 #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P 1449 # define rb_fstring_cstr(str) RB_GNUC_EXTENSION_BLOCK( \ 1450 (__builtin_constant_p(str)) ? \ 1451 rb_fstring_new((str), (long)strlen(str)) : \ 1452 rb_fstring_cstr(str) \ 1455 #ifdef RUBY_ENCODING_H 1457 #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc)) 1458 #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc) 1460 # ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P 1461 # define rb_fstring_enc_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \ 1462 (__builtin_constant_p(str)) ? \ 1463 rb_fstring_enc_new((str), (long)strlen(str), (enc)) : \ 1464 rb_fstring_enc_cstr(str, enc) \ 1472 #define QUOTE(str) rb_str_quote_unprintable(str) 1473 #define QUOTE_ID(id) rb_id_quote_unprintable(id) 1480 #ifdef RUBY_ENCODING_H 1486 #define STR_NOEMBED FL_USER1 1487 #define STR_SHARED FL_USER2 1488 #define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED)) 1489 #define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED) 1490 #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) 1491 #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) 1497 #ifdef RUBY_ENCODING_H 1501 #define rb_sym_intern_cstr(ptr, enc) __extension__ ( \ 1503 (__builtin_constant_p(ptr)) ? \ 1504 rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \ 1505 rb_sym_intern_cstr((ptr), (enc)); \ 1512 #define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \ 1514 (__builtin_constant_p(ptr)) ? \ 1515 rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \ 1516 rb_sym_intern_ascii_cstr(ptr); \ 1555 char *
ruby_dtoa(
double d_,
int mode,
int ndigits,
int *decpt,
int *sign,
char **rve);
1556 char *
ruby_hdtoa(
double d,
const char *xdigs,
int ndigits,
int *decpt,
int *sign,
char **rve);
1657 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) 1661 VALUE rb_str2big_gmp(
VALUE arg,
int base,
int badcheck);
1668 #define Check_Type(v, t) \ 1669 (!RB_TYPE_P((VALUE)(v), (t)) || \ 1670 ((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \ 1671 rb_unexpected_type((VALUE)(v), (t)) : (void)0) 1674 #ifdef HAVE_READLINK 1678 VALUE rb_str_normalize_ospath(
const char *ptr,
long len);
1709 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) 1714 #ifdef RUBY_ENCODING_H 1725 extern unsigned long ruby_scan_digits(
const char *str, ssize_t
len,
int base,
size_t *retlen,
int *overflow);
1740 #define RB_OBJ_GC_FLAGS_MAX 5 1746 #define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__) 1753 #define RUBY_DTRACE_CREATE_HOOK(name, arg) \ 1754 RUBY_DTRACE_HOOK(name##_CREATE, arg) 1755 #define RUBY_DTRACE_HOOK(name, arg) \ 1757 if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \ 1759 const char *dtrace_file = rb_source_loc(&dtrace_line); \ 1760 if (!dtrace_file) dtrace_file = ""; \ 1761 RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \ 1765 #define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj) 1766 #define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj) 1768 #define rb_obj_builtin_type(obj) \ 1770 VALUE arg_obj = (obj); \ 1771 RB_SPECIAL_CONST_P(arg_obj) ? -1 : \ 1772 RB_BUILTIN_TYPE(arg_obj); \ 1783 #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_report_bug_valist(VALUE file, int line, const char *fmt, va_list args)
void rb_class_remove_from_super_subclasses(VALUE)
st_table * rb_init_identtable_with_size(st_index_t size)
void rb_backtrace_print_to(VALUE output)
VALUE rb_int_cmp(VALUE x, VALUE y)
static unsigned int nlz_long(unsigned long x)
VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc)
void rb_execarg_setenv(VALUE execarg_obj, VALUE env)
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_math_sqrt(VALUE)
void rb_vm_inc_const_missing_count(void)
VALUE rb_vm_backtrace_object(void)
VALUE rb_parser_get_yydebug(VALUE)
VALUE rb_big_mul_balance(VALUE x, VALUE y)
struct st_table * iv_index_tbl
VALUE(* rb_block_call_func_t)(ANYARGS)
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding *, const char *, va_list)
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)
static int max(int a, int b)
void rb_str_tmp_frozen_release(VALUE str, VALUE tmp)
static unsigned int hash(str, len) register const char *str
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_hash_values(VALUE hash)
VALUE rb_check_backtrace(VALUE)
VALUE rb_big2str_generic(VALUE x, int base)
VALUE rb_fstring_cstr(const char *str)
int rb_is_attrset_sym(VALUE sym)
static int ntz_int64(uint64_t x)
static int ntz_intptr(uintptr_t x)
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_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)
rb_subclass_entry_t * subclasses
const char * ruby_get_inplace_mode(void)
void rb_ary_set_len(VALUE, long)
VALUE rb_yield_lambda(VALUE values)
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)
SSL_METHOD *(* func)(void)
#define RB_SPECIAL_CONST_P(x)
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)
void rb_async_bug_errno(const char *mesg, int errno_arg)
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)
static VALUE rb_fix_mul_fix(VALUE x, VALUE y)
VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, VALUE timev, int gmt)
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)
static long rb_struct_len(VALUE st)
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_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr)
VALUE rb_int_gt(VALUE x, VALUE y)
VALUE rb_math_sinh(VALUE)
VALUE rb_attr_delete(VALUE, ID)
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)
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
static VALUE rb_fix_div_fix(VALUE x, VALUE y)
int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val)
double rb_int_fdiv_double(VALUE x, VALUE y)
void rb_load_fail(VALUE path, const char *err)
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)
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)
int rb_local_defined(ID, const struct rb_block *)
static double rb_float_flonum_value(VALUE v)
#define RSTRUCT_EMBED_LEN_MAX
#define BIGNUM_EMBED_LEN_MAX
VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc)
VALUE rb_ary_tmp_new_fill(long capa)
static int rb_obj_builtin_type(VALUE obj)
static unsigned char * output
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)
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_obj_not(VALUE obj)
static VALUE RCLASS_SUPER(VALUE klass)
VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
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)
static unsigned int nlz_int(unsigned int x)
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 ruby_error_print(void)
void rb_vm_mark(void *ptr)
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 *)
BDIGIT ary[BIGNUM_EMBED_LEN_MAX]
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)
static VALUE RCLASS_SET_SUPER(VALUE klass, VALUE super)
int rb_match_nth_defined(int nth, VALUE match)
VALUE rb_sym_intern_ascii(const char *ptr, long len)
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)
void rb_unexpected_type(VALUE x, int t)
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)
static const VALUE * rb_struct_const_ptr(VALUE st)
VALUE rb_proc_location(VALUE self)
void rb_file_const(const char *, VALUE)
int rb_is_class_sym(VALUE sym)
void rb_undefined_alloc(VALUE klass)
const char * rb_builtin_class_name(VALUE x)
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)
void rb_gc_resurrect(VALUE ptr)
VALUE rb_int_abs(VALUE num)
VALUE rb_float_new_in_heap(double)
int rb_backtrace_p(VALUE obj)
VALUE rb_obj_equal(VALUE obj1, VALUE obj2)
static VALUE rb_float_new_inline(double d)
int rb_obj_basic_to_s_p(VALUE)
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)
static int ntz_int32(uint32_t x)
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)
static int chfunc(void *data, char *errbuf, size_t errbuf_len)
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)
#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)
static unsigned int nlz_intptr(uintptr_t x)
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)
static int options(unsigned char *cp)
VALUE rb_integer_float_eq(VALUE x, VALUE y)
int rb_bug_reporter_add(void(*func)(FILE *, void *), void *data)
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)
VALUE rb_big_ge(VALUE x, VALUE y)
VALUE rb_get_backtrace(VALUE info)
void rb_obj_copy_ivar(VALUE dest, VALUE obj)
VALUE rb_str2big_normal(VALUE arg, int base, int badcheck)
const char ruby_initial_load_paths[]
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)
void rb_thread_mark(void *th)
void rb_enc_warn(rb_encoding *enc, const char *fmt,...)
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv)
static struct vm_ifunc * rb_vm_ifunc_proc_new(VALUE(*func)(ANYARGS), const void *data)
static double rb_float_noflonum_value(VALUE v)
VALUE rb_math_cosh(VALUE)
static VALUE rb_fix_mod_fix(VALUE x, VALUE y)
int Init_enc_set_filesystem_encoding(void)
int rb_sigaltstack_size(void)
VALUE rb_uninterruptible(VALUE(*b_proc)(ANYARGS), VALUE data)
VALUE rb_blocking_function_t(void *)
static int rb_popcount64(uint64_t x)
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)
static int rb_popcount_intptr(uintptr_t x)
void rb_sys_enc_warning(rb_encoding *enc, const char *fmt,...)
VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary)
int rb_thread_to_be_killed(VALUE thread)
VALUE rb_wb_protected_newobj_of(VALUE, VALUE)
void rb_write_error_str(VALUE mesg)
VALUE rb_rational_plus(VALUE self, VALUE other)
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_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)
static void rb_fix_divmod_fix(VALUE a, VALUE b, VALUE *divp, VALUE *modp)
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
void rb_gc_verify_internal_consistency(void)
double rb_num_to_dbl(VALUE val)
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)
static void RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
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)
size_t rb_obj_gc_flags(VALUE, ID[], size_t)
VALUE rb_gcd(VALUE x, VALUE y)
void ruby_kill(rb_pid_t pid, int sig)
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)
VALUE rb_big2str_poweroftwo(VALUE x, int base)
void rb_gc_mark_global_tbl(void)
VALUE rb_source_location(int *pline)
static double rb_float_value_inline(VALUE v)
void ruby_only_for_internal_use(const char *func)
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)
struct RBignum::@134::@135 heap
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[])
const char ruby_hexdigits[]
void rb_gc_mark_encodings(void)
void rb_clear_trace_func(void)
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_class_search_ancestor(VALUE klass, VALUE super)
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)
static int match(VALUE str, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
static unsigned int rb_popcount32(uint32_t x)
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)
void rb_maygvl_fd_fix_cloexec(int fd)
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
ID rb_make_internal_id(void)
VALUE rb_mutex_owned_p(VALUE self)
#define RB_OBJ_WRITE(a, slot, b)
VALUE rb_sourcefilename(void)
const char * rb_builtin_type_name(int t)
VALUE rb_obj_is_fiber(VALUE)
VALUE rb_big_divrem_normal(VALUE x, VALUE y)
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)