Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

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