Ruby: vm_core.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

vm_core.h
Go to the documentation of this file.
1#ifndef RUBY_VM_CORE_H
2#define RUBY_VM_CORE_H
3/**********************************************************************
4
5 vm_core.h -
6
7 $Author$
8 created at: 04/01/01 19:41:38 JST
9
10 Copyright (C) 2004-2007 Koichi Sasada
11
12**********************************************************************/
13
14/*
15 * Enable check mode.
16 * 1: enable local assertions.
17 */
18#ifndef VM_CHECK_MODE
19
20// respect RUBY_DUBUG: if given n is 0, then use RUBY_DEBUG
21#define N_OR_RUBY_DEBUG(n) (((n) > 0) ? (n) : RUBY_DEBUG)
22
23#define VM_CHECK_MODE N_OR_RUBY_DEBUG(0)
24#endif
25
39#ifndef VMDEBUG
40#define VMDEBUG 0
41#endif
42
43#if 0
44#undef VMDEBUG
45#define VMDEBUG 3
46#endif
47
48#include "ruby/internal/config.h"
49
50#include <stddef.h>
51#include <signal.h>
52#include <stdarg.h>
53
54#include "ruby_assert.h"
55
56#if VM_CHECK_MODE > 0
57#define VM_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(VM_CHECK_MODE > 0, expr, #expr)
58#define VM_UNREACHABLE(func) rb_bug(#func ": unreachable")
59
60#else
61#define VM_ASSERT(expr) ((void)0)
62#define VM_UNREACHABLE(func) UNREACHABLE
63#endif
64
65#include <setjmp.h>
66
67#include "ruby/internal/stdbool.h"
68#include "ccan/list/list.h"
69#include "id.h"
70#include "internal.h"
71#include "internal/array.h"
72#include "internal/serial.h"
73#include "internal/vm.h"
74#include "method.h"
75#include "node.h"
76#include "ruby/ruby.h"
77#include "ruby/st.h"
78#include "ruby_atomic.h"
79#include "vm_opts.h"
80
81#include "ruby/thread_native.h"
82#if defined(_WIN32)
83#include "thread_win32.h"
84#elif defined(HAVE_PTHREAD_H)
85#include "thread_pthread.h"
86#endif
87
88#define RUBY_VM_THREAD_MODEL 2
89
90/*
91 * implementation selector of get_insn_info algorithm
92 * 0: linear search
93 * 1: binary search
94 * 2: succinct bitvector
95 */
96#ifndef VM_INSN_INFO_TABLE_IMPL
97# define VM_INSN_INFO_TABLE_IMPL 2
98#endif
99
100#if defined(NSIG_MAX) /* POSIX issue 8 */
101# undef NSIG
102# define NSIG NSIG_MAX
103#elif defined(_SIG_MAXSIG) /* FreeBSD */
104# undef NSIG
105# define NSIG _SIG_MAXSIG
106#elif defined(_SIGMAX) /* QNX */
107# define NSIG (_SIGMAX + 1)
108#elif defined(NSIG) /* 99% of everything else */
109# /* take it */
110#else /* Last resort */
111# define NSIG (sizeof(sigset_t) * CHAR_BIT + 1)
112#endif
113
114#define RUBY_NSIG NSIG
115
116#if defined(SIGCLD)
117# define RUBY_SIGCHLD (SIGCLD)
118#elif defined(SIGCHLD)
119# define RUBY_SIGCHLD (SIGCHLD)
120#else
121# define RUBY_SIGCHLD (0)
122#endif
123
124/* platforms with broken or non-existent SIGCHLD work by polling */
125#if defined(__APPLE__)
126# define SIGCHLD_LOSSY (1)
127#else
128# define SIGCHLD_LOSSY (0)
129#endif
130
131/* define to 0 to test old code path */
132#define WAITPID_USE_SIGCHLD (RUBY_SIGCHLD || SIGCHLD_LOSSY)
133
134#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
135# define USE_SIGALTSTACK
136void *rb_allocate_sigaltstack(void);
137void *rb_register_sigaltstack(void *);
138# define RB_ALTSTACK_INIT(var, altstack) var = rb_register_sigaltstack(altstack)
139# define RB_ALTSTACK_FREE(var) free(var)
140# define RB_ALTSTACK(var) var
141#else /* noop */
142# define RB_ALTSTACK_INIT(var, altstack)
143# define RB_ALTSTACK_FREE(var)
144# define RB_ALTSTACK(var) (0)
145#endif
146
147/*****************/
148/* configuration */
149/*****************/
150
151/* gcc ver. check */
152#if defined(__GNUC__) && __GNUC__ >= 2
153
154#if OPT_TOKEN_THREADED_CODE
155#if OPT_DIRECT_THREADED_CODE
156#undef OPT_DIRECT_THREADED_CODE
157#endif
158#endif
159
160#else /* defined(__GNUC__) && __GNUC__ >= 2 */
161
162/* disable threaded code options */
163#if OPT_DIRECT_THREADED_CODE
164#undef OPT_DIRECT_THREADED_CODE
165#endif
166#if OPT_TOKEN_THREADED_CODE
167#undef OPT_TOKEN_THREADED_CODE
168#endif
169#endif
170
171/* call threaded code */
172#if OPT_CALL_THREADED_CODE
173#if OPT_DIRECT_THREADED_CODE
174#undef OPT_DIRECT_THREADED_CODE
175#endif /* OPT_DIRECT_THREADED_CODE */
176#if OPT_STACK_CACHING
177#undef OPT_STACK_CACHING
178#endif /* OPT_STACK_CACHING */
179#endif /* OPT_CALL_THREADED_CODE */
180
181void rb_vm_encoded_insn_data_table_init(void);
182 typedef unsigned long rb_num_t;
183 typedef signed long rb_snum_t;
184
185 enum ruby_tag_type {
186 RUBY_TAG_NONE = 0x0,
187 RUBY_TAG_RETURN = 0x1,
188 RUBY_TAG_BREAK = 0x2,
189 RUBY_TAG_NEXT = 0x3,
190 RUBY_TAG_RETRY = 0x4,
191 RUBY_TAG_REDO = 0x5,
192 RUBY_TAG_RAISE = 0x6,
193 RUBY_TAG_THROW = 0x7,
194 RUBY_TAG_FATAL = 0x8,
195 RUBY_TAG_MASK = 0xf
196};
197
198#define TAG_NONE RUBY_TAG_NONE
199#define TAG_RETURN RUBY_TAG_RETURN
200#define TAG_BREAK RUBY_TAG_BREAK
201#define TAG_NEXT RUBY_TAG_NEXT
202#define TAG_RETRY RUBY_TAG_RETRY
203#define TAG_REDO RUBY_TAG_REDO
204#define TAG_RAISE RUBY_TAG_RAISE
205#define TAG_THROW RUBY_TAG_THROW
206#define TAG_FATAL RUBY_TAG_FATAL
207#define TAG_MASK RUBY_TAG_MASK
208
209 enum ruby_vm_throw_flags {
210 VM_THROW_NO_ESCAPE_FLAG = 0x8000,
211 VM_THROW_STATE_MASK = 0xff
212};
213
214/* forward declarations */
215struct rb_thread_struct;
216struct rb_control_frame_struct;
217
218/* iseq data type */
219 typedef struct rb_compile_option_struct rb_compile_option_t;
220
221// imemo_constcache
222 struct iseq_inline_constant_cache_entry {
223 VALUE flags;
224
225 VALUE value; // v0
226 const rb_cref_t *ic_cref; // v1
227 rb_serial_t ic_serial; // v2
228 // v3
229};
230
231 struct iseq_inline_constant_cache {
232 struct iseq_inline_constant_cache_entry *entry;
233};
234
235 struct iseq_inline_iv_cache_entry {
236 struct rb_iv_index_tbl_entry *entry;
237};
238
239 union iseq_inline_storage_entry {
240 struct {
241 struct rb_thread_struct *running_thread;
242 VALUE value;
243 } once;
244 struct iseq_inline_constant_cache ic_cache;
245 struct iseq_inline_iv_cache_entry iv_cache;
246};
247
248 struct rb_calling_info {
249 const struct rb_callinfo *ci;
250 const struct rb_callcache *cc;
251 VALUE block_handler;
252 VALUE recv;
253 int argc;
254 int kw_splat;
255};
256
257struct rb_execution_context_struct;
258
259#if 1
260#define CoreDataFromValue(obj, type) (type*)DATA_PTR(obj)
261#else
262#define CoreDataFromValue(obj, type) (type*)rb_data_object_get(obj)
263#endif
264#define GetCoreDataFromValue(obj, type, ptr) ((ptr) = CoreDataFromValue((obj), type))
265
266 typedef struct rb_iseq_location_struct {
267 VALUE pathobj; /* String (path) or Array [path, realpath]. Frozen. */
268 VALUE base_label; /* String */
269 VALUE label; /* String */
270 VALUE first_lineno; /* TODO: may be unsigned short */
271 int node_id;
272 rb_code_location_t code_location;
273} rb_iseq_location_t;
274
275#define PATHOBJ_PATH 0
276#define PATHOBJ_REALPATH 1
277
278static inline VALUE
279pathobj_path(VALUE pathobj)
280{
281 if (RB_TYPE_P(pathobj, T_STRING)) {
282 return pathobj;
283 }
284 else {
285 VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
286 return RARRAY_AREF(pathobj, PATHOBJ_PATH);
287 }
288}
289
290static inline VALUE
291pathobj_realpath(VALUE pathobj)
292{
293 if (RB_TYPE_P(pathobj, T_STRING)) {
294 return pathobj;
295 }
296 else {
297 VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
298 return RARRAY_AREF(pathobj, PATHOBJ_REALPATH);
299 }
300}
301
302/* Forward declarations */
303struct rb_mjit_unit;
304
305 struct rb_iseq_constant_body {
306 enum iseq_type {
307 ISEQ_TYPE_TOP,
308 ISEQ_TYPE_METHOD,
309 ISEQ_TYPE_BLOCK,
310 ISEQ_TYPE_CLASS,
311 ISEQ_TYPE_RESCUE,
312 ISEQ_TYPE_ENSURE,
313 ISEQ_TYPE_EVAL,
314 ISEQ_TYPE_MAIN,
315 ISEQ_TYPE_PLAIN
316 } type; /* instruction sequence type */
317
318 unsigned int iseq_size;
319 VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
320
344 struct {
345 struct {
346 unsigned int has_lead : 1;
347 unsigned int has_opt : 1;
348 unsigned int has_rest : 1;
349 unsigned int has_post : 1;
350 unsigned int has_kw : 1;
351 unsigned int has_kwrest : 1;
352 unsigned int has_block : 1;
353
354 unsigned int ambiguous_param0 : 1; /* {|a|} */
355 unsigned int accepts_no_kwarg : 1;
356 unsigned int ruby2_keywords: 1;
357 } flags;
358
359 unsigned int size;
360
361 int lead_num;
362 int opt_num;
363 int rest_start;
364 int post_start;
365 int post_num;
366 int block_start;
367
368 const VALUE *opt_table; /* (opt_num + 1) entries. */
369 /* opt_num and opt_table:
370 *
371 * def foo o1=e1, o2=e2, ..., oN=eN
372 * #=>
373 * # prologue code
374 * A1: e1
375 * A2: e2
376 * ...
377 * AN: eN
378 * AL: body
379 * opt_num = N
380 * opt_table = [A1, A2, ..., AN, AL]
381 */
382
383 const struct rb_iseq_param_keyword {
384 int num;
385 int required_num;
386 int bits_start;
387 int rest_start;
388 const ID *table;
389 VALUE *default_values;
390 } *keyword;
391 } param;
392
393 rb_iseq_location_t location;
394
395 /* insn info, must be freed */
396 struct iseq_insn_info {
397 const struct iseq_insn_info_entry *body;
398 unsigned int *positions;
399 unsigned int size;
400#if VM_INSN_INFO_TABLE_IMPL == 2
401 struct succ_index_table *succ_index_table;
402#endif
403 } insns_info;
404
405 const ID *local_table; /* must free */
406
407 /* catch table */
408 struct iseq_catch_table *catch_table;
409
410 /* for child iseq */
411 const struct rb_iseq_struct *parent_iseq;
412 struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */
413
414 union iseq_inline_storage_entry *is_entries;
415 struct rb_call_data *call_data; //struct rb_call_data calls[ci_size];
416
417 struct {
418 rb_snum_t flip_count;
419 VALUE coverage;
420 VALUE pc2branchindex;
421 VALUE *original_iseq;
422 } variable;
423
424 unsigned int local_table_size;
425 unsigned int is_size;
426 unsigned int ci_size;
427 unsigned int stack_max; /* for stack overflow check */
428
429 char catch_except_p; /* If a frame of this ISeq may catch exception, set TRUE */
430 bool builtin_inline_p; // This ISeq's builtin func is safe to be inlined by MJIT
431 struct rb_id_table *outer_variables;
432
433#if USE_MJIT
434 /* The following fields are MJIT related info. */
435 VALUE (*jit_func)(struct rb_execution_context_struct *,
436 struct rb_control_frame_struct *); /* function pointer for loaded native code */
437 long unsigned total_calls; /* number of total calls with `mjit_exec()` */
438 struct rb_mjit_unit *jit_unit;
439#endif
440};
441
442/* T_IMEMO/iseq */
443/* typedef rb_iseq_t is in method.h */
444 struct rb_iseq_struct {
445 VALUE flags; /* 1 */
446 VALUE wrapper; /* 2 */
447
448 struct rb_iseq_constant_body *body; /* 3 */
449
450 union { /* 4, 5 words */
451 struct iseq_compile_data *compile_data; /* used at compile time */
452
453 struct {
454 VALUE obj;
455 int index;
456 } loader;
457
458 struct {
459 struct rb_hook_list_struct *local_hooks;
460 rb_event_flag_t global_trace_events;
461 } exec;
462 } aux;
463};
464
465#ifndef USE_LAZY_LOAD
466#define USE_LAZY_LOAD 0
467#endif
468
469#if USE_LAZY_LOAD
470const rb_iseq_t *rb_iseq_complete(const rb_iseq_t *iseq);
471#endif
472
473static inline const rb_iseq_t *
474rb_iseq_check(const rb_iseq_t *iseq)
475{
476#if USE_LAZY_LOAD
477 if (iseq->body == NULL) {
478 rb_iseq_complete((rb_iseq_t *)iseq);
479 }
480#endif
481 return iseq;
482}
483
484static inline const rb_iseq_t *
485def_iseq_ptr(rb_method_definition_t *def)
486{
487//TODO: re-visit. to check the bug, enable this assertion.
488#if VM_CHECK_MODE > 0
489 if (def->type != VM_METHOD_TYPE_ISEQ) rb_bug("def_iseq_ptr: not iseq (%d)", def->type);
490#endif
491 return rb_iseq_check(def->body.iseq.iseqptr);
492}
493
494 enum ruby_special_exceptions {
495 ruby_error_reenter,
496 ruby_error_nomemory,
497 ruby_error_sysstack,
498 ruby_error_stackfatal,
499 ruby_error_stream_closed,
500 ruby_special_error_count
501};
502
503 enum ruby_basic_operators {
504 BOP_PLUS,
505 BOP_MINUS,
506 BOP_MULT,
507 BOP_DIV,
508 BOP_MOD,
509 BOP_EQ,
510 BOP_EQQ,
511 BOP_LT,
512 BOP_LE,
513 BOP_LTLT,
514 BOP_AREF,
515 BOP_ASET,
516 BOP_LENGTH,
517 BOP_SIZE,
518 BOP_EMPTY_P,
519 BOP_NIL_P,
520 BOP_SUCC,
521 BOP_GT,
522 BOP_GE,
523 BOP_NOT,
524 BOP_NEQ,
525 BOP_MATCH,
526 BOP_FREEZE,
527 BOP_UMINUS,
528 BOP_MAX,
529 BOP_MIN,
530 BOP_CALL,
531 BOP_AND,
532 BOP_OR,
533
534 BOP_LAST_
535};
536
537#define GetVMPtr(obj, ptr) \
538 GetCoreDataFromValue((obj), rb_vm_t, (ptr))
539
540struct rb_vm_struct;
541 typedef void rb_vm_at_exit_func(struct rb_vm_struct*);
542
543 typedef struct rb_at_exit_list {
544 rb_vm_at_exit_func *func;
545 struct rb_at_exit_list *next;
546} rb_at_exit_list;
547
548struct rb_objspace;
549struct rb_objspace *rb_objspace_alloc(void);
550void rb_objspace_free(struct rb_objspace *);
551void rb_objspace_call_finalizer(struct rb_objspace *);
552
553 typedef struct rb_hook_list_struct {
554 struct rb_event_hook_struct *hooks;
555 rb_event_flag_t events;
556 unsigned int need_clean;
557 unsigned int running;
558} rb_hook_list_t;
559
560
561// see builtin.h for definition
562 typedef const struct rb_builtin_function *RB_BUILTIN;
563
564 typedef struct rb_vm_struct {
565 VALUE self;
566
567 struct {
568 struct list_head set;
569 unsigned int cnt;
570 unsigned int blocking_cnt;
571
572 struct rb_ractor_struct *main_ractor;
573 struct rb_thread_struct *main_thread; // == vm->ractor.main_ractor->threads.main
574
575 struct {
576 // monitor
577 rb_nativethread_lock_t lock;
578 struct rb_ractor_struct *lock_owner;
579 unsigned int lock_rec;
580
581 // barrier
582 bool barrier_waiting;
583 unsigned int barrier_cnt;
584 rb_nativethread_cond_t barrier_cond;
585
586 // join at exit
587 rb_nativethread_cond_t terminate_cond;
588 bool terminate_waiting;
589 } sync;
590 } ractor;
591
592#ifdef USE_SIGALTSTACK
593 void *main_altstack;
594#endif
595
596 rb_serial_t fork_gen;
597 rb_nativethread_lock_t waitpid_lock;
598 struct list_head waiting_pids; /* PID > 0: <=> struct waitpid_state */
599 struct list_head waiting_grps; /* PID <= 0: <=> struct waitpid_state */
600 struct list_head waiting_fds; /* <=> struct waiting_fd */
601
602 /* set in single-threaded processes only: */
603 volatile int ubf_async_safe;
604
605 unsigned int running: 1;
606 unsigned int thread_abort_on_exception: 1;
607 unsigned int thread_report_on_exception: 1;
608 unsigned int thread_ignore_deadlock: 1;
609
610 /* object management */
611 VALUE mark_object_ary;
612 const VALUE special_exceptions[ruby_special_error_count];
613
614 /* load */
615 VALUE top_self;
616 VALUE load_path;
617 VALUE load_path_snapshot;
618 VALUE load_path_check_cache;
619 VALUE expanded_load_path;
620 VALUE loaded_features;
621 VALUE loaded_features_snapshot;
622 struct st_table *loaded_features_index;
623 struct st_table *loading_table;
624
625 /* signal */
626 struct {
627 VALUE cmd[RUBY_NSIG];
628 } trap_list;
629
630 /* relation table of ensure - rollback for callcc */
631 struct st_table *ensure_rollback_table;
632
633 /* postponed_job (async-signal-safe, NOT thread-safe) */
634 struct rb_postponed_job_struct *postponed_job_buffer;
635 rb_atomic_t postponed_job_index;
636
637 int src_encoding_index;
638
639 /* workqueue (thread-safe, NOT async-signal-safe) */
640 struct list_head workqueue; /* <=> rb_workqueue_job.jnode */
641 rb_nativethread_lock_t workqueue_lock;
642
643 VALUE orig_progname, progname;
644 VALUE coverages;
645 int coverage_mode;
646
647 st_table * defined_module_hash;
648
649 struct rb_objspace *objspace;
650
651 rb_at_exit_list *at_exit;
652
653 VALUE *defined_strings;
654 st_table *frozen_strings;
655
656 const struct rb_builtin_function *builtin_function_table;
657 int builtin_inline_index;
658
659 struct rb_id_table *negative_cme_table;
660
661#ifndef VM_GLOBAL_CC_CACHE_TABLE_SIZE
662#define VM_GLOBAL_CC_CACHE_TABLE_SIZE 1023
663#endif
664 const struct rb_callcache *global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]; // vm_eval.c
665
666#if USE_VM_CLOCK
667 uint32_t clock;
668#endif
669
670 /* params */
671 struct { /* size in byte */
672 size_t thread_vm_stack_size;
673 size_t thread_machine_stack_size;
674 size_t fiber_vm_stack_size;
675 size_t fiber_machine_stack_size;
676 } default_params;
677
678 short redefined_flag[BOP_LAST_];
679} rb_vm_t;
680
681/* default values */
682
683#define RUBY_VM_SIZE_ALIGN 4096
684
685#define RUBY_VM_THREAD_VM_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
686#define RUBY_VM_THREAD_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
687#define RUBY_VM_THREAD_MACHINE_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
688#define RUBY_VM_THREAD_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
689
690#define RUBY_VM_FIBER_VM_STACK_SIZE ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
691#define RUBY_VM_FIBER_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
692#define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 64 * 1024 * sizeof(VALUE)) /* 256 KB or 512 KB */
693#if defined(__powerpc64__)
694#define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 32 * 1024 * sizeof(VALUE)) /* 128 KB or 256 KB */
695#else
696#define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
697#endif
698
699#if __has_feature(memory_sanitizer) || __has_feature(address_sanitizer)
700/* It seems sanitizers consume A LOT of machine stacks */
701#undef RUBY_VM_THREAD_MACHINE_STACK_SIZE
702#define RUBY_VM_THREAD_MACHINE_STACK_SIZE (1024 * 1024 * sizeof(VALUE))
703#undef RUBY_VM_THREAD_MACHINE_STACK_SIZE_MIN
704#define RUBY_VM_THREAD_MACHINE_STACK_SIZE_MIN ( 512 * 1024 * sizeof(VALUE))
705#undef RUBY_VM_FIBER_MACHINE_STACK_SIZE
706#define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 256 * 1024 * sizeof(VALUE))
707#undef RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN
708#define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 128 * 1024 * sizeof(VALUE))
709#endif
710
711/* optimize insn */
712#define INTEGER_REDEFINED_OP_FLAG (1 << 0)
713#define FLOAT_REDEFINED_OP_FLAG (1 << 1)
714#define STRING_REDEFINED_OP_FLAG (1 << 2)
715#define ARRAY_REDEFINED_OP_FLAG (1 << 3)
716#define HASH_REDEFINED_OP_FLAG (1 << 4)
717/* #define BIGNUM_REDEFINED_OP_FLAG (1 << 5) */
718#define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
719#define TIME_REDEFINED_OP_FLAG (1 << 7)
720#define REGEXP_REDEFINED_OP_FLAG (1 << 8)
721#define NIL_REDEFINED_OP_FLAG (1 << 9)
722#define TRUE_REDEFINED_OP_FLAG (1 << 10)
723#define FALSE_REDEFINED_OP_FLAG (1 << 11)
724#define PROC_REDEFINED_OP_FLAG (1 << 12)
725
726#define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0))
727
728#ifndef VM_DEBUG_BP_CHECK
729#define VM_DEBUG_BP_CHECK 0
730#endif
731
732#ifndef VM_DEBUG_VERIFY_METHOD_CACHE
733#define VM_DEBUG_VERIFY_METHOD_CACHE (VMDEBUG != 0)
734#endif
735
736 struct rb_captured_block {
737 VALUE self;
738 const VALUE *ep;
739 union {
740 const rb_iseq_t *iseq;
741 const struct vm_ifunc *ifunc;
742 VALUE val;
743 } code;
744};
745
746 enum rb_block_handler_type {
747 block_handler_type_iseq,
748 block_handler_type_ifunc,
749 block_handler_type_symbol,
750 block_handler_type_proc
751};
752
753 enum rb_block_type {
754 block_type_iseq,
755 block_type_ifunc,
756 block_type_symbol,
757 block_type_proc
758};
759
760 struct rb_block {
761 union {
762 struct rb_captured_block captured;
763 VALUE symbol;
764 VALUE proc;
765 } as;
766 enum rb_block_type type;
767};
768
769 typedef struct rb_control_frame_struct {
770 const VALUE *pc; /* cfp[0] */
771 VALUE *sp; /* cfp[1] */
772 const rb_iseq_t *iseq; /* cfp[2] */
773 VALUE self; /* cfp[3] / block[0] */
774 const VALUE *ep; /* cfp[4] / block[1] */
775 const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc or forwarded block handler */
776 VALUE *__bp__; /* cfp[6] */ /* outside vm_push_frame, use vm_base_ptr instead. */
777
778#if VM_DEBUG_BP_CHECK
779 VALUE *bp_check; /* cfp[7] */
780#endif
781} rb_control_frame_t;
782
783extern const rb_data_type_t ruby_threadptr_data_type;
784
785static inline struct rb_thread_struct *
786rb_thread_ptr(VALUE thval)
787{
788 return (struct rb_thread_struct *)rb_check_typeddata(thval, &ruby_threadptr_data_type);
789}
790
791 enum rb_thread_status {
792 THREAD_RUNNABLE,
793 THREAD_STOPPED,
794 THREAD_STOPPED_FOREVER,
795 THREAD_KILLED
796};
797
798#ifdef RUBY_JMP_BUF
799typedef RUBY_JMP_BUF rb_jmpbuf_t;
800#else
801 typedef void *rb_jmpbuf_t[5];
802#endif
803
804/*
805 the members which are written in EC_PUSH_TAG() should be placed at
806 the beginning and the end, so that entire region is accessible.
807*/
808 struct rb_vm_tag {
809 VALUE tag;
810 VALUE retval;
811 rb_jmpbuf_t buf;
812 struct rb_vm_tag *prev;
813 enum ruby_tag_type state;
814 unsigned int lock_rec;
815};
816
817 STATIC_ASSERT(rb_vm_tag_buf_offset, offsetof(struct rb_vm_tag, buf) > 0);
818 STATIC_ASSERT(rb_vm_tag_buf_end,
819 offsetof(struct rb_vm_tag, buf) + sizeof(rb_jmpbuf_t) <
820 sizeof(struct rb_vm_tag));
821
822 struct rb_vm_protect_tag {
823 struct rb_vm_protect_tag *prev;
824};
825
826 struct rb_unblock_callback {
827 rb_unblock_function_t *func;
828 void *arg;
829};
830
831struct rb_mutex_struct;
832
833 typedef struct rb_ensure_entry {
834 VALUE marker;
835 VALUE (*e_proc)(VALUE);
836 VALUE data2;
837} rb_ensure_entry_t;
838
839 typedef struct rb_ensure_list {
840 struct rb_ensure_list *next;
841 struct rb_ensure_entry entry;
842} rb_ensure_list_t;
843
844 typedef char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) * 2 + 3];
845
846 typedef struct rb_fiber_struct rb_fiber_t;
847
848 struct rb_waiting_list {
849 struct rb_waiting_list *next;
850 struct rb_thread_struct *thread;
851 struct rb_fiber_struct *fiber;
852};
853
854 struct rb_execution_context_struct {
855 /* execution information */
856 VALUE *vm_stack; /* must free, must mark */
857 size_t vm_stack_size; /* size in word (byte size / sizeof(VALUE)) */
858 rb_control_frame_t *cfp;
859
860 struct rb_vm_tag *tag;
861 struct rb_vm_protect_tag *protect_tag;
862
863 /* interrupt flags */
864 rb_atomic_t interrupt_flag;
865 rb_atomic_t interrupt_mask; /* size should match flag */
866#if USE_VM_CLOCK
867 uint32_t checked_clock;
868#endif
869
870 rb_fiber_t *fiber_ptr;
871 struct rb_thread_struct *thread_ptr;
872
873 /* storage (ec (fiber) local) */
874 struct rb_id_table *local_storage;
875 VALUE local_storage_recursive_hash;
876 VALUE local_storage_recursive_hash_for_trace;
877
878 /* eval env */
879 const VALUE *root_lep;
880 VALUE root_svar;
881
882 /* ensure & callcc */
883 rb_ensure_list_t *ensure_list;
884
885 /* trace information */
886 struct rb_trace_arg_struct *trace_arg;
887
888 /* temporary places */
889 VALUE errinfo;
890 VALUE passed_block_handler; /* for rb_iterate */
891
892 uint8_t raised_flag; /* only 3 bits needed */
893
894 /* n.b. only 7 bits needed, really: */
895 BITFIELD(enum method_missing_reason, method_missing_reason, 8);
896
897 VALUE private_const_reference;
898
899 /* for GC */
900 struct {
901 VALUE *stack_start;
902 VALUE *stack_end;
903 size_t stack_maxsize;
904 RUBY_ALIGNAS(SIZEOF_VALUE) jmp_buf regs;
905 } machine;
906};
907
908#ifndef rb_execution_context_t
909 typedef struct rb_execution_context_struct rb_execution_context_t;
910#define rb_execution_context_t rb_execution_context_t
911#endif
912
913// for builtin.h
914#define VM_CORE_H_EC_DEFINED 1
915
916// Set the vm_stack pointer in the execution context.
917void rb_ec_set_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t size);
918
919// Initialize the vm_stack pointer in the execution context and push the initial stack frame.
920// @param ec the execution context to update.
921// @param stack a pointer to the stack to use.
922// @param size the size of the stack, as in `VALUE stack[size]`.
923void rb_ec_initialize_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t size);
924
925// Clear (set to `NULL`) the vm_stack pointer.
926// @param ec the execution context to update.
927void rb_ec_clear_vm_stack(rb_execution_context_t *ec);
928
929 struct rb_ext_config {
930 bool ractor_safe;
931};
932
933 typedef struct rb_ractor_struct rb_ractor_t;
934
935 typedef struct rb_thread_struct {
936 struct list_node lt_node; // managed by a ractor
937 VALUE self;
938 rb_ractor_t *ractor;
939 rb_vm_t *vm;
940
941 rb_execution_context_t *ec;
942
943 VALUE last_status; /* $? */
944
945 /* for cfunc */
946 struct rb_calling_info *calling;
947
948 /* for load(true) */
949 VALUE top_self;
950 VALUE top_wrapper;
951
952 /* thread control */
953 rb_nativethread_id_t thread_id;
954#ifdef NON_SCALAR_THREAD_ID
955 rb_thread_id_string_t thread_id_string;
956#endif
957 BITFIELD(enum rb_thread_status, status, 2);
958 /* bit flags */
959 unsigned int to_kill : 1;
960 unsigned int abort_on_exception: 1;
961 unsigned int report_on_exception: 1;
962 unsigned int pending_interrupt_queue_checked: 1;
963 int8_t priority; /* -3 .. 3 (RUBY_THREAD_PRIORITY_{MIN,MAX}) */
964 uint32_t running_time_us; /* 12500..800000 */
965
966 native_thread_data_t native_thread_data;
967 void *blocking_region_buffer;
968
969 VALUE thgroup;
970 VALUE value;
971
972 /* temporary place of retval on OPT_CALL_THREADED_CODE */
973#if OPT_CALL_THREADED_CODE
974 VALUE retval;
975#endif
976
977 /* async errinfo queue */
978 VALUE pending_interrupt_queue;
979 VALUE pending_interrupt_mask_stack;
980
981 /* interrupt management */
982 rb_nativethread_lock_t interrupt_lock;
983 struct rb_unblock_callback unblock;
984 VALUE locking_mutex;
985 struct rb_mutex_struct *keeping_mutexes;
986
987 struct rb_waiting_list *join_list;
988
989 union {
990 struct {
991 VALUE proc;
992 VALUE args;
993 int kw_splat;
994 } proc;
995 struct {
996 VALUE (*func)(void *);
997 void *arg;
998 } func;
999 } invoke_arg;
1000
1001 enum thread_invoke_type {
1002 thread_invoke_type_none = 0,
1003 thread_invoke_type_proc,
1004 thread_invoke_type_ractor_proc,
1005 thread_invoke_type_func
1006 } invoke_type;
1007
1008 /* statistics data for profiler */
1009 VALUE stat_insn_usage;
1010
1011 /* fiber */
1012 rb_fiber_t *root_fiber;
1013 rb_jmpbuf_t root_jmpbuf;
1014
1015 VALUE scheduler;
1016 unsigned blocking;
1017
1018 /* misc */
1019 VALUE name;
1020
1021 struct rb_ext_config ext_config;
1022
1023#ifdef USE_SIGALTSTACK
1024 void *altstack;
1025#endif
1026} rb_thread_t;
1027
1028 typedef enum {
1029 VM_DEFINECLASS_TYPE_CLASS = 0x00,
1030 VM_DEFINECLASS_TYPE_SINGLETON_CLASS = 0x01,
1031 VM_DEFINECLASS_TYPE_MODULE = 0x02,
1032 /* 0x03..0x06 is reserved */
1033 VM_DEFINECLASS_TYPE_MASK = 0x07
1034} rb_vm_defineclass_type_t;
1035
1036#define VM_DEFINECLASS_TYPE(x) ((rb_vm_defineclass_type_t)(x) & VM_DEFINECLASS_TYPE_MASK)
1037#define VM_DEFINECLASS_FLAG_SCOPED 0x08
1038#define VM_DEFINECLASS_FLAG_HAS_SUPERCLASS 0x10
1039#define VM_DEFINECLASS_SCOPED_P(x) ((x) & VM_DEFINECLASS_FLAG_SCOPED)
1040#define VM_DEFINECLASS_HAS_SUPERCLASS_P(x) \
1041 ((x) & VM_DEFINECLASS_FLAG_HAS_SUPERCLASS)
1042
1043/* iseq.c */
1044RUBY_SYMBOL_EXPORT_BEGIN
1045
1046/* node -> iseq */
1047 rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
1048 rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
1049 rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent);
1050 rb_iseq_t *rb_iseq_new_eval (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth);
1051 rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth,
1052 enum iseq_type, const rb_compile_option_t*);
1053
1054struct iseq_link_anchor;
1055 struct rb_iseq_new_with_callback_callback_func {
1056 VALUE flags;
1057 VALUE reserved;
1058 void (*func)(rb_iseq_t *, struct iseq_link_anchor *, const void *);
1059 const void *data;
1060};
1061static inline struct rb_iseq_new_with_callback_callback_func *
1062rb_iseq_new_with_callback_new_callback(
1063 void (*func)(rb_iseq_t *, struct iseq_link_anchor *, const void *), const void *ptr)
1064{
1065 VALUE memo = rb_imemo_new(imemo_ifunc, (VALUE)func, (VALUE)ptr, Qundef, Qfalse);
1066 return (struct rb_iseq_new_with_callback_callback_func *)memo;
1067}
1068 rb_iseq_t *rb_iseq_new_with_callback(const struct rb_iseq_new_with_callback_callback_func * ifunc,
1069 VALUE name, VALUE path, VALUE realpath, VALUE first_lineno,
1070 const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*);
1071
1072 VALUE rb_iseq_disasm(const rb_iseq_t *iseq);
1073int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);
1074
1075 VALUE rb_iseq_coverage(const rb_iseq_t *iseq);
1076
1077 RUBY_EXTERN VALUE rb_cISeq;
1078 RUBY_EXTERN VALUE rb_cRubyVM;
1079 RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
1080 RUBY_EXTERN VALUE rb_block_param_proxy;
1081RUBY_SYMBOL_EXPORT_END
1082
1083#define GetProcPtr(obj, ptr) \
1084 GetCoreDataFromValue((obj), rb_proc_t, (ptr))
1085
1086 typedef struct {
1087 const struct rb_block block;
1088 unsigned int is_from_method: 1; /* bool */
1089 unsigned int is_lambda: 1; /* bool */
1090 unsigned int is_isolated: 1; /* bool */
1091} rb_proc_t;
1092
1093RUBY_SYMBOL_EXPORT_BEGIN
1094 VALUE rb_proc_isolate(VALUE self);
1095 VALUE rb_proc_isolate_bang(VALUE self);
1096 VALUE rb_proc_ractor_make_shareable(VALUE self);
1097RUBY_SYMBOL_EXPORT_END
1098
1099 typedef struct {
1100 VALUE flags; /* imemo header */
1101 rb_iseq_t *iseq;
1102 const VALUE *ep;
1103 const VALUE *env;
1104 unsigned int env_size;
1105} rb_env_t;
1106
1107extern const rb_data_type_t ruby_binding_data_type;
1108
1109#define GetBindingPtr(obj, ptr) \
1110 GetCoreDataFromValue((obj), rb_binding_t, (ptr))
1111
1112 typedef struct {
1113 const struct rb_block block;
1114 const VALUE pathobj;
1115 unsigned short first_lineno;
1116} rb_binding_t;
1117
1118/* used by compile time and send insn */
1119
1120 enum vm_check_match_type {
1121 VM_CHECKMATCH_TYPE_WHEN = 1,
1122 VM_CHECKMATCH_TYPE_CASE = 2,
1123 VM_CHECKMATCH_TYPE_RESCUE = 3
1124};
1125
1126#define VM_CHECKMATCH_TYPE_MASK 0x03
1127#define VM_CHECKMATCH_ARRAY 0x04
1128
1129 enum vm_special_object_type {
1130 VM_SPECIAL_OBJECT_VMCORE = 1,
1131 VM_SPECIAL_OBJECT_CBASE,
1132 VM_SPECIAL_OBJECT_CONST_BASE
1133};
1134
1135 enum vm_svar_index {
1136 VM_SVAR_LASTLINE = 0, /* $_ */
1137 VM_SVAR_BACKREF = 1, /* $~ */
1138
1139 VM_SVAR_EXTRA_START = 2,
1140 VM_SVAR_FLIPFLOP_START = 2 /* flipflop */
1141};
1142
1143/* inline cache */
1144 typedef struct iseq_inline_constant_cache *IC;
1145 typedef struct iseq_inline_iv_cache_entry *IVC;
1146 typedef union iseq_inline_storage_entry *ISE;
1147 typedef const struct rb_callinfo *CALL_INFO;
1148 typedef const struct rb_callcache *CALL_CACHE;
1149 typedef struct rb_call_data *CALL_DATA;
1150
1151 typedef VALUE CDHASH;
1152
1153#ifndef FUNC_FASTCALL
1154#define FUNC_FASTCALL(x) x
1155#endif
1156
1157typedef rb_control_frame_t *
1158 (FUNC_FASTCALL(*rb_insn_func_t))(rb_execution_context_t *, rb_control_frame_t *);
1159
1160#define VM_TAGGED_PTR_SET(p, tag) ((VALUE)(p) | (tag))
1161#define VM_TAGGED_PTR_REF(v, mask) ((void *)((v) & ~mask))
1162
1163#define GC_GUARDED_PTR(p) VM_TAGGED_PTR_SET((p), 0x01)
1164#define GC_GUARDED_PTR_REF(p) VM_TAGGED_PTR_REF((p), 0x03)
1165#define GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01)
1166
1167enum {
1168 /* Frame/Environment flag bits:
1169 * MMMM MMMM MMMM MMMM ____ _FFF FFFF EEEX (LSB)
1170 *
1171 * X : tag for GC marking (It seems as Fixnum)
1172 * EEE : 3 bits Env flags
1173 * FF..: 7 bits Frame flags
1174 * MM..: 15 bits frame magic (to check frame corruption)
1175 */
1176
1177 /* frame types */
1178 VM_FRAME_MAGIC_METHOD = 0x11110001,
1179 VM_FRAME_MAGIC_BLOCK = 0x22220001,
1180 VM_FRAME_MAGIC_CLASS = 0x33330001,
1181 VM_FRAME_MAGIC_TOP = 0x44440001,
1182 VM_FRAME_MAGIC_CFUNC = 0x55550001,
1183 VM_FRAME_MAGIC_IFUNC = 0x66660001,
1184 VM_FRAME_MAGIC_EVAL = 0x77770001,
1185 VM_FRAME_MAGIC_RESCUE = 0x78880001,
1186 VM_FRAME_MAGIC_DUMMY = 0x79990001,
1187
1188 VM_FRAME_MAGIC_MASK = 0x7fff0001,
1189
1190 /* frame flag */
1191 VM_FRAME_FLAG_FINISH = 0x0020,
1192 VM_FRAME_FLAG_BMETHOD = 0x0040,
1193 VM_FRAME_FLAG_CFRAME = 0x0080,
1194 VM_FRAME_FLAG_LAMBDA = 0x0100,
1195 VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM = 0x0200,
1196 VM_FRAME_FLAG_CFRAME_KW = 0x0400,
1197 VM_FRAME_FLAG_PASSED = 0x0800,
1198
1199 /* env flag */
1200 VM_ENV_FLAG_LOCAL = 0x0002,
1201 VM_ENV_FLAG_ESCAPED = 0x0004,
1202 VM_ENV_FLAG_WB_REQUIRED = 0x0008,
1203 VM_ENV_FLAG_ISOLATED = 0x0010,
1204};
1205
1206#define VM_ENV_DATA_SIZE ( 3)
1207
1208#define VM_ENV_DATA_INDEX_ME_CREF (-2) /* ep[-2] */
1209#define VM_ENV_DATA_INDEX_SPECVAL (-1) /* ep[-1] */
1210#define VM_ENV_DATA_INDEX_FLAGS ( 0) /* ep[ 0] */
1211#define VM_ENV_DATA_INDEX_ENV ( 1) /* ep[ 1] */
1212
1213#define VM_ENV_INDEX_LAST_LVAR (-VM_ENV_DATA_SIZE)
1214
1215static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value);
1216
1217static inline void
1218VM_ENV_FLAGS_SET(const VALUE *ep, VALUE flag)
1219{
1220 VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
1221 VM_ASSERT(FIXNUM_P(flags));
1222 VM_FORCE_WRITE_SPECIAL_CONST(&ep[VM_ENV_DATA_INDEX_FLAGS], flags | flag);
1223}
1224
1225static inline void
1226VM_ENV_FLAGS_UNSET(const VALUE *ep, VALUE flag)
1227{
1228 VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
1229 VM_ASSERT(FIXNUM_P(flags));
1230 VM_FORCE_WRITE_SPECIAL_CONST(&ep[VM_ENV_DATA_INDEX_FLAGS], flags & ~flag);
1231}
1232
1233static inline unsigned long
1234VM_ENV_FLAGS(const VALUE *ep, long flag)
1235{
1236 VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
1237 VM_ASSERT(FIXNUM_P(flags));
1238 return flags & flag;
1239}
1240
1241static inline unsigned long
1242VM_FRAME_TYPE(const rb_control_frame_t *cfp)
1243{
1244 return VM_ENV_FLAGS(cfp->ep, VM_FRAME_MAGIC_MASK);
1245}
1246
1247static inline int
1248VM_FRAME_LAMBDA_P(const rb_control_frame_t *cfp)
1249{
1250 return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_LAMBDA) != 0;
1251}
1252
1253static inline int
1254VM_FRAME_CFRAME_KW_P(const rb_control_frame_t *cfp)
1255{
1256 return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME_KW) != 0;
1257}
1258
1259static inline int
1260VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
1261{
1262 return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_FINISH) != 0;
1263}
1264
1265static inline int
1266VM_FRAME_BMETHOD_P(const rb_control_frame_t *cfp)
1267{
1268 return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_BMETHOD) != 0;
1269}
1270
1271static inline int
1272rb_obj_is_iseq(VALUE iseq)
1273{
1274 return imemo_type_p(iseq, imemo_iseq);
1275}
1276
1277#if VM_CHECK_MODE > 0
1278#define RUBY_VM_NORMAL_ISEQ_P(iseq) rb_obj_is_iseq((VALUE)iseq)
1279#endif
1280
1281static inline int
1282VM_FRAME_CFRAME_P(const rb_control_frame_t *cfp)
1283{
1284 int cframe_p = VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME) != 0;
1285 VM_ASSERT(RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) != cframe_p);
1286 return cframe_p;
1287}
1288
1289static inline int
1290VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
1291{
1292 return !VM_FRAME_CFRAME_P(cfp);
1293}
1294
1295#define RUBYVM_CFUNC_FRAME_P(cfp) \
1296 (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
1297
1298#define VM_GUARDED_PREV_EP(ep) GC_GUARDED_PTR(ep)
1299#define VM_BLOCK_HANDLER_NONE 0
1300
1301static inline int
1302VM_ENV_LOCAL_P(const VALUE *ep)
1303{
1304 return VM_ENV_FLAGS(ep, VM_ENV_FLAG_LOCAL) ? 1 : 0;
1305}
1306
1307static inline const VALUE *
1308VM_ENV_PREV_EP(const VALUE *ep)
1309{
1310 VM_ASSERT(VM_ENV_LOCAL_P(ep) == 0);
1311 return GC_GUARDED_PTR_REF(ep[VM_ENV_DATA_INDEX_SPECVAL]);
1312}
1313
1314static inline VALUE
1315VM_ENV_BLOCK_HANDLER(const VALUE *ep)
1316{
1317 VM_ASSERT(VM_ENV_LOCAL_P(ep));
1318 return ep[VM_ENV_DATA_INDEX_SPECVAL];
1319}
1320
1321#if VM_CHECK_MODE > 0
1322int rb_vm_ep_in_heap_p(const VALUE *ep);
1323#endif
1324
1325static inline int
1326VM_ENV_ESCAPED_P(const VALUE *ep)
1327{
1328 VM_ASSERT(rb_vm_ep_in_heap_p(ep) == !!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED));
1329 return VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) ? 1 : 0;
1330}
1331
1332#if VM_CHECK_MODE > 0
1333static inline int
1334vm_assert_env(VALUE obj)
1335{
1336 VM_ASSERT(imemo_type_p(obj, imemo_env));
1337 return 1;
1338}
1339#endif
1340
1341static inline VALUE
1342VM_ENV_ENVVAL(const VALUE *ep)
1343{
1344 VALUE envval = ep[VM_ENV_DATA_INDEX_ENV];
1345 VM_ASSERT(VM_ENV_ESCAPED_P(ep));
1346 VM_ASSERT(vm_assert_env(envval));
1347 return envval;
1348}
1349
1350static inline const rb_env_t *
1351VM_ENV_ENVVAL_PTR(const VALUE *ep)
1352{
1353 return (const rb_env_t *)VM_ENV_ENVVAL(ep);
1354}
1355
1356static inline const rb_env_t *
1357vm_env_new(VALUE *env_ep, VALUE *env_body, unsigned int env_size, const rb_iseq_t *iseq)
1358{
1359 rb_env_t *env = (rb_env_t *)rb_imemo_new(imemo_env, (VALUE)env_ep, (VALUE)env_body, 0, (VALUE)iseq);
1360 env->env_size = env_size;
1361 env_ep[VM_ENV_DATA_INDEX_ENV] = (VALUE)env;
1362 return env;
1363}
1364
1365static inline void
1366VM_FORCE_WRITE(const VALUE *ptr, VALUE v)
1367{
1368 *((VALUE *)ptr) = v;
1369}
1370
1371static inline void
1372VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value)
1373{
1374 VM_ASSERT(RB_SPECIAL_CONST_P(special_const_value));
1375 VM_FORCE_WRITE(ptr, special_const_value);
1376}
1377
1378static inline void
1379VM_STACK_ENV_WRITE(const VALUE *ep, int index, VALUE v)
1380{
1381 VM_ASSERT(VM_ENV_FLAGS(ep, VM_ENV_FLAG_WB_REQUIRED) == 0);
1382 VM_FORCE_WRITE(&ep[index], v);
1383}
1384
1385const VALUE *rb_vm_ep_local_ep(const VALUE *ep);
1386const VALUE *rb_vm_proc_local_ep(VALUE proc);
1387void rb_vm_block_ep_update(VALUE obj, const struct rb_block *dst, const VALUE *ep);
1388void rb_vm_block_copy(VALUE obj, const struct rb_block *dst, const struct rb_block *src);
1389
1390 VALUE rb_vm_frame_block_handler(const rb_control_frame_t *cfp);
1391
1392#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1)
1393#define RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1)
1394
1395#define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
1396 ((void *)(ecfp) > (void *)(cfp))
1397
1398static inline const rb_control_frame_t *
1399RUBY_VM_END_CONTROL_FRAME(const rb_execution_context_t *ec)
1400{
1401 return (rb_control_frame_t *)(ec->vm_stack + ec->vm_stack_size);
1402}
1403
1404static inline int
1405RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
1406{
1407 return !RUBY_VM_VALID_CONTROL_FRAME_P(cfp, RUBY_VM_END_CONTROL_FRAME(ec));
1408}
1409
1410static inline int
1411VM_BH_ISEQ_BLOCK_P(VALUE block_handler)
1412{
1413 if ((block_handler & 0x03) == 0x01) {
1414#if VM_CHECK_MODE > 0
1415 struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1416 VM_ASSERT(imemo_type_p(captured->code.val, imemo_iseq));
1417#endif
1418 return 1;
1419 }
1420 else {
1421 return 0;
1422 }
1423}
1424
1425static inline VALUE
1426VM_BH_FROM_ISEQ_BLOCK(const struct rb_captured_block *captured)
1427{
1428 VALUE block_handler = VM_TAGGED_PTR_SET(captured, 0x01);
1429 VM_ASSERT(VM_BH_ISEQ_BLOCK_P(block_handler));
1430 return block_handler;
1431}
1432
1433static inline const struct rb_captured_block *
1434VM_BH_TO_ISEQ_BLOCK(VALUE block_handler)
1435{
1436 struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1437 VM_ASSERT(VM_BH_ISEQ_BLOCK_P(block_handler));
1438 return captured;
1439}
1440
1441static inline int
1442VM_BH_IFUNC_P(VALUE block_handler)
1443{
1444 if ((block_handler & 0x03) == 0x03) {
1445#if VM_CHECK_MODE > 0
1446 struct rb_captured_block *captured = (void *)(block_handler & ~0x03);
1447 VM_ASSERT(imemo_type_p(captured->code.val, imemo_ifunc));
1448#endif
1449 return 1;
1450 }
1451 else {
1452 return 0;
1453 }
1454}
1455
1456static inline VALUE
1457VM_BH_FROM_IFUNC_BLOCK(const struct rb_captured_block *captured)
1458{
1459 VALUE block_handler = VM_TAGGED_PTR_SET(captured, 0x03);
1460 VM_ASSERT(VM_BH_IFUNC_P(block_handler));
1461 return block_handler;
1462}
1463
1464static inline const struct rb_captured_block *
1465VM_BH_TO_IFUNC_BLOCK(VALUE block_handler)
1466{
1467 struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1468 VM_ASSERT(VM_BH_IFUNC_P(block_handler));
1469 return captured;
1470}
1471
1472static inline const struct rb_captured_block *
1473VM_BH_TO_CAPT_BLOCK(VALUE block_handler)
1474{
1475 struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1476 VM_ASSERT(VM_BH_IFUNC_P(block_handler) || VM_BH_ISEQ_BLOCK_P(block_handler));
1477 return captured;
1478}
1479
1480static inline enum rb_block_handler_type
1481vm_block_handler_type(VALUE block_handler)
1482{
1483 if (VM_BH_ISEQ_BLOCK_P(block_handler)) {
1484 return block_handler_type_iseq;
1485 }
1486 else if (VM_BH_IFUNC_P(block_handler)) {
1487 return block_handler_type_ifunc;
1488 }
1489 else if (SYMBOL_P(block_handler)) {
1490 return block_handler_type_symbol;
1491 }
1492 else {
1493 VM_ASSERT(rb_obj_is_proc(block_handler));
1494 return block_handler_type_proc;
1495 }
1496}
1497
1498static inline void
1499vm_block_handler_verify(MAYBE_UNUSED(VALUE block_handler))
1500{
1501 VM_ASSERT(block_handler == VM_BLOCK_HANDLER_NONE ||
1502 (vm_block_handler_type(block_handler), 1));
1503}
1504
1505static inline int
1506vm_cfp_forwarded_bh_p(const rb_control_frame_t *cfp, VALUE block_handler)
1507{
1508 return ((VALUE) cfp->block_code) == block_handler;
1509}
1510
1511static inline enum rb_block_type
1512vm_block_type(const struct rb_block *block)
1513{
1514#if VM_CHECK_MODE > 0
1515 switch (block->type) {
1516 case block_type_iseq:
1517 VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_iseq));
1518 break;
1519 case block_type_ifunc:
1520 VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_ifunc));
1521 break;
1522 case block_type_symbol:
1523 VM_ASSERT(SYMBOL_P(block->as.symbol));
1524 break;
1525 case block_type_proc:
1526 VM_ASSERT(rb_obj_is_proc(block->as.proc));
1527 break;
1528 }
1529#endif
1530 return block->type;
1531}
1532
1533static inline void
1534vm_block_type_set(const struct rb_block *block, enum rb_block_type type)
1535{
1536 struct rb_block *mb = (struct rb_block *)block;
1537 mb->type = type;
1538}
1539
1540static inline const struct rb_block *
1541vm_proc_block(VALUE procval)
1542{
1543 VM_ASSERT(rb_obj_is_proc(procval));
1544 return &((rb_proc_t *)RTYPEDDATA_DATA(procval))->block;
1545}
1546
1547static inline const rb_iseq_t *vm_block_iseq(const struct rb_block *block);
1548static inline const VALUE *vm_block_ep(const struct rb_block *block);
1549
1550static inline const rb_iseq_t *
1551vm_proc_iseq(VALUE procval)
1552{
1553 return vm_block_iseq(vm_proc_block(procval));
1554}
1555
1556static inline const VALUE *
1557vm_proc_ep(VALUE procval)
1558{
1559 return vm_block_ep(vm_proc_block(procval));
1560}
1561
1562static inline const rb_iseq_t *
1563vm_block_iseq(const struct rb_block *block)
1564{
1565 switch (vm_block_type(block)) {
1566 case block_type_iseq: return rb_iseq_check(block->as.captured.code.iseq);
1567 case block_type_proc: return vm_proc_iseq(block->as.proc);
1568 case block_type_ifunc:
1569 case block_type_symbol: return NULL;
1570 }
1571 VM_UNREACHABLE(vm_block_iseq);
1572 return NULL;
1573}
1574
1575static inline const VALUE *
1576vm_block_ep(const struct rb_block *block)
1577{
1578 switch (vm_block_type(block)) {
1579 case block_type_iseq:
1580 case block_type_ifunc: return block->as.captured.ep;
1581 case block_type_proc: return vm_proc_ep(block->as.proc);
1582 case block_type_symbol: return NULL;
1583 }
1584 VM_UNREACHABLE(vm_block_ep);
1585 return NULL;
1586}
1587
1588static inline VALUE
1589vm_block_self(const struct rb_block *block)
1590{
1591 switch (vm_block_type(block)) {
1592 case block_type_iseq:
1593 case block_type_ifunc:
1594 return block->as.captured.self;
1595 case block_type_proc:
1596 return vm_block_self(vm_proc_block(block->as.proc));
1597 case block_type_symbol:
1598 return Qundef;
1599 }
1600 VM_UNREACHABLE(vm_block_self);
1601 return Qundef;
1602}
1603
1604static inline VALUE
1605VM_BH_TO_SYMBOL(VALUE block_handler)
1606{
1607 VM_ASSERT(SYMBOL_P(block_handler));
1608 return block_handler;
1609}
1610
1611static inline VALUE
1612VM_BH_FROM_SYMBOL(VALUE symbol)
1613{
1614 VM_ASSERT(SYMBOL_P(symbol));
1615 return symbol;
1616}
1617
1618static inline VALUE
1619VM_BH_TO_PROC(VALUE block_handler)
1620{
1621 VM_ASSERT(rb_obj_is_proc(block_handler));
1622 return block_handler;
1623}
1624
1625static inline VALUE
1626VM_BH_FROM_PROC(VALUE procval)
1627{
1628 VM_ASSERT(rb_obj_is_proc(procval));
1629 return procval;
1630}
1631
1632/* VM related object allocate functions */
1633 VALUE rb_thread_alloc(VALUE klass);
1634 VALUE rb_binding_alloc(VALUE klass);
1635 VALUE rb_proc_alloc(VALUE klass);
1636 VALUE rb_proc_dup(VALUE self);
1637
1638/* for debug */
1639extern void rb_vmdebug_stack_dump_raw(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
1640extern void rb_vmdebug_debug_print_pre(const rb_execution_context_t *ec, const rb_control_frame_t *cfp, const VALUE *_pc);
1641extern void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const rb_control_frame_t *cfp
1642#if OPT_STACK_CACHING
1643 , VALUE reg_a, VALUE reg_b
1644#endif
1645);
1646
1647#define SDR() rb_vmdebug_stack_dump_raw(GET_EC(), GET_EC()->cfp)
1648#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp))
1649void rb_vm_bugreport(const void *);
1650 typedef void (*ruby_sighandler_t)(int);
1651 NORETURN(void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt, ...));
1652
1653/* functions about thread/vm execution */
1654RUBY_SYMBOL_EXPORT_BEGIN
1655 VALUE rb_iseq_eval(const rb_iseq_t *iseq);
1656 VALUE rb_iseq_eval_main(const rb_iseq_t *iseq);
1657 VALUE rb_iseq_path(const rb_iseq_t *iseq);
1658 VALUE rb_iseq_realpath(const rb_iseq_t *iseq);
1659RUBY_SYMBOL_EXPORT_END
1660
1661 VALUE rb_iseq_pathobj_new(VALUE path, VALUE realpath);
1662void rb_iseq_pathobj_set(const rb_iseq_t *iseq, VALUE path, VALUE realpath);
1663
1664int rb_ec_frame_method_id_and_class(const rb_execution_context_t *ec, ID *idp, ID *called_idp, VALUE *klassp);
1665void rb_ec_setup_exception(const rb_execution_context_t *ec, VALUE mesg, VALUE cause);
1666
1667 VALUE rb_vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, int argc, const VALUE *argv, int kw_splat, VALUE block_handler);
1668
1669 VALUE rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda);
1670static inline VALUE
1671rb_vm_make_proc(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass)
1672{
1673 return rb_vm_make_proc_lambda(ec, captured, klass, 0);
1674}
1675
1676static inline VALUE
1677rb_vm_make_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass)
1678{
1679 return rb_vm_make_proc_lambda(ec, captured, klass, 1);
1680}
1681
1682 VALUE rb_vm_make_binding(const rb_execution_context_t *ec, const rb_control_frame_t *src_cfp);
1683 VALUE rb_vm_env_local_variables(const rb_env_t *env);
1684const rb_env_t *rb_vm_env_prev_env(const rb_env_t *env);
1685const VALUE *rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const ID *dynvars);
1686void rb_vm_inc_const_missing_count(void);
1687 VALUE rb_vm_call_kw(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc,
1688 const VALUE *argv, const rb_callable_method_entry_t *me, int kw_splat);
1689 MJIT_STATIC void rb_vm_pop_frame(rb_execution_context_t *ec);
1690
1691 void rb_gvl_destroy(rb_global_vm_lock_t *gvl);
1692
1693void rb_thread_start_timer_thread(void);
1694void rb_thread_stop_timer_thread(void);
1695void rb_thread_reset_timer_thread(void);
1696 void rb_thread_wakeup_timer_thread(int);
1697
1698static inline void
1699rb_vm_living_threads_init(rb_vm_t *vm)
1700{
1701 list_head_init(&vm->waiting_fds);
1702 list_head_init(&vm->waiting_pids);
1703 list_head_init(&vm->workqueue);
1704 list_head_init(&vm->waiting_grps);
1705 list_head_init(&vm->ractor.set);
1706}
1707
1708 typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
1709 rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
1710 rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
1711int rb_vm_get_sourceline(const rb_control_frame_t *);
1712void rb_vm_stack_to_heap(rb_execution_context_t *ec);
1713void ruby_thread_init_stack(rb_thread_t *th);
1714int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp);
1715void rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp);
1716 MJIT_STATIC VALUE rb_vm_bh_to_procval(const rb_execution_context_t *ec, VALUE block_handler);
1717
1718void rb_vm_register_special_exception_str(enum ruby_special_exceptions sp, VALUE exception_class, VALUE mesg);
1719
1720#define rb_vm_register_special_exception(sp, e, m) \
1721 rb_vm_register_special_exception_str(sp, e, rb_usascii_str_new_static((m), (long)rb_strlen_lit(m)))
1722
1723void rb_gc_mark_machine_stack(const rb_execution_context_t *ec);
1724
1725void rb_vm_rewrite_cref(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr);
1726
1727 MJIT_STATIC const rb_callable_method_entry_t *rb_vm_frame_method_entry(const rb_control_frame_t *cfp);
1728
1729#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
1730
1731#define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) do { \
1732 STATIC_ASSERT(sizeof_sp, sizeof(*(sp)) == sizeof(VALUE)); \
1733 STATIC_ASSERT(sizeof_cfp, sizeof(*(cfp)) == sizeof(rb_control_frame_t)); \
1734 const struct rb_control_frame_struct *bound = (void *)&(sp)[(margin)]; \
1735 if (UNLIKELY((cfp) <= &bound[1])) { \
1736 vm_stackoverflow(); \
1737 } \
1738} while (0)
1739
1740#define CHECK_VM_STACK_OVERFLOW(cfp, margin) \
1741 CHECK_VM_STACK_OVERFLOW0((cfp), (cfp)->sp, (margin))
1742
1743 VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr);
1744
1745 rb_execution_context_t *rb_vm_main_ractor_ec(rb_vm_t *vm); // ractor.c
1746
1747/* for thread */
1748
1749#if RUBY_VM_THREAD_MODEL == 2
1750RUBY_SYMBOL_EXPORT_BEGIN
1751
1752 RUBY_EXTERN struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
1753 RUBY_EXTERN rb_vm_t *ruby_current_vm_ptr;
1754 RUBY_EXTERN rb_event_flag_t ruby_vm_event_flags;
1755 RUBY_EXTERN rb_event_flag_t ruby_vm_event_enabled_global_flags;
1756 RUBY_EXTERN unsigned int ruby_vm_event_local_num;
1757
1758RUBY_SYMBOL_EXPORT_END
1759
1760#define GET_VM() rb_current_vm()
1761#define GET_RACTOR() rb_current_ractor()
1762#define GET_THREAD() rb_current_thread()
1763#define GET_EC() rb_current_execution_context(true)
1764
1765static inline rb_thread_t *
1766rb_ec_thread_ptr(const rb_execution_context_t *ec)
1767{
1768 return ec->thread_ptr;
1769}
1770
1771static inline rb_ractor_t *
1772rb_ec_ractor_ptr(const rb_execution_context_t *ec)
1773{
1774 const rb_thread_t *th = rb_ec_thread_ptr(ec);
1775 if (th) {
1776 VM_ASSERT(th->ractor != NULL);
1777 return th->ractor;
1778 }
1779 else {
1780 return NULL;
1781 }
1782}
1783
1784static inline rb_vm_t *
1785rb_ec_vm_ptr(const rb_execution_context_t *ec)
1786{
1787 const rb_thread_t *th = rb_ec_thread_ptr(ec);
1788 if (th) {
1789 return th->vm;
1790 }
1791 else {
1792 return NULL;
1793 }
1794}
1795
1796static inline rb_execution_context_t *
1797rb_current_execution_context(bool expect_ec)
1798{
1799#ifdef RB_THREAD_LOCAL_SPECIFIER
1800 #if __APPLE__
1801 rb_execution_context_t *ec = rb_current_ec();
1802 #else
1803 rb_execution_context_t *ec = ruby_current_ec;
1804 #endif
1805#else
1806 rb_execution_context_t *ec = native_tls_get(ruby_current_ec_key);
1807#endif
1808 VM_ASSERT(!expect_ec || ec != NULL);
1809 return ec;
1810}
1811
1812static inline rb_thread_t *
1813rb_current_thread(void)
1814{
1815 const rb_execution_context_t *ec = GET_EC();
1816 return rb_ec_thread_ptr(ec);
1817}
1818
1819static inline rb_ractor_t *
1820rb_current_ractor(void)
1821{
1822 if (ruby_single_main_ractor) {
1823 return ruby_single_main_ractor;
1824 }
1825 else {
1826 const rb_execution_context_t *ec = GET_EC();
1827 return rb_ec_ractor_ptr(ec);
1828 }
1829}
1830
1831static inline rb_vm_t *
1832rb_current_vm(void)
1833{
1834#if 0 // TODO: reconsider the assertions
1835 VM_ASSERT(ruby_current_vm_ptr == NULL ||
1836 ruby_current_execution_context_ptr == NULL ||
1837 rb_ec_thread_ptr(GET_EC()) == NULL ||
1838 rb_ec_thread_ptr(GET_EC())->status == THREAD_KILLED ||
1839 rb_ec_vm_ptr(GET_EC()) == ruby_current_vm_ptr);
1840#endif
1841
1842 return ruby_current_vm_ptr;
1843}
1844
1845void rb_ec_vm_lock_rec_release(const rb_execution_context_t *ec,
1846 unsigned int recorded_lock_rec,
1847 unsigned int current_lock_rec);
1848
1849static inline unsigned int
1850rb_ec_vm_lock_rec(const rb_execution_context_t *ec)
1851{
1852 rb_vm_t *vm = rb_ec_vm_ptr(ec);
1853
1854 if (vm->ractor.sync.lock_owner != rb_ec_ractor_ptr(ec)) {
1855 return 0;
1856 }
1857 else {
1858 return vm->ractor.sync.lock_rec;
1859 }
1860}
1861
1862#else
1863#error "unsupported thread model"
1864#endif
1865
1866enum {
1867 TIMER_INTERRUPT_MASK = 0x01,
1868 PENDING_INTERRUPT_MASK = 0x02,
1869 POSTPONED_JOB_INTERRUPT_MASK = 0x04,
1870 TRAP_INTERRUPT_MASK = 0x08,
1871 TERMINATE_INTERRUPT_MASK = 0x10,
1872 VM_BARRIER_INTERRUPT_MASK = 0x20,
1873};
1874
1875#define RUBY_VM_SET_TIMER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TIMER_INTERRUPT_MASK)
1876#define RUBY_VM_SET_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, PENDING_INTERRUPT_MASK)
1877#define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
1878#define RUBY_VM_SET_TRAP_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TRAP_INTERRUPT_MASK)
1879#define RUBY_VM_SET_TERMINATE_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TERMINATE_INTERRUPT_MASK)
1880#define RUBY_VM_SET_VM_BARRIER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, VM_BARRIER_INTERRUPT_MASK)
1881#define RUBY_VM_INTERRUPTED(ec) ((ec)->interrupt_flag & ~(ec)->interrupt_mask & \
1882 (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
1883
1884static inline bool
1885RUBY_VM_INTERRUPTED_ANY(rb_execution_context_t *ec)
1886{
1887#if USE_VM_CLOCK
1888 uint32_t current_clock = rb_ec_vm_ptr(ec)->clock;
1889
1890 if (current_clock != ec->checked_clock) {
1891 ec->checked_clock = current_clock;
1892 RUBY_VM_SET_TIMER_INTERRUPT(ec);
1893 }
1894#endif
1895 return ec->interrupt_flag & ~(ec)->interrupt_mask;
1896}
1897
1898 VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
1899int rb_signal_buff_size(void);
1900int rb_signal_exec(rb_thread_t *th, int sig);
1901void rb_threadptr_check_signal(rb_thread_t *mth);
1902void rb_threadptr_signal_raise(rb_thread_t *th, int sig);
1903void rb_threadptr_signal_exit(rb_thread_t *th);
1904int rb_threadptr_execute_interrupts(rb_thread_t *, int);
1905void rb_threadptr_interrupt(rb_thread_t *th);
1906void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
1907void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
1908void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
1909 VALUE rb_ec_get_errinfo(const rb_execution_context_t *ec);
1910void rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo);
1911void rb_execution_context_update(const rb_execution_context_t *ec);
1912void rb_execution_context_mark(const rb_execution_context_t *ec);
1913void rb_fiber_close(rb_fiber_t *fib);
1914 void Init_native_thread(rb_thread_t *th);
1915int rb_vm_check_ints_blocking(rb_execution_context_t *ec);
1916
1917// vm_sync.h
1918void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond);
1919void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec);
1920
1921#define RUBY_VM_CHECK_INTS(ec) rb_vm_check_ints(ec)
1922static inline void
1923rb_vm_check_ints(rb_execution_context_t *ec)
1924{
1925 VM_ASSERT(ec == GET_EC());
1926 if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {
1927 rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);
1928 }
1929}
1930
1931/* tracer */
1932
1933 struct rb_trace_arg_struct {
1934 rb_event_flag_t event;
1935 rb_execution_context_t *ec;
1936 const rb_control_frame_t *cfp;
1937 VALUE self;
1938 ID id;
1939 ID called_id;
1940 VALUE klass;
1941 VALUE data;
1942
1943 int klass_solved;
1944
1945 /* calc from cfp */
1946 int lineno;
1947 VALUE path;
1948};
1949
1950void rb_hook_list_mark(rb_hook_list_t *hooks);
1951void rb_hook_list_free(rb_hook_list_t *hooks);
1952void rb_hook_list_connect_tracepoint(VALUE target, rb_hook_list_t *list, VALUE tpval, unsigned int target_line);
1953void rb_hook_list_remove_tracepoint(rb_hook_list_t *list, VALUE tpval);
1954
1955void rb_exec_event_hooks(struct rb_trace_arg_struct *trace_arg, rb_hook_list_t *hooks, int pop_p);
1956
1957#define EXEC_EVENT_HOOK_ORIG(ec_, hooks_, flag_, self_, id_, called_id_, klass_, data_, pop_p_) do { \
1958 const rb_event_flag_t flag_arg_ = (flag_); \
1959 rb_hook_list_t *hooks_arg_ = (hooks_); \
1960 if (UNLIKELY((hooks_arg_)->events & (flag_arg_))) { \
1961 /* defer evaluating the other arguments */ \
1962 rb_exec_event_hook_orig(ec_, hooks_arg_, flag_arg_, self_, id_, called_id_, klass_, data_, pop_p_); \
1963 } \
1964} while (0)
1965
1966static inline void
1967rb_exec_event_hook_orig(rb_execution_context_t *ec, rb_hook_list_t *hooks, rb_event_flag_t flag,
1968 VALUE self, ID id, ID called_id, VALUE klass, VALUE data, int pop_p)
1969{
1970 struct rb_trace_arg_struct trace_arg;
1971
1972 VM_ASSERT((hooks->events & flag) != 0);
1973
1974 trace_arg.event = flag;
1975 trace_arg.ec = ec;
1976 trace_arg.cfp = ec->cfp;
1977 trace_arg.self = self;
1978 trace_arg.id = id;
1979 trace_arg.called_id = called_id;
1980 trace_arg.klass = klass;
1981 trace_arg.data = data;
1982 trace_arg.path = Qundef;
1983 trace_arg.klass_solved = 0;
1984
1985 rb_exec_event_hooks(&trace_arg, hooks, pop_p);
1986}
1987
1988 struct rb_ractor_pub {
1989 VALUE self;
1990 uint32_t id;
1991 rb_hook_list_t hooks;
1992};
1993
1994static inline rb_hook_list_t *
1995rb_ec_ractor_hooks(const rb_execution_context_t *ec)
1996{
1997 struct rb_ractor_pub *cr_pub = (struct rb_ractor_pub *)rb_ec_ractor_ptr(ec);
1998 return &cr_pub->hooks;
1999}
2000
2001#define EXEC_EVENT_HOOK(ec_, flag_, self_, id_, called_id_, klass_, data_) \
2002 EXEC_EVENT_HOOK_ORIG(ec_, rb_ec_ractor_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 0)
2003
2004#define EXEC_EVENT_HOOK_AND_POP_FRAME(ec_, flag_, self_, id_, called_id_, klass_, data_) \
2005 EXEC_EVENT_HOOK_ORIG(ec_, rb_ec_ractor_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 1)
2006
2007static inline void
2008rb_exec_event_hook_script_compiled(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE eval_script)
2009{
2010 EXEC_EVENT_HOOK(ec, RUBY_EVENT_SCRIPT_COMPILED, ec->cfp->self, 0, 0, 0,
2011 NIL_P(eval_script) ? (VALUE)iseq :
2012 rb_ary_new_from_args(2, eval_script, (VALUE)iseq));
2013}
2014
2015void rb_vm_trap_exit(rb_vm_t *vm);
2016
2017RUBY_SYMBOL_EXPORT_BEGIN
2018
2019int rb_thread_check_trap_pending(void);
2020
2021/* #define RUBY_EVENT_RESERVED_FOR_INTERNAL_USE 0x030000 */ /* from vm_core.h */
2022#define RUBY_EVENT_COVERAGE_LINE 0x010000
2023#define RUBY_EVENT_COVERAGE_BRANCH 0x020000
2024
2025extern VALUE rb_get_coverages(void);
2026extern void rb_set_coverages(VALUE, int, VALUE);
2027extern void rb_clear_coverages(void);
2028extern void rb_reset_coverages(void);
2029
2030void rb_postponed_job_flush(rb_vm_t *vm);
2031
2032// ractor.c
2033 RUBY_EXTERN VALUE rb_eRactorUnsafeError;
2034 RUBY_EXTERN VALUE rb_eRactorIsolationError;
2035
2036RUBY_SYMBOL_EXPORT_END
2037
2038#endif /* RUBY_VM_CORE_H */
offsetof
#define offsetof(p_type, field)
Definition: addrinfo.h:186
NORETURN
#define NORETURN(x)
Definition: attributes.h:152
RUBY_ALIGNAS
#define RUBY_ALIGNAS
Definition: stdalign.h:27
ptr
struct RIMemo * ptr
Definition: debug.c:88
MJIT_STATIC
#define MJIT_STATIC
Definition: dllexport.h:71
RUBY_EXTERN
#define RUBY_EXTERN
Definition: dllexport.h:36
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
RUBY_EVENT_SCRIPT_COMPILED
#define RUBY_EVENT_SCRIPT_COMPILED
Definition: event.h:46
rb_event_flag_t
uint32_t rb_event_flag_t
Definition: event.h:66
MAYBE_UNUSED
#define MAYBE_UNUSED
Definition: ffi_common.h:30
UNLIKELY
#define UNLIKELY(x)
Definition: ffi_common.h:126
rb_imemo_new
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
Definition: gc.c:2412
rb_exc_set_backtrace
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt)
Definition: error.c:1446
rb_bug
void rb_bug(const char *fmt,...)
Definition: error.c:768
rb_check_typeddata
void * rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
Definition: error.c:1024
rb_bug_for_fatal_signal
void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt,...)
Definition: error.c:778
id.h
imemo_ifunc
@ imemo_ifunc
iterator function
Definition: imemo.h:39
imemo_env
@ imemo_env
Definition: imemo.h:35
imemo_iseq
@ imemo_iseq
Definition: imemo.h:42
config.h
Thin wrapper to ruby/config.h.
rb_obj_is_proc
VALUE rb_obj_is_proc(VALUE)
Definition: proc.c:152
rb_unblock_function_t
void rb_unblock_function_t(void *)
Definition: thread.h:59
array.h
Internal header for Array.
STATIC_ASSERT
#define STATIC_ASSERT
Definition: static_assert.h:14
vm.h
Internal header for RubyVM.
method_missing_reason
method_missing_reason
Definition: vm.h:32
internal.h
rb_ary_new_from_args
#define rb_ary_new_from_args(...)
Definition: internal.h:65
size
voidpf void uLong size
Definition: ioapi.h:138
int
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
buf
voidpf void * buf
Definition: ioapi.h:138
rb_block_call_func
VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
Definition: iterator.h:33
method.h
VM_METHOD_TYPE_ISEQ
@ VM_METHOD_TYPE_ISEQ
Ruby method.
Definition: method.h:110
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56
id
const int id
Definition: nkf.c:209
name
const char * name
Definition: nkf.c:208
node.h
RARRAY_AREF
#define RARRAY_AREF(a, i)
Definition: psych_emitter.c:7
NULL
#define NULL
Definition: regenc.h:69
RTYPEDDATA_DATA
#define RTYPEDDATA_DATA(v)
Definition: rtypeddata.h:47
ruby.h
argc
int argc
Definition: ruby.c:240
argv
char ** argv
Definition: ruby.c:241
ruby_assert.h
ruby_atomic.h
serial.h
Internal header for rb_serial_t.
rb_serial_t
unsigned LONG_LONG rb_serial_t
Definition: serial.h:19
uint32_t
unsigned int uint32_t
Definition: sha2.h:101
uint8_t
unsigned char uint8_t
Definition: sha2.h:100
Qundef
#define Qundef
Definition: special_consts.h:53
Qfalse
#define Qfalse
Definition: special_consts.h:50
NIL_P
#define NIL_P
Definition: special_consts.h:46
FIXNUM_P
#define FIXNUM_P
Definition: special_consts.h:44
st.h
stdarg.h
Defines old _.
stdbool.h
C99 shim for <stdbool.h>
iseq_compile_data
Definition: iseq.h:85
iseq_inline_constant_cache_entry
Definition: vm_core.h:222
iseq_inline_constant_cache_entry::flags
VALUE flags
Definition: vm_core.h:223
iseq_inline_constant_cache_entry::ic_serial
rb_serial_t ic_serial
Definition: vm_core.h:227
iseq_inline_constant_cache_entry::value
VALUE value
Definition: vm_core.h:225
iseq_inline_constant_cache_entry::ic_cref
const rb_cref_t * ic_cref
Definition: vm_core.h:226
iseq_inline_constant_cache
Definition: vm_core.h:231
iseq_inline_constant_cache::entry
struct iseq_inline_constant_cache_entry * entry
Definition: vm_core.h:232
iseq_inline_iv_cache_entry
Definition: vm_core.h:235
iseq_inline_iv_cache_entry::entry
struct rb_iv_index_tbl_entry * entry
Definition: vm_core.h:236
iseq_insn_info_entry
Definition: iseq.h:213
iseq_link_anchor
Definition: compile.c:65
native_thread_data_struct
Definition: thread_pthread.h:20
rb_ast_body_struct
Definition: node.h:398
rb_at_exit_list
Definition: vm_core.h:543
rb_at_exit_list::next
struct rb_at_exit_list * next
Definition: vm_core.h:545
rb_at_exit_list::func
rb_vm_at_exit_func * func
Definition: vm_core.h:544
rb_binding_t
Definition: vm_core.h:1112
rb_binding_t::pathobj
const VALUE pathobj
Definition: vm_core.h:1114
rb_binding_t::first_lineno
unsigned short first_lineno
Definition: vm_core.h:1115
rb_block
Definition: vm_core.h:760
rb_block::as
union rb_block::@199 as
rb_block::captured
struct rb_captured_block captured
Definition: vm_core.h:762
rb_block::symbol
VALUE symbol
Definition: vm_core.h:763
rb_block::type
enum rb_block_type type
Definition: vm_core.h:766
rb_block::proc
VALUE proc
Definition: vm_core.h:764
rb_builtin_function
Definition: builtin.h:6
rb_call_data
Definition: vm_callinfo.h:426
rb_callable_method_entry_struct
Definition: method.h:62
rb_callcache
Definition: vm_callinfo.h:274
rb_callinfo
Definition: vm_callinfo.h:61
rb_calling_info
Definition: vm_core.h:248
rb_calling_info::argc
int argc
Definition: vm_core.h:253
rb_calling_info::cc
const struct rb_callcache * cc
Definition: vm_core.h:250
rb_calling_info::recv
VALUE recv
Definition: vm_core.h:252
rb_calling_info::kw_splat
int kw_splat
Definition: vm_core.h:254
rb_calling_info::ci
const struct rb_callinfo * ci
Definition: vm_core.h:249
rb_calling_info::block_handler
VALUE block_handler
Definition: vm_core.h:251
rb_captured_block
Definition: vm_core.h:736
rb_captured_block::ifunc
const struct vm_ifunc * ifunc
Definition: vm_core.h:741
rb_captured_block::ep
const VALUE * ep
Definition: vm_core.h:738
rb_captured_block::iseq
const rb_iseq_t * iseq
Definition: vm_core.h:740
rb_captured_block::code
union rb_captured_block::@198 code
rb_captured_block::self
VALUE self
Definition: vm_core.h:737
rb_captured_block::val
VALUE val
Definition: vm_core.h:742
rb_code_location_struct
Definition: node.h:135
rb_compile_option_struct
Definition: iseq.h:199
rb_control_frame_struct
Definition: vm_core.h:769
rb_control_frame_struct::sp
VALUE * sp
Definition: vm_core.h:771
rb_control_frame_struct::__bp__
VALUE * __bp__
Definition: vm_core.h:776
rb_control_frame_struct::ep
const VALUE * ep
Definition: vm_core.h:774
rb_control_frame_struct::block_code
const void * block_code
Definition: vm_core.h:775
rb_control_frame_struct::self
VALUE self
Definition: vm_core.h:773
rb_control_frame_struct::iseq
const rb_iseq_t * iseq
Definition: vm_core.h:772
rb_control_frame_struct::pc
const VALUE * pc
Definition: vm_core.h:770
rb_cref_struct
CREF (Class REFerence)
Definition: method.h:44
rb_data_type_struct
Definition: rtypeddata.h:70
rb_ensure_entry
Definition: vm_core.h:833
rb_ensure_entry::e_proc
VALUE(* e_proc)(VALUE)
Definition: vm_core.h:835
rb_ensure_entry::marker
VALUE marker
Definition: vm_core.h:834
rb_ensure_entry::data2
VALUE data2
Definition: vm_core.h:836
rb_ensure_list
Definition: vm_core.h:839
rb_ensure_list::next
struct rb_ensure_list * next
Definition: vm_core.h:840
rb_ensure_list::entry
struct rb_ensure_entry entry
Definition: vm_core.h:841
rb_env_t
Definition: vm_core.h:1099
rb_env_t::env
const VALUE * env
Definition: vm_core.h:1103
rb_env_t::iseq
rb_iseq_t * iseq
Definition: vm_core.h:1101
rb_env_t::env_size
unsigned int env_size
Definition: vm_core.h:1104
rb_env_t::ep
const VALUE * ep
Definition: vm_core.h:1102
rb_env_t::flags
VALUE flags
Definition: vm_core.h:1100
rb_event_hook_struct
Definition: vm_trace.c:38
rb_execution_context_struct
Definition: vm_core.h:854
rb_execution_context_struct::raised_flag
uint8_t raised_flag
Definition: vm_core.h:892
rb_execution_context_struct::root_svar
VALUE root_svar
Definition: vm_core.h:880
rb_execution_context_struct::vm_stack
VALUE * vm_stack
Definition: vm_core.h:856
rb_execution_context_struct::errinfo
VALUE errinfo
Definition: vm_core.h:889
rb_execution_context_struct::local_storage_recursive_hash_for_trace
VALUE local_storage_recursive_hash_for_trace
Definition: vm_core.h:876
rb_execution_context_struct::machine
struct rb_execution_context_struct::@200 machine
rb_execution_context_struct::local_storage
struct rb_id_table * local_storage
Definition: vm_core.h:874
rb_execution_context_struct::BITFIELD
BITFIELD(enum method_missing_reason, method_missing_reason, 8)
rb_execution_context_struct::stack_end
VALUE * stack_end
Definition: vm_core.h:902
rb_execution_context_struct::vm_stack_size
size_t vm_stack_size
Definition: vm_core.h:857
rb_execution_context_struct::private_const_reference
VALUE private_const_reference
Definition: vm_core.h:897
rb_execution_context_struct::ensure_list
rb_ensure_list_t * ensure_list
Definition: vm_core.h:883
rb_execution_context_struct::protect_tag
struct rb_vm_protect_tag * protect_tag
Definition: vm_core.h:861
rb_execution_context_struct::passed_block_handler
VALUE passed_block_handler
Definition: vm_core.h:890
rb_execution_context_struct::interrupt_flag
rb_atomic_t interrupt_flag
Definition: vm_core.h:864
rb_execution_context_struct::interrupt_mask
rb_atomic_t interrupt_mask
Definition: vm_core.h:865
rb_execution_context_struct::thread_ptr
struct rb_thread_struct * thread_ptr
Definition: vm_core.h:871
rb_execution_context_struct::cfp
rb_control_frame_t * cfp
Definition: vm_core.h:858
rb_execution_context_struct::fiber_ptr
rb_fiber_t * fiber_ptr
Definition: vm_core.h:870
rb_execution_context_struct::local_storage_recursive_hash
VALUE local_storage_recursive_hash
Definition: vm_core.h:875
rb_execution_context_struct::stack_maxsize
size_t stack_maxsize
Definition: vm_core.h:903
rb_execution_context_struct::stack_start
VALUE * stack_start
Definition: vm_core.h:901
rb_execution_context_struct::tag
struct rb_vm_tag * tag
Definition: vm_core.h:860
rb_execution_context_struct::root_lep
const VALUE * root_lep
Definition: vm_core.h:879
rb_execution_context_struct::trace_arg
struct rb_trace_arg_struct * trace_arg
Definition: vm_core.h:886
rb_ext_config
Definition: vm_core.h:929
rb_ext_config::ractor_safe
bool ractor_safe
Definition: vm_core.h:930
rb_fiber_struct
Definition: cont.c:234
rb_global_vm_lock_struct
Definition: thread_pthread.h:45
rb_hook_list_struct
Definition: vm_core.h:553
rb_hook_list_struct::need_clean
unsigned int need_clean
Definition: vm_core.h:556
rb_hook_list_struct::running
unsigned int running
Definition: vm_core.h:557
rb_hook_list_struct::events
rb_event_flag_t events
Definition: vm_core.h:555
rb_hook_list_struct::hooks
struct rb_event_hook_struct * hooks
Definition: vm_core.h:554
rb_id_table
Definition: id_table.c:41
rb_iseq_constant_body::iseq_insn_info
Definition: vm_core.h:396
rb_iseq_constant_body::iseq_insn_info::size
unsigned int size
Definition: vm_core.h:399
rb_iseq_constant_body::iseq_insn_info::body
const struct iseq_insn_info_entry * body
Definition: vm_core.h:397
rb_iseq_constant_body::iseq_insn_info::positions
unsigned int * positions
Definition: vm_core.h:398
rb_iseq_constant_body
Definition: vm_core.h:305
rb_iseq_constant_body::catch_table
struct iseq_catch_table * catch_table
Definition: vm_core.h:408
rb_iseq_constant_body::ruby2_keywords
unsigned int ruby2_keywords
Definition: vm_core.h:356
rb_iseq_constant_body::ambiguous_param0
unsigned int ambiguous_param0
Definition: vm_core.h:354
rb_iseq_constant_body::post_start
int post_start
Definition: vm_core.h:364
rb_iseq_constant_body::flip_count
rb_snum_t flip_count
Definition: vm_core.h:418
rb_iseq_constant_body::opt_table
const VALUE * opt_table
Definition: vm_core.h:368
rb_iseq_constant_body::insns_info
struct rb_iseq_constant_body::iseq_insn_info insns_info
rb_iseq_constant_body::type
enum rb_iseq_constant_body::iseq_type type
rb_iseq_constant_body::size
unsigned int size
Definition: vm_core.h:359
rb_iseq_constant_body::ci_size
unsigned int ci_size
Definition: vm_core.h:426
rb_iseq_constant_body::outer_variables
struct rb_id_table * outer_variables
Definition: vm_core.h:431
rb_iseq_constant_body::catch_except_p
char catch_except_p
Definition: vm_core.h:429
rb_iseq_constant_body::keyword
const struct rb_iseq_constant_body::@188::rb_iseq_param_keyword * keyword
rb_iseq_constant_body::local_iseq
struct rb_iseq_struct * local_iseq
Definition: vm_core.h:412
rb_iseq_constant_body::iseq_type
iseq_type
Definition: vm_core.h:306
rb_iseq_constant_body::ISEQ_TYPE_TOP
@ ISEQ_TYPE_TOP
Definition: vm_core.h:307
rb_iseq_constant_body::ISEQ_TYPE_ENSURE
@ ISEQ_TYPE_ENSURE
Definition: vm_core.h:312
rb_iseq_constant_body::ISEQ_TYPE_BLOCK
@ ISEQ_TYPE_BLOCK
Definition: vm_core.h:309
rb_iseq_constant_body::ISEQ_TYPE_EVAL
@ ISEQ_TYPE_EVAL
Definition: vm_core.h:313
rb_iseq_constant_body::ISEQ_TYPE_PLAIN
@ ISEQ_TYPE_PLAIN
Definition: vm_core.h:315
rb_iseq_constant_body::ISEQ_TYPE_CLASS
@ ISEQ_TYPE_CLASS
Definition: vm_core.h:310
rb_iseq_constant_body::ISEQ_TYPE_METHOD
@ ISEQ_TYPE_METHOD
Definition: vm_core.h:308
rb_iseq_constant_body::ISEQ_TYPE_RESCUE
@ ISEQ_TYPE_RESCUE
Definition: vm_core.h:311
rb_iseq_constant_body::ISEQ_TYPE_MAIN
@ ISEQ_TYPE_MAIN
Definition: vm_core.h:314
rb_iseq_constant_body::block_start
int block_start
Definition: vm_core.h:366
rb_iseq_constant_body::has_block
unsigned int has_block
Definition: vm_core.h:352
rb_iseq_constant_body::local_table_size
unsigned int local_table_size
Definition: vm_core.h:424
rb_iseq_constant_body::has_kwrest
unsigned int has_kwrest
Definition: vm_core.h:351
rb_iseq_constant_body::builtin_inline_p
bool builtin_inline_p
Definition: vm_core.h:430
rb_iseq_constant_body::has_post
unsigned int has_post
Definition: vm_core.h:349
rb_iseq_constant_body::opt_num
int opt_num
Definition: vm_core.h:362
rb_iseq_constant_body::stack_max
unsigned int stack_max
Definition: vm_core.h:427
rb_iseq_constant_body::flags
struct rb_iseq_constant_body::@188::@190 flags
rb_iseq_constant_body::original_iseq
VALUE * original_iseq
Definition: vm_core.h:421
rb_iseq_constant_body::lead_num
int lead_num
Definition: vm_core.h:361
rb_iseq_constant_body::is_entries
union iseq_inline_storage_entry * is_entries
Definition: vm_core.h:414
rb_iseq_constant_body::bits_start
int bits_start
Definition: vm_core.h:386
rb_iseq_constant_body::iseq_encoded
VALUE * iseq_encoded
Definition: vm_core.h:319
rb_iseq_constant_body::iseq_size
unsigned int iseq_size
Definition: vm_core.h:318
rb_iseq_constant_body::location
rb_iseq_location_t location
Definition: vm_core.h:393
rb_iseq_constant_body::variable
struct rb_iseq_constant_body::@189 variable
rb_iseq_constant_body::default_values
VALUE * default_values
Definition: vm_core.h:389
rb_iseq_constant_body::coverage
VALUE coverage
Definition: vm_core.h:419
rb_iseq_constant_body::accepts_no_kwarg
unsigned int accepts_no_kwarg
Definition: vm_core.h:355
rb_iseq_constant_body::num
int num
Definition: vm_core.h:384
rb_iseq_constant_body::is_size
unsigned int is_size
Definition: vm_core.h:425
rb_iseq_constant_body::rest_start
int rest_start
Definition: vm_core.h:363
rb_iseq_constant_body::has_kw
unsigned int has_kw
Definition: vm_core.h:350
rb_iseq_constant_body::post_num
int post_num
Definition: vm_core.h:365
rb_iseq_constant_body::pc2branchindex
VALUE pc2branchindex
Definition: vm_core.h:420
rb_iseq_constant_body::param
struct rb_iseq_constant_body::@188 param
parameter information
rb_iseq_constant_body::has_opt
unsigned int has_opt
Definition: vm_core.h:347
rb_iseq_constant_body::has_lead
unsigned int has_lead
Definition: vm_core.h:346
rb_iseq_constant_body::required_num
int required_num
Definition: vm_core.h:385
rb_iseq_constant_body::parent_iseq
const struct rb_iseq_struct * parent_iseq
Definition: vm_core.h:411
rb_iseq_constant_body::table
const ID * table
Definition: vm_core.h:388
rb_iseq_constant_body::call_data
struct rb_call_data * call_data
Definition: vm_core.h:415
rb_iseq_constant_body::local_table
const ID * local_table
Definition: vm_core.h:405
rb_iseq_constant_body::has_rest
unsigned int has_rest
Definition: vm_core.h:348
rb_iseq_location_struct
Definition: vm_core.h:266
rb_iseq_location_struct::label
VALUE label
Definition: vm_core.h:269
rb_iseq_location_struct::first_lineno
VALUE first_lineno
Definition: vm_core.h:270
rb_iseq_location_struct::code_location
rb_code_location_t code_location
Definition: vm_core.h:272
rb_iseq_location_struct::pathobj
VALUE pathobj
Definition: vm_core.h:267
rb_iseq_location_struct::base_label
VALUE base_label
Definition: vm_core.h:268
rb_iseq_location_struct::node_id
int node_id
Definition: vm_core.h:271
rb_iseq_new_with_callback_callback_func
Definition: vm_core.h:1055
rb_iseq_new_with_callback_callback_func::flags
VALUE flags
Definition: vm_core.h:1056
rb_iseq_new_with_callback_callback_func::func
void(* func)(rb_iseq_t *, struct iseq_link_anchor *, const void *)
Definition: vm_core.h:1058
rb_iseq_new_with_callback_callback_func::data
const void * data
Definition: vm_core.h:1059
rb_iseq_new_with_callback_callback_func::reserved
VALUE reserved
Definition: vm_core.h:1057
rb_iseq_struct
Definition: vm_core.h:444
rb_iseq_struct::index
int index
Definition: vm_core.h:455
rb_iseq_struct::body
struct rb_iseq_constant_body * body
Definition: vm_core.h:448
rb_iseq_struct::local_hooks
struct rb_hook_list_struct * local_hooks
Definition: vm_core.h:459
rb_iseq_struct::wrapper
VALUE wrapper
Definition: vm_core.h:446
rb_iseq_struct::compile_data
struct iseq_compile_data * compile_data
Definition: vm_core.h:451
rb_iseq_struct::aux
union rb_iseq_struct::@191 aux
rb_iseq_struct::global_trace_events
rb_event_flag_t global_trace_events
Definition: vm_core.h:460
rb_iseq_struct::flags
VALUE flags
Definition: vm_core.h:445
rb_iseq_struct::obj
VALUE obj
Definition: vm_core.h:454
rb_iv_index_tbl_entry
Definition: class.h:28
rb_method_definition_struct
Definition: method.h:172
rb_mjit_unit
Definition: mjit_worker.c:154
rb_mutex_struct
Definition: thread_sync.c:9
rb_objspace
Definition: gc.c:666
rb_postponed_job_struct
Definition: vm_trace.c:1542
rb_proc_t
Definition: vm_core.h:1086
rb_proc_t::is_isolated
unsigned int is_isolated
Definition: vm_core.h:1090
rb_proc_t::is_from_method
unsigned int is_from_method
Definition: vm_core.h:1088
rb_proc_t::is_lambda
unsigned int is_lambda
Definition: vm_core.h:1089
rb_ractor_pub
Definition: vm_core.h:1988
rb_ractor_pub::id
uint32_t id
Definition: vm_core.h:1990
rb_ractor_pub::self
VALUE self
Definition: vm_core.h:1989
rb_ractor_pub::hooks
rb_hook_list_t hooks
Definition: vm_core.h:1991
rb_ractor_struct
Definition: ractor_core.h:82
rb_thread_cond_struct
Definition: thread_win32.h:24
rb_thread_struct
Definition: vm_core.h:935
rb_thread_struct::last_status
VALUE last_status
Definition: vm_core.h:943
rb_thread_struct::to_kill
unsigned int to_kill
Definition: vm_core.h:959
rb_thread_struct::root_jmpbuf
rb_jmpbuf_t root_jmpbuf
Definition: vm_core.h:1013
rb_thread_struct::ec
rb_execution_context_t * ec
Definition: vm_core.h:941
rb_thread_struct::kw_splat
int kw_splat
Definition: vm_core.h:993
rb_thread_struct::value
VALUE value
Definition: vm_core.h:970
rb_thread_struct::unblock
struct rb_unblock_callback unblock
Definition: vm_core.h:983
rb_thread_struct::native_thread_data
native_thread_data_t native_thread_data
Definition: vm_core.h:966
rb_thread_struct::pending_interrupt_queue_checked
unsigned int pending_interrupt_queue_checked
Definition: vm_core.h:962
rb_thread_struct::stat_insn_usage
VALUE stat_insn_usage
Definition: vm_core.h:1009
rb_thread_struct::vm
rb_vm_t * vm
Definition: vm_core.h:939
rb_thread_struct::thgroup
VALUE thgroup
Definition: vm_core.h:969
rb_thread_struct::proc
VALUE proc
Definition: vm_core.h:991
rb_thread_struct::ractor
rb_ractor_t * ractor
Definition: vm_core.h:938
rb_thread_struct::top_wrapper
VALUE top_wrapper
Definition: vm_core.h:950
rb_thread_struct::self
VALUE self
Definition: vm_core.h:937
rb_thread_struct::priority
int8_t priority
Definition: vm_core.h:963
rb_thread_struct::abort_on_exception
unsigned int abort_on_exception
Definition: vm_core.h:960
rb_thread_struct::thread_id
rb_nativethread_id_t thread_id
Definition: vm_core.h:953
rb_thread_struct::scheduler
VALUE scheduler
Definition: vm_core.h:1015
rb_thread_struct::args
VALUE args
Definition: vm_core.h:992
rb_thread_struct::name
VALUE name
Definition: vm_core.h:1019
rb_thread_struct::invoke_type
enum rb_thread_struct::thread_invoke_type invoke_type
rb_thread_struct::pending_interrupt_mask_stack
VALUE pending_interrupt_mask_stack
Definition: vm_core.h:979
rb_thread_struct::interrupt_lock
rb_nativethread_lock_t interrupt_lock
Definition: vm_core.h:982
rb_thread_struct::report_on_exception
unsigned int report_on_exception
Definition: vm_core.h:961
rb_thread_struct::lt_node
struct list_node lt_node
Definition: vm_core.h:936
rb_thread_struct::blocking_region_buffer
void * blocking_region_buffer
Definition: vm_core.h:967
rb_thread_struct::pending_interrupt_queue
VALUE pending_interrupt_queue
Definition: vm_core.h:978
rb_thread_struct::locking_mutex
VALUE locking_mutex
Definition: vm_core.h:984
rb_thread_struct::top_self
VALUE top_self
Definition: vm_core.h:949
rb_thread_struct::invoke_arg
union rb_thread_struct::@201 invoke_arg
rb_thread_struct::BITFIELD
BITFIELD(enum rb_thread_status, status, 2)
rb_thread_struct::thread_invoke_type
thread_invoke_type
Definition: vm_core.h:1001
rb_thread_struct::thread_invoke_type_proc
@ thread_invoke_type_proc
Definition: vm_core.h:1003
rb_thread_struct::thread_invoke_type_func
@ thread_invoke_type_func
Definition: vm_core.h:1005
rb_thread_struct::thread_invoke_type_ractor_proc
@ thread_invoke_type_ractor_proc
Definition: vm_core.h:1004
rb_thread_struct::thread_invoke_type_none
@ thread_invoke_type_none
Definition: vm_core.h:1002
rb_thread_struct::ext_config
struct rb_ext_config ext_config
Definition: vm_core.h:1021
rb_thread_struct::running_time_us
uint32_t running_time_us
Definition: vm_core.h:964
rb_thread_struct::keeping_mutexes
struct rb_mutex_struct * keeping_mutexes
Definition: vm_core.h:985
rb_thread_struct::join_list
struct rb_waiting_list * join_list
Definition: vm_core.h:987
rb_thread_struct::blocking
unsigned blocking
Definition: vm_core.h:1016
rb_thread_struct::arg
void * arg
Definition: vm_core.h:997
rb_thread_struct::calling
struct rb_calling_info * calling
Definition: vm_core.h:946
rb_thread_struct::root_fiber
rb_fiber_t * root_fiber
Definition: vm_core.h:1012
rb_trace_arg_struct
Definition: vm_core.h:1933
rb_trace_arg_struct::id
ID id
Definition: vm_core.h:1938
rb_trace_arg_struct::event
rb_event_flag_t event
Definition: vm_core.h:1934
rb_trace_arg_struct::ec
rb_execution_context_t * ec
Definition: vm_core.h:1935
rb_trace_arg_struct::klass
VALUE klass
Definition: vm_core.h:1940
rb_trace_arg_struct::self
VALUE self
Definition: vm_core.h:1937
rb_trace_arg_struct::klass_solved
int klass_solved
Definition: vm_core.h:1943
rb_trace_arg_struct::cfp
const rb_control_frame_t * cfp
Definition: vm_core.h:1936
rb_trace_arg_struct::lineno
int lineno
Definition: vm_core.h:1946
rb_trace_arg_struct::data
VALUE data
Definition: vm_core.h:1941
rb_trace_arg_struct::called_id
ID called_id
Definition: vm_core.h:1939
rb_trace_arg_struct::path
VALUE path
Definition: vm_core.h:1947
rb_unblock_callback
Definition: vm_core.h:826
rb_unblock_callback::arg
void * arg
Definition: vm_core.h:828
rb_unblock_callback::func
rb_unblock_function_t * func
Definition: vm_core.h:827
rb_vm_protect_tag
Definition: vm_core.h:822
rb_vm_protect_tag::prev
struct rb_vm_protect_tag * prev
Definition: vm_core.h:823
rb_vm_struct
Definition: vm_core.h:564
rb_vm_struct::redefined_flag
short redefined_flag[BOP_LAST_]
Definition: vm_core.h:678
rb_vm_struct::load_path_check_cache
VALUE load_path_check_cache
Definition: vm_core.h:618
rb_vm_struct::set
struct list_head set
Definition: vm_core.h:568
rb_vm_struct::barrier_waiting
bool barrier_waiting
Definition: vm_core.h:582
rb_vm_struct::sync
struct rb_vm_struct::@194::@197 sync
rb_vm_struct::progname
VALUE progname
Definition: vm_core.h:643
rb_vm_struct::barrier_cond
rb_nativethread_cond_t barrier_cond
Definition: vm_core.h:584
rb_vm_struct::trap_list
struct rb_vm_struct::@195 trap_list
rb_vm_struct::defined_module_hash
st_table * defined_module_hash
Definition: vm_core.h:647
rb_vm_struct::barrier_cnt
unsigned int barrier_cnt
Definition: vm_core.h:583
rb_vm_struct::thread_ignore_deadlock
unsigned int thread_ignore_deadlock
Definition: vm_core.h:608
rb_vm_struct::builtin_inline_index
int builtin_inline_index
Definition: vm_core.h:657
rb_vm_struct::coverages
VALUE coverages
Definition: vm_core.h:644
rb_vm_struct::builtin_function_table
const struct rb_builtin_function * builtin_function_table
Definition: vm_core.h:656
rb_vm_struct::ensure_rollback_table
struct st_table * ensure_rollback_table
Definition: vm_core.h:631
rb_vm_struct::waitpid_lock
rb_nativethread_lock_t waitpid_lock
Definition: vm_core.h:597
rb_vm_struct::src_encoding_index
int src_encoding_index
Definition: vm_core.h:637
rb_vm_struct::load_path
VALUE load_path
Definition: vm_core.h:616
rb_vm_struct::ractor
struct rb_vm_struct::@194 ractor
rb_vm_struct::waiting_fds
struct list_head waiting_fds
Definition: vm_core.h:600
rb_vm_struct::negative_cme_table
struct rb_id_table * negative_cme_table
Definition: vm_core.h:659
rb_vm_struct::load_path_snapshot
VALUE load_path_snapshot
Definition: vm_core.h:617
rb_vm_struct::loading_table
struct st_table * loading_table
Definition: vm_core.h:623
rb_vm_struct::defined_strings
VALUE * defined_strings
Definition: vm_core.h:653
rb_vm_struct::main_thread
struct rb_thread_struct * main_thread
Definition: vm_core.h:573
rb_vm_struct::global_cc_cache_table
const struct rb_callcache * global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]
Definition: vm_core.h:664
rb_vm_struct::self
VALUE self
Definition: vm_core.h:565
rb_vm_struct::coverage_mode
int coverage_mode
Definition: vm_core.h:645
rb_vm_struct::postponed_job_buffer
struct rb_postponed_job_struct * postponed_job_buffer
Definition: vm_core.h:634
rb_vm_struct::terminate_waiting
bool terminate_waiting
Definition: vm_core.h:588
rb_vm_struct::waiting_pids
struct list_head waiting_pids
Definition: vm_core.h:598
rb_vm_struct::workqueue
struct list_head workqueue
Definition: vm_core.h:640
rb_vm_struct::fiber_vm_stack_size
size_t fiber_vm_stack_size
Definition: vm_core.h:674
rb_vm_struct::expanded_load_path
VALUE expanded_load_path
Definition: vm_core.h:619
rb_vm_struct::ubf_async_safe
volatile int ubf_async_safe
Definition: vm_core.h:603
rb_vm_struct::top_self
VALUE top_self
Definition: vm_core.h:615
rb_vm_struct::fiber_machine_stack_size
size_t fiber_machine_stack_size
Definition: vm_core.h:675
rb_vm_struct::default_params
struct rb_vm_struct::@196 default_params
rb_vm_struct::main_ractor
struct rb_ractor_struct * main_ractor
Definition: vm_core.h:572
rb_vm_struct::thread_vm_stack_size
size_t thread_vm_stack_size
Definition: vm_core.h:672
rb_vm_struct::orig_progname
VALUE orig_progname
Definition: vm_core.h:643
rb_vm_struct::objspace
struct rb_objspace * objspace
Definition: vm_core.h:649
rb_vm_struct::lock
rb_nativethread_lock_t lock
Definition: vm_core.h:577
rb_vm_struct::special_exceptions
const VALUE special_exceptions[ruby_special_error_count]
Definition: vm_core.h:612
rb_vm_struct::loaded_features_snapshot
VALUE loaded_features_snapshot
Definition: vm_core.h:621
rb_vm_struct::lock_rec
unsigned int lock_rec
Definition: vm_core.h:579
rb_vm_struct::running
unsigned int running
Definition: vm_core.h:605
rb_vm_struct::postponed_job_index
rb_atomic_t postponed_job_index
Definition: vm_core.h:635
rb_vm_struct::cnt
unsigned int cnt
Definition: vm_core.h:569
rb_vm_struct::loaded_features_index
struct st_table * loaded_features_index
Definition: vm_core.h:622
rb_vm_struct::blocking_cnt
unsigned int blocking_cnt
Definition: vm_core.h:570
rb_vm_struct::loaded_features
VALUE loaded_features
Definition: vm_core.h:620
rb_vm_struct::waiting_grps
struct list_head waiting_grps
Definition: vm_core.h:599
rb_vm_struct::thread_report_on_exception
unsigned int thread_report_on_exception
Definition: vm_core.h:607
rb_vm_struct::terminate_cond
rb_nativethread_cond_t terminate_cond
Definition: vm_core.h:587
rb_vm_struct::workqueue_lock
rb_nativethread_lock_t workqueue_lock
Definition: vm_core.h:641
rb_vm_struct::thread_abort_on_exception
unsigned int thread_abort_on_exception
Definition: vm_core.h:606
rb_vm_struct::frozen_strings
st_table * frozen_strings
Definition: vm_core.h:654
rb_vm_struct::mark_object_ary
VALUE mark_object_ary
Definition: vm_core.h:611
rb_vm_struct::thread_machine_stack_size
size_t thread_machine_stack_size
Definition: vm_core.h:673
rb_vm_struct::lock_owner
struct rb_ractor_struct * lock_owner
Definition: vm_core.h:578
rb_vm_struct::at_exit
rb_at_exit_list * at_exit
Definition: vm_core.h:651
rb_vm_struct::fork_gen
rb_serial_t fork_gen
Definition: vm_core.h:596
rb_vm_tag
Definition: vm_core.h:808
rb_vm_tag::retval
VALUE retval
Definition: vm_core.h:810
rb_vm_tag::prev
struct rb_vm_tag * prev
Definition: vm_core.h:812
rb_vm_tag::buf
rb_jmpbuf_t buf
Definition: vm_core.h:811
rb_vm_tag::state
enum ruby_tag_type state
Definition: vm_core.h:813
rb_vm_tag::lock_rec
unsigned int lock_rec
Definition: vm_core.h:814
rb_vm_tag::tag
VALUE tag
Definition: vm_core.h:809
rb_waiting_list
Definition: vm_core.h:848
rb_waiting_list::next
struct rb_waiting_list * next
Definition: vm_core.h:849
rb_waiting_list::fiber
struct rb_fiber_struct * fiber
Definition: vm_core.h:851
rb_waiting_list::thread
struct rb_thread_struct * thread
Definition: vm_core.h:850
st_table
Definition: st.h:79
vm_ifunc
IFUNC (Internal FUNCtion)
Definition: imemo.h:85
t
#define t
Definition: symbol.c:253
thread_native.h
thread_pthread.h
ruby_current_ec
RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct * ruby_current_ec
thread_win32.h
ruby_current_ec_key
native_tls_key_t ruby_current_ec_key
Definition: vm.c:400
iseq_inline_storage_entry
Definition: vm_core.h:239
iseq_inline_storage_entry::ic_cache
struct iseq_inline_constant_cache ic_cache
Definition: vm_core.h:244
iseq_inline_storage_entry::iv_cache
struct iseq_inline_iv_cache_entry iv_cache
Definition: vm_core.h:245
iseq_inline_storage_entry::once
struct iseq_inline_storage_entry::@187 once
iseq_inline_storage_entry::value
VALUE value
Definition: vm_core.h:242
iseq_inline_storage_entry::running_thread
struct rb_thread_struct * running_thread
Definition: vm_core.h:241
VALUE
unsigned long VALUE
Definition: value.h:38
SIZEOF_VALUE
#define SIZEOF_VALUE
Definition: value.h:41
ID
unsigned long ID
Definition: value.h:39
T_STRING
#define T_STRING
Definition: value_type.h:77
T_ARRAY
#define T_ARRAY
Definition: value_type.h:55
SYMBOL_P
#define SYMBOL_P
Definition: value_type.h:87
ruby_single_main_ractor
rb_ractor_t * ruby_single_main_ractor
Definition: vm.c:381
ruby_current_vm_ptr
rb_vm_t * ruby_current_vm_ptr
Definition: vm.c:380
ruby_vm_event_flags
rb_event_flag_t ruby_vm_event_flags
Definition: vm.c:403
ruby_vm_event_local_num
unsigned int ruby_vm_event_local_num
Definition: vm.c:405
ruby_vm_event_enabled_global_flags
rb_event_flag_t ruby_vm_event_enabled_global_flags
Definition: vm.c:404
rb_vm_block_copy
void rb_vm_block_copy(VALUE obj, const struct rb_block *dst, const struct rb_block *src)
Definition: vm.c:921
rb_ec_setup_exception
void rb_ec_setup_exception(const rb_execution_context_t *ec, VALUE mesg, VALUE cause)
Definition: eval.c:683
rb_thread_check_trap_pending
int rb_thread_check_trap_pending(void)
Definition: thread.c:1587
rb_thread_status
rb_thread_status
Definition: vm_core.h:791
THREAD_KILLED
@ THREAD_KILLED
Definition: vm_core.h:795
THREAD_STOPPED
@ THREAD_STOPPED
Definition: vm_core.h:793
THREAD_RUNNABLE
@ THREAD_RUNNABLE
Definition: vm_core.h:792
THREAD_STOPPED_FOREVER
@ THREAD_STOPPED_FOREVER
Definition: vm_core.h:794
ruby_threadptr_data_type
const rb_data_type_t ruby_threadptr_data_type
Definition: vm.c:2991
rb_ec_clear_vm_stack
void rb_ec_clear_vm_stack(rb_execution_context_t *ec)
Definition: vm.c:3047
rb_vm_cond_wait
void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond)
Definition: vm_sync.c:205
rb_iseq_path
VALUE rb_iseq_path(const rb_iseq_t *iseq)
Definition: iseq.c:1087
rb_get_coverages
VALUE rb_get_coverages(void)
Definition: thread.c:5773
rb_ec_initialize_vm_stack
void rb_ec_initialize_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t size)
Definition: vm.c:3031
rb_vm_ep_local_ep
const VALUE * rb_vm_ep_local_ep(const VALUE *ep)
Definition: vm.c:93
ruby_sighandler_t
void(* ruby_sighandler_t)(int)
Definition: vm_core.h:1650
rb_iseq_new_with_callback
rb_iseq_t * rb_iseq_new_with_callback(const struct rb_iseq_new_with_callback_callback_func *ifunc, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t *)
Definition: iseq.c:888
ruby_basic_operators
ruby_basic_operators
Definition: vm_core.h:503
BOP_EQ
@ BOP_EQ
Definition: vm_core.h:509
BOP_LENGTH
@ BOP_LENGTH
Definition: vm_core.h:516
BOP_DIV
@ BOP_DIV
Definition: vm_core.h:507
BOP_LAST_
@ BOP_LAST_
Definition: vm_core.h:534
BOP_LE
@ BOP_LE
Definition: vm_core.h:512
BOP_LTLT
@ BOP_LTLT
Definition: vm_core.h:513
BOP_GE
@ BOP_GE
Definition: vm_core.h:522
BOP_SIZE
@ BOP_SIZE
Definition: vm_core.h:517
BOP_CALL
@ BOP_CALL
Definition: vm_core.h:530
BOP_AND
@ BOP_AND
Definition: vm_core.h:531
BOP_NEQ
@ BOP_NEQ
Definition: vm_core.h:524
BOP_NOT
@ BOP_NOT
Definition: vm_core.h:523
BOP_NIL_P
@ BOP_NIL_P
Definition: vm_core.h:519
BOP_SUCC
@ BOP_SUCC
Definition: vm_core.h:520
BOP_EQQ
@ BOP_EQQ
Definition: vm_core.h:510
BOP_ASET
@ BOP_ASET
Definition: vm_core.h:515
BOP_MAX
@ BOP_MAX
Definition: vm_core.h:528
BOP_AREF
@ BOP_AREF
Definition: vm_core.h:514
BOP_FREEZE
@ BOP_FREEZE
Definition: vm_core.h:526
BOP_PLUS
@ BOP_PLUS
Definition: vm_core.h:504
BOP_MOD
@ BOP_MOD
Definition: vm_core.h:508
BOP_MINUS
@ BOP_MINUS
Definition: vm_core.h:505
BOP_LT
@ BOP_LT
Definition: vm_core.h:511
BOP_MATCH
@ BOP_MATCH
Definition: vm_core.h:525
BOP_MULT
@ BOP_MULT
Definition: vm_core.h:506
BOP_EMPTY_P
@ BOP_EMPTY_P
Definition: vm_core.h:518
BOP_OR
@ BOP_OR
Definition: vm_core.h:532
BOP_MIN
@ BOP_MIN
Definition: vm_core.h:529
BOP_GT
@ BOP_GT
Definition: vm_core.h:521
BOP_UMINUS
@ BOP_UMINUS
Definition: vm_core.h:527
rb_vm_frame_method_entry
const rb_callable_method_entry_t * rb_vm_frame_method_entry(const rb_control_frame_t *cfp)
Definition: vm_insnhelper.c:667
rb_iseq_pathobj_new
VALUE rb_iseq_pathobj_new(VALUE path, VALUE realpath)
Definition: iseq.c:502
rb_iseq_eval_main
VALUE rb_iseq_eval_main(const rb_iseq_t *iseq)
Definition: vm.c:2413
rb_mRubyVMFrozenCore
VALUE rb_mRubyVMFrozenCore
Definition: vm.c:375
ruby_vm_throw_flags
ruby_vm_throw_flags
Definition: vm_core.h:209
VM_THROW_STATE_MASK
@ VM_THROW_STATE_MASK
Definition: vm_core.h:211
VM_THROW_NO_ESCAPE_FLAG
@ VM_THROW_NO_ESCAPE_FLAG
Definition: vm_core.h:210
rb_ec_error_print
void rb_ec_error_print(rb_execution_context_t *volatile ec, volatile VALUE errinfo)
Definition: eval_error.c:360
rb_vm_pop_frame
void rb_vm_pop_frame(rb_execution_context_t *ec)
Definition: vm_insnhelper.c:419
rb_iseq_eval
VALUE rb_iseq_eval(const rb_iseq_t *iseq)
Definition: vm.c:2403
rb_threadptr_check_signal
void rb_threadptr_check_signal(rb_thread_t *mth)
Definition: thread.c:4598
RUBY_VM_SET_TIMER_INTERRUPT
#define RUBY_VM_SET_TIMER_INTERRUPT(ec)
Definition: vm_core.h:1875
ruby_thread_init_stack
void ruby_thread_init_stack(rb_thread_t *th)
Definition: thread.c:669
Init_native_thread
void Init_native_thread(rb_thread_t *th)
rb_vmdebug_debug_print_pre
void rb_vmdebug_debug_print_pre(const rb_execution_context_t *ec, const rb_control_frame_t *cfp, const VALUE *_pc)
Definition: vm_dump.c:388
rb_iseq_new_with_opt
rb_iseq_t * rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth, enum iseq_type, const rb_compile_option_t *)
Definition: iseq.c:862
rb_iseq_pathobj_set
void rb_iseq_pathobj_set(const rb_iseq_t *iseq, VALUE path, VALUE realpath)
Definition: iseq.c:521
rb_vm_main_ractor_ec
rb_execution_context_t * rb_vm_main_ractor_ec(rb_vm_t *vm)
Definition: ractor.c:1978
rb_proc_ractor_make_shareable
VALUE rb_proc_ractor_make_shareable(VALUE self)
Definition: vm.c:1105
rb_threadptr_execute_interrupts
int rb_threadptr_execute_interrupts(rb_thread_t *, int)
Definition: thread.c:2424
rb_thread_t
struct rb_thread_struct rb_thread_t
ruby_tag_type
ruby_tag_type
Definition: vm_core.h:185
RUBY_TAG_NEXT
@ RUBY_TAG_NEXT
Definition: vm_core.h:189
RUBY_TAG_NONE
@ RUBY_TAG_NONE
Definition: vm_core.h:186
RUBY_TAG_FATAL
@ RUBY_TAG_FATAL
Definition: vm_core.h:194
RUBY_TAG_MASK
@ RUBY_TAG_MASK
Definition: vm_core.h:195
RUBY_TAG_THROW
@ RUBY_TAG_THROW
Definition: vm_core.h:193
RUBY_TAG_BREAK
@ RUBY_TAG_BREAK
Definition: vm_core.h:188
RUBY_TAG_RETRY
@ RUBY_TAG_RETRY
Definition: vm_core.h:190
RUBY_TAG_RAISE
@ RUBY_TAG_RAISE
Definition: vm_core.h:192
RUBY_TAG_RETURN
@ RUBY_TAG_RETURN
Definition: vm_core.h:187
RUBY_TAG_REDO
@ RUBY_TAG_REDO
Definition: vm_core.h:191
ruby_binding_data_type
const rb_data_type_t ruby_binding_data_type
Definition: proc.c:319
rb_cISeq
VALUE rb_cISeq
Definition: iseq.c:46
rb_vm_encoded_insn_data_table_init
void rb_vm_encoded_insn_data_table_init(void)
Definition: iseq.c:3139
rb_vm_stack_to_heap
void rb_vm_stack_to_heap(rb_execution_context_t *ec)
Definition: vm.c:820
GC_GUARDED_PTR_REF
#define GC_GUARDED_PTR_REF(p)
Definition: vm_core.h:1164
PATHOBJ_PATH
#define PATHOBJ_PATH
Definition: vm_core.h:275
rb_clear_coverages
void rb_clear_coverages(void)
Definition: thread.c:4739
vm_special_object_type
vm_special_object_type
Definition: vm_core.h:1129
VM_SPECIAL_OBJECT_CBASE
@ VM_SPECIAL_OBJECT_CBASE
Definition: vm_core.h:1131
VM_SPECIAL_OBJECT_VMCORE
@ VM_SPECIAL_OBJECT_VMCORE
Definition: vm_core.h:1130
VM_SPECIAL_OBJECT_CONST_BASE
@ VM_SPECIAL_OBJECT_CONST_BASE
Definition: vm_core.h:1132
rb_vm_frame_block_handler
VALUE rb_vm_frame_block_handler(const rb_control_frame_t *cfp)
Definition: vm.c:126
rb_objspace_call_finalizer
void rb_objspace_call_finalizer(struct rb_objspace *)
Definition: gc.c:3771
rb_proc_isolate_bang
VALUE rb_proc_isolate_bang(VALUE self)
Definition: vm.c:1055
rb_gc_mark_machine_stack
void rb_gc_mark_machine_stack(const rb_execution_context_t *ec)
Definition: gc.c:5869
rb_ec_get_errinfo
VALUE rb_ec_get_errinfo(const rb_execution_context_t *ec)
Definition: eval.c:1881
VM_ENV_DATA_INDEX_FLAGS
#define VM_ENV_DATA_INDEX_FLAGS
Definition: vm_core.h:1210
rb_block_type
rb_block_type
Definition: vm_core.h:753
block_type_symbol
@ block_type_symbol
Definition: vm_core.h:756
block_type_iseq
@ block_type_iseq
Definition: vm_core.h:754
block_type_ifunc
@ block_type_ifunc
Definition: vm_core.h:755
block_type_proc
@ block_type_proc
Definition: vm_core.h:757
rb_vm_bugreport
void rb_vm_bugreport(const void *)
Definition: vm_dump.c:962
VM_ASSERT
#define VM_ASSERT(expr)
Definition: vm_core.h:61
rb_proc_dup
VALUE rb_proc_dup(VALUE self)
Definition: vm.c:956
rb_block_handler_type
rb_block_handler_type
Definition: vm_core.h:746
block_handler_type_ifunc
@ block_handler_type_ifunc
Definition: vm_core.h:748
block_handler_type_proc
@ block_handler_type_proc
Definition: vm_core.h:750
block_handler_type_symbol
@ block_handler_type_symbol
Definition: vm_core.h:749
block_handler_type_iseq
@ block_handler_type_iseq
Definition: vm_core.h:747
rb_binding_alloc
VALUE rb_binding_alloc(VALUE klass)
Definition: proc.c:331
rb_vm_at_exit_func
void rb_vm_at_exit_func(struct rb_vm_struct *)
Definition: vm_core.h:541
VM_ENV_DATA_INDEX_ENV
#define VM_ENV_DATA_INDEX_ENV
Definition: vm_core.h:1211
ruby_special_exceptions
ruby_special_exceptions
Definition: vm_core.h:494
ruby_error_stackfatal
@ ruby_error_stackfatal
Definition: vm_core.h:498
ruby_error_nomemory
@ ruby_error_nomemory
Definition: vm_core.h:496
ruby_error_reenter
@ ruby_error_reenter
Definition: vm_core.h:495
ruby_error_sysstack
@ ruby_error_sysstack
Definition: vm_core.h:497
ruby_special_error_count
@ ruby_special_error_count
Definition: vm_core.h:500
ruby_error_stream_closed
@ ruby_error_stream_closed
Definition: vm_core.h:499
rb_vm_make_binding
VALUE rb_vm_make_binding(const rb_execution_context_t *ec, const rb_control_frame_t *src_cfp)
Definition: vm.c:1172
PATHOBJ_REALPATH
#define PATHOBJ_REALPATH
Definition: vm_core.h:276
rb_ec_set_vm_stack
void rb_ec_set_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t size)
Definition: vm.c:3024
rb_proc_isolate
VALUE rb_proc_isolate(VALUE self)
Definition: vm.c:1097
CDHASH
VALUE CDHASH
Definition: vm_core.h:1151
rb_cRubyVM
VALUE rb_cRubyVM
Definition: vm.c:373
rb_hook_list_free
void rb_hook_list_free(rb_hook_list_t *hooks)
Definition: vm_trace.c:69
rb_threadptr_pending_interrupt_enque
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v)
Definition: thread.c:1987
rb_vm_get_sourceline
int rb_vm_get_sourceline(const rb_control_frame_t *)
Definition: vm_backtrace.c:71
ISE
union iseq_inline_storage_entry * ISE
Definition: vm_core.h:1146
rb_threadptr_pending_interrupt_clear
void rb_threadptr_pending_interrupt_clear(rb_thread_t *th)
Definition: thread.c:1981
rb_iseq_new
rb_iseq_t * rb_iseq_new(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type)
Definition: iseq.c:809
EXEC_EVENT_HOOK
#define EXEC_EVENT_HOOK(ec_, flag_, self_, id_, called_id_, klass_, data_)
Definition: vm_core.h:2001
RB_BUILTIN
const struct rb_builtin_function * RB_BUILTIN
Definition: vm_core.h:562
VM_GLOBAL_CC_CACHE_TABLE_SIZE
#define VM_GLOBAL_CC_CACHE_TABLE_SIZE
Definition: vm_core.h:662
rb_jmpbuf_t
void * rb_jmpbuf_t[5]
Definition: vm_core.h:801
rb_vmdebug_stack_dump_raw
void rb_vmdebug_stack_dump_raw(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
Definition: vm_dump.c:195
rb_snum_t
signed long rb_snum_t
Definition: vm_core.h:183
rb_thread_id_string_t
char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) *2+3]
Definition: vm_core.h:844
rb_iseq_new_main
rb_iseq_t * rb_iseq_new_main(const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent)
Definition: iseq.c:833
rb_vm_t
struct rb_vm_struct rb_vm_t
rb_iseq_coverage
VALUE rb_iseq_coverage(const rb_iseq_t *iseq)
Definition: iseq.c:1146
rb_threadptr_signal_raise
void rb_threadptr_signal_raise(rb_thread_t *th, int sig)
Definition: thread.c:2565
CALL_INFO
const struct rb_callinfo * CALL_INFO
Definition: vm_core.h:1147
rb_signal_exec
int rb_signal_exec(rb_thread_t *th, int sig)
Definition: signal.c:1099
TERMINATE_INTERRUPT_MASK
@ TERMINATE_INTERRUPT_MASK
Definition: vm_core.h:1871
POSTPONED_JOB_INTERRUPT_MASK
@ POSTPONED_JOB_INTERRUPT_MASK
Definition: vm_core.h:1869
VM_BARRIER_INTERRUPT_MASK
@ VM_BARRIER_INTERRUPT_MASK
Definition: vm_core.h:1872
TRAP_INTERRUPT_MASK
@ TRAP_INTERRUPT_MASK
Definition: vm_core.h:1870
TIMER_INTERRUPT_MASK
@ TIMER_INTERRUPT_MASK
Definition: vm_core.h:1867
PENDING_INTERRUPT_MASK
@ PENDING_INTERRUPT_MASK
Definition: vm_core.h:1868
rb_vm_make_proc_lambda
VALUE rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda)
Definition: vm.c:1152
rb_vm_env_local_variables
VALUE rb_vm_env_local_variables(const rb_env_t *env)
Definition: vm.c:876
FUNC_FASTCALL
#define FUNC_FASTCALL(x)
Definition: vm_core.h:1154
rb_vm_control_frame_id_and_class
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp)
Definition: vm.c:2424
IC
struct iseq_inline_constant_cache * IC
Definition: vm_core.h:1144
rb_thread_alloc
VALUE rb_thread_alloc(VALUE klass)
Definition: vm.c:3114
CALL_CACHE
const struct rb_callcache * CALL_CACHE
Definition: vm_core.h:1148
rb_catch_protect
VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr)
Definition: vm_eval.c:2421
rb_gvl_destroy
void rb_gvl_destroy(rb_global_vm_lock_t *gvl)
rb_vm_get_ruby_level_next_cfp
rb_control_frame_t * rb_vm_get_ruby_level_next_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
Definition: vm.c:589
rb_hook_list_mark
void rb_hook_list_mark(rb_hook_list_t *hooks)
Definition: vm_trace.c:56
rb_ensure_entry_t
struct rb_ensure_entry rb_ensure_entry_t
rb_binding_add_dynavars
const VALUE * rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const ID *dynvars)
Definition: vm.c:1203
rb_vm_cond_timedwait
void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec)
Definition: vm_sync.c:211
rb_thread_reset_timer_thread
void rb_thread_reset_timer_thread(void)
Definition: thread.c:4696
rb_eRactorUnsafeError
VALUE rb_eRactorUnsafeError
Definition: ractor.c:22
vm_svar_index
vm_svar_index
Definition: vm_core.h:1135
VM_SVAR_FLIPFLOP_START
@ VM_SVAR_FLIPFLOP_START
Definition: vm_core.h:1140
VM_SVAR_EXTRA_START
@ VM_SVAR_EXTRA_START
Definition: vm_core.h:1139
VM_SVAR_BACKREF
@ VM_SVAR_BACKREF
Definition: vm_core.h:1137
VM_SVAR_LASTLINE
@ VM_SVAR_LASTLINE
Definition: vm_core.h:1136
rb_threadptr_unlock_all_locking_mutexes
void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th)
Definition: thread.c:567
rb_vm_get_binding_creatable_next_cfp
rb_control_frame_t * rb_vm_get_binding_creatable_next_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
Definition: vm.c:577
rb_ensure_list_t
struct rb_ensure_list rb_ensure_list_t
RUBY_VM_VALID_CONTROL_FRAME_P
#define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp)
Definition: vm_core.h:1395
VM_TAGGED_PTR_REF
#define VM_TAGGED_PTR_REF(v, mask)
Definition: vm_core.h:1161
rb_vm_rewind_cfp
void rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp)
Definition: vm.c:639
rb_control_frame_t
struct rb_control_frame_struct rb_control_frame_t
rb_block_param_proxy
VALUE rb_block_param_proxy
Definition: vm.c:376
rb_vm_env_prev_env
const rb_env_t * rb_vm_env_prev_env(const rb_env_t *env)
Definition: vm.c:830
rb_vm_invoke_proc
VALUE rb_vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, int argc, const VALUE *argv, int kw_splat, VALUE block_handler)
Definition: vm.c:1475
rb_thread_stop_timer_thread
void rb_thread_stop_timer_thread(void)
Definition: thread.c:4688
rb_threadptr_signal_exit
void rb_threadptr_signal_exit(rb_thread_t *th)
Definition: thread.c:2575
rb_hook_list_t
struct rb_hook_list_struct rb_hook_list_t
rb_vmdebug_debug_print_post
void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
Definition: vm_dump.c:417
rb_iseq_new_eval
rb_iseq_t * rb_iseq_new_eval(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth)
Definition: iseq.c:841
rb_exec_event_hooks
void rb_exec_event_hooks(struct rb_trace_arg_struct *trace_arg, rb_hook_list_t *hooks, int pop_p)
Definition: vm_trace.c:365
rb_insn_func_t
rb_control_frame_t *FUNC_FASTCALL rb_insn_func_t(rb_execution_context_t *, rb_control_frame_t *)
Definition: vm_core.h:1158
CALL_DATA
struct rb_call_data * CALL_DATA
Definition: vm_core.h:1149
rb_vm_block_ep_update
void rb_vm_block_ep_update(VALUE obj, const struct rb_block *dst, const VALUE *ep)
Definition: vm.c:326
rb_threadptr_interrupt
void rb_threadptr_interrupt(rb_thread_t *th)
Definition: thread.c:508
rb_iseq_disasm_insn
int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child)
Disassemble a instruction Iseq -> Iseq inspect object.
Definition: iseq.c:2078
rb_thread_wakeup_timer_thread
void rb_thread_wakeup_timer_thread(int)
rb_set_coverages
void rb_set_coverages(VALUE, int, VALUE)
Definition: thread.c:5785
VM_BLOCK_HANDLER_NONE
#define VM_BLOCK_HANDLER_NONE
Definition: vm_core.h:1299
rb_vm_proc_local_ep
const VALUE * rb_vm_proc_local_ep(VALUE proc)
Definition: thread.c:675
VM_ENV_DATA_INDEX_SPECVAL
#define VM_ENV_DATA_INDEX_SPECVAL
Definition: vm_core.h:1209
rb_iseq_disasm
VALUE rb_iseq_disasm(const rb_iseq_t *iseq)
Definition: iseq.c:2335
rb_eRactorIsolationError
VALUE rb_eRactorIsolationError
Definition: ractor.c:23
rb_fiber_close
void rb_fiber_close(rb_fiber_t *fib)
Definition: cont.c:2365
VM_TAGGED_PTR_SET
#define VM_TAGGED_PTR_SET(p, tag)
Definition: vm_core.h:1160
rb_vm_rewrite_cref
void rb_vm_rewrite_cref(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr)
Definition: vm_insnhelper.c:867
rb_ec_frame_method_id_and_class
int rb_ec_frame_method_id_and_class(const rb_execution_context_t *ec, ID *idp, ID *called_idp, VALUE *klassp)
Definition: vm.c:2440
rb_vm_defineclass_type_t
rb_vm_defineclass_type_t
Definition: vm_core.h:1028
VM_DEFINECLASS_TYPE_CLASS
@ VM_DEFINECLASS_TYPE_CLASS
Definition: vm_core.h:1029
VM_DEFINECLASS_TYPE_MASK
@ VM_DEFINECLASS_TYPE_MASK
Definition: vm_core.h:1033
VM_DEFINECLASS_TYPE_MODULE
@ VM_DEFINECLASS_TYPE_MODULE
Definition: vm_core.h:1031
VM_DEFINECLASS_TYPE_SINGLETON_CLASS
@ VM_DEFINECLASS_TYPE_SINGLETON_CLASS
Definition: vm_core.h:1030
rb_hook_list_remove_tracepoint
void rb_hook_list_remove_tracepoint(rb_hook_list_t *list, VALUE tpval)
Definition: vm_trace.c:1268
rb_vm_check_ints_blocking
int rb_vm_check_ints_blocking(rb_execution_context_t *ec)
Definition: thread.c:222
rb_iseq_new_top
rb_iseq_t * rb_iseq_new_top(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent)
Definition: iseq.c:817
RUBY_NSIG
#define RUBY_NSIG
Definition: vm_core.h:114
rb_vm_trap_exit
void rb_vm_trap_exit(rb_vm_t *vm)
Definition: signal.c:1077
rb_signal_buff_size
int rb_signal_buff_size(void)
Definition: signal.c:747
rb_iseq_location_t
struct rb_iseq_location_struct rb_iseq_location_t
rb_objspace_free
void rb_objspace_free(struct rb_objspace *)
Definition: gc.c:1610
rb_vm_bh_to_procval
VALUE rb_vm_bh_to_procval(const rb_execution_context_t *ec, VALUE block_handler)
Definition: vm_insnhelper.c:474
rb_vm_register_special_exception_str
void rb_vm_register_special_exception_str(enum ruby_special_exceptions sp, VALUE exception_class, VALUE mesg)
Definition: vm.c:2612
IVC
struct iseq_inline_iv_cache_entry * IVC
Definition: vm_core.h:1145
rb_iseq_realpath
VALUE rb_iseq_realpath(const rb_iseq_t *iseq)
Definition: iseq.c:1093
rb_hook_list_connect_tracepoint
void rb_hook_list_connect_tracepoint(VALUE target, rb_hook_list_t *list, VALUE tpval, unsigned int target_line)
Definition: vm_trace.c:1258
rb_backtrace_iter_func
int rb_backtrace_iter_func(void *, VALUE, int, VALUE)
Definition: vm_core.h:1708
rb_execution_context_update
void rb_execution_context_update(const rb_execution_context_t *ec)
Definition: vm.c:2785
VM_UNREACHABLE
#define VM_UNREACHABLE(func)
Definition: vm_core.h:62
vm_check_match_type
vm_check_match_type
Definition: vm_core.h:1120
VM_CHECKMATCH_TYPE_RESCUE
@ VM_CHECKMATCH_TYPE_RESCUE
Definition: vm_core.h:1123
VM_CHECKMATCH_TYPE_CASE
@ VM_CHECKMATCH_TYPE_CASE
Definition: vm_core.h:1122
VM_CHECKMATCH_TYPE_WHEN
@ VM_CHECKMATCH_TYPE_WHEN
Definition: vm_core.h:1121
rb_execution_context_mark
void rb_execution_context_mark(const rb_execution_context_t *ec)
Definition: vm.c:2835
rb_postponed_job_flush
void rb_postponed_job_flush(rb_vm_t *vm)
Definition: vm_trace.c:1676
rb_reset_coverages
void rb_reset_coverages(void)
Definition: thread.c:5800
rb_vm_call_kw
VALUE rb_vm_call_kw(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_callable_method_entry_t *me, int kw_splat)
Definition: vm_eval.c:260
VM_FRAME_FLAG_LAMBDA
@ VM_FRAME_FLAG_LAMBDA
Definition: vm_core.h:1194
VM_FRAME_FLAG_CFRAME_KW
@ VM_FRAME_FLAG_CFRAME_KW
Definition: vm_core.h:1196
VM_FRAME_MAGIC_IFUNC
@ VM_FRAME_MAGIC_IFUNC
Definition: vm_core.h:1183
VM_FRAME_MAGIC_METHOD
@ VM_FRAME_MAGIC_METHOD
Definition: vm_core.h:1178
VM_FRAME_MAGIC_TOP
@ VM_FRAME_MAGIC_TOP
Definition: vm_core.h:1181
VM_FRAME_FLAG_CFRAME
@ VM_FRAME_FLAG_CFRAME
Definition: vm_core.h:1193
VM_FRAME_MAGIC_DUMMY
@ VM_FRAME_MAGIC_DUMMY
Definition: vm_core.h:1186
VM_FRAME_FLAG_PASSED
@ VM_FRAME_FLAG_PASSED
Definition: vm_core.h:1197
VM_FRAME_FLAG_BMETHOD
@ VM_FRAME_FLAG_BMETHOD
Definition: vm_core.h:1192
VM_FRAME_MAGIC_BLOCK
@ VM_FRAME_MAGIC_BLOCK
Definition: vm_core.h:1179
VM_ENV_FLAG_LOCAL
@ VM_ENV_FLAG_LOCAL
Definition: vm_core.h:1200
VM_FRAME_MAGIC_MASK
@ VM_FRAME_MAGIC_MASK
Definition: vm_core.h:1188
VM_FRAME_MAGIC_CFUNC
@ VM_FRAME_MAGIC_CFUNC
Definition: vm_core.h:1182
VM_FRAME_MAGIC_EVAL
@ VM_FRAME_MAGIC_EVAL
Definition: vm_core.h:1184
VM_FRAME_MAGIC_CLASS
@ VM_FRAME_MAGIC_CLASS
Definition: vm_core.h:1180
VM_ENV_FLAG_ESCAPED
@ VM_ENV_FLAG_ESCAPED
Definition: vm_core.h:1201
VM_ENV_FLAG_WB_REQUIRED
@ VM_ENV_FLAG_WB_REQUIRED
Definition: vm_core.h:1202
VM_ENV_FLAG_ISOLATED
@ VM_ENV_FLAG_ISOLATED
Definition: vm_core.h:1203
VM_FRAME_FLAG_FINISH
@ VM_FRAME_FLAG_FINISH
Definition: vm_core.h:1191
VM_FRAME_MAGIC_RESCUE
@ VM_FRAME_MAGIC_RESCUE
Definition: vm_core.h:1185
VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM
@ VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM
Definition: vm_core.h:1195
rb_num_t
unsigned long rb_num_t
Definition: vm_core.h:182
rb_thread_start_timer_thread
void rb_thread_start_timer_thread(void)
Definition: thread.c:4702
rb_proc_alloc
VALUE rb_proc_alloc(VALUE klass)
Definition: proc.c:145
rb_vm_inc_const_missing_count
void rb_vm_inc_const_missing_count(void)
Definition: vm.c:425
rb_objspace_alloc
struct rb_objspace * rb_objspace_alloc(void)
Definition: gc.c:1595
vm_opts.h
OPT_STACK_CACHING
#define OPT_STACK_CACHING
Definition: vm_opts.h:58
rb_ec_vm_lock_rec_release
void rb_ec_vm_lock_rec_release(const rb_execution_context_t *ec, unsigned int recorded_lock_rec, unsigned int current_lock_rec)
Definition: vm_sync.c:282
env
#define env
def
int def(FILE *source, FILE *dest, int level)
Definition: zpipe.c:36