Ruby 4.1.0dev (2026-09-08 revision f60a60427f3d69062bc0b701a6ab500bccfdf7e4)
yjit.c (f60a60427f3d69062bc0b701a6ab500bccfdf7e4)
1// This part of YJIT helps interfacing with the rest of CRuby and with the OS.
2// Sometimes our FFI binding generation tool gives undesirable outputs when it
3// sees C features that Rust doesn't support well. We mitigate that by binding
4// functions which have simple parameter types. The boilerplate C functions for
5// that purpose are in this file.
6// Similarly, we wrap OS facilities we need in simple functions to help with
7// FFI and to avoid the need to use external crates.io Rust libraries.
8
9#include "internal.h"
10#include "internal/sanitizers.h"
11#include "internal/string.h"
12#include "internal/hash.h"
13#include "internal/variable.h"
14#include "internal/compile.h"
15#include "internal/class.h"
16#include "internal/fixnum.h"
17#include "internal/numeric.h"
18#include "internal/gc.h"
19#include "vm_core.h"
20#include "vm_callinfo.h"
21#include "builtin.h"
22#include "insns.inc"
23#include "insns_info.inc"
24#include "yjit.h"
25#include "zjit.h"
26#include "vm_insnhelper.h"
27#include "probes.h"
28#include "probes_helper.h"
29#include "iseq.h"
30#include "ruby/debug.h"
31#include "internal/cont.h"
32
33// For mmapp(), sysconf()
34#ifndef _WIN32
35#include <unistd.h>
36#include <sys/mman.h>
37#endif
38
39#include <errno.h>
40
41// We need size_t to have a known size to simplify code generation and FFI.
42// TODO(alan): check this in configure.ac to fail fast on 32 bit platforms.
43STATIC_ASSERT(64b_size_t, SIZE_MAX == UINT64_MAX);
44// I don't know any C implementation that has uint64_t and puts padding bits
45// into size_t but the standard seems to allow it.
46STATIC_ASSERT(size_t_no_padding_bits, sizeof(size_t) == sizeof(uint64_t));
47
48// This build config impacts the pointer tagging scheme and we only want to
49// support one scheme for simplicity.
50STATIC_ASSERT(pointer_tagging_scheme, USE_FLONUM);
51
52// NOTE: We can trust that uint8_t has no "padding bits" since the C spec
53// guarantees it. Wording about padding bits is more explicit in C11 compared
54// to C99. See C11 7.20.1.1p2. All this is to say we have _some_ standards backing to
55// use a Rust `*mut u8` to represent a C `uint8_t *`.
56//
57// If we don't want to trust that we can interpreter the C standard correctly, we
58// could outsource that work to the Rust standard library by sticking to fundamental
59// types in C such as int, long, etc. and use `std::os::raw::c_long` and friends on
60// the Rust side.
61//
62// What's up with the long prefix? Even though we build with `-fvisibility=hidden`
63// we are sometimes a static library where the option doesn't prevent name collision.
64// The "_yjit_" part is for trying to be informative. We might want different
65// suffixes for symbols meant for Rust and symbols meant for broader CRuby.
66
67// For a given raw_sample (frame), set the hash with the caller's
68// name, file, and line number. Return the hash with collected frame_info.
69static void
70rb_yjit_add_frame(VALUE hash, VALUE frame)
71{
72 VALUE frame_id = PTR2NUM(frame);
73
74 if (RTEST(rb_hash_aref(hash, frame_id))) {
75 return;
76 }
77 else {
78 VALUE frame_info = rb_hash_new();
79 // Full label for the frame
81 // Absolute path of the frame from rb_iseq_realpath
83 // Line number of the frame
85
86 // If absolute path isn't available use the rb_iseq_path
87 if (NIL_P(file)) {
88 file = rb_profile_frame_path(frame);
89 }
90
91 rb_hash_aset(frame_info, ID2SYM(rb_intern("name")), name);
92 rb_hash_aset(frame_info, ID2SYM(rb_intern("file")), file);
93 rb_hash_aset(frame_info, ID2SYM(rb_intern("samples")), INT2NUM(0));
94 rb_hash_aset(frame_info, ID2SYM(rb_intern("total_samples")), INT2NUM(0));
95 rb_hash_aset(frame_info, ID2SYM(rb_intern("edges")), rb_hash_new());
96 rb_hash_aset(frame_info, ID2SYM(rb_intern("lines")), rb_hash_new());
97
98 if (line != INT2FIX(0)) {
99 rb_hash_aset(frame_info, ID2SYM(rb_intern("line")), line);
100 }
101
102 rb_hash_aset(hash, frame_id, frame_info);
103 }
104}
105
106// Parses the YjitExitLocations raw_samples and line_samples collected by
107// rb_yjit_record_exit_stack and turns them into 3 hashes (raw, lines, and frames) to
108// be used by RubyVM::YJIT.exit_locations. yjit_raw_samples represents the raw frames information
109// (without name, file, and line), and yjit_line_samples represents the line information
110// of the iseq caller.
111VALUE
112rb_yjit_exit_locations_dict(VALUE *yjit_raw_samples, int *yjit_line_samples, int samples_len)
113{
114 VALUE result = rb_hash_new();
115 VALUE raw_samples = rb_ary_new_capa(samples_len);
116 VALUE line_samples = rb_ary_new_capa(samples_len);
117 VALUE frames = rb_hash_new();
118 int idx = 0;
119
120 // While the index is less than samples_len, parse yjit_raw_samples and
121 // yjit_line_samples, then add casted values to raw_samples and line_samples array.
122 while (idx < samples_len) {
123 int num = (int)yjit_raw_samples[idx];
124 int line_num = (int)yjit_line_samples[idx];
125 idx++;
126
127 // + 1 as we append an additional sample for the insn
128 rb_ary_push(raw_samples, SIZET2NUM(num + 1));
129 rb_ary_push(line_samples, INT2NUM(line_num + 1));
130
131 // Loop through the length of samples_len and add data to the
132 // frames hash. Also push the current value onto the raw_samples
133 // and line_samples array respectively.
134 for (int o = 0; o < num; o++) {
135 rb_yjit_add_frame(frames, yjit_raw_samples[idx]);
136 rb_ary_push(raw_samples, SIZET2NUM(yjit_raw_samples[idx]));
137 rb_ary_push(line_samples, INT2NUM(yjit_line_samples[idx]));
138 idx++;
139 }
140
141 rb_ary_push(raw_samples, SIZET2NUM(yjit_raw_samples[idx]));
142 rb_ary_push(line_samples, INT2NUM(yjit_line_samples[idx]));
143 idx++;
144
145 rb_ary_push(raw_samples, SIZET2NUM(yjit_raw_samples[idx]));
146 rb_ary_push(line_samples, INT2NUM(yjit_line_samples[idx]));
147 idx++;
148 }
149
150 // Set add the raw_samples, line_samples, and frames to the results
151 // hash.
152 rb_hash_aset(result, ID2SYM(rb_intern("raw")), raw_samples);
153 rb_hash_aset(result, ID2SYM(rb_intern("lines")), line_samples);
154 rb_hash_aset(result, ID2SYM(rb_intern("frames")), frames);
155
156 return result;
157}
158
159// Is anyone listening for :c_call and :c_return event currently?
160bool
161rb_c_method_tracing_currently_enabled(const rb_execution_context_t *ec)
162{
163 return ruby_vm_c_events_enabled > 0;
164}
165
166// The code we generate in gen_send_cfunc() doesn't fire the c_return TracePoint event
167// like the interpreter. When tracing for c_return is enabled, we patch the code after
168// the C method return to call into this to fire the event.
169void
170rb_full_cfunc_return(rb_execution_context_t *ec, VALUE return_value)
171{
172 rb_control_frame_t *cfp = ec->cfp;
173 RUBY_ASSERT_ALWAYS(cfp == GET_EC()->cfp);
174 const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
175
176 RUBY_ASSERT_ALWAYS(RUBYVM_CFUNC_FRAME_P(cfp));
177 RUBY_ASSERT_ALWAYS(me->def->type == VM_METHOD_TYPE_CFUNC);
178
179 // CHECK_CFP_CONSISTENCY("full_cfunc_return"); TODO revive this
180
181 // Pop the C func's frame and fire the c_return TracePoint event
182 // Note that this is the same order as vm_call_cfunc_with_frame().
183 rb_vm_pop_frame(ec);
184 EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_RETURN, cfp->self, me->def->original_id, me->called_id, me->owner, return_value);
185 // Note, this deviates from the interpreter in that users need to enable
186 // a c_return TracePoint for this DTrace hook to work. A reasonable change
187 // since the Ruby return event works this way as well.
188 RUBY_DTRACE_CMETHOD_RETURN_HOOK(ec, me->owner, me->def->original_id);
189
190 // Push return value into the caller's stack. We know that it's a frame that
191 // uses cfp->sp because we are patching a call done with gen_send_cfunc().
192 ec->cfp->sp[0] = return_value;
193 ec->cfp->sp++;
194}
195
196// This is defined only as a named struct inside rb_iseq_constant_body.
197// By giving it a separate typedef, we make it nameable by rust-bindgen.
198// Bindgen's temp/anon name isn't guaranteed stable.
199typedef struct rb_iseq_param_keyword rb_seq_param_keyword_struct;
200
201ID rb_get_symbol_id(VALUE namep);
202
203// If true, the iseq has only opt_invokebuiltin_delegate(_leave) and leave insns.
204static bool
205invokebuiltin_delegate_leave_p(const rb_iseq_t *iseq)
206{
207 int insn1 = rb_vm_insn_addr2opcode((void *)ISEQ_BODY(iseq)->iseq_encoded[0]);
208 if ((int)ISEQ_BODY(iseq)->iseq_size != insn_len(insn1) + insn_len(BIN(leave))) {
209 return false;
210 }
211 int insn2 = rb_vm_insn_addr2opcode((void *)ISEQ_BODY(iseq)->iseq_encoded[insn_len(insn1)]);
212 return (insn1 == BIN(opt_invokebuiltin_delegate) || insn1 == BIN(opt_invokebuiltin_delegate_leave)) &&
213 insn2 == BIN(leave);
214}
215
216// Return an rb_builtin_function if the iseq contains only that builtin function.
217const struct rb_builtin_function *
218rb_yjit_builtin_function(const rb_iseq_t *iseq)
219{
220 if (invokebuiltin_delegate_leave_p(iseq)) {
221 return (const struct rb_builtin_function *)ISEQ_BODY(iseq)->iseq_encoded[1];
222 }
223 else {
224 return NULL;
225 }
226}
227
228extern VALUE *rb_vm_base_ptr(struct rb_control_frame_struct *cfp);
229
230VALUE
231rb_str_neq_internal(VALUE str1, VALUE str2)
232{
233 return rb_str_eql_internal(str1, str2) == Qtrue ? Qfalse : Qtrue;
234}
235
236extern VALUE rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary);
237
238VALUE
239rb_yjit_rb_ary_subseq_length(VALUE ary, long beg)
240{
241 long len = RARRAY_LEN(ary);
242 return rb_ary_subseq(ary, beg, len);
243}
244
245// Checks to establish preconditions for rb_yjit_splat_varg_cfunc()
246VALUE
247rb_yjit_splat_varg_checks(VALUE *sp, VALUE splat_array, rb_control_frame_t *cfp)
248{
249 // We inserted a T_ARRAY guard before this call
250 long len = RARRAY_LEN(splat_array);
251
252 // Large splat arrays need a separate allocation
253 if (len < 0 || len > VM_ARGC_STACK_MAX) return Qfalse;
254
255 // Would we overflow if we put the contents of the array onto the stack?
256 if (sp + len > (VALUE *)(cfp - 2)) return Qfalse;
257
258 // Reject keywords hash since that requires duping it sometimes
259 if (len > 0) {
260 VALUE last_hash = RARRAY_AREF(splat_array, len - 1);
261 if (RB_TYPE_P(last_hash, T_HASH) &&
262 FL_TEST_RAW(last_hash, RHASH_PASS_AS_KEYWORDS)) {
263 return Qfalse;
264 }
265 }
266
267 return Qtrue;
268}
269
270// Push array elements to the stack for a C method that has a variable number
271// of parameters. Returns the number of arguments the splat array contributes.
272int
273rb_yjit_splat_varg_cfunc(VALUE *stack_splat_array)
274{
275 VALUE splat_array = *stack_splat_array;
276 int len;
277
278 // We already checked that length fits in `int`
279 RUBY_ASSERT(RB_TYPE_P(splat_array, T_ARRAY));
280 len = (int)RARRAY_LEN(splat_array);
281
282 // Push the contents of the array onto the stack
283 MEMCPY(stack_splat_array, RARRAY_CONST_PTR(splat_array), VALUE, len);
284
285 return len;
286}
287
288// Print the Ruby source location of some ISEQ for debugging purposes
289void
290rb_yjit_dump_iseq_loc(const rb_iseq_t *iseq, uint32_t insn_idx)
291{
292 char *ptr;
293 long len;
294 VALUE path = rb_iseq_path(iseq);
295 RSTRING_GETMEM(path, ptr, len);
296 fprintf(stderr, "%s %.*s:%u\n", __func__, (int)len, ptr, rb_iseq_line_no(iseq, insn_idx));
297}
298
299// Get the number of digits required to print an integer
300static int
301num_digits(int integer)
302{
303 int num = 1;
304 while (integer /= 10) {
305 num++;
306 }
307 return num;
308}
309
310// Allocate a C string that formats an ISEQ label like iseq_inspect()
311char *
312rb_yjit_iseq_inspect(const rb_iseq_t *iseq)
313{
314 const char *label = RSTRING_PTR(ISEQ_BODY(iseq)->location.label);
315 const char *path = RSTRING_PTR(rb_iseq_path(iseq));
316 int lineno = ISEQ_BODY(iseq)->location.code_location.beg_pos.lineno;
317
318 const size_t size = strlen(label) + strlen(path) + num_digits(lineno) + 3;
319 char *buf = ZALLOC_N(char, size);
320 snprintf(buf, size, "%s@%s:%d", label, path, lineno);
321 return buf;
322}
323
324// There are RSTRUCT_SETs in ruby/internal/core/rstruct.h and internal/struct.h
325// with different types (int vs long) for k. Here we use the one from ruby/internal/core/rstruct.h,
326// which takes an int.
327void
328rb_RSTRUCT_SET(VALUE st, int k, VALUE v)
329{
330 RSTRUCT_SET(st, k, v);
331}
332
333// Return the string encoding index
334int
335rb_ENCODING_GET(VALUE obj)
336{
337 return RB_ENCODING_GET(obj);
338}
339
340// For running write barriers from Rust. Required when we add a new edge in the
341// object graph from `old` to `young`.
342void
343rb_yjit_obj_written(VALUE old, VALUE young, const char *file, int line)
344{
345 rb_obj_written(old, Qundef, young, file, line);
346}
347
348void
349rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception)
350{
351 RB_VM_LOCKING() {
352 rb_vm_barrier();
353
354 // Compile a block version starting at the current instruction
355 uint8_t *rb_yjit_iseq_gen_entry_point(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception); // defined in Rust
356 uintptr_t code_ptr = (uintptr_t)rb_yjit_iseq_gen_entry_point(iseq, ec, jit_exception);
357
358 if (jit_exception) {
359 ISEQ_BODY(iseq)->jit_exception = (rb_jit_func_t)code_ptr;
360 }
361 else {
362 ISEQ_BODY(iseq)->jit_entry = (rb_jit_func_t)code_ptr;
363 }
364 }
365}
366
367// GC root for interacting with the GC
369 bool unused; // empty structs are not legal in C99
370};
371
372// For dealing with refinements
373void
374rb_yjit_invalidate_all_method_lookup_assumptions(void)
375{
376 // It looks like Module#using actually doesn't need to invalidate all the
377 // method caches, so we do nothing here for now.
378}
379
380// Number of object shapes, which might be useful for investigating YJIT exit reasons.
381VALUE
382rb_object_shape_count(void)
383{
384 // next_shape_id starts from 0, so it's the same as the count
385 return ULONG2NUM((unsigned long)rb_shapes_count());
386}
387
388bool
389rb_yjit_shape_obj_complex_p(VALUE obj)
390{
391 return rb_obj_shape_complex_p(obj);
392}
393
394bool
395rb_yjit_shape_obj_embedded_p(VALUE obj)
396{
397 return rb_obj_shape_embedded_p(obj);
398}
399
400attr_index_t
401rb_yjit_shape_capacity(shape_id_t shape_id)
402{
403 return RSHAPE_CAPACITY(shape_id);
404}
405
406attr_index_t
407rb_yjit_shape_index(shape_id_t shape_id)
408{
409 return RSHAPE_INDEX(shape_id);
410}
411
412// The number of stack slots that vm_sendish() pops for send and invokesuper.
413size_t
414rb_yjit_sendish_sp_pops(const struct rb_callinfo *ci)
415{
416 return 1 - sp_inc_of_sendish(ci); // + 1 to ignore return value push
417}
418
419// The number of stack slots that vm_sendish() pops for invokeblock.
420size_t
421rb_yjit_invokeblock_sp_pops(const struct rb_callinfo *ci)
422{
423 return 1 - sp_inc_of_invokeblock(ci); // + 1 to ignore return value push
424}
425
426rb_serial_t
427rb_yjit_cme_ractor_serial(const rb_callable_method_entry_t *cme)
428{
429 return cme->def->body.bmethod.defined_ractor_id;
430}
431
432// Setup jit_return to avoid returning a non-Qundef value on a non-FINISH frame.
433// See [jit_compile_exception] for details.
434void
435rb_yjit_set_exception_return(rb_control_frame_t *cfp, void *leave_exit, void *leave_exception)
436{
437 if (VM_FRAME_FINISHED_P(cfp)) {
438 // If it's a FINISH frame, just normally exit with a non-Qundef value.
439 cfp->jit_return = leave_exit;
440 }
441 else if (cfp->jit_return) {
442 while (!VM_FRAME_FINISHED_P(cfp)) {
443 if (cfp->jit_return == leave_exit) {
444 // Unlike jit_exec(), leave_exit is not safe on a non-FINISH frame on
445 // jit_exec_exception(). See [jit_exec] and [jit_exec_exception] for
446 // details. Exit to the interpreter with Qundef to let it keep executing
447 // other Ruby frames.
448 cfp->jit_return = leave_exception;
449 return;
450 }
451 cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
452 }
453 }
454 else {
455 // If the caller was not JIT code, exit to the interpreter with Qundef
456 // to keep executing Ruby frames with the interpreter.
457 cfp->jit_return = leave_exception;
458 }
459}
460
461// VM_INSTRUCTION_SIZE changes depending on if ZJIT is in the build. Since
462// bindgen can only grab one version of the constant and copy that to rust,
463// we make that the upper bound and this the accurate value.
464uint32_t
465rb_vm_instruction_size(void)
466{
467 return VM_INSTRUCTION_SIZE;
468}
469
470static int
471yjit_cdhash_all_fixnum_i(st_data_t key, st_data_t _val, st_data_t data)
472{
473 if (!FIXNUM_P((VALUE)key)) {
474 *((bool *)data) = false;
475 return ST_STOP;
476 }
477 return ST_CONTINUE;
478}
479
480bool
481rb_yjit_cdhash_all_fixnum_p(VALUE cdhash)
482{
483 bool all_fixnum = true;
484 st_foreach(rb_imemo_cdhash_tbl(cdhash), yjit_cdhash_all_fixnum_i, (st_data_t)&all_fixnum);
485 return all_fixnum;
486}
487
488int
489rb_yjit_cdhash_lookup(VALUE cdhash, st_data_t key, st_data_t *val)
490{
491 return st_lookup(rb_imemo_cdhash_tbl(cdhash), key, val);
492}
493
494// Primitives used by yjit.rb
495VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
496VALUE rb_yjit_print_stats_p(rb_execution_context_t *ec, VALUE self);
497VALUE rb_yjit_log_enabled_p(rb_execution_context_t *c, VALUE self);
498VALUE rb_yjit_print_log_p(rb_execution_context_t *c, VALUE self);
499VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);
500VALUE rb_yjit_get_stats(rb_execution_context_t *ec, VALUE self, VALUE key);
501VALUE rb_yjit_reset_stats_bang(rb_execution_context_t *ec, VALUE self);
502VALUE rb_yjit_get_log(rb_execution_context_t *ec, VALUE self);
503VALUE rb_yjit_disasm_iseq(rb_execution_context_t *ec, VALUE self, VALUE iseq);
504VALUE rb_yjit_insns_compiled(rb_execution_context_t *ec, VALUE self, VALUE iseq);
505VALUE rb_yjit_code_gc(rb_execution_context_t *ec, VALUE self);
506VALUE rb_yjit_simulate_oom_bang(rb_execution_context_t *ec, VALUE self);
507VALUE rb_yjit_get_exit_locations(rb_execution_context_t *ec, VALUE self);
508VALUE rb_yjit_enable(rb_execution_context_t *ec, VALUE self, VALUE gen_stats, VALUE print_stats, VALUE gen_compilation_log, VALUE print_compilation_log, VALUE mem_size, VALUE call_threshold);
509VALUE rb_yjit_c_builtin_p(rb_execution_context_t *ec, VALUE self);
510
511// Allow YJIT_C_BUILTIN macro to force --yjit-c-builtin
512#ifdef YJIT_C_BUILTIN
513static VALUE yjit_c_builtin_p(rb_execution_context_t *ec, VALUE self) { return Qtrue; }
514#else
515#define yjit_c_builtin_p rb_yjit_c_builtin_p
516#endif
517
518// Preprocessed yjit.rb generated during build
519#include "yjit.rbinc"
520
#define RUBY_ASSERT_ALWAYS(expr,...)
A variant of RUBY_ASSERT that does not interface with RUBY_DEBUG.
Definition assert.h:199
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
Definition assert.h:219
VALUE rb_profile_frame_full_label(VALUE frame)
Identical to rb_profile_frame_label(), except it returns a qualified result.
VALUE rb_profile_frame_absolute_path(VALUE frame)
Identical to rb_profile_frame_path(), except it tries to expand the returning path.
VALUE rb_profile_frame_path(VALUE frame)
Queries the path of the passed backtrace.
VALUE rb_profile_frame_first_lineno(VALUE frame)
Queries the first line of the method of the passed frame pointer.
#define RUBY_EVENT_C_RETURN
Return from a method, written in C.
Definition event.h:44
#define Qundef
Old name of RUBY_Qundef.
#define INT2FIX
Old name of RB_INT2FIX.
Definition long.h:48
#define ID2SYM
Old name of RB_ID2SYM.
Definition symbol.h:44
#define ULONG2NUM
Old name of RB_ULONG2NUM.
Definition long.h:60
#define SIZET2NUM
Old name of RB_SIZE2NUM.
Definition size_t.h:62
#define ZALLOC_N
Old name of RB_ZALLOC_N.
Definition memory.h:401
#define T_HASH
Old name of RUBY_T_HASH.
Definition value_type.h:65
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
Definition fl_type.h:128
#define Qtrue
Old name of RUBY_Qtrue.
#define INT2NUM
Old name of RB_INT2NUM.
Definition int.h:43
#define Qfalse
Old name of RUBY_Qfalse.
#define T_ARRAY
Old name of RUBY_T_ARRAY.
Definition value_type.h:56
#define NIL_P
Old name of RB_NIL_P.
#define FIXNUM_P
Old name of RB_FIXNUM_P.
static int RB_ENCODING_GET(VALUE obj)
Just another name of rb_enc_get_index.
Definition encoding.h:195
Defines RBIMPL_HAS_BUILTIN.
VALUE rb_ary_new_capa(long capa)
Identical to rb_ary_new(), except it additionally specifies how many rooms of objects it should alloc...
VALUE rb_ary_subseq(VALUE ary, long beg, long len)
Obtains a part of the passed array.
VALUE rb_ary_push(VALUE ary, VALUE elem)
Special case of rb_ary_cat() that it adds only one element.
int len
Length of the buffer.
Definition io.h:8
#define MEMCPY(p1, p2, type, n)
Handy macro to call memcpy.
Definition memory.h:372
#define RARRAY_LEN
Just another name of rb_array_len.
Definition rarray.h:50
#define RARRAY_AREF(a, i)
Definition rarray.h:402
#define RARRAY_CONST_PTR
Just another name of rb_array_const_ptr.
Definition rarray.h:51
#define RSTRING_GETMEM(str, ptrvar, lenvar)
Convenient macro to obtain the contents and length at once.
Definition rstring.h:450
static VALUE RSTRUCT_SET(VALUE st, int k, VALUE v)
Resembles Struct#[]=.
Definition rstruct.h:92
#define RTEST
This is an old name of RB_TEST.
#define USE_FLONUM
Definition method.h:63
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40
static bool RB_TYPE_P(VALUE obj, enum ruby_value_type t)
Queries if the given object is of given type.
Definition value_type.h:376