12#ifndef RUBY_INTERNAL_H
13#define RUBY_INTERNAL_H 1
17#if defined(__cplusplus)
34#define HALF_LONG_MSB ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))
36#define LIKELY(x) RB_LIKELY(x)
37#define UNLIKELY(x) RB_UNLIKELY(x)
40# define MAYBE_UNUSED(x) x
43#ifndef WARN_UNUSED_RESULT
44# define WARN_UNUSED_RESULT(x) x
48# define __has_feature(x) 0
51#ifndef __has_extension
52# define __has_extension __has_feature
56#elif defined(NO_SANITIZE) && __has_feature(memory_sanitizer)
57# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
58 NO_SANITIZE("memory", NO_SANITIZE("address", NOINLINE(x)))
59#elif defined(NO_SANITIZE)
60# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
61 NO_SANITIZE("address", NOINLINE(x))
62#elif defined(NO_SANITIZE_ADDRESS)
63# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
64 NO_SANITIZE_ADDRESS(NOINLINE(x))
65#elif defined(NO_ADDRESS_SAFETY_ANALYSIS)
66# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
67 NO_ADDRESS_SAFETY_ANALYSIS(NOINLINE(x))
69# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) x
72#if defined(NO_SANITIZE) && defined(__GNUC__) &&! defined(__clang__)
75#define NO_SANITIZE(x, y) \
76 COMPILER_WARNING_PUSH; \
77 COMPILER_WARNING_IGNORED(-Wattributes); \
78 __attribute__((__no_sanitize__(x))) y; \
83# define NO_SANITIZE(x, y) y
86#ifdef HAVE_VALGRIND_MEMCHECK_H
87# include <valgrind/memcheck.h>
88# ifndef VALGRIND_MAKE_MEM_DEFINED
89# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
91# ifndef VALGRIND_MAKE_MEM_UNDEFINED
92# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
95# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
96# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
99#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
103#ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
104# include <sanitizer/asan_interface.h>
107#if !__has_feature(address_sanitizer)
108# define __asan_poison_memory_region(x, y)
109# define __asan_unpoison_memory_region(x, y)
110# define __asan_region_is_poisoned(x, y) 0
113#ifdef HAVE_SANITIZER_MSAN_INTERFACE_H
114# if __has_feature(memory_sanitizer)
115# include <sanitizer/msan_interface.h>
119#if !__has_feature(memory_sanitizer)
120# define __msan_allocated_memory(x, y) ((void)(x), (void)(y))
121# define __msan_poison(x, y) ((void)(x), (void)(y))
122# define __msan_unpoison(x, y) ((void)(x), (void)(y))
123# define __msan_unpoison_string(x) ((void)(x))
140asan_poison_memory_region(
const volatile void *
ptr,
size_t size)
158#if !__has_feature(address_sanitizer)
159#define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj))
161#define asan_poison_object_if(ptr, obj) do { \
162 if (ptr) asan_poison_object(obj); \
196asan_unpoison_memory_region(
const volatile void *
ptr,
size_t size,
bool malloc_p)
214asan_unpoison_object(
VALUE obj,
bool newobj_p)
223#define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
225#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
226# define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
227#elif GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
228# define STATIC_ASSERT(name, expr) RB_GNUC_EXTENSION _Static_assert(expr, #name ": " #expr)
230# define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
233#define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
234#define SIGNED_INTEGER_MAX(sint_type) \
236 ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \
237 ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1))
238#define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1)
239#define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0)
241#if SIGNEDNESS_OF_TIME_T < 0
242# define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
243# define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
244#elif SIGNEDNESS_OF_TIME_T > 0
245# define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
246# define TIMET_MIN ((time_t)0)
248#define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
250#ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P
251#define MUL_OVERFLOW_P(a, b) \
252 __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
253#elif defined HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW
254#define MUL_OVERFLOW_P(a, b) \
255 ({__typeof__(a) c; __builtin_mul_overflow((a), (b), &c);})
258#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
260 (a) == -1 ? (b) < -(max) : \
262 ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
263 ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
265#ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P
268#define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \
269 struct { long fixnum : SIZEOF_LONG * CHAR_BIT - 1; } c; \
270 __builtin_mul_overflow_p((a), (b), c.fixnum); \
273#define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
277#define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
278#define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
279#define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b)
281#define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
282#define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
283#define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
287# ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
288# define swap16(x) __builtin_bswap16(x)
293# define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
297# ifdef HAVE_BUILTIN___BUILTIN_BSWAP32
298# define swap32(x) __builtin_bswap32(x)
303# define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
305 |(((x)&0x0000FF00)<<8) \
306 |(((x)&0x00FF0000)>>8) ))
310# ifdef HAVE_BUILTIN___BUILTIN_BSWAP64
311# define swap64(x) __builtin_bswap64(x)
317# define byte_in_64bit(n) ((uint64_t)0xff << (n))
318# define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
320 |(((x)&byte_in_64bit(8))<<40) \
321 |(((x)&byte_in_64bit(48))>>40) \
322 |(((x)&byte_in_64bit(16))<<24) \
323 |(((x)&byte_in_64bit(40))>>24) \
324 |(((x)&byte_in_64bit(24))<<8) \
325 |(((x)&byte_in_64bit(32))>>8)))
329static inline unsigned int
330nlz_int(
unsigned int x)
332#if defined(HAVE_BUILTIN___BUILTIN_CLZ)
334 return (
unsigned int)__builtin_clz(x);
337# if 64 < SIZEOF_INT * CHAR_BIT
338 unsigned int n = 128;
339# elif 32 < SIZEOF_INT * CHAR_BIT
344# if 64 < SIZEOF_INT * CHAR_BIT
345 y = x >> 64;
if (y) {
n -= 64; x = y;}
347# if 32 < SIZEOF_INT * CHAR_BIT
348 y = x >> 32;
if (y) {
n -= 32; x = y;}
350 y = x >> 16;
if (y) {
n -= 16; x = y;}
351 y = x >> 8;
if (y) {
n -= 8; x = y;}
352 y = x >> 4;
if (y) {
n -= 4; x = y;}
353 y = x >> 2;
if (y) {
n -= 2; x = y;}
354 y = x >> 1;
if (y) {
return n - 2;}
355 return (
unsigned int)(
n - x);
359static inline unsigned int
360nlz_long(
unsigned long x)
362#if defined(HAVE_BUILTIN___BUILTIN_CLZL)
364 return (
unsigned int)__builtin_clzl(x);
367# if 64 < SIZEOF_LONG * CHAR_BIT
368 unsigned int n = 128;
369# elif 32 < SIZEOF_LONG * CHAR_BIT
374# if 64 < SIZEOF_LONG * CHAR_BIT
375 y = x >> 64;
if (y) {
n -= 64; x = y;}
377# if 32 < SIZEOF_LONG * CHAR_BIT
378 y = x >> 32;
if (y) {
n -= 32; x = y;}
380 y = x >> 16;
if (y) {
n -= 16; x = y;}
381 y = x >> 8;
if (y) {
n -= 8; x = y;}
382 y = x >> 4;
if (y) {
n -= 4; x = y;}
383 y = x >> 2;
if (y) {
n -= 2; x = y;}
384 y = x >> 1;
if (y) {
return n - 2;}
385 return (
unsigned int)(
n - x);
390static inline unsigned int
393#if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
395 return (
unsigned int)__builtin_clzll(x);
398# if 64 < SIZEOF_LONG_LONG * CHAR_BIT
399 unsigned int n = 128;
400# elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
405# if 64 < SIZEOF_LONG_LONG * CHAR_BIT
406 y = x >> 64;
if (y) {
n -= 64; x = y;}
408# if 32 < SIZEOF_LONG_LONG * CHAR_BIT
409 y = x >> 32;
if (y) {
n -= 32; x = y;}
411 y = x >> 16;
if (y) {
n -= 16; x = y;}
412 y = x >> 8;
if (y) {
n -= 8; x = y;}
413 y = x >> 4;
if (y) {
n -= 4; x = y;}
414 y = x >> 2;
if (y) {
n -= 2; x = y;}
415 y = x >> 1;
if (y) {
return n - 2;}
416 return (
unsigned int)(
n - x);
422static inline unsigned int
426 unsigned int n = 128;
427 y = x >> 64;
if (y) {
n -= 64; x = y;}
428 y = x >> 32;
if (y) {
n -= 32; x = y;}
429 y = x >> 16;
if (y) {
n -= 16; x = y;}
430 y = x >> 8;
if (y) {
n -= 8; x = y;}
431 y = x >> 4;
if (y) {
n -= 4; x = y;}
432 y = x >> 2;
if (y) {
n -= 2; x = y;}
433 y = x >> 1;
if (y) {
return n - 2;}
434 return (
unsigned int)(
n - x);
438static inline unsigned int
441#if SIZEOF_UINTPTR_T == SIZEOF_INT
443#elif SIZEOF_UINTPTR_T == SIZEOF_LONG
445#elif SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG
446 return nlz_long_long(x);
448 #error no known integer type corresponds uintptr_t
453static inline unsigned int
456#ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
457 return (
unsigned int)__builtin_popcount(x);
459 x = (x & 0x55555555) + (x >> 1 & 0x55555555);
460 x = (x & 0x33333333) + (x >> 2 & 0x33333333);
461 x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
462 x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
463 return (x & 0x0000003f) + (x >>16 & 0x0000003f);
470#ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
471 return __builtin_popcountll(x);
473 x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
474 x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
475 x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
476 x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
477 x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
478 return (x & 0x7f) + (x >>32 & 0x7f);
486 return rb_popcount64(x);
487#elif SIZEOF_VOIDP == 4
488 return rb_popcount32(x);
495#ifdef HAVE_BUILTIN___BUILTIN_CTZ
496 return __builtin_ctz(x);
498 return rb_popcount32((~x) & (x-1));
505#ifdef HAVE_BUILTIN___BUILTIN_CTZLL
506 return __builtin_ctzll(x);
508 return rb_popcount64((~x) & (x-1));
517#elif SIZEOF_VOIDP == 4
522#if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG
523# define DLONG LONG_LONG
524# define DL2NUM(x) LL2NUM(x)
525#elif defined(HAVE_INT128_T)
526# define DLONG int128_t
527# define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x))
532rb_overflowed_fix_to_int(
long x)
540#ifdef HAVE_BUILTIN___BUILTIN_ADD_OVERFLOW
562 if (__builtin_add_overflow((
long)x, (
long)y-1, &lz)) {
563 return rb_int2big(rb_overflowed_fix_to_int(lz));
577#ifdef HAVE_BUILTIN___BUILTIN_SUB_OVERFLOW
579 if (__builtin_sub_overflow((
long)x, (
long)y-1, &lz)) {
580 return rb_int2big(rb_overflowed_fix_to_int(lz));
630 if (y > 0 ? mod < 0 : mod > 0) {
645 rb_fix_divmod_fix(x, y, &
div,
NULL);
656 rb_fix_divmod_fix(x, y,
NULL, &
mod);
660#if defined(HAVE_UINT128_T) && defined(HAVE_LONG_LONG)
661# define bit_length(x) \
663 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
664 sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
665 sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
666 SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
667#elif defined(HAVE_UINT128_T)
668# define bit_length(x) \
670 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
671 sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
672 SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
673#elif defined(HAVE_LONG_LONG)
674# define bit_length(x) \
676 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
677 sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
678 SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
680# define bit_length(x) \
682 (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
683 SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
687# if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
688# define BDIGIT unsigned int
689# define SIZEOF_BDIGIT SIZEOF_INT
690# define BDIGIT_DBL unsigned LONG_LONG
691# define BDIGIT_DBL_SIGNED LONG_LONG
692# define PRI_BDIGIT_PREFIX ""
693# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
694# elif SIZEOF_INT*2 <= SIZEOF_LONG
695# define BDIGIT unsigned int
696# define SIZEOF_BDIGIT SIZEOF_INT
697# define BDIGIT_DBL unsigned long
698# define BDIGIT_DBL_SIGNED long
699# define PRI_BDIGIT_PREFIX ""
700# define PRI_BDIGIT_DBL_PREFIX "l"
701# elif SIZEOF_SHORT*2 <= SIZEOF_LONG
702# define BDIGIT unsigned short
703# define SIZEOF_BDIGIT SIZEOF_SHORT
704# define BDIGIT_DBL unsigned long
705# define BDIGIT_DBL_SIGNED long
706# define PRI_BDIGIT_PREFIX "h"
707# define PRI_BDIGIT_DBL_PREFIX "l"
709# define BDIGIT unsigned short
710# define SIZEOF_BDIGIT (SIZEOF_LONG/2)
711# define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
712# define BDIGIT_DBL unsigned long
713# define BDIGIT_DBL_SIGNED long
714# define PRI_BDIGIT_PREFIX "h"
715# define PRI_BDIGIT_DBL_PREFIX "l"
718#ifndef SIZEOF_ACTUAL_BDIGIT
719# define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT
722#ifdef PRI_BDIGIT_PREFIX
723# define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
724# define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
725# define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
726# define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
727# define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
728# define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
731#ifdef PRI_BDIGIT_DBL_PREFIX
732# define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
733# define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
734# define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
735# define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
736# define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
737# define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
740#define BIGNUM_EMBED_LEN_NUMBITS 3
741#ifndef BIGNUM_EMBED_LEN_MAX
742# if (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
743# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT)
745# define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
759#define BIGNUM_SIGN_BIT ((VALUE)FL_USER1)
761#define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
762#define BIGNUM_SET_SIGN(b,sign) \
763 ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \
764 : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
765#define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
766#define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
767#define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT)
769#define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2)
770#define BIGNUM_EMBED_LEN_MASK \
771 (~(~(VALUE)0U << BIGNUM_EMBED_LEN_NUMBITS) << BIGNUM_EMBED_LEN_SHIFT)
772#define BIGNUM_EMBED_LEN_SHIFT \
774#define BIGNUM_LEN(b) \
775 ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
776 (size_t)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
777 (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
778 RBIGNUM(b)->as.heap.len)
780#define BIGNUM_DIGITS(b) \
781 ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
782 RBIGNUM(b)->as.ary : \
783 RBIGNUM(b)->as.heap.digits)
784#define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b))
786#define RBIGNUM(obj) (R_CAST(RBignum)(obj))
794#define RRATIONAL(obj) (R_CAST(RRational)(obj))
795#define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
796#define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
803#define RFLOAT(obj) (R_CAST(RFloat)(obj))
811#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
814#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
815#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
821#define RHASH_AR_TABLE_MAX_SIZE SIZEOF_VALUE
828#define RHASH_LEV_MASK (FL_USER13 | FL_USER14 | FL_USER15 | \
829 FL_USER16 | FL_USER17 | FL_USER18 | FL_USER19)
831#if USE_TRANSIENT_HEAP
841#define RHASH_AR_TABLE_SIZE_RAW(h) \
842 ((unsigned int)((RBASIC(h)->flags & RHASH_AR_TABLE_SIZE_MASK) >> RHASH_AR_TABLE_SIZE_SHIFT))
850#define RHASH_AR_TABLE_P(hash) rb_hash_ar_table_p(hash)
851#define RHASH_AR_TABLE(h) rb_hash_ar_table(h)
852#define RHASH_ST_TABLE(h) rb_hash_st_table(h)
854#define RHASH_AR_TABLE_P(hash) (!FL_TEST_RAW((hash), RHASH_ST_TABLE_FLAG))
855#define RHASH_AR_TABLE(hash) (RHASH(hash)->as.ar)
856#define RHASH_ST_TABLE(hash) (RHASH(hash)->as.st)
859#define RHASH(obj) (R_CAST(RHash)(obj))
860#define RHASH_ST_SIZE(h) (RHASH_ST_TABLE(h)->num_entries)
861#define RHASH_ST_TABLE_P(h) (!RHASH_AR_TABLE_P(h))
862#define RHASH_ST_CLEAR(h) (FL_UNSET_RAW(h, RHASH_ST_TABLE_FLAG), RHASH(h)->as.ar = NULL)
864#define RHASH_AR_TABLE_SIZE_MASK (VALUE)RHASH_AR_TABLE_SIZE_MASK
865#define RHASH_AR_TABLE_SIZE_SHIFT RHASH_AR_TABLE_SIZE_SHIFT
866#define RHASH_AR_TABLE_BOUND_MASK (VALUE)RHASH_AR_TABLE_BOUND_MASK
867#define RHASH_AR_TABLE_BOUND_SHIFT RHASH_AR_TABLE_BOUND_SHIFT
869#if USE_TRANSIENT_HEAP
870#define RHASH_TRANSIENT_P(hash) FL_TEST_RAW((hash), RHASH_TRANSIENT_FLAG)
871#define RHASH_SET_TRANSIENT_FLAG(h) FL_SET_RAW(h, RHASH_TRANSIENT_FLAG)
872#define RHASH_UNSET_TRANSIENT_FLAG(h) FL_UNSET_RAW(h, RHASH_TRANSIENT_FLAG)
874#define RHASH_TRANSIENT_P(hash) 0
875#define RHASH_SET_TRANSIENT_FLAG(h) ((void)0)
876#define RHASH_UNSET_TRANSIENT_FLAG(h) ((void)0)
879#if SIZEOF_VALUE / RHASH_AR_TABLE_MAX_SIZE == 2
881#elif SIZEOF_VALUE / RHASH_AR_TABLE_MAX_SIZE == 1
904# define RHASH_IFNONE(h) (RHASH(h)->ifnone)
905# define RHASH_SIZE(h) (RHASH_AR_TABLE_P(h) ? RHASH_AR_TABLE_SIZE_RAW(h) : RHASH_ST_SIZE(h))
915#ifndef HAVE_SETPROCTITLE
919#define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX
920#define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK
921#define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
932#if USE_TRANSIENT_HEAP
933#define RSTRUCT_TRANSIENT_P(st) FL_TEST_RAW((obj), RSTRUCT_TRANSIENT_FLAG)
934#define RSTRUCT_TRANSIENT_SET(st) FL_SET_RAW((st), RSTRUCT_TRANSIENT_FLAG)
935#define RSTRUCT_TRANSIENT_UNSET(st) FL_UNSET_RAW((st), RSTRUCT_TRANSIENT_FLAG)
937#define RSTRUCT_TRANSIENT_P(st) 0
938#define RSTRUCT_TRANSIENT_SET(st) ((void)0)
939#define RSTRUCT_TRANSIENT_UNSET(st) ((void)0)
957#define RSTRUCT_EMBED_LEN(st) \
958 (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
959 (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT))
960#define RSTRUCT_LEN(st) rb_struct_len(st)
961#define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st))
962#define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st)
963#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st)))
964#define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
965#define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
966#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
975static inline const VALUE *
982static inline const VALUE *
983rb_struct_const_heap_ptr(
VALUE st)
1003#if defined(HAVE_LONG_LONG)
1005#define SERIALT2NUM ULL2NUM
1006#define PRI_SERIALT_PREFIX PRI_LL_PREFIX
1007#define SIZEOF_SERIAL_T SIZEOF_LONG_LONG
1008#elif defined(HAVE_UINT64_T)
1010#define SERIALT2NUM SIZET2NUM
1011#define PRI_SERIALT_PREFIX PRI_64_PREFIX
1012#define SIZEOF_SERIAL_T SIZEOF_UINT64_T
1015#define SERIALT2NUM ULONG2NUM
1016#define PRI_SERIALT_PREFIX PRI_LONG_PREFIX
1017#define SIZEOF_SERIAL_T SIZEOF_LONG
1023#if SIZEOF_SERIAL_T == SIZEOF_VALUE
1036#if SIZEOF_SERIAL_T != SIZEOF_VALUE
1049 struct RBasic
basic;
1052#if SIZEOF_SERIAL_T == SIZEOF_VALUE
1065#define RCLASS_EXT(c) (RCLASS(c)->ptr)
1066#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
1067#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
1068#if SIZEOF_SERIAL_T == SIZEOF_VALUE
1069# define RCLASS_M_TBL(c) (RCLASS_EXT(c)->m_tbl)
1071# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
1073#define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
1074#define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
1075#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
1076#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
1077#if SIZEOF_SERIAL_T == SIZEOF_VALUE
1078# define RCLASS_SERIAL(c) (RCLASS(c)->class_serial)
1080# define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
1082#define RCLASS_INCLUDER(c) (RCLASS_EXT(c)->includer)
1084#define RCLASS_CLONED FL_USER6
1085#define RICLASS_IS_ORIGIN FL_USER5
1086#define RCLASS_REFINED_BY_ANY FL_USER7
1121#define IMEMO_DEBUG 0
1145#define IMEMO_MASK 0x0f
1171#define IMEMO_FL_USHIFT (FL_USHIFT + 4)
1172#define IMEMO_FL_USER0 FL_USER4
1173#define IMEMO_FL_USER1 FL_USER5
1174#define IMEMO_FL_USER2 FL_USER6
1175#define IMEMO_FL_USER3 FL_USER7
1176#define IMEMO_FL_USER4 FL_USER8
1190#define THROW_DATA_CONSUMED IMEMO_FL_USER0
1201#define THROW_DATA_P(err) RB_TYPE_P((VALUE)(err), T_IMEMO)
1206#if SIZEOF_INT * 2 > SIZEOF_VALUE
1223#define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
1239#define rb_imemo_tmpbuf_auto_free_pointer() rb_imemo_new(imemo_tmpbuf, 0, 0, 0, 0)
1242#define RB_IMEMO_TMPBUF_PTR(v) \
1243 ((void *)(((const struct rb_imemo_tmpbuf_struct *)(v))->ptr))
1246rb_imemo_tmpbuf_set_ptr(
VALUE v,
void *
ptr)
1252rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(
VALUE str)
1291#define MEMO_V1_SET(m, v) RB_OBJ_WRITE((m), &(m)->v1, (v))
1292#define MEMO_V2_SET(m, v) RB_OBJ_WRITE((m), &(m)->v2, (v))
1294#define MEMO_CAST(m) ((struct MEMO *)m)
1296#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
1298#define roomof(x, y) (((x) + (y) - 1) / (y))
1299#define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
1300#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
1301#define NEW_MEMO_FOR(type, value) \
1302 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
1303#define NEW_PARTIAL_MEMO_FOR(type, value, member) \
1304 ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
1305 rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
1306 MEMO_FOR(type, value))
1308#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
1310#ifdef RUBY_INTEGER_UNIFICATION
1311# define rb_cFixnum rb_cInteger
1312# define rb_cBignum rb_cInteger
1327#define NEW_CMP_OPT_MEMO(type, value) \
1328 NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt)
1329#define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type))
1330#define CMP_OPTIMIZABLE(data, type) \
1331 (((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \
1332 ((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \
1333 (((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \
1334 rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \
1335 ((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type))))
1337#define OPTIMIZED_CMP(a, b, data) \
1338 ((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \
1339 (((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
1340 (STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
1341 rb_str_cmp(a, b) : \
1342 (RB_FLOAT_TYPE_P(a) && RB_FLOAT_TYPE_P(b) && CMP_OPTIMIZABLE(data, Float)) ? \
1343 rb_float_cmp(a, b) : \
1344 rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b))
1363#define ARRAY_DEBUG (0+RUBY_DEBUG)
1367#define RARRAY_PTR_IN_USE_FLAG FL_USER14
1368#define ARY_PTR_USING_P(ary) FL_TEST_RAW((ary), RARRAY_PTR_IN_USE_FLAG)
1372#undef RARRAY_PTR_USE_START_TRANSIENT
1373#undef RARRAY_PTR_USE_END_TRANSIENT
1374#define RARRAY_PTR_USE_START_TRANSIENT(a) ((VALUE *)RARRAY_CONST_PTR_TRANSIENT(a))
1375#define RARRAY_PTR_USE_END_TRANSIENT(a)
1376#define ARY_PTR_USING_P(ary) 0
1380#if USE_TRANSIENT_HEAP
1381#define RARY_TRANSIENT_SET(ary) FL_SET_RAW((ary), RARRAY_TRANSIENT_FLAG);
1382#define RARY_TRANSIENT_UNSET(ary) FL_UNSET_RAW((ary), RARRAY_TRANSIENT_FLAG);
1384#undef RARRAY_TRANSIENT_P
1385#define RARRAY_TRANSIENT_P(a) 0
1386#define RARY_TRANSIENT_SET(ary) ((void)0)
1387#define RARY_TRANSIENT_UNSET(ary) ((void)0)
1402#if defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
1403#define rb_ary_new_from_args(n, ...) \
1405 const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
1406 if (__builtin_constant_p(n)) { \
1407 STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
1409 rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
1414rb_ary_entry_internal(
VALUE ary,
long offset)
1421 if (offset < 0)
return Qnil;
1423 else if (
len <= offset) {
1435#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, __func__)
1438#define rp_m(msg, obj) do { \
1439 fprintf(stderr, "%s", (msg)); \
1440 rb_obj_info_dump((VALUE)obj); \
1445#define bp() ruby_debug_breakpoint()
1526#ifdef RUBY_ENCODING_H
1553#ifdef RUBY_ENCODING_H
1569#define rb_raise_cstr(etype, mesg) \
1570 rb_exc_raise(rb_exc_new_str(etype, rb_str_new_cstr(mesg)))
1571#define rb_raise_static(etype, mesg) \
1572 rb_exc_raise(rb_exc_new_str(etype, rb_str_new_static(mesg, rb_strlen_lit(mesg))))
1575#define rb_name_err_raise_str(mesg, recv, name) \
1576 rb_exc_raise(rb_name_err_new(mesg, recv, name))
1577#define rb_name_err_raise(mesg, recv, name) \
1578 rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
1581#define rb_key_err_raise(mesg, recv, name) \
1582 rb_exc_raise(rb_key_err_new(mesg, recv, name))
1590#define id_signo ruby_static_id_signo
1591#define id_status ruby_static_id_status
1606#ifdef RUBY_ENCODING_H
1618#ifdef RUBY_FUNCTION_NAME_STRING
1619# if defined __GNUC__ && __GNUC__ >= 4
1620# pragma GCC visibility push(default)
1624# if defined __GNUC__ && __GNUC__ >= 4
1625# pragma GCC visibility pop
1627# define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
1628# define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
1630# define rb_sys_fail_path(path) rb_sys_fail_str(path)
1631# define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
1647#define rb_gc_writebarrier_remember(obj) 0
1652#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
1653#define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
1654#define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc2(ptr, new_count, element_size)
1655#define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
1656#define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
1663#define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc2((void*)(var), (n), sizeof(type), (old_n)))
1669#define RB_NEWOBJ_OF(obj,type,klass,flags) \
1670 type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \
1671 rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \
1672 rb_wb_unprotected_newobj_of(klass, flags))
1673#define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
1675#ifdef __has_attribute
1676#if __has_attribute(alloc_align)
1690#if RHASH_CONVERT_TABLE_DEBUG
1692#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h, __FILE__, __LINE__)
1695#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
1734#define rb_io_fptr_finalize rb_io_fptr_finalize_internal
1766#define mjit_enabled 0
1769static inline void mjit_finish(
bool close_handle_p){}
1777#define FIXNUM_POSITIVE_P(num) ((SIGNED_VALUE)(num) > (SIGNED_VALUE)INT2FIX(0))
1778#define FIXNUM_NEGATIVE_P(num) ((SIGNED_VALUE)(num) < 0)
1779#define FIXNUM_ZERO_P(num) ((num) == INT2FIX(0))
1781#define INT_NEGATIVE_P(x) (FIXNUM_P(x) ? FIXNUM_NEGATIVE_P(x) : BIGNUM_NEGATIVE_P(x))
1783#define FLOAT_ZERO_P(x) (RFLOAT_VALUE(x) == 0.0)
1785#ifndef ROUND_DEFAULT
1786# define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP
1794#define ROUND_TO(mode, even, up, down) \
1795 ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \
1796 (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down)
1797#define ROUND_FUNC(mode, name) \
1798 ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down)
1799#define ROUND_CALL(mode, name, args) \
1800 ROUND_TO(mode, name##_half_even args, \
1801 name##_half_up args, name##_half_down args)
1847rb_num_compare_with_zero(
VALUE num,
ID mid)
1858rb_num_positive_int_p(
VALUE num)
1870 return RTEST(rb_num_compare_with_zero(num, mid));
1875rb_num_negative_int_p(
VALUE num)
1887 return RTEST(rb_num_compare_with_zero(num, mid));
1897#define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
1898#define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
1902rb_float_flonum_value(
VALUE v)
1905 if (
v != (
VALUE)0x8000000000000002) {
1923rb_float_noflonum_value(
VALUE v)
1925 return ((
struct RFloat *)
v)->float_value;
1929rb_float_value_inline(
VALUE v)
1932 return rb_float_flonum_value(
v);
1934 return rb_float_noflonum_value(
v);
1938rb_float_new_inline(
double d)
1948 bits = (
int)((
VALUE)(t.v >> 60) & 0x7);
1954 if (t.v != 0x3000000000000000 &&
1955 !((bits-3) & ~0x01)) {
1958 else if (t.v == (
VALUE)0) {
1960 return 0x8000000000000002;
1967#define rb_float_value(v) rb_float_value_inline(v)
1968#define rb_float_new(d) rb_float_new_inline(d)
1989#define RBASIC_CLEAR_CLASS(obj) memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(VALUE))
1990#define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE))
1991#define RBASIC_SET_CLASS(obj, cls) do { \
1992 VALUE _obj_ = (obj); \
1993 RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
1997#ifndef USE_SYMBOL_GC
1998#define USE_SYMBOL_GC 1
2024#define RB_MAX_GROUPS (65536)
2055 unsigned exception : 1;
2077#define ARGVSTR2ARGV(argv_str) ((char **)RB_IMEMO_TMPBUF_PTR(argv_str) + 1)
2080ARGVSTR2ARGC(
VALUE argv_str)
2099#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
2100#define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
2101#define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2])
2140#define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
2141#define rb_fstring_literal(str) rb_fstring_lit(str)
2143#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
2144# define rb_fstring_cstr(str) RB_GNUC_EXTENSION_BLOCK( \
2145 (__builtin_constant_p(str)) ? \
2146 rb_fstring_new((str), (long)strlen(str)) : \
2147 rb_fstring_cstr(str) \
2150#ifdef RUBY_ENCODING_H
2152#define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
2153#define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
2159#define QUOTE(str) rb_str_quote_unprintable(str)
2160#define QUOTE_ID(id) rb_id_quote_unprintable(id)
2165#ifdef RUBY_ENCODING_H
2172#define STR_NOEMBED FL_USER1
2173#define STR_SHARED FL_USER2
2174#define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED))
2175#define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED)
2176#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
2177#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
2189rb_str_eql_internal(
const VALUE str1,
const VALUE str2)
2192 const char *ptr1, *ptr2;
2204#ifdef RUBY_ENCODING_H
2210#define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \
2212 (__builtin_constant_p(ptr)) ? \
2213 rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
2214 rb_sym_intern_ascii_cstr(ptr); \
2228#define COVERAGE_INDEX_LINES 0
2229#define COVERAGE_INDEX_BRANCHES 1
2230#define COVERAGE_TARGET_LINES 1
2231#define COVERAGE_TARGET_BRANCHES 2
2232#define COVERAGE_TARGET_METHODS 4
2233#define COVERAGE_TARGET_ONESHOT_LINES 8
2252#ifdef RUBY_ENCODING_H
2257#ifdef RUBY_ENCODING_H
2262char *
ruby_dtoa(
double d_,
int mode,
int ndigits,
int *decpt,
int *sign,
char **rve);
2263char *
ruby_hdtoa(
double d,
const char *xdigs,
int ndigits,
int *decpt,
int *sign,
char **rve);
2266#ifdef RUBY_ENCODING_H
2271#if USE_TRANSIENT_HEAP
2272#define ROBJECT_TRANSIENT_FLAG FL_USER13
2273#define ROBJ_TRANSIENT_P(obj) FL_TEST_RAW((obj), ROBJECT_TRANSIENT_FLAG)
2274#define ROBJ_TRANSIENT_SET(obj) FL_SET_RAW((obj), ROBJECT_TRANSIENT_FLAG)
2275#define ROBJ_TRANSIENT_UNSET(obj) FL_UNSET_RAW((obj), ROBJECT_TRANSIENT_FLAG)
2277#define ROBJ_TRANSIENT_P(obj) 0
2278#define ROBJ_TRANSIENT_SET(obj) ((void)0)
2279#define ROBJ_TRANSIENT_UNSET(obj) ((void)0)
2420# define rb_funcallv(recv, mid, argc, argv) \
2422 static struct rb_call_data rb_funcallv_data; \
2423 rb_funcallv_with_cc(&rb_funcallv_data, recv, mid, argc, argv); \
2425# define rb_method_basic_definition_p(klass, mid) \
2427 static struct rb_call_data rb_mbdp; \
2428 (klass == Qfalse) ? true : \
2429 rb_method_basic_definition_p_with_cc(&rb_mbdp, klass, mid); \
2474#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
2498#define Check_Type(v, t) \
2499 (!RB_TYPE_P((VALUE)(v), (t)) || \
2500 ((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \
2501 rb_unexpected_type((VALUE)(v), (t)) : (void)0)
2508#define rb_typeddata_is_instance_of rb_typeddata_is_instance_of_inline
2511#if defined HAVE_READLINK && defined RUBY_ENCODING_H
2515VALUE rb_str_normalize_ospath(
const char *
ptr,
long len);
2548#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
2558#ifdef RUBY_ENCODING_H
2590#define RB_OBJ_GC_FLAGS_MAX 6
2597#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
2607#define RUBY_DTRACE_CREATE_HOOK(name, arg) \
2608 RUBY_DTRACE_HOOK(name##_CREATE, arg)
2609#define RUBY_DTRACE_HOOK(name, arg) \
2611 if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
2613 const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
2614 if (!dtrace_file) dtrace_file = ""; \
2615 RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
2619#define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
2620#define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
2622#define rb_obj_builtin_type(obj) \
2624 VALUE arg_obj = (obj); \
2625 RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
2626 RB_BUILTIN_TYPE(arg_obj); \
2638#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2639# define FLEX_ARY_LEN
2640#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
2641# define FLEX_ARY_LEN 0
2643# define FLEX_ARY_LEN 1
2653#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
2654# define BITFIELD(type, name, size) type name : size
2656# define BITFIELD(type, name, size) unsigned int name : size
2659#if defined(_MSC_VER)
2660# define COMPILER_WARNING_PUSH __pragma(warning(push))
2661# define COMPILER_WARNING_POP __pragma(warning(pop))
2662# define COMPILER_WARNING_ERROR(flag) __pragma(warning(error: flag)))
2663# define COMPILER_WARNING_IGNORED(flag) __pragma(warning(suppress: flag)))
2665#elif defined(__clang__)
2666# define COMPILER_WARNING_PUSH _Pragma("clang diagnostic push")
2667# define COMPILER_WARNING_POP _Pragma("clang diagnostic pop")
2668# define COMPILER_WARNING_SPECIFIER(kind, msg) \
2669 clang diagnostic kind # msg
2670# define COMPILER_WARNING_ERROR(flag) \
2671 COMPILER_WARNING_PRAGMA(COMPILER_WARNING_SPECIFIER(error, flag))
2672# define COMPILER_WARNING_IGNORED(flag) \
2673 COMPILER_WARNING_PRAGMA(COMPILER_WARNING_SPECIFIER(ignored, flag))
2675#elif GCC_VERSION_SINCE(4, 6, 0)
2677# define COMPILER_WARNING_PUSH _Pragma("GCC diagnostic push")
2678# define COMPILER_WARNING_POP _Pragma("GCC diagnostic pop")
2679# define COMPILER_WARNING_SPECIFIER(kind, msg) \
2680 GCC diagnostic kind # msg
2681# define COMPILER_WARNING_ERROR(flag) \
2682 COMPILER_WARNING_PRAGMA(COMPILER_WARNING_SPECIFIER(error, flag))
2683# define COMPILER_WARNING_IGNORED(flag) \
2684 COMPILER_WARNING_PRAGMA(COMPILER_WARNING_SPECIFIER(ignored, flag))
2687# define COMPILER_WARNING_PUSH
2688# define COMPILER_WARNING_POP
2689# define COMPILER_WARNING_ERROR(flag)
2690# define COMPILER_WARNING_IGNORED(flag)
2693#define COMPILER_WARNING_PRAGMA(str) COMPILER_WARNING_PRAGMA_(str)
2694#define COMPILER_WARNING_PRAGMA_(str) _Pragma(#str)
2696#if defined(USE_UNALIGNED_MEMBER_ACCESS) && USE_UNALIGNED_MEMBER_ACCESS && \
2697 (defined(__clang__) || GCC_VERSION_SINCE(9, 0, 0))
2698# define UNALIGNED_MEMBER_ACCESS(expr) __extension__({ \
2699 COMPILER_WARNING_PUSH; \
2700 COMPILER_WARNING_IGNORED(-Waddress-of-packed-member); \
2701 typeof(expr) unaligned_member_access_result = (expr); \
2702 COMPILER_WARNING_POP; \
2703 unaligned_member_access_result; \
2706# define UNALIGNED_MEMBER_ACCESS(expr) expr
2708#define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
2711#define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
2713#if defined(__cplusplus)
VALUE rb_int2big(intptr_t n)
void rb_cmperr(VALUE x, VALUE y)
rb_encoding * rb_enc_check_str(VALUE str1, VALUE str2)
rb_encoding * rb_enc_get_from_index(int index)
int rb_data_is_encoding(VALUE obj)
char str[HTML_ESCAPE_MAX_LEN+1]
VALUE rb_f_raise(int argc, VALUE *argv)
VALUE rb_check_realpath(VALUE basedir, VALUE path, rb_encoding *enc)
void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE, VALUE), VALUE)
VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
void rb_class_subclass_add(VALUE super, VALUE klass)
VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
void rb_class_detach_subclasses(VALUE)
void Init_class_hierarchy(void)
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
VALUE rb_include_class_new(VALUE, VALUE)
VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
int rb_singleton_class_internal_p(VALUE sklass)
VALUE rb_class_inherited(VALUE, VALUE)
Calls Class::inherited.
VALUE rb_class_boot(VALUE)
A utility function that wraps class_alloc.
void rb_class_modify_check(VALUE)
Asserts that klass is not a frozen class.
void rb_class_detach_module_subclasses(VALUE)
VALUE rb_special_singleton_class(VALUE)
void rb_class_remove_from_module_subclasses(VALUE)
VALUE rb_singleton_class_get(VALUE obj)
Returns the singleton class of obj, or nil if obj is not a singleton object.
VALUE rb_make_metaclass(VALUE, VALUE)
VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
void rb_class_remove_from_super_subclasses(VALUE)
int rb_class_has_methods(VALUE c)
void rb_undef_methods_from(VALUE klass, VALUE super)
int rb_bug_reporter_add(void(*func)(FILE *, void *), void *data)
VALUE rb_syntax_error_append(VALUE exc, VALUE file, int line, int column, rb_encoding *enc, const char *fmt, va_list args)
VALUE rb_get_backtrace(VALUE info)
bool rb_warning_category_enabled_p(rb_warning_category_t category)
void rb_enc_warn(rb_encoding *enc, const char *fmt,...)
void rb_sys_enc_warning(rb_encoding *enc, const char *fmt,...)
void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt,...)
VALUE rb_nomethod_err_new(VALUE mesg, VALUE recv, VALUE method, VALUE args, int priv)
const char * rb_builtin_type_name(int t)
void rb_vraise(VALUE exc, const char *fmt, va_list ap)
void rb_load_fail(VALUE path, const char *err)
void rb_unexpected_type(VALUE x, int t)
const char * rb_builtin_class_name(VALUE x)
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
rb_warning_category_t rb_warning_category_from_name(VALUE category)
void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args)
void rb_async_bug_errno(const char *mesg, int errno_arg)
VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE name)
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
void rb_obj_copy_ivar(VALUE dest, VALUE obj)
int rb_opts_exception_p(VALUE opts, int default_value)
double rb_num_to_dbl(VALUE val)
int rb_bool_expected(VALUE, const char *)
VALUE rb_convert_type_with_id(VALUE, int, const char *, ID)
VALUE rb_immutable_obj_clone(int, VALUE *, VALUE)
VALUE rb_class_search_ancestor(VALUE klass, VALUE super)
VALUE rb_check_convert_type_with_id(VALUE, int, const char *, ID)
VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2)
int rb_hash_ar_table_p(VALUE hash)
st_table * rb_hash_st_table(VALUE hash)
ar_table * rb_hash_ar_table(VALUE hash)
int rb_int_negative_p(VALUE num)
VALUE rb_big_even_p(VALUE)
void rb_fiber_reset_root_local_storage(struct rb_thread_struct *)
struct rb_execarg * rb_execarg_get(VALUE execarg_obj)
VALUE rb_math_log(int argc, const VALUE *argv)
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE)
VALUE * ruby_initial_gc_stress_ptr
VALUE rb_get_coverages(void)
VALUE rb_hash_default_value(VALUE hash, VALUE key)
void rb_file_const(const char *, VALUE)
void rb_print_backtrace(void)
#define RSTRUCT_EMBED_LEN_SHIFT
VALUE rb_adjust_argv_kw_splat(int *, const VALUE **, int *)
NORETURN(void rb_async_bug_errno(const char *, int))
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv)
void rb_backref_set_string(VALUE string, long pos, long len)
@ RB_WARN_CATEGORY_DEPRECATED
@ RB_WARN_CATEGORY_ALL_BITS
@ RB_WARN_CATEGORY_EXPERIMENTAL
struct rb_global_entry * rb_global_entry(ID)
VALUE rb_str_locktmp_ensure(VALUE str, VALUE(*func)(VALUE), VALUE arg)
VALUE rb_rational_cmp(VALUE self, VALUE other)
VALUE rb_hash_values(VALUE hash)
size_t rb_big_size(VALUE)
VALUE rb_reg_check_preprocess(VALUE)
char * rb_str_fill_terminator(VALUE str, const int termlen)
VALUE rb_hash_resurrect(VALUE hash)
VALUE rb_backtrace_to_str_ary(VALUE obj)
VALUE rb_rational_uminus(VALUE self)
void rb_io_fptr_finalize_internal(void *ptr)
void rb_encdb_declare(const char *name)
PRINTF_ARGS(void ruby_debug_printf(const char *,...), 1, 2)
VALUE rb_rational_pow(VALUE self, VALUE other)
int ruby_is_fd_loadable(int fd)
const char * ruby_escaped_char(int c)
void rb_backtrace_each(VALUE(*iter)(VALUE recv, VALUE str), VALUE output)
VALUE rb_dir_getwd_ospath(void)
VALUE rb_integer_float_eq(VALUE x, VALUE y)
#define RHASH_AR_TABLE_SIZE_SHIFT
void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen)
double rb_big_fdiv_double(VALUE x, VALUE y)
VALUE rb_yield_1(VALUE val)
VALUE rb_int_modulo(VALUE x, VALUE y)
void rb_mutex_allow_trap(VALUE self, int val)
VALUE rb_str_eql(VALUE str1, VALUE str2)
VALUE rb_fix_aref(VALUE fix, VALUE idx)
int rb_str_symname_p(VALUE)
VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
void rb_hash_st_table_set(VALUE hash, st_table *st)
int ruby_thread_has_gvl_p(void)
const void ** rb_vm_get_insns_address_table(void)
VALUE rb_check_to_array(VALUE ary)
VALUE rb_big2str_generic(VALUE x, int base)
void rb_mark_end_proc(void)
VALUE rb_to_array_type(VALUE obj)
void ruby_debug_breakpoint(void)
VALUE rb_str_quote_unprintable(VALUE)
#define FIXNUM_POSITIVE_P(num)
int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val)
RUBY_SYMBOL_EXPORT_BEGIN const char * rb_objspace_data_type_name(VALUE obj)
VALUE rb_num_pow(VALUE x, VALUE y)
#define RHASH_AR_TABLE_BOUND_SHIFT
VALUE rb_ary_tmp_new_fill(long capa)
RUBY_FUNC_EXPORTED RUBY_FUNC_NONNULL(1, VALUE rb_funcallv_with_cc(struct rb_call_data *, VALUE, ID, int, const VALUE *))
VALUE rb_struct_init_copy(VALUE copy, VALUE s)
VALUE rb_big_mul_toom3(VALUE x, VALUE y)
VALUE rb_big_comp(VALUE x)
void ruby_reset_leap_second_info(void)
size_t rb_obj_memsize_of(VALUE)
int rb_vm_insn_addr2insn(const void *)
const char ruby_exec_prefix[]
VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc)
void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE)
#define BIGNUM_EMBED_LEN_MAX
VALUE rb_int_abs(VALUE num)
void rb_execarg_parent_end(VALUE execarg_obj)
void ruby_mimfree(void *ptr)
rb_imemo_tmpbuf_t * rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt)
size_t rb_str_memsize(VALUE)
#define RSTRUCT_EMBED_LEN_MASK
void rb_write_error_str(VALUE mesg)
VALUE rb_big_sq_fast(VALUE x)
int rb_hash_stlike_delete(VALUE hash, st_data_t *pkey, st_data_t *pval)
VALUE rb_mutex_owned_p(VALUE self)
VALUE rb_float_floor(VALUE x, int ndigits)
VALUE rb_int_div(VALUE x, VALUE y)
VALUE rb_file_expand_path_fast(VALUE, VALUE)
st_index_t rb_hash_proc(st_index_t hash, VALUE proc)
void Init_eval_method(void)
void * rb_xmalloc_mul_add(size_t, size_t, size_t) RUBY_ATTR_MALLOC
void * rb_xrealloc_mul_add(const void *, size_t, size_t, size_t)
VALUE rb_big2str_poweroftwo(VALUE x, int base)
VALUE rb_fstring_cstr(const char *str)
size_t rb_size_mul_or_raise(size_t, size_t, VALUE)
void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func)
VALUE rb_rational_plus(VALUE self, VALUE other)
VALUE rb_suppress_tracing(VALUE(*func)(VALUE), VALUE arg)
void * ruby_mimmalloc(size_t size) RUBY_ATTR_MALLOC
VALUE rb_gcd_normal(VALUE self, VALUE other)
rb_pid_t rb_fork_ruby(int *status)
@ RB_INT_PARSE_UNDERSCORE
void ruby_set_inplace_mode(const char *)
VALUE rb_arith_seq_new(VALUE obj, VALUE meth, int argc, VALUE const *argv, rb_enumerator_size_func *size_fn, VALUE beg, VALUE end, VALUE step, int excl)
#define __asan_unpoison_memory_region(x, y)
#define RSTRUCT_EMBED_LEN_MAX
RUBY_SYMBOL_EXPORT_BEGIN VALUE rb_parser_set_context(VALUE, const struct rb_iseq_struct *, int)
VALUE rb_float_pow(VALUE x, VALUE y)
long rb_reg_search0(VALUE, VALUE, long, int, int)
VALUE rb_ident_hash_new(void)
size_t rb_obj_gc_flags(VALUE, ID[], size_t)
VALUE rb_hash_set_pair(VALUE hash, VALUE pair)
#define __asan_region_is_poisoned(x, y)
VALUE rb_ary_last(int, const VALUE *, VALUE)
int rb_enc_set_dummy(int index)
VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE)
VALUE rb_int_pow(VALUE x, VALUE y)
VALUE rb_hash_rehash(VALUE hash)
int rb_is_instance_name(VALUE name)
void rb_deprecate_constant(VALUE mod, const char *name)
void rb_gc_mark_global_tbl(void)
void rb_mark_generic_ivar(VALUE)
VALUE rb_float_numerator(VALUE x)
void ruby_register_rollback_func_for_ensure(VALUE(*ensure_func)(VALUE), VALUE(*rollback_func)(VALUE))
int rb_thread_to_be_killed(VALUE thread)
#define RCLASS_INCLUDER(c)
void rb_backtrace_print_as_bugreport(void)
VALUE rb_hash_has_key(VALUE hash, VALUE key)
#define __msan_unpoison(x, y)
VALUE rb_int2str(VALUE num, int base)
void rb_maygvl_fd_fix_cloexec(int fd)
VALUE rb_cEncodingConverter
void rb_ary_set_len(VALUE, long)
VALUE rb_big_gt(VALUE x, VALUE y)
VALUE rb_float_equal(VALUE x, VALUE y)
const char * rb_type_str(enum ruby_value_type type)
void rb_enc_set_base(const char *name, const char *orig)
VALUE rb_io_flush_raw(VALUE, int)
VALUE rb_big_ge(VALUE x, VALUE y)
void Init_vm_backtrace(void)
VALUE rb_hash_key_str(VALUE)
int rb_require_internal(VALUE fname)
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
VALUE rb_big_aref(VALUE x, VALUE y)
VALUE rb_math_atan2(VALUE, VALUE)
void rb_ary_detransient(VALUE a)
VALUE rb_int_uminus(VALUE num)
void * ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2
VALUE rb_math_sinh(VALUE)
RUBY_SYMBOL_EXPORT_END int rb_hash_stlike_foreach_with_replace(VALUE hash, st_foreach_check_callback_func *func, st_update_callback_func *replace, st_data_t arg)
VALUE rb_autoload_at_p(VALUE, ID, int)
VALUE rb_float_mul(VALUE x, VALUE y)
VALUE rb_reg_match_p(VALUE re, VALUE str, long pos)
VALUE rb_thread_shield_new(void)
int rb_local_defined(ID, const struct rb_iseq_struct *)
VALUE rb_int_equal(VALUE x, VALUE y)
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc)
void ruby_init_setproctitle(int argc, char *argv[])
int rb_gc_for_fd(int err)
const signed char ruby_digit36_to_number_table[]
VALUE rb_float_plus(VALUE x, VALUE y)
VALUE rb_int_positive_pow(long x, unsigned long y)
bool rb_gvar_is_traced(const struct rb_global_entry *)
VALUE rb_big_bit_length(VALUE big)
VALUE rb_obj_is_fiber(VALUE)
VALUE rb_thread_shield_destroy(VALUE self)
VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary)
#define ARGVSTR2ARGV(argv_str)
struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t
void rb_last_status_clear(void)
int rb_vm_check_optimizable_mid(VALUE mid)
VALUE rb_flo_div_flo(VALUE x, VALUE y)
void rb_execarg_setenv(VALUE execarg_obj, VALUE env)
VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info)
VALUE rb_insns_name_array(void)
VALUE rb_eql_opt(VALUE obj1, VALUE obj2)
void rb_gc_free_dsymbol(VALUE)
unsigned long rb_serial_t
VALUE rb_uninterruptible(VALUE(*b_proc)(VALUE), VALUE data)
VALUE rb_int_cmp(VALUE x, VALUE y)
VALUE rb_rational_floor(VALUE self, int ndigits)
VALUE rb_gvar_defined(struct rb_global_entry *)
double ruby_float_mod(double x, double y)
int ruby_fill_random_bytes(void *, size_t, int)
VALUE rb_str_tmp_frozen_acquire(VALUE str)
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash)
VALUE rb_float_denominator(VALUE x)
VALUE rb_objspace_gc_disable(struct rb_objspace *)
const char ruby_null_device[]
void rb_encdb_set_unicode(int index)
rb_gvar_setter_t * rb_gvar_setter_function_of(const struct rb_global_entry *)
struct st_table * rb_hash_tbl_raw(VALUE hash)
struct timeval rb_time_timeval(VALUE)
VALUE rb_float_eql(VALUE x, VALUE y)
VALUE rb_int_and(VALUE x, VALUE y)
#define STATIC_ASSERT(name, expr)
size_t rb_generic_ivar_memsize(VALUE)
VALUE rb_to_symbol_type(VALUE obj)
VALUE rb_rational_reciprocal(VALUE x)
VALUE rb_obj_is_thread(VALUE obj)
#define FIXNUM_NEGATIVE_P(num)
void rb_vm_mark(void *ptr)
int rb_backtrace_p(VALUE obj)
VALUE rb_float_abs(VALUE flt)
VALUE * rb_ary_ptr_use_start(VALUE ary)
#define MUL_OVERFLOW_FIXNUM_P(a, b)
int rb_file_load_ok(const char *)
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen)
#define RB_OBJ_WRITE(a, slot, b)
VALUE rb_rational_abs(VALUE self)
VALUE rb_hash_new_with_size(st_index_t size)
void rb_strterm_mark(VALUE obj)
VALUE rb_rational_div(VALUE self, VALUE other)
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p)
int rb_is_class_name(VALUE name)
VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck)
VALUE rb_float_uminus(VALUE num)
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements)
VALUE rb_big_lt(VALUE x, VALUE y)
void rb_ary_ptr_use_end(VALUE ary)
VALUE rb_equal_opt(VALUE obj1, VALUE obj2)
PUREFUNC(int rb_data_is_encoding(VALUE obj))
VALUE rb_gvar_get(struct rb_global_entry *)
void ruby_gc_set_params(void)
void rb_stdio_set_default_encoding(void)
void rb_iv_tbl_copy(VALUE dst, VALUE src)
void rb_objspace_set_event_hook(const rb_event_flag_t event)
VALUE rb_big_remainder(VALUE x, VALUE y)
VALUE rb_backtrace_to_location_ary(VALUE obj)
void rb_vm_check_redefinition_by_prepend(VALUE klass)
void rb_fiber_init_mjit_cont(struct rb_fiber_struct *fiber)
VALUE rb_dbl_complex_new_polar_pi(double abs, double ang)
void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_)
VALUE rb_int_lshift(VALUE x, VALUE y)
VALUE rb_str_upto_each(VALUE, VALUE, int, int(*each)(VALUE, VALUE), VALUE)
double ruby_float_step_size(double beg, double end, double unit, int excl)
int rb_vm_add_root_module(ID id, VALUE module)
void * rb_aligned_malloc(size_t, size_t) RUBY_ATTR_MALLOC RUBY_ATTR_ALLOC_SIZE((2))
VALUE rb_big_size_m(VALUE big)
VALUE rb_objspace_gc_enable(struct rb_objspace *)
VALUE rb_to_hash_type(VALUE obj)
const char ruby_digitmap[]
rb_serial_t rb_next_class_serial(void)
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval)
VALUE rb_int_powm(int const argc, VALUE *const argv, VALUE const num)
void rb_ary_delete_same(VALUE, VALUE)
#define RHASH_AR_TABLE_SIZE_MASK
#define RUBY_BIT_ROTR(v, n)
VALUE rb_yield_force_blockarg(VALUE values)
VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE)
VALUE rb_cstr_to_rat(const char *, int)
VALUE rb_invcmp(VALUE, VALUE)
#define RHASH_AR_TABLE_BOUND_MASK
VALUE rb_str2big_normal(VALUE arg, int base, int badcheck)
VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg, int kw_splat)
bool rb_reg_start_with_p(VALUE re, VALUE str)
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg)
void rb_gc_verify_internal_consistency(void)
VALUE rb_hash_compare_by_id_p(VALUE hash)
VALUE rb_thread_shield_wait(VALUE self)
const char ruby_initial_load_paths[]
void rb_str_tmp_frozen_release(VALUE str, VALUE tmp)
#define RHASH_AR_TABLE_MAX_SIZE
VALUE rb_float_gt(VALUE x, VALUE y)
VALUE rb_default_coverage(int)
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)
int rb_num_negative_p(VALUE)
VALUE rb_big_mul_karatsuba(VALUE x, VALUE y)
VALUE rb_get_path_check_convert(VALUE)
VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc)
VALUE rb_float_ceil(VALUE num, int ndigits)
double rb_int_fdiv_double(VALUE x, VALUE y)
VALUE rb_ary_at(VALUE, VALUE)
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val)
VALUE rb_integer_float_cmp(VALUE x, VALUE y)
void rb_autoload_str(VALUE mod, ID id, VALUE file)
int rb_int_positive_p(VALUE num)
void void ruby_sized_xfree(void *x, size_t size)
void rb_gc_mark_values(long n, const VALUE *values)
VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell, int allow_exc_opt)
void rb_call_end_proc(VALUE data)
void rb_obj_info_dump(VALUE obj)
VALUE rb_parser_set_yydebug(VALUE, VALUE)
void rb_execarg_parent_start(VALUE execarg_obj)
VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl, int allow_endless)
VALUE rb_str_upto_endless_each(VALUE, int(*each)(VALUE, VALUE), VALUE)
VALUE rb_hash_keys(VALUE hash)
#define __asan_poison_memory_region(x, y)
enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts)
#define rb_imemo_tmpbuf_auto_free_pointer()
VALUE rb_obj_as_string_result(VALUE str, VALUE obj)
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
@ imemo_ifunc
iterator function
@ imemo_cref
class reference
@ imemo_svar
special variable
void Init_vm_stack_canary(void)
ID rb_make_internal_id(void)
VALUE rb_math_hypot(VALUE, VALUE)
const char * rb_insns_name(int i)
VALUE rb_str_chomp_string(VALUE str, VALUE chomp)
RUBY_SYMBOL_EXPORT_BEGIN int rb_hash_stlike_foreach(VALUE hash, st_foreach_callback_func *func, st_data_t arg)
VALUE rb_fstring_new(const char *ptr, long len)
VALUE rb_int_ge(VALUE x, VALUE y)
VALUE rb_hash_delete_entry(VALUE hash, VALUE key)
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char *errmsg, size_t errmsg_buflen)
VALUE rb_thread_shield_release(VALUE self)
VALUE rb_math_cosh(VALUE)
#define RSTRUCT_EMBED_LEN(st)
VALUE rb_float_div(VALUE x, VALUE y)
VALUE rb_rational_minus(VALUE self, VALUE other)
VALUE rb_lcm(VALUE x, VALUE y)
int rb_match_nth_defined(int nth, VALUE match)
MJIT_STATIC VALUE ruby_vm_special_exception_copy(VALUE)
int rb_encdb_dummy(const char *name)
const char * rb_source_location_cstr(int *pline)
struct vm_ifunc * rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc)
int rb_class_ivar_set(VALUE klass, ID vid, VALUE value)
int rb_get_next_signal(void)
int rb_stderr_tty_p(void)
int Init_enc_set_filesystem_encoding(void)
VALUE rb_source_location(int *pline)
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
VALUE rb_gcd(VALUE x, VALUE y)
VALUE rb_proc_location(VALUE self)
#define RICLASS_IS_ORIGIN
VALUE rb_int_minus(VALUE x, VALUE y)
VALUE rb_int_odd_p(VALUE num)
VALUE rb_big_divrem_normal(VALUE x, VALUE y)
VALUE rb_refinement_module_get_refined_class(VALUE module)
#define __msan_poison(x, y)
int rb_num_to_uint(VALUE val, unsigned int *ret)
#define BIGNUM_NEGATIVE_P(b)
@ RUBY_NUM_ROUND_HALF_EVEN
@ RUBY_NUM_ROUND_HALF_DOWN
char * rb_str_to_cstr(VALUE str)
VALUE rb_fix_plus(VALUE x, VALUE y)
VALUE rb_str_convert_to_inum(VALUE str, int base, int badcheck, int raise_exception)
VALUE rb_const_missing(VALUE klass, VALUE name)
const char ruby_hexdigits[]
void rb_mv_generic_ivar(VALUE src, VALUE dst)
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline)
RUBY_SYMBOL_EXPORT_END void * rb_parser_load_file(VALUE parser, VALUE name)
VALUE rb_int_divmod(VALUE x, VALUE y)
int rb_hash_stlike_update(VALUE hash, st_data_t key, st_update_callback_func func, st_data_t arg)
size_t rb_size_mul_add_or_raise(size_t, size_t, size_t, VALUE)
VALUE rb_big_uminus(VALUE x)
void rb_gc_writebarrier_remember(VALUE obj)
void Init_vm_objects(void)
int rb_match_count(VALUE match)
CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2))
VALUE rb_id_quote_unprintable(ID)
long rb_dbl_long_hash(double d)
unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
int rb_is_const_name(VALUE name)
int rb_float_cmp(VALUE x, VALUE y)
VALUE rb_big_odd_p(VALUE)
VALUE rb_sym_intern_ascii_cstr(const char *ptr)
void * rb_xmalloc_mul_add_mul(size_t, size_t, size_t, size_t) RUBY_ATTR_MALLOC
VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval)
VALUE rb_ary_tmp_new_from_values(VALUE, long, const VALUE *)
void rb_gc_mark_vm_stack_values(long n, const VALUE *values)
VALUE rb_int_idiv(VALUE x, VALUE y)
VALUE rb_big_mul_balance(VALUE x, VALUE y)
rb_gvar_getter_t * rb_gvar_getter_function_of(const struct rb_global_entry *)
int rb_get_coverage_mode(void)
VALUE rb_reg_new_ary(VALUE ary, int options)
VALUE rb_big_abs(VALUE x)
size_t rb_ary_memsize(VALUE)
VALUE rb_gvar_set(struct rb_global_entry *, VALUE)
VALUE rb_ary_behead(VALUE, long)
VALUE rb_attr_delete(VALUE, ID)
VALUE rb_sym_to_proc(VALUE sym)
VALUE rb_home_dir_of(VALUE user, VALUE result)
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags)
void rb_match_unbusy(VALUE)
VALUE rb_struct_lookup(VALUE s, VALUE idx)
#define BIGNUM_POSITIVE_P(b)
VALUE rb_get_path_check_to_string(VALUE)
VALUE rb_obj_is_mutex(VALUE obj)
VALUE rb_wb_protected_newobj_of(VALUE, VALUE)
#define __msan_allocated_memory(x, y)
VALUE rb_float_minus(VALUE x, VALUE y)
VALUE rb_big_mul_normal(VALUE x, VALUE y)
void rb_thread_execute_interrupts(VALUE th)
MJIT_STATIC void rb_vm_pop_cfunc_frame(void)
VALUE rb_get_expanded_load_path(void)
int rb_encdb_alias(const char *alias, const char *orig)
char * ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve)
VALUE rb_make_backtrace(void)
VALUE rb_str_opt_plus(VALUE, VALUE)
int rb_encdb_replicate(const char *alias, const char *orig)
VALUE rb_current_realfilepath(void)
void * rb_xcalloc_mul_add_mul(size_t, size_t, size_t, size_t) RUBY_ATTR_MALLOC
VALUE rb_rational_canonicalize(VALUE x)
int rb_block_min_max_arity(int *max)
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict)
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd)
VALUE rb_sym_intern_ascii(const char *ptr, long len)
VALUE rb_rational_mul(VALUE self, VALUE other)
VALUE rb_search_class_path(VALUE)
int rb_is_local_name(VALUE name)
int rb_hash_stlike_lookup(VALUE hash, st_data_t key, st_data_t *pval)
VALUE rb_int_plus(VALUE x, VALUE y)
st_table * rb_init_identtable(void)
VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck)
RUBY_SYMBOL_EXPORT_BEGIN void * ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2))
VALUE rb_int_gt(VALUE x, VALUE y)
VALUE rb_numeric_quo(VALUE x, VALUE y)
VALUE rb_ary_aref1(VALUE ary, VALUE i)
VALUE rb_int_succ(VALUE num)
VALUE rb_big_le(VALUE x, VALUE y)
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)
#define RUBY_BIT_ROTL(v, n)
char * ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve)
VALUE rb_struct_s_keyword_init(VALUE klass)
VALUE rb_int_mul(VALUE x, VALUE y)
void rb_vm_inc_const_missing_count(void)
int rb_dvar_defined(ID, const struct rb_iseq_struct *)
VALUE rb_default_home_dir(VALUE result)
RUBY_FUNC_EXPORTED size_t rb_io_memsize(const rb_io_t *fptr)
VALUE type(ANYARGS)
ANYARGS-ed function type.
unsigned char buf[MIME_BUF_SIZE]
ONIG_EXTERN const OnigEncodingType OnigEncodingUTF_8
VALUE rb_float_new_in_heap(double)
rb_atomic_t cnt[RUBY_NSIG]
VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc)
VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc)
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_fstring_enc_new(const char *ptr, long len, rb_encoding *enc)
VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc)
VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl)
struct RBignum::@27::@28 heap
unsigned int ary[(8 *RVALUE_EMBED_LEN_MAX/4)]
struct ar_table_struct * ar
struct RStruct::@31::@32 heap
const VALUE ary[RSTRUCT_EMBED_LEN_MAX]
enum method_missing_reason method_missing_reason
const struct rb_callable_method_entry_struct * me
rb_serial_t class_serial[(64 - sizeof(rb_serial_t) - sizeof(struct rb_callable_method_entry_struct *) - sizeof(uintptr_t) - sizeof(enum method_missing_reason) - sizeof(VALUE(*)(struct rb_execution_context_struct *e, struct rb_control_frame_struct *, struct rb_calling_info *, const struct rb_call_data *)))/sizeof(rb_serial_t)]
union rb_call_cache::@37 aux
VALUE(* call)(struct rb_execution_context_struct *ec, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, struct rb_call_data *cd)
rb_subclass_entry_t ** parent_subclasses
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...
struct st_table * iv_index_tbl
struct rb_id_table * m_tbl
struct rb_id_table * const_tbl
rb_subclass_entry_t * subclasses
rb_alloc_func_t allocator
struct rb_id_table * callable_m_tbl
const VALUE refined_class
char conflict[sizeof(VALUE) *3]
struct rb_execarg::@34::@36 cmd
unsigned unsetenv_others_given
unsigned new_pgroup_given
union rb_execarg::@34 invoke
struct waitpid_state * waitpid_state
unsigned unsetenv_others_do
unsigned close_others_given
struct rb_execarg::@34::@35 sh
struct rb_global_variable * var
struct rb_imemo_tmpbuf_struct * next
rb_subclass_entry_t * next
IFUNC (Internal FUNCtion)
struct vm_ifunc_argc argc
rb_block_call_func_t func
const VALUE cref_or_me
class reference or rb_method_entry_t
const struct rb_control_frame_struct * catch_frame
VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc)
int rb_is_attrset_sym(VALUE sym)
int rb_is_const_sym(VALUE sym)
size_t rb_econv_memsize(rb_econv_t *ec)
VALUE rb_mod_const_missing(VALUE klass, VALUE name)
VALUE rb_vm_top_self(void)
st_table * rb_vm_fstring_table(void)
bool rb_method_basic_definition_p_with_cc(struct rb_call_data *cd, VALUE klass, ID mid)
VALUE rb_readlink(VALUE path, rb_encoding *resultenc)