Ruby: yjit.c Source File

Ruby 4.0.6p0 (2026-07-14 revision 03b6d3f8898a28604fe6cb00eae3226b821168f4)

yjit.c
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
80 VALUE name = rb_profile_frame_full_label(frame);
81 // Absolute path of the frame from rb_iseq_realpath
82 VALUE file = rb_profile_frame_absolute_path(frame);
83 // Line number of the frame
84 VALUE line = rb_profile_frame_first_lineno(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.
111 VALUE
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// TODO(alan): consider using an opaque pointer for the payload rather than a void pointer
197void *
198rb_iseq_get_yjit_payload(const rb_iseq_t *iseq)
199{
200 RUBY_ASSERT_ALWAYS(IMEMO_TYPE_P(iseq, imemo_iseq));
201 if (iseq->body) {
202 return iseq->body->yjit_payload;
203 }
204 else {
205 // Body is NULL when constructing the iseq.
206 return NULL;
207 }
208}
209
210void
211rb_iseq_set_yjit_payload(const rb_iseq_t *iseq, void *payload)
212{
213 RUBY_ASSERT_ALWAYS(IMEMO_TYPE_P(iseq, imemo_iseq));
214 RUBY_ASSERT_ALWAYS(iseq->body);
215 RUBY_ASSERT_ALWAYS(NULL == iseq->body->yjit_payload);
216 iseq->body->yjit_payload = payload;
217}
218
219// This is defined only as a named struct inside rb_iseq_constant_body.
220// By giving it a separate typedef, we make it nameable by rust-bindgen.
221// Bindgen's temp/anon name isn't guaranteed stable.
222typedef struct rb_iseq_param_keyword rb_seq_param_keyword_struct;
223
224 ID rb_get_symbol_id(VALUE namep);
225
226 VALUE
227rb_optimized_call(VALUE *recv, rb_execution_context_t *ec, int argc, VALUE *argv, int kw_splat, VALUE block_handler)
228{
229 rb_proc_t *proc;
230 GetProcPtr(recv, proc);
231 return rb_vm_invoke_proc(ec, proc, argc, argv, kw_splat, block_handler);
232}
233
234// If true, the iseq has only opt_invokebuiltin_delegate(_leave) and leave insns.
235static bool
236invokebuiltin_delegate_leave_p(const rb_iseq_t *iseq)
237{
238 int insn1 = rb_vm_insn_addr2opcode((void *)iseq->body->iseq_encoded[0]);
239 if ((int)iseq->body->iseq_size != insn_len(insn1) + insn_len(BIN(leave))) {
240 return false;
241 }
242 int insn2 = rb_vm_insn_addr2opcode((void *)iseq->body->iseq_encoded[insn_len(insn1)]);
243 return (insn1 == BIN(opt_invokebuiltin_delegate) || insn1 == BIN(opt_invokebuiltin_delegate_leave)) &&
244 insn2 == BIN(leave);
245}
246
247// Return an rb_builtin_function if the iseq contains only that builtin function.
248const struct rb_builtin_function *
249rb_yjit_builtin_function(const rb_iseq_t *iseq)
250{
251 if (invokebuiltin_delegate_leave_p(iseq)) {
252 return (const struct rb_builtin_function *)iseq->body->iseq_encoded[1];
253 }
254 else {
255 return NULL;
256 }
257}
258
259 VALUE
260rb_yjit_str_simple_append(VALUE str1, VALUE str2)
261{
262 return rb_str_cat(str1, RSTRING_PTR(str2), RSTRING_LEN(str2));
263}
264
265extern VALUE *rb_vm_base_ptr(struct rb_control_frame_struct *cfp);
266
267 VALUE
268rb_str_neq_internal(VALUE str1, VALUE str2)
269{
270 return rb_str_eql_internal(str1, str2) == Qtrue ? Qfalse : Qtrue;
271}
272
273extern VALUE rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary);
274
275 VALUE
276rb_yjit_rb_ary_subseq_length(VALUE ary, long beg)
277{
278 long len = RARRAY_LEN(ary);
279 return rb_ary_subseq(ary, beg, len);
280}
281
282// Return non-zero when `obj` is an array and its last item is a
283// `ruby2_keywords` hash. We don't support this kind of splat.
284size_t
285rb_yjit_ruby2_keywords_splat_p(VALUE obj)
286{
287 if (!RB_TYPE_P(obj, T_ARRAY)) return 0;
288 long len = RARRAY_LEN(obj);
289 if (len == 0) return 0;
290 VALUE last = RARRAY_AREF(obj, len - 1);
291 if (!RB_TYPE_P(last, T_HASH)) return 0;
292 return FL_TEST_RAW(last, RHASH_PASS_AS_KEYWORDS);
293}
294
295// Checks to establish preconditions for rb_yjit_splat_varg_cfunc()
296 VALUE
297rb_yjit_splat_varg_checks(VALUE *sp, VALUE splat_array, rb_control_frame_t *cfp)
298{
299 // We inserted a T_ARRAY guard before this call
300 long len = RARRAY_LEN(splat_array);
301
302 // Large splat arrays need a separate allocation
303 if (len < 0 || len > VM_ARGC_STACK_MAX) return Qfalse;
304
305 // Would we overflow if we put the contents of the array onto the stack?
306 if (sp + len > (VALUE *)(cfp - 2)) return Qfalse;
307
308 // Reject keywords hash since that requires duping it sometimes
309 if (len > 0) {
310 VALUE last_hash = RARRAY_AREF(splat_array, len - 1);
311 if (RB_TYPE_P(last_hash, T_HASH) &&
312 FL_TEST_RAW(last_hash, RHASH_PASS_AS_KEYWORDS)) {
313 return Qfalse;
314 }
315 }
316
317 return Qtrue;
318}
319
320// Push array elements to the stack for a C method that has a variable number
321// of parameters. Returns the number of arguments the splat array contributes.
322int
323rb_yjit_splat_varg_cfunc(VALUE *stack_splat_array)
324{
325 VALUE splat_array = *stack_splat_array;
326 int len;
327
328 // We already checked that length fits in `int`
329 RUBY_ASSERT(RB_TYPE_P(splat_array, T_ARRAY));
330 len = (int)RARRAY_LEN(splat_array);
331
332 // Push the contents of the array onto the stack
333 MEMCPY(stack_splat_array, RARRAY_CONST_PTR(splat_array), VALUE, len);
334
335 return len;
336}
337
338// Print the Ruby source location of some ISEQ for debugging purposes
339void
340rb_yjit_dump_iseq_loc(const rb_iseq_t *iseq, uint32_t insn_idx)
341{
342 char *ptr;
343 long len;
344 VALUE path = rb_iseq_path(iseq);
345 RSTRING_GETMEM(path, ptr, len);
346 fprintf(stderr, "%s %.*s:%u\n", __func__, (int)len, ptr, rb_iseq_line_no(iseq, insn_idx));
347}
348
349// Get the number of digits required to print an integer
350static int
351num_digits(int integer)
352{
353 int num = 1;
354 while (integer /= 10) {
355 num++;
356 }
357 return num;
358}
359
360// Allocate a C string that formats an ISEQ label like iseq_inspect()
361char *
362rb_yjit_iseq_inspect(const rb_iseq_t *iseq)
363{
364 const char *label = RSTRING_PTR(iseq->body->location.label);
365 const char *path = RSTRING_PTR(rb_iseq_path(iseq));
366 int lineno = iseq->body->location.code_location.beg_pos.lineno;
367
368 const size_t size = strlen(label) + strlen(path) + num_digits(lineno) + 3;
369 char *buf = ZALLOC_N(char, size);
370 snprintf(buf, size, "%s@%s:%d", label, path, lineno);
371 return buf;
372}
373
374// There are RSTRUCT_SETs in ruby/internal/core/rstruct.h and internal/struct.h
375// with different types (int vs long) for k. Here we use the one from ruby/internal/core/rstruct.h,
376// which takes an int.
377void
378rb_RSTRUCT_SET(VALUE st, int k, VALUE v)
379{
380 RSTRUCT_SET(st, k, v);
381}
382
383// Return the string encoding index
384int
385rb_ENCODING_GET(VALUE obj)
386{
387 return RB_ENCODING_GET(obj);
388}
389
390bool
391rb_yjit_constcache_shareable(const struct iseq_inline_constant_cache_entry *ice)
392{
393 return (ice->flags & IMEMO_CONST_CACHE_SHAREABLE) != 0;
394}
395
396// For running write barriers from Rust. Required when we add a new edge in the
397// object graph from `old` to `young`.
398void
399rb_yjit_obj_written(VALUE old, VALUE young, const char *file, int line)
400{
401 rb_obj_written(old, Qundef, young, file, line);
402}
403
404void
405rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception)
406{
407 RB_VM_LOCKING() {
408 rb_vm_barrier();
409
410 // Compile a block version starting at the current instruction
411 uint8_t *rb_yjit_iseq_gen_entry_point(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception); // defined in Rust
412 uintptr_t code_ptr = (uintptr_t)rb_yjit_iseq_gen_entry_point(iseq, ec, jit_exception);
413
414 if (jit_exception) {
415 iseq->body->jit_exception = (rb_jit_func_t)code_ptr;
416 }
417 else {
418 iseq->body->jit_entry = (rb_jit_func_t)code_ptr;
419 }
420 }
421}
422
423// GC root for interacting with the GC
424 struct yjit_root_struct {
425 bool unused; // empty structs are not legal in C99
426};
427
428// For dealing with refinements
429void
430rb_yjit_invalidate_all_method_lookup_assumptions(void)
431{
432 // It looks like Module#using actually doesn't need to invalidate all the
433 // method caches, so we do nothing here for now.
434}
435
436// Number of object shapes, which might be useful for investigating YJIT exit reasons.
437 VALUE
438rb_object_shape_count(void)
439{
440 // next_shape_id starts from 0, so it's the same as the count
441 return ULONG2NUM((unsigned long)rb_shapes_count());
442}
443
444bool
445rb_yjit_shape_obj_too_complex_p(VALUE obj)
446{
447 return rb_shape_obj_too_complex_p(obj);
448}
449
450attr_index_t
451rb_yjit_shape_capacity(shape_id_t shape_id)
452{
453 return RSHAPE_CAPACITY(shape_id);
454}
455
456attr_index_t
457rb_yjit_shape_index(shape_id_t shape_id)
458{
459 return RSHAPE_INDEX(shape_id);
460}
461
462// The number of stack slots that vm_sendish() pops for send and invokesuper.
463size_t
464rb_yjit_sendish_sp_pops(const struct rb_callinfo *ci)
465{
466 return 1 - sp_inc_of_sendish(ci); // + 1 to ignore return value push
467}
468
469// The number of stack slots that vm_sendish() pops for invokeblock.
470size_t
471rb_yjit_invokeblock_sp_pops(const struct rb_callinfo *ci)
472{
473 return 1 - sp_inc_of_invokeblock(ci); // + 1 to ignore return value push
474}
475
476rb_serial_t
477rb_yjit_cme_ractor_serial(const rb_callable_method_entry_t *cme)
478{
479 return cme->def->body.bmethod.defined_ractor_id;
480}
481
482// Setup jit_return to avoid returning a non-Qundef value on a non-FINISH frame.
483// See [jit_compile_exception] for details.
484void
485rb_yjit_set_exception_return(rb_control_frame_t *cfp, void *leave_exit, void *leave_exception)
486{
487 if (VM_FRAME_FINISHED_P(cfp)) {
488 // If it's a FINISH frame, just normally exit with a non-Qundef value.
489 cfp->jit_return = leave_exit;
490 }
491 else if (cfp->jit_return) {
492 while (!VM_FRAME_FINISHED_P(cfp)) {
493 if (cfp->jit_return == leave_exit) {
494 // Unlike jit_exec(), leave_exit is not safe on a non-FINISH frame on
495 // jit_exec_exception(). See [jit_exec] and [jit_exec_exception] for
496 // details. Exit to the interpreter with Qundef to let it keep executing
497 // other Ruby frames.
498 cfp->jit_return = leave_exception;
499 return;
500 }
501 cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
502 }
503 }
504 else {
505 // If the caller was not JIT code, exit to the interpreter with Qundef
506 // to keep executing Ruby frames with the interpreter.
507 cfp->jit_return = leave_exception;
508 }
509}
510
511// VM_INSTRUCTION_SIZE changes depending on if ZJIT is in the build. Since
512// bindgen can only grab one version of the constant and copy that to rust,
513// we make that the upper bound and this the accurate value.
514uint32_t
515rb_vm_instruction_size(void)
516{
517 return VM_INSTRUCTION_SIZE;
518}
519
520// Primitives used by yjit.rb
521 VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
522 VALUE rb_yjit_print_stats_p(rb_execution_context_t *ec, VALUE self);
523 VALUE rb_yjit_log_enabled_p(rb_execution_context_t *c, VALUE self);
524 VALUE rb_yjit_print_log_p(rb_execution_context_t *c, VALUE self);
525 VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);
526 VALUE rb_yjit_get_stats(rb_execution_context_t *ec, VALUE self, VALUE key);
527 VALUE rb_yjit_reset_stats_bang(rb_execution_context_t *ec, VALUE self);
528 VALUE rb_yjit_get_log(rb_execution_context_t *ec, VALUE self);
529 VALUE rb_yjit_disasm_iseq(rb_execution_context_t *ec, VALUE self, VALUE iseq);
530 VALUE rb_yjit_insns_compiled(rb_execution_context_t *ec, VALUE self, VALUE iseq);
531 VALUE rb_yjit_code_gc(rb_execution_context_t *ec, VALUE self);
532 VALUE rb_yjit_simulate_oom_bang(rb_execution_context_t *ec, VALUE self);
533 VALUE rb_yjit_get_exit_locations(rb_execution_context_t *ec, VALUE self);
534 VALUE 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);
535 VALUE rb_yjit_c_builtin_p(rb_execution_context_t *ec, VALUE self);
536
537// Allow YJIT_C_BUILTIN macro to force --yjit-c-builtin
538#ifdef YJIT_C_BUILTIN
539static VALUE yjit_c_builtin_p(rb_execution_context_t *ec, VALUE self) { return Qtrue; }
540#else
541#define yjit_c_builtin_p rb_yjit_c_builtin_p
542#endif
543
544// Preprocessed yjit.rb generated during build
545#include "yjit.rbinc"
546
RUBY_ASSERT_ALWAYS
#define RUBY_ASSERT_ALWAYS(expr,...)
A variant of RUBY_ASSERT that does not interface with RUBY_DEBUG.
Definition assert.h:199
RUBY_ASSERT
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
Definition assert.h:219
debug.h
rb_profile_frame_full_label
VALUE rb_profile_frame_full_label(VALUE frame)
Identical to rb_profile_frame_label(), except it returns a qualified result.
Definition vm_backtrace.c:2004
rb_profile_frame_absolute_path
VALUE rb_profile_frame_absolute_path(VALUE frame)
Identical to rb_profile_frame_path(), except it tries to expand the returning path.
Definition vm_backtrace.c:1884
rb_profile_frame_path
VALUE rb_profile_frame_path(VALUE frame)
Queries the path of the passed backtrace.
Definition vm_backtrace.c:1852
rb_profile_frame_first_lineno
VALUE rb_profile_frame_first_lineno(VALUE frame)
Queries the first line of the method of the passed frame pointer.
Definition vm_backtrace.c:1913
RUBY_EVENT_C_RETURN
#define RUBY_EVENT_C_RETURN
Return from a method, written in C.
Definition event.h:44
Qundef
#define Qundef
Old name of RUBY_Qundef.
Definition special_consts.h:62
INT2FIX
#define INT2FIX
Old name of RB_INT2FIX.
Definition long.h:48
ID2SYM
#define ID2SYM
Old name of RB_ID2SYM.
Definition symbol.h:44
ULONG2NUM
#define ULONG2NUM
Old name of RB_ULONG2NUM.
Definition long.h:60
SIZET2NUM
#define SIZET2NUM
Old name of RB_SIZE2NUM.
Definition size_t.h:62
ZALLOC_N
#define ZALLOC_N
Old name of RB_ZALLOC_N.
Definition memory.h:401
T_HASH
#define T_HASH
Old name of RUBY_T_HASH.
Definition value_type.h:65
FL_TEST_RAW
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
Definition fl_type.h:131
Qtrue
#define Qtrue
Old name of RUBY_Qtrue.
Definition special_consts.h:61
INT2NUM
#define INT2NUM
Old name of RB_INT2NUM.
Definition int.h:43
Qfalse
#define Qfalse
Old name of RUBY_Qfalse.
Definition special_consts.h:59
T_ARRAY
#define T_ARRAY
Old name of RUBY_T_ARRAY.
Definition value_type.h:56
NIL_P
#define NIL_P
Old name of RB_NIL_P.
Definition special_consts.h:55
RB_ENCODING_GET
static int RB_ENCODING_GET(VALUE obj)
Just another name of rb_enc_get_index.
Definition encoding.h:195
rb_ary_new_capa
VALUE rb_ary_new_capa(long capa)
Identical to rb_ary_new(), except it additionally specifies how many rooms of objects it should alloc...
rb_ary_subseq
VALUE rb_ary_subseq(VALUE ary, long beg, long len)
Obtains a part of the passed array.
rb_ary_push
VALUE rb_ary_push(VALUE ary, VALUE elem)
Special case of rb_ary_cat() that it adds only one element.
rb_hash_new
VALUE rb_hash_new(void)
Creates a new, empty hash object.
Definition hash.c:1484
rb_str_cat
VALUE rb_str_cat(VALUE dst, const char *src, long srclen)
Destructively appends the passed contents to the string.
Definition string.c:3567
len
int len
Length of the buffer.
Definition io.h:8
MEMCPY
#define MEMCPY(p1, p2, type, n)
Handy macro to call memcpy.
Definition memory.h:372
RARRAY_LEN
#define RARRAY_LEN
Just another name of rb_array_len.
Definition rarray.h:51
RARRAY_AREF
#define RARRAY_AREF(a, i)
Definition rarray.h:403
RARRAY_CONST_PTR
#define RARRAY_CONST_PTR
Just another name of rb_array_const_ptr.
Definition rarray.h:52
RSTRING_GETMEM
#define RSTRING_GETMEM(str, ptrvar, lenvar)
Convenient macro to obtain the contents and length at once.
Definition rstring.h:450
RTEST
#define RTEST
This is an old name of RB_TEST.
Definition special_consts.h:51
USE_FLONUM
#define USE_FLONUM
Definition special_consts.h:45
iseq_inline_constant_cache_entry
Definition vm_core.h:261
rb_builtin_function
Definition builtin.h:6
rb_callinfo
Definition vm_callinfo.h:79
rb_control_frame_struct
Definition vm_core.h:912
rb_proc_t
Definition vm_core.h:1288
yjit_root_struct
Definition yjit.c:424
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40
RB_TYPE_P
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