Ruby  2.4.2p198(2017-09-14revision59899)
vm_core.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  vm_core.h -
4 
5  $Author: nagachika $
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 #define VM_CHECK_MODE 0
21 #endif
22 
36 #ifndef VMDEBUG
37 #define VMDEBUG 0
38 #endif
39 
40 #if 0
41 #undef VMDEBUG
42 #define VMDEBUG 3
43 #endif
44 
45 #include "ruby_assert.h"
46 
47 #if VM_CHECK_MODE > 0
48 #define VM_ASSERT(expr) ( \
49  RUBY_ASSERT_MESG_WHEN(VM_CHECK_MODE > 0, expr, #expr))
50 
51 #define VM_UNREACHABLE(func) rb_bug(#func ": unreachable")
52 
53 #else
54 #define VM_ASSERT(expr) ((void)0)
55 #define VM_UNREACHABLE(func) ((void)0)
56 #endif
57 
58 #define RUBY_VM_THREAD_MODEL 2
59 
60 #include "ruby/ruby.h"
61 #include "ruby/st.h"
62 
63 #include "node.h"
64 #include "vm_debug.h"
65 #include "vm_opts.h"
66 #include "id.h"
67 #include "method.h"
68 #include "ruby_atomic.h"
69 #include "ccan/list/list.h"
70 
71 #include "ruby/thread_native.h"
72 #if defined(_WIN32)
73 #include "thread_win32.h"
74 #elif defined(HAVE_PTHREAD_H)
75 #include "thread_pthread.h"
76 #endif
77 
78 #ifndef ENABLE_VM_OBJSPACE
79 #ifdef _WIN32
80 /*
81  * TODO: object space independent st_table.
82  * socklist and conlist will be freed exit_handler(), after object
83  * space destruction.
84  */
85 #define ENABLE_VM_OBJSPACE 0
86 #else
87 #define ENABLE_VM_OBJSPACE 1
88 #endif
89 #endif
90 
91 #include <setjmp.h>
92 #include <signal.h>
93 
94 #ifndef NSIG
95 # define NSIG (_SIGMAX + 1) /* For QNX */
96 #endif
97 
98 #define RUBY_NSIG NSIG
99 
100 #ifdef HAVE_STDARG_PROTOTYPES
101 #include <stdarg.h>
102 #define va_init_list(a,b) va_start((a),(b))
103 #else
104 #include <varargs.h>
105 #define va_init_list(a,b) va_start((a))
106 #endif
107 
108 #if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
109 #define USE_SIGALTSTACK
110 #endif
111 
112 /*****************/
113 /* configuration */
114 /*****************/
115 
116 /* gcc ver. check */
117 #if defined(__GNUC__) && __GNUC__ >= 2
118 
119 #if OPT_TOKEN_THREADED_CODE
120 #if OPT_DIRECT_THREADED_CODE
121 #undef OPT_DIRECT_THREADED_CODE
122 #endif
123 #endif
124 
125 #else /* defined(__GNUC__) && __GNUC__ >= 2 */
126 
127 /* disable threaded code options */
128 #if OPT_DIRECT_THREADED_CODE
129 #undef OPT_DIRECT_THREADED_CODE
130 #endif
131 #if OPT_TOKEN_THREADED_CODE
132 #undef OPT_TOKEN_THREADED_CODE
133 #endif
134 #endif
135 
136 #ifdef __native_client__
137 #undef OPT_DIRECT_THREADED_CODE
138 #endif
139 
140 /* call threaded code */
141 #if OPT_CALL_THREADED_CODE
142 #if OPT_DIRECT_THREADED_CODE
143 #undef OPT_DIRECT_THREADED_CODE
144 #endif /* OPT_DIRECT_THREADED_CODE */
145 #if OPT_STACK_CACHING
146 #undef OPT_STACK_CACHING
147 #endif /* OPT_STACK_CACHING */
148 #endif /* OPT_CALL_THREADED_CODE */
149 
150 typedef unsigned long rb_num_t;
151 
162 };
163 #define TAG_RETURN RUBY_TAG_RETURN
164 #define TAG_BREAK RUBY_TAG_BREAK
165 #define TAG_NEXT RUBY_TAG_NEXT
166 #define TAG_RETRY RUBY_TAG_RETRY
167 #define TAG_REDO RUBY_TAG_REDO
168 #define TAG_RAISE RUBY_TAG_RAISE
169 #define TAG_THROW RUBY_TAG_THROW
170 #define TAG_FATAL RUBY_TAG_FATAL
171 #define TAG_MASK RUBY_TAG_MASK
172 
177 };
178 
179 /* forward declarations */
180 struct rb_thread_struct;
182 
183 /* iseq data type */
185 
189  union {
190  size_t index;
192  } ic_value;
193 };
194 
196  struct {
199  } once;
201 };
202 
212 };
213 
214 struct rb_call_info {
215  /* fixed at compile time */
217  unsigned int flag;
219 };
220 
223  VALUE keywords[1];
224 };
225 
227  struct rb_call_info ci;
229 };
230 
234  int argc;
235 };
236 
237 struct rb_call_cache;
238 typedef VALUE (*vm_call_handler)(struct rb_thread_struct *th, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc);
239 
241  /* inline cache: keys */
244 
245  /* inline cache: values */
247 
249 
250  union {
251  unsigned int index; /* used by ivar */
252  enum method_missing_reason method_missing_reason; /* used by method_missing */
253  int inc_sp; /* used by cfunc */
254  } aux;
255 };
256 
257 #if 1
258 #define CoreDataFromValue(obj, type) (type*)DATA_PTR(obj)
259 #else
260 #define CoreDataFromValue(obj, type) (type*)rb_data_object_get(obj)
261 #endif
262 #define GetCoreDataFromValue(obj, type, ptr) ((ptr) = CoreDataFromValue((obj), type))
263 
264 typedef struct rb_iseq_location_struct {
269  VALUE first_lineno; /* TODO: may be unsigned short */
271 
273  enum iseq_type {
282  ISEQ_TYPE_DEFINED_GUARD
283  } type; /* instruction sequence type */
284 
285  unsigned int iseq_size;
286  const VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
287 
311  struct {
312  struct {
313  unsigned int has_lead : 1;
314  unsigned int has_opt : 1;
315  unsigned int has_rest : 1;
316  unsigned int has_post : 1;
317  unsigned int has_kw : 1;
318  unsigned int has_kwrest : 1;
319  unsigned int has_block : 1;
320 
321  unsigned int ambiguous_param0 : 1; /* {|a|} */
322  } flags;
323 
324  unsigned int size;
325 
326  int lead_num;
327  int opt_num;
330  int post_num;
332 
333  const VALUE *opt_table; /* (opt_num + 1) entries. */
334  /* opt_num and opt_table:
335  *
336  * def foo o1=e1, o2=e2, ..., oN=eN
337  * #=>
338  * # prologue code
339  * A1: e1
340  * A2: e2
341  * ...
342  * AN: eN
343  * AL: body
344  * opt_num = N
345  * opt_table = [A1, A2, ..., AN, AL]
346  */
347 
348  const struct rb_iseq_param_keyword {
349  int num;
352  int rest_start;
353  const ID *table;
355  } *keyword;
356  } param;
357 
359 
360  /* insn info, must be freed */
362 
363  const ID *local_table; /* must free */
364 
365  /* catch table */
366  const struct iseq_catch_table *catch_table;
367 
368  /* for child iseq */
370  struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */
371 
373  struct rb_call_info *ci_entries; /* struct rb_call_info ci_entries[ci_size];
374  * struct rb_call_info_with_kwarg cikw_entries[ci_kw_size];
375  * So that:
376  * struct rb_call_info_with_kwarg *cikw_entries = &body->ci_entries[ci_size];
377  */
378  struct rb_call_cache *cc_entries; /* size is ci_size = ci_kw_size */
379 
380  VALUE mark_ary; /* Array: includes operands which should be GC marked */
381 
382  unsigned int local_table_size;
383  unsigned int is_size;
384  unsigned int ci_size;
385  unsigned int ci_kw_size;
386  unsigned int line_info_size;
387  unsigned int stack_max; /* for stack overflow check */
388 };
389 
390 /* T_IMEMO/iseq */
391 /* typedef rb_iseq_t is in method.h */
396 
397  union { /* 4, 5 words */
398  struct iseq_compile_data *compile_data; /* used at compile time */
399 
400  struct {
402  int index;
403  } loader;
404  } aux;
405 };
406 
407 #ifndef USE_LAZY_LOAD
408 #define USE_LAZY_LOAD 0
409 #endif
410 
411 #if USE_LAZY_LOAD
412 const rb_iseq_t *rb_iseq_complete(const rb_iseq_t *iseq);
413 #endif
414 
415 static inline const rb_iseq_t *
417 {
418 #if USE_LAZY_LOAD
419  if (iseq->body == NULL) {
420  rb_iseq_complete((rb_iseq_t *)iseq);
421  }
422 #endif
423  return iseq;
424 }
425 
432 };
433 
459 
461 };
462 
463 #define GetVMPtr(obj, ptr) \
464  GetCoreDataFromValue((obj), rb_vm_t, (ptr))
465 
466 struct rb_vm_struct;
467 typedef void rb_vm_at_exit_func(struct rb_vm_struct*);
468 
469 typedef struct rb_at_exit_list {
473 
474 struct rb_objspace;
475 struct rb_objspace *rb_objspace_alloc(void);
476 void rb_objspace_free(struct rb_objspace *);
477 
478 typedef struct rb_hook_list_struct {
483 
484 typedef struct rb_vm_struct {
485  VALUE self;
486 
488  rb_nativethread_lock_t thread_destruct_lock;
489 
492 
493  struct list_head waiting_fds; /* <=> struct waiting_fd */
494  struct list_head living_threads;
497 
498  unsigned int running: 1;
499  unsigned int thread_abort_on_exception: 1;
500  unsigned int thread_report_on_exception: 1;
502  volatile int sleeper;
503 
504  /* object management */
506  const VALUE special_exceptions[ruby_special_error_count];
507 
508  /* load */
518 
519  /* signal */
520  struct {
522  int safe;
523  } trap_list[RUBY_NSIG];
524 
525  /* hook */
527 
528  /* relation table of ensure - rollback for callcc */
530 
531  /* postponed_job */
534 
536 
537  VALUE verbose, debug, orig_progname, progname;
539 
541 
543 
545 
548 
549  /* params */
550  struct { /* size in byte */
555  } default_params;
556 
557  short redefined_flag[BOP_LAST_];
558 } rb_vm_t;
559 
560 /* default values */
561 
562 #define RUBY_VM_SIZE_ALIGN 4096
563 
564 #define RUBY_VM_THREAD_VM_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
565 #define RUBY_VM_THREAD_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
566 #define RUBY_VM_THREAD_MACHINE_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
567 #define RUBY_VM_THREAD_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
568 
569 #define RUBY_VM_FIBER_VM_STACK_SIZE ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
570 #define RUBY_VM_FIBER_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
571 #define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 64 * 1024 * sizeof(VALUE)) /* 256 KB or 512 KB */
572 #define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
573 
574 /* optimize insn */
575 #define INTEGER_REDEFINED_OP_FLAG (1 << 0)
576 #define FLOAT_REDEFINED_OP_FLAG (1 << 1)
577 #define STRING_REDEFINED_OP_FLAG (1 << 2)
578 #define ARRAY_REDEFINED_OP_FLAG (1 << 3)
579 #define HASH_REDEFINED_OP_FLAG (1 << 4)
580 /* #define BIGNUM_REDEFINED_OP_FLAG (1 << 5) */
581 #define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
582 #define TIME_REDEFINED_OP_FLAG (1 << 7)
583 #define REGEXP_REDEFINED_OP_FLAG (1 << 8)
584 #define NIL_REDEFINED_OP_FLAG (1 << 9)
585 #define TRUE_REDEFINED_OP_FLAG (1 << 10)
586 #define FALSE_REDEFINED_OP_FLAG (1 << 11)
587 
588 #define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0))
589 
590 #ifndef VM_DEBUG_BP_CHECK
591 #define VM_DEBUG_BP_CHECK 0
592 #endif
593 
594 #ifndef VM_DEBUG_VERIFY_METHOD_CACHE
595 #define VM_DEBUG_VERIFY_METHOD_CACHE (VM_DEBUG_MODE != 0)
596 #endif
597 
599  VALUE self;
600  const VALUE *ep;
601  union {
602  const rb_iseq_t *iseq;
603  const struct vm_ifunc *ifunc;
605  } code;
606 };
607 
613 };
614 
620 };
621 
622 struct rb_block {
623  union {
624  struct rb_captured_block captured;
627  } as;
628  enum rb_block_type type;
629 };
630 
631 typedef struct rb_control_frame_struct {
632  const VALUE *pc; /* cfp[0] */
633  VALUE *sp; /* cfp[1] */
634  const rb_iseq_t *iseq; /* cfp[2] */
635  VALUE self; /* cfp[3] / block[0] */
636  const VALUE *ep; /* cfp[4] / block[1] */
637  const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc */
638 
639 #if VM_DEBUG_BP_CHECK
640  VALUE *bp_check; /* cfp[6] */
641 #endif
643 
645 
646 #define GetThreadPtr(obj, ptr) \
647  TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))
648 
654 };
655 
656 typedef RUBY_JMP_BUF rb_jmpbuf_t;
657 
658 /*
659  the members which are written in TH_PUSH_TAG() should be placed at
660  the beginning and the end, so that entire region is accessible.
661 */
662 struct rb_vm_tag {
666  struct rb_vm_tag *prev;
667 };
668 
671 };
672 
675  void *arg;
676 };
677 
678 struct rb_mutex_struct;
679 
680 typedef struct rb_thread_list_struct{
684 
685 typedef struct rb_ensure_entry {
687  VALUE (*e_proc)(ANYARGS);
690 
691 typedef struct rb_ensure_list {
693  struct rb_ensure_entry entry;
695 
696 typedef char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) * 2 + 3];
697 
699 
700 typedef struct rb_thread_struct {
701  struct list_node vmlt_node;
702  VALUE self;
704 
705  /* execution information */
706  VALUE *stack; /* must free, must mark */
707  size_t stack_size; /* size in word (byte size / sizeof(VALUE)) */
711  VALUE last_status; /* $? */
712 
713  /* passing state */
714  int state;
715 
716  /* for rb_iterate */
718 
719  /* for bmethod */
721 
722  /* for cfunc */
724 
725  /* for load(true) */
728 
729  /* eval env */
730  const VALUE *root_lep;
732 
733  /* thread control */
734  rb_nativethread_id_t thread_id;
735 #ifdef NON_SCALAR_THREAD_ID
736  rb_thread_id_string_t thread_id_string;
737 #endif
738  enum rb_thread_status status;
739  int to_kill;
740  int priority;
741 
744 
747 
748  /* temporary place of errinfo */
750 
751  /* temporary place of retval on OPT_CALL_THREADED_CODE */
752 #if OPT_CALL_THREADED_CODE
753  VALUE retval;
754 #endif
755 
756  /* async errinfo queue */
760 
762  unsigned long interrupt_mask;
763  rb_nativethread_lock_t interrupt_lock;
765  struct rb_unblock_callback unblock;
768 
769  struct rb_vm_tag *tag;
771 
772  /* storage */
776 
778 
781  VALUE (*first_func)(ANYARGS);
782 
783  /* for GC */
784  struct {
788 #ifdef __ia64
789  VALUE *register_stack_start;
790  VALUE *register_stack_end;
791  size_t register_stack_maxsize;
792 #endif
793  jmp_buf regs;
794  } machine;
795 
796  /* statistics data for profiler */
798 
799  /* tracer */
801  struct rb_trace_arg_struct *trace_arg; /* trace information */
802 
803  /* fiber */
807 
808  /* ensure & callcc */
810 
811  /* misc */
813  unsigned int abort_on_exception: 1;
814  unsigned int report_on_exception: 1;
815 #ifdef USE_SIGALTSTACK
816  void *altstack;
817 #endif
818  unsigned long running_time_us;
820 } rb_thread_t;
821 
822 typedef enum {
826  /* 0x03..0x06 is reserved */
829 
830 #define VM_DEFINECLASS_TYPE(x) ((rb_vm_defineclass_type_t)(x) & VM_DEFINECLASS_TYPE_MASK)
831 #define VM_DEFINECLASS_FLAG_SCOPED 0x08
832 #define VM_DEFINECLASS_FLAG_HAS_SUPERCLASS 0x10
833 #define VM_DEFINECLASS_SCOPED_P(x) ((x) & VM_DEFINECLASS_FLAG_SCOPED)
834 #define VM_DEFINECLASS_HAS_SUPERCLASS_P(x) \
835  ((x) & VM_DEFINECLASS_FLAG_HAS_SUPERCLASS)
836 
837 /* iseq.c */
839 
840 /* node -> iseq */
841 rb_iseq_t *rb_iseq_new(NODE*, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type);
842 rb_iseq_t *rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, const rb_iseq_t *parent);
843 rb_iseq_t *rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path, const rb_iseq_t *parent);
845 rb_iseq_t *rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*);
846 
847 /* src -> iseq */
848 rb_iseq_t *rb_iseq_compile(VALUE src, VALUE file, VALUE line);
849 rb_iseq_t *rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, const struct rb_block *base_block);
850 rb_iseq_t *rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, const struct rb_block *base_block, VALUE opt);
851 
852 VALUE rb_iseq_disasm(const rb_iseq_t *iseq);
853 int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);
854 const char *ruby_node_name(int node);
855 
856 VALUE rb_iseq_coverage(const rb_iseq_t *iseq);
857 
862 
863 #define GetProcPtr(obj, ptr) \
864  GetCoreDataFromValue((obj), rb_proc_t, (ptr))
865 
866 typedef struct {
867  const struct rb_block block;
868  int8_t safe_level; /* 0..1 */
869  int8_t is_from_method; /* bool */
870  int8_t is_lambda; /* bool */
871 } rb_proc_t;
872 
873 typedef struct {
874  VALUE flags; /* imemo header */
875  const rb_iseq_t *iseq;
876  const VALUE *ep;
877  const VALUE *env;
878  unsigned int env_size;
879 } rb_env_t;
880 
882 
883 #define GetBindingPtr(obj, ptr) \
884  GetCoreDataFromValue((obj), rb_binding_t, (ptr))
885 
886 typedef struct {
887  struct rb_block block;
889  unsigned short first_lineno;
890 } rb_binding_t;
891 
892 /* used by compile time and send insn */
893 
898 };
899 
900 #define VM_CHECKMATCH_TYPE_MASK 0x03
901 #define VM_CHECKMATCH_ARRAY 0x04
902 
903 #define VM_CALL_ARGS_SPLAT (0x01 << 0) /* m(*args) */
904 #define VM_CALL_ARGS_BLOCKARG (0x01 << 1) /* m(&block) */
905 #define VM_CALL_FCALL (0x01 << 2) /* m(...) */
906 #define VM_CALL_VCALL (0x01 << 3) /* m */
907 #define VM_CALL_ARGS_SIMPLE (0x01 << 4) /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */
908 #define VM_CALL_BLOCKISEQ (0x01 << 5) /* has blockiseq */
909 #define VM_CALL_KWARG (0x01 << 6) /* has kwarg */
910 #define VM_CALL_TAILCALL (0x01 << 7) /* located at tail position */
911 #define VM_CALL_SUPER (0x01 << 8) /* super */
912 #define VM_CALL_OPT_SEND (0x01 << 9) /* internal flag */
913 
918 };
919 
921  VM_SVAR_LASTLINE = 0, /* $_ */
922  VM_SVAR_BACKREF = 1, /* $~ */
923 
925  VM_SVAR_FLIPFLOP_START = 2 /* flipflop */
926 };
927 
928 /* inline cache */
929 typedef struct iseq_inline_cache_entry *IC;
930 typedef struct rb_call_info *CALL_INFO;
931 typedef struct rb_call_cache *CALL_CACHE;
932 
933 void rb_vm_change_state(void);
934 
935 typedef VALUE CDHASH;
936 
937 #ifndef FUNC_FASTCALL
938 #define FUNC_FASTCALL(x) x
939 #endif
940 
941 typedef rb_control_frame_t *
943 
944 #define VM_TAGGED_PTR_SET(p, tag) ((VALUE)(p) | (tag))
945 #define VM_TAGGED_PTR_REF(v, mask) ((void *)((v) & ~mask))
946 
947 #define GC_GUARDED_PTR(p) VM_TAGGED_PTR_SET((p), 0x01)
948 #define GC_GUARDED_PTR_REF(p) VM_TAGGED_PTR_REF((p), 0x03)
949 #define GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01)
950 
951 enum {
952  /* Frame/Environment flag bits:
953  * MMMM MMMM MMMM MMMM ____ ____ FFFF EEEX (LSB)
954  *
955  * X : tag for GC marking (It seems as Fixnum)
956  * EEE : 3 bits Env flags
957  * FFFF: 4 bits Frame flags
958  * MMMM: 16 bits frame magic (to check frame corruption)
959  */
960 
961  /* frame types */
962  VM_FRAME_MAGIC_METHOD = 0x11110001,
963  VM_FRAME_MAGIC_BLOCK = 0x22220001,
964  VM_FRAME_MAGIC_CLASS = 0x33330001,
965  VM_FRAME_MAGIC_TOP = 0x44440001,
966  VM_FRAME_MAGIC_CFUNC = 0x55550001,
967  VM_FRAME_MAGIC_PROC = 0x66660001,
968  VM_FRAME_MAGIC_IFUNC = 0x77770001,
969  VM_FRAME_MAGIC_EVAL = 0x88880001,
970  VM_FRAME_MAGIC_LAMBDA = 0x99990001,
971  VM_FRAME_MAGIC_RESCUE = 0xaaaa0001,
972  VM_FRAME_MAGIC_DUMMY = 0xbbbb0001,
973 
974  VM_FRAME_MAGIC_MASK = 0xffff0001,
975 
976  /* frame flag */
981 
982  /* env flag */
986 };
987 
988 #define VM_ENV_DATA_SIZE ( 3)
989 
990 #define VM_ENV_DATA_INDEX_ME_CREF (-2) /* ep[-2] */
991 #define VM_ENV_DATA_INDEX_SPECVAL (-1) /* ep[-1] */
992 #define VM_ENV_DATA_INDEX_FLAGS ( 0) /* ep[ 0] */
993 #define VM_ENV_DATA_INDEX_ENV ( 1) /* ep[ 1] */
994 #define VM_ENV_DATA_INDEX_ENV_PROC ( 2) /* ep[ 2] */
995 
996 #define VM_ENV_INDEX_LAST_LVAR (-VM_ENV_DATA_SIZE)
997 
998 static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value);
999 
1000 static inline void
1001 VM_ENV_FLAGS_SET(const VALUE *ep, VALUE flag)
1002 {
1003  VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
1004  VM_ASSERT(FIXNUM_P(flags));
1006 }
1007 
1008 static inline void
1010 {
1011  VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
1012  VM_ASSERT(FIXNUM_P(flags));
1014 }
1015 
1016 static inline unsigned long
1017 VM_ENV_FLAGS(const VALUE *ep, long flag)
1018 {
1019  VALUE flags = ep[VM_ENV_DATA_INDEX_FLAGS];
1020  VM_ASSERT(FIXNUM_P(flags));
1021  return flags & flag;
1022 }
1023 
1024 static inline unsigned long
1026 {
1027  return VM_ENV_FLAGS(cfp->ep, VM_FRAME_MAGIC_MASK);
1028 }
1029 
1030 static inline int
1032 {
1033  return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_FINISH ) != 0;
1034 }
1035 
1036 static inline int
1038 {
1039  return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_BMETHOD) != 0;
1040 }
1041 
1042 static inline int
1044 {
1045  return RB_TYPE_P(iseq, T_IMEMO) && imemo_type(iseq) == imemo_iseq;
1046 }
1047 
1048 #if VM_CHECK_MODE > 0
1049 #define RUBY_VM_NORMAL_ISEQ_P(iseq) rb_obj_is_iseq((VALUE)iseq)
1050 #endif
1051 
1052 static inline int
1054 {
1055  int cframe_p = VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME) != 0;
1056  VM_ASSERT(RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) != cframe_p);
1057  return cframe_p;
1058 }
1059 
1060 static inline int
1062 {
1063  return !VM_FRAME_CFRAME_P(cfp);
1064 }
1065 
1066 #define RUBYVM_CFUNC_FRAME_P(cfp) \
1067  (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
1068 
1069 #define VM_GUARDED_PREV_EP(ep) GC_GUARDED_PTR(ep)
1070 #define VM_BLOCK_HANDLER_NONE 0
1071 
1072 static inline int
1074 {
1075  return VM_ENV_FLAGS(ep, VM_ENV_FLAG_LOCAL) ? 1 : 0;
1076 }
1077 
1078 static inline const VALUE *
1080 {
1081  VM_ASSERT(VM_ENV_LOCAL_P(ep) == 0);
1083 }
1084 
1085 static inline VALUE
1087 {
1089  return ep[VM_ENV_DATA_INDEX_SPECVAL];
1090 }
1091 
1092 #if VM_CHECK_MODE > 0
1093 int rb_vm_ep_in_heap_p(const VALUE *ep);
1094 #endif
1095 
1096 static inline int
1098 {
1099  VM_ASSERT(rb_vm_ep_in_heap_p(ep) == !!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED));
1100  return VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) ? 1 : 0;
1101 }
1102 
1103 #if VM_CHECK_MODE > 0
1104 static inline int
1105 vm_assert_env(VALUE obj)
1106 {
1107  VM_ASSERT(RB_TYPE_P(obj, T_IMEMO));
1108  VM_ASSERT(imemo_type(obj) == imemo_env);
1109  return 1;
1110 }
1111 #endif
1112 
1113 static inline VALUE
1115 {
1116  VALUE envval = ep[VM_ENV_DATA_INDEX_ENV];
1118  VM_ASSERT(vm_assert_env(envval));
1119  return envval;
1120 }
1121 
1122 static inline const rb_env_t *
1124 {
1125  return (const rb_env_t *)VM_ENV_ENVVAL(ep);
1126 }
1127 
1128 static inline VALUE
1130 {
1134 
1135  return ep[VM_ENV_DATA_INDEX_ENV_PROC];
1136 }
1137 
1138 static inline const rb_env_t *
1139 vm_env_new(VALUE *env_ep, VALUE *env_body, unsigned int env_size, const rb_iseq_t *iseq)
1140 {
1141  rb_env_t *env = (rb_env_t *)rb_imemo_new(imemo_env, (VALUE)env_ep, (VALUE)env_body, 0, (VALUE)iseq);
1142  env->env_size = env_size;
1143  env_ep[VM_ENV_DATA_INDEX_ENV] = (VALUE)env;
1144  return env;
1145 }
1146 
1147 static inline void
1149 {
1150  *((VALUE *)ptr) = v;
1151 }
1152 
1153 static inline void
1154 VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value)
1155 {
1156  VM_ASSERT(RB_SPECIAL_CONST_P(special_const_value));
1157  VM_FORCE_WRITE(ptr, special_const_value);
1158 }
1159 
1160 static inline void
1162 {
1164  VM_FORCE_WRITE(&ep[index], v);
1165 }
1166 
1167 const VALUE *rb_vm_ep_local_ep(const VALUE *ep);
1168 const VALUE *rb_vm_proc_local_ep(VALUE proc);
1169 
1171 
1172 #define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1)
1173 #define RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1)
1174 #define RUBY_VM_END_CONTROL_FRAME(th) \
1175  ((rb_control_frame_t *)((th)->stack + (th)->stack_size))
1176 #define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
1177  ((void *)(ecfp) > (void *)(cfp))
1178 #define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
1179  (!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
1180 
1181 static inline int
1183 {
1184  if ((block_handler & 0x03) == 0x01) {
1185 #if VM_CHECK_MODE > 0
1186  struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1187  VM_ASSERT(RB_TYPE_P(captured->code.val, T_IMEMO));
1188  VM_ASSERT(imemo_type(captured->code.val) == imemo_iseq);
1189 #endif
1190  return 1;
1191  }
1192  else {
1193  return 0;
1194  }
1195 }
1196 
1197 static inline VALUE
1199 {
1200  VALUE block_handler = VM_TAGGED_PTR_SET(captured, 0x01);
1201  VM_ASSERT(VM_BH_ISEQ_BLOCK_P(block_handler));
1202  return block_handler;
1203 }
1204 
1205 static inline const struct rb_captured_block *
1207 {
1208  struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1209  VM_ASSERT(VM_BH_ISEQ_BLOCK_P(block_handler));
1210  return captured;
1211 }
1212 
1213 static inline int
1214 VM_BH_IFUNC_P(VALUE block_handler)
1215 {
1216  if ((block_handler & 0x03) == 0x03) {
1217 #if VM_CHECK_MODE > 0
1218  struct rb_captured_block *captured = (void *)(block_handler & ~0x03);
1219  VM_ASSERT(RB_TYPE_P(captured->code.val, T_IMEMO));
1220  VM_ASSERT(imemo_type(captured->code.val) == imemo_ifunc);
1221 #endif
1222  return 1;
1223  }
1224  else {
1225  return 0;
1226  }
1227 }
1228 
1229 static inline VALUE
1231 {
1232  VALUE block_handler = VM_TAGGED_PTR_SET(captured, 0x03);
1233  VM_ASSERT(VM_BH_IFUNC_P(block_handler));
1234  return block_handler;
1235 }
1236 
1237 static inline const struct rb_captured_block *
1239 {
1240  struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1241  VM_ASSERT(VM_BH_IFUNC_P(block_handler));
1242  return captured;
1243 }
1244 
1245 static inline const struct rb_captured_block *
1247 {
1248  struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1249  VM_ASSERT(VM_BH_IFUNC_P(block_handler) || VM_BH_ISEQ_BLOCK_P(block_handler));
1250  return captured;
1251 }
1252 
1253 static inline enum rb_block_handler_type
1255 {
1256  if (VM_BH_ISEQ_BLOCK_P(block_handler)) {
1257  return block_handler_type_iseq;
1258  }
1259  else if (VM_BH_IFUNC_P(block_handler)) {
1260  return block_handler_type_ifunc;
1261  }
1262  else if (SYMBOL_P(block_handler)) {
1264  }
1265  else {
1266  VM_ASSERT(rb_obj_is_proc(block_handler));
1267  return block_handler_type_proc;
1268  }
1269 }
1270 
1271 static inline int
1273 {
1274  VM_ASSERT(block_handler == VM_BLOCK_HANDLER_NONE ||
1275  vm_block_handler_type(block_handler) >= 0);
1276  return 1;
1277 }
1278 
1279 static inline enum rb_block_type
1280 vm_block_type(const struct rb_block *block)
1281 {
1282 #if VM_CHECK_MODE > 0
1283  switch (block->type) {
1284  case block_type_iseq:
1287  break;
1288  case block_type_ifunc:
1291  break;
1292  case block_type_symbol:
1293  VM_ASSERT(SYMBOL_P(block->as.symbol));
1294  break;
1295  case block_type_proc:
1296  VM_ASSERT(rb_obj_is_proc(block->as.proc));
1297  break;
1298  }
1299 #endif
1300  return block->type;
1301 }
1302 
1303 static inline void
1304 vm_block_type_set(const struct rb_block *block, enum rb_block_type type)
1305 {
1306  struct rb_block *mb = (struct rb_block *)block;
1307  mb->type = type;
1308 }
1309 
1310 static inline const struct rb_block *
1312 {
1313  rb_proc_t *proc = RTYPEDDATA_DATA(procval);
1314  VM_ASSERT(rb_obj_is_proc(procval));
1315  return &proc->block;
1316 }
1317 
1318 static inline const rb_iseq_t *vm_block_iseq(const struct rb_block *block);
1319 static inline const VALUE *vm_block_ep(const struct rb_block *block);
1320 
1321 static inline const rb_iseq_t *
1323 {
1324  VM_ASSERT(rb_obj_is_proc(procval));
1325  return vm_block_iseq(vm_proc_block(procval));
1326 }
1327 
1328 static inline const VALUE *
1330 {
1331  return vm_block_ep(vm_proc_block(procval));
1332 }
1333 
1334 static inline const rb_iseq_t *
1335 vm_block_iseq(const struct rb_block *block)
1336 {
1337  switch (vm_block_type(block)) {
1338  case block_type_iseq: return block->as.captured.code.iseq;
1339  case block_type_proc: return vm_proc_iseq(block->as.proc);
1340  case block_type_ifunc:
1341  case block_type_symbol: return NULL;
1342  }
1343  VM_UNREACHABLE(vm_block_iseq);
1344  return NULL;
1345 }
1346 
1347 static inline const VALUE *
1348 vm_block_ep(const struct rb_block *block)
1349 {
1350  switch (vm_block_type(block)) {
1351  case block_type_iseq:
1352  case block_type_ifunc: return block->as.captured.ep;
1353  case block_type_proc: return vm_proc_ep(block->as.proc);
1354  case block_type_symbol: return NULL;
1355  }
1356  VM_UNREACHABLE(vm_block_ep);
1357  return NULL;
1358 }
1359 
1360 static inline VALUE
1361 vm_block_self(const struct rb_block *block)
1362 {
1363  switch (vm_block_type(block)) {
1364  case block_type_iseq:
1365  case block_type_ifunc:
1366  return block->as.captured.self;
1367  case block_type_proc:
1368  return vm_block_self(vm_proc_block(block->as.proc));
1369  case block_type_symbol:
1370  return Qundef;
1371  }
1373  return Qundef;
1374 }
1375 
1376 static inline VALUE
1377 VM_BH_TO_SYMBOL(VALUE block_handler)
1378 {
1379  VM_ASSERT(SYMBOL_P(block_handler));
1380  return block_handler;
1381 }
1382 
1383 static inline VALUE
1385 {
1386  VM_ASSERT(SYMBOL_P(symbol));
1387  return symbol;
1388 }
1389 
1390 static inline VALUE
1391 VM_BH_TO_PROC(VALUE block_handler)
1392 {
1393  VM_ASSERT(rb_obj_is_proc(block_handler));
1394  return block_handler;
1395 }
1396 
1397 static inline VALUE
1399 {
1400  VM_ASSERT(rb_obj_is_proc(procval));
1401  return procval;
1402 }
1403 
1404 /* VM related object allocate functions */
1405 VALUE rb_thread_alloc(VALUE klass);
1406 VALUE rb_proc_alloc(VALUE klass);
1408 
1409 /* for debug */
1411 extern void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp, const VALUE *_pc);
1413 
1414 #define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
1415 #define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
1416 void rb_vm_bugreport(const void *);
1417 NORETURN(void rb_bug_context(const void *, const char *fmt, ...));
1418 
1419 /* functions about thread/vm execution */
1421 VALUE rb_iseq_eval(const rb_iseq_t *iseq);
1422 VALUE rb_iseq_eval_main(const rb_iseq_t *iseq);
1424 int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, ID *called_idp, VALUE *klassp);
1425 
1426 VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, int argc, const VALUE *argv, VALUE block_handler);
1427 VALUE rb_vm_make_proc_lambda(rb_thread_t *th, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda);
1431 const rb_env_t *rb_vm_env_prev_env(const rb_env_t *env);
1432 const VALUE *rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars);
1434 void rb_vm_gvl_destroy(rb_vm_t *vm);
1435 VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc,
1436  const VALUE *argv, const rb_callable_method_entry_t *me);
1437 void rb_vm_pop_frame(rb_thread_t *th);
1438 
1439 void rb_thread_start_timer_thread(void);
1440 void rb_thread_stop_timer_thread(void);
1441 void rb_thread_reset_timer_thread(void);
1443 
1444 static inline void
1446 {
1447  list_head_init(&vm->waiting_fds);
1448  list_head_init(&vm->living_threads);
1449  vm->living_thread_num = 0;
1450 }
1451 
1452 static inline void
1454 {
1455  list_add_tail(&vm->living_threads, &th->vmlt_node);
1456  vm->living_thread_num++;
1457 }
1458 
1459 static inline void
1461 {
1462  list_del(&th->vmlt_node);
1463  vm->living_thread_num--;
1464 }
1465 
1466 typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
1470 VALUE rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method);
1473 int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp);
1475 
1476 void rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE exception_class, const char *mesg);
1477 
1479 
1481 
1482 void rb_vm_rewrite_cref(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr);
1483 
1485 
1486 #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
1487 
1488 #define RUBY_CONST_ASSERT(expr) (1/!!(expr)) /* expr must be a compile-time constant */
1489 #define VM_STACK_OVERFLOWED_P(cfp, sp, margin) \
1490  (!RUBY_CONST_ASSERT(sizeof(*(sp)) == sizeof(VALUE)) || \
1491  !RUBY_CONST_ASSERT(sizeof(*(cfp)) == sizeof(rb_control_frame_t)) || \
1492  ((rb_control_frame_t *)((sp) + (margin)) + 1) >= (cfp))
1493 #define WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) \
1494  if (LIKELY(!VM_STACK_OVERFLOWED_P(cfp, sp, margin))) {(void)0;} else /* overflowed */
1495 #define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) \
1496  WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) vm_stackoverflow()
1497 #define CHECK_VM_STACK_OVERFLOW(cfp, margin) \
1498  WHEN_VM_STACK_OVERFLOWED(cfp, (cfp)->sp, margin) vm_stackoverflow()
1499 
1500 /* for thread */
1501 
1502 #if RUBY_VM_THREAD_MODEL == 2
1504 extern rb_vm_t *ruby_current_vm;
1506 
1507 #define GET_VM() ruby_current_vm
1508 
1509 #ifndef OPT_CALL_CFUNC_WITHOUT_FRAME
1510 #define OPT_CALL_CFUNC_WITHOUT_FRAME 0
1511 #endif
1512 
1513 #define GET_THREAD() vm_thread_with_frame(ruby_current_thread)
1514 #if OPT_CALL_CFUNC_WITHOUT_FRAME
1515 static inline rb_thread_t *
1517 {
1518  if (UNLIKELY(th->passed_ci != 0)) {
1519  void rb_vm_call_cfunc_push_frame(rb_thread_t *th);
1520  rb_vm_call_cfunc_push_frame(th);
1521  }
1522  return th;
1523 }
1524 #else
1525 #define vm_thread_with_frame(th) (th)
1526 #endif
1527 
1528 #define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
1529 #define rb_thread_set_current(th) do { \
1530  if ((th)->vm->running_thread != (th)) { \
1531  (th)->running_time_us = 0; \
1532  } \
1533  rb_thread_set_current_raw(th); \
1534  (th)->vm->running_thread = (th); \
1535 } while (0)
1536 
1537 #else
1538 #error "unsupported thread model"
1539 #endif
1540 
1541 enum {
1546 };
1547 
1548 #define RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TIMER_INTERRUPT_MASK)
1549 #define RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, PENDING_INTERRUPT_MASK)
1550 #define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
1551 #define RUBY_VM_SET_TRAP_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TRAP_INTERRUPT_MASK)
1552 #define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & ~(th)->interrupt_mask & (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
1553 #define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
1554 
1556 int rb_signal_buff_size(void);
1557 void rb_signal_exec(rb_thread_t *th, int sig);
1559 void rb_threadptr_signal_raise(rb_thread_t *th, int sig);
1567 void rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo);
1568 
1569 #define RUBY_VM_CHECK_INTS(th) ruby_vm_check_ints(th)
1570 static inline void
1572 {
1573  if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) {
1575  }
1576 }
1577 
1578 /* tracer */
1583  VALUE self;
1588 
1590 
1591  /* calc from cfp */
1592  int lineno;
1594 };
1595 
1596 void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg);
1598 
1599 #define EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, called_id_, klass_, data_, pop_p_) do { \
1600  const rb_event_flag_t flag_arg_ = (flag_); \
1601  if (UNLIKELY(ruby_vm_event_flags & (flag_arg_))) { \
1602  /* defer evaluating the other arguments */ \
1603  ruby_exec_event_hook_orig(th_, flag_arg_, self_, id_, called_id_, klass_, data_, pop_p_); \
1604  } \
1605 } while (0)
1606 
1607 static inline void
1609  VALUE self, ID id, ID called_id, VALUE klass, VALUE data, int pop_p)
1610 {
1611  if ((th->event_hooks.events | th->vm->event_hooks.events) & flag) {
1612  struct rb_trace_arg_struct trace_arg;
1613  trace_arg.event = flag;
1614  trace_arg.th = th;
1615  trace_arg.cfp = th->cfp;
1616  trace_arg.self = self;
1617  trace_arg.id = id;
1618  trace_arg.called_id = called_id;
1619  trace_arg.klass = klass;
1620  trace_arg.data = data;
1621  trace_arg.path = Qundef;
1622  trace_arg.klass_solved = 0;
1623  if (pop_p) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg);
1624  else rb_threadptr_exec_event_hooks(&trace_arg);
1625  }
1626 }
1627 
1628 #define EXEC_EVENT_HOOK(th_, flag_, self_, id_, called_id_, klass_, data_) \
1629  EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, called_id_, klass_, data_, 0)
1630 
1631 #define EXEC_EVENT_HOOK_AND_POP_FRAME(th_, flag_, self_, id_, called_id_, klass_, data_) \
1632  EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, called_id_, klass_, data_, 1)
1633 
1635 
1637 
1638 extern VALUE rb_get_coverages(void);
1639 extern void rb_set_coverages(VALUE);
1640 extern void rb_reset_coverages(void);
1641 
1643 
1645 
1646 #endif /* RUBY_VM_CORE_H */
void rb_thread_stop_timer_thread(void)
Definition: thread.c:4073
rb_control_frame_t * cfp
Definition: vm_core.h:708
unsigned int stack_max
Definition: vm_core.h:387
static int VM_ENV_ESCAPED_P(const VALUE *ep)
Definition: vm_core.h:1097
void rb_objspace_free(struct rb_objspace *)
Definition: gc.c:1321
rb_thread_list_t * join_list
Definition: vm_core.h:777
union iseq_inline_storage_entry * is_entries
Definition: vm_core.h:372
struct rb_ensure_entry rb_ensure_entry_t
VALUE * stack_end
Definition: vm_core.h:786
const VALUE * ep
Definition: vm_core.h:636
unsigned long running_time_us
Definition: vm_core.h:818
rb_vm_t * vm
Definition: vm_core.h:703
VALUE rb_get_coverages(void)
Definition: thread.c:5004
VALUE expanded_load_path
Definition: vm_core.h:513
VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc, const VALUE *argv, const rb_callable_method_entry_t *me)
Definition: vm_eval.c:255
void rb_threadptr_pending_interrupt_clear(rb_thread_t *th)
Definition: thread.c:1587
void rb_threadptr_signal_raise(rb_thread_t *th, int sig)
Definition: thread.c:2142
const VALUE * default_values
Definition: vm_core.h:354
VALUE passed_block_handler
Definition: vm_core.h:717
void rb_postponed_job_flush(rb_vm_t *vm)
Definition: vm_trace.c:1606
ruby_tag_type
Definition: vm_core.h:152
struct rb_vm_protect_tag * protect_tag
Definition: vm_core.h:770
struct rb_thread_struct * running_thread
Definition: vm_core.h:491
Definition: st.h:79
VALUE cmd
Definition: vm_core.h:521
st_table * local_storage
Definition: vm_core.h:773
void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th)
Definition: thread.c:455
int pending_interrupt_queue_checked
Definition: vm_core.h:759
const rb_callable_method_entry_t * me
Definition: vm_core.h:246
VALUE rb_proc_alloc(VALUE klass)
Definition: proc.c:110
VALUE value
Definition: vm_core.h:198
unsigned int has_lead
Definition: vm_core.h:313
const VALUE * rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars)
Definition: vm.c:920
VALUE rb_iseq_disasm(const rb_iseq_t *iseq)
Definition: iseq.c:1487
unsigned int is_size
Definition: vm_core.h:383
VALUE rb_iseq_eval_main(const rb_iseq_t *iseq)
Definition: vm.c:2014
VALUE top_self
Definition: vm_core.h:509
static int VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
Definition: vm_core.h:1031
int8_t safe_level
Definition: vm_core.h:868
struct rb_thread_struct * th
Definition: vm_core.h:682
void rb_unblock_function_t(void *)
Definition: intern.h:895
void rb_thread_start_timer_thread(void)
Definition: thread.c:4087
VALUE rb_vm_frame_block_handler(const rb_control_frame_t *cfp)
Definition: vm.c:82
rb_unblock_function_t * func
Definition: vm_core.h:674
RUBY_SYMBOL_EXPORT_END int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, ID *called_idp, VALUE *klassp)
Definition: vm.c:2041
const VALUE * env
Definition: vm_core.h:877
VALUE symbol
Definition: vm_core.h:625
union iseq_inline_cache_entry::@193 ic_value
struct iseq_compile_data * compile_data
Definition: vm_core.h:398
struct st_table * loaded_features_index
Definition: vm_core.h:516
static const rb_iseq_t * rb_iseq_check(const rb_iseq_t *iseq)
Definition: vm_core.h:416
struct list_node vmlt_node
Definition: vm_core.h:701
vm_check_match_type
Definition: vm_core.h:894
static const VALUE * vm_proc_ep(VALUE procval)
Definition: vm_core.h:1329
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
Definition: gc.c:1971
rb_iseq_t * rb_iseq_compile(VALUE src, VALUE file, VALUE line)
Definition: iseq.c:658
VALUE pending_interrupt_mask_stack
Definition: vm_core.h:758
jmp_buf regs
Definition: vm_core.h:793
VALUE reserved1
Definition: vm_core.h:394
static void rb_vm_living_threads_insert(rb_vm_t *vm, rb_thread_t *th)
Definition: vm_core.h:1453
const int id
Definition: nkf.c:209
const rb_callable_method_entry_t * rb_vm_frame_method_entry(const rb_control_frame_t *cfp)
RUBY_EXTERN VALUE rb_cRubyVM
Definition: vm_core.h:859
static const rb_iseq_t * vm_proc_iseq(VALUE procval)
Definition: vm_core.h:1322
VALUE * defined_strings
Definition: vm_core.h:546
#define VM_ENV_DATA_INDEX_ENV_PROC
Definition: vm_core.h:994
VALUE rb_thread_alloc(VALUE klass)
Definition: vm.c:2564
VALUE data2
Definition: vm_core.h:688
rb_thread_t * th
Definition: vm_core.h:1581
VALUE rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method)
Definition: error.c:1354
VALUE mark_object_ary
Definition: vm_core.h:505
#define RUBY_NSIG
Definition: vm_core.h:98
rb_iseq_t * rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, const struct rb_block *base_block, VALUE opt)
Definition: iseq.c:610
const rb_data_type_t ruby_binding_data_type
Definition: proc.c:297
int rb_autoloading_value(VALUE mod, ID id, VALUE *value)
Definition: variable.c:2062
const rb_iseq_t * iseq
Definition: vm_core.h:875
const ID * local_table
Definition: vm_core.h:363
#define VM_BLOCK_HANDLER_NONE
Definition: vm_core.h:1070
#define RB_SPECIAL_CONST_P(x)
Definition: ruby.h:1248
static VALUE VM_BH_TO_SYMBOL(VALUE block_handler)
Definition: vm_core.h:1377
size_t fiber_machine_stack_size
Definition: vm_core.h:554
unsigned int report_on_exception
Definition: vm_core.h:814
struct rb_iseq_constant_body * body
Definition: vm_core.h:395
rb_vm_t * ruby_current_vm
Definition: vm.c:317
#define debug(lvl, x...)
Definition: ffi.c:52
VALUE verbose
Definition: vm_core.h:537
void ruby_thread_init_stack(rb_thread_t *th)
Definition: thread.c:552
st_table * frozen_strings
Definition: vm_core.h:547
struct rb_call_info_kw_arg * kw_arg
Definition: vm_core.h:228
unsigned int index
Definition: vm_core.h:251
rb_at_exit_list * at_exit
Definition: vm_core.h:544
#define VM_TAGGED_PTR_REF(v, mask)
Definition: vm_core.h:945
struct rb_hook_list_struct rb_hook_list_t
const VALUE * ep
Definition: vm_core.h:876
struct rb_vm_protect_tag * prev
Definition: vm_core.h:670
unsigned int flag
Definition: vm_core.h:217
static int VM_FRAME_CFRAME_P(const rb_control_frame_t *cfp)
Definition: vm_core.h:1053
rb_fiber_t * root_fiber
Definition: vm_core.h:805
struct rb_control_frame_struct rb_control_frame_t
rb_vm_at_exit_func * func
Definition: vm_core.h:470
VALUE last_status
Definition: vm_core.h:711
static void rb_vm_living_threads_remove(rb_vm_t *vm, rb_thread_t *th)
Definition: vm_core.h:1460
static void ruby_vm_check_ints(rb_thread_t *th)
Definition: vm_core.h:1571
vm_call_handler call
Definition: vm_core.h:248
VALUE local_storage_recursive_hash_for_trace
Definition: vm_core.h:775
VALUE rb_vm_make_proc(rb_thread_t *th, const struct rb_captured_block *captured, VALUE klass)
Definition: vm.c:863
static int VM_ENV_LOCAL_P(const VALUE *ep)
Definition: vm_core.h:1073
Definition: vm_core.h:685
unsigned int has_kwrest
Definition: vm_core.h:318
struct rb_thread_list_struct rb_thread_list_t
rb_vm_defineclass_type_t
Definition: vm_core.h:822
static int VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
Definition: vm_core.h:1061
rb_event_flag_t events
Definition: vm_core.h:480
#define FIXNUM_P(f)
Definition: ruby.h:365
void rb_vm_rewrite_cref(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr)
void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *)
Definition: vm_dump.c:146
VALUE value
Definition: vm_core.h:191
int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th)
Definition: thread.c:1710
void rb_vm_stack_to_heap(rb_thread_t *th)
Definition: vm.c:729
union rb_block::@203 as
const VALUE * ep
Definition: vm_core.h:600
unsigned int has_block
Definition: vm_core.h:319
VALUE thgroup_default
Definition: vm_core.h:496
#define vm_thread_with_frame(th)
Definition: vm_core.h:1525
VALUE flags
Definition: vm_core.h:874
Definition: node.h:235
const VALUE * iseq_encoded
Definition: vm_core.h:286
VALUE rb_vm_env_local_variables(const rb_env_t *env)
Definition: vm.c:783
unsigned int has_kw
Definition: vm_core.h:317
int orig_argc
Definition: vm_core.h:218
static const struct rb_captured_block * VM_BH_TO_CAPT_BLOCK(VALUE block_handler)
Definition: vm_core.h:1246
rb_control_frame_t * rb_vm_get_binding_creatable_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp)
Definition: vm.c:477
unsigned int thread_abort_on_exception
Definition: vm_core.h:499
unsigned int has_rest
Definition: vm_core.h:315
unsigned int iseq_size
Definition: vm_core.h:285
VALUE * stack
Definition: vm_core.h:706
#define RB_TYPE_P(obj, type)
Definition: ruby.h:527
rb_fiber_t * fiber
Definition: vm_core.h:804
VALUE defined_module_hash
Definition: vm_core.h:540
#define RUBY_VM_INTERRUPTED_ANY(th)
Definition: vm_core.h:1553
void rb_thread_reset_timer_thread(void)
Definition: thread.c:4081
rb_iseq_t * rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, const rb_iseq_t *parent)
Definition: iseq.c:444
void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp, const VALUE *_pc)
Definition: vm_dump.c:344
size_t living_thread_num
Definition: vm_core.h:495
const rb_iseq_t * iseq
Definition: vm_core.h:634
unsigned short first_lineno
Definition: vm_core.h:889
rb_iseq_t * rb_iseq_new_with_opt(NODE *, VALUE, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t *)
Definition: iseq.c:473
void rb_thread_wakeup_timer_thread(void)
static int rb_obj_is_iseq(VALUE iseq)
Definition: vm_core.h:1043
int src_encoding_index
Definition: vm_core.h:535
static int VM_BH_ISEQ_BLOCK_P(VALUE block_handler)
Definition: vm_core.h:1182
int trace_running
Definition: vm_core.h:501
VALUE(* vm_call_handler)(struct rb_thread_struct *th, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
Definition: vm_core.h:238
VALUE locking_mutex
Definition: vm_core.h:766
unsigned int local_table_size
Definition: vm_core.h:382
struct st_table * ensure_rollback_table
Definition: vm_core.h:529
void rb_gc_mark_machine_stack(rb_thread_t *th)
Definition: gc.c:4201
rb_iseq_t * rb_iseq_new_with_bopt(NODE *, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE)
struct rb_call_info * ci_entries
Definition: vm_core.h:373
void rb_signal_exec(rb_thread_t *th, int sig)
Definition: signal.c:1011
size_t fiber_vm_stack_size
Definition: vm_core.h:553
struct rb_vm_struct rb_vm_t
void * blocking_region_buffer
Definition: vm_core.h:743
void rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
Definition: vm.c:535
rb_iseq_t * rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path, const rb_iseq_t *parent)
Definition: iseq.c:451
VALUE load_path_check_cache
Definition: vm_core.h:512
struct rb_ensure_list rb_ensure_list_t
static VALUE VM_BH_FROM_PROC(VALUE procval)
Definition: vm_core.h:1398
void rb_threadptr_exec_event_hooks_and_pop_frame(struct rb_trace_arg_struct *trace_arg)
Definition: vm_trace.c:375
rb_control_frame_t * cfp
Definition: vm_core.h:1582
VALUE tag
Definition: vm_core.h:663
static const struct rb_captured_block * VM_BH_TO_ISEQ_BLOCK(VALUE block_handler)
Definition: vm_core.h:1206
Definition: vm_core.h:195
VALUE top_self
Definition: vm_core.h:726
int postponed_job_index
Definition: vm_core.h:533
int argc
Definition: ruby.c:183
vm_special_object_type
Definition: vm_core.h:914
struct st_table * loading_table
Definition: vm_core.h:517
rb_thread_status
Definition: vm_core.h:649
void rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE exception_class, const char *mesg)
Definition: vm.c:2142
struct rb_iseq_location_struct rb_iseq_location_t
ruby_basic_operators
Definition: vm_core.h:434
static void vm_block_type_set(const struct rb_block *block, enum rb_block_type type)
Definition: vm_core.h:1304
static unsigned long VM_ENV_FLAGS(const VALUE *ep, long flag)
Definition: vm_core.h:1017
Definition: method.h:58
VALUE rb_iseq_coverage(const rb_iseq_t *iseq)
Definition: iseq.c:715
void rb_threadptr_signal_exit(rb_thread_t *th)
Definition: thread.c:2152
static const rb_env_t * vm_env_new(VALUE *env_ep, VALUE *env_body, unsigned int env_size, const rb_iseq_t *iseq)
Definition: vm_core.h:1139
VALUE flags
Definition: vm_core.h:393
int8_t is_from_method
Definition: vm_core.h:869
volatile int sleeper
Definition: vm_core.h:502
static int VM_BH_IFUNC_P(VALUE block_handler)
Definition: vm_core.h:1214
rb_serial_t method_state
Definition: vm_core.h:242
struct rb_event_hook_struct * hooks
Definition: vm_core.h:479
static const rb_env_t * VM_ENV_ENVVAL_PTR(const VALUE *ep)
Definition: vm_core.h:1123
#define VM_ENV_DATA_INDEX_SPECVAL
Definition: vm_core.h:991
unsigned long rb_num_t
Definition: vm_core.h:150
int rb_signal_buff_size(void)
Definition: signal.c:709
const char * ruby_node_name(int node)
Definition: iseq.c:1739
static void rb_vm_living_threads_init(rb_vm_t *vm)
Definition: vm_core.h:1445
Definition: vm_core.h:186
static VALUE vm_block_self(const struct rb_block *block)
Definition: vm_core.h:1361
rb_hook_list_t event_hooks
Definition: vm_core.h:800
void rb_vm_pop_frame(rb_thread_t *th)
struct rb_call_cache * cc_entries
Definition: vm_core.h:378
static const struct rb_block * vm_proc_block(VALUE procval)
Definition: vm_core.h:1311
static void VM_FORCE_WRITE(const VALUE *ptr, VALUE v)
Definition: vm_core.h:1148
#define RUBY_EXTERN
Definition: missing.h:77
VALUE rb_obj_is_proc(VALUE)
Definition: proc.c:117
struct rb_mutex_struct * keeping_mutexes
Definition: vm_core.h:767
unsigned long rb_serial_t
Definition: internal.h:650
VALUE rb_vm_make_proc_lambda(rb_thread_t *th, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda)
Definition: vm.c:869
NORETURN(void rb_bug_context(const void *, const char *fmt,...))
VALUE loaded_features
Definition: vm_core.h:514
#define VM_ASSERT(expr)
Definition: vm_core.h:54
unsigned int ambiguous_param0
Definition: vm_core.h:321
static enum rb_block_handler_type vm_block_handler_type(VALUE block_handler)
Definition: vm_core.h:1254
VALUE proc
Definition: vm_core.h:626
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
rb_event_flag_t ruby_vm_event_flags
Definition: vm.c:318
static const rb_iseq_t * vm_block_iseq(const struct rb_block *block)
Definition: vm_core.h:1335
static void VM_STACK_ENV_WRITE(const VALUE *ep, int index, VALUE v)
Definition: vm_core.h:1161
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v)
Definition: thread.c:1593
struct list_head waiting_fds
Definition: vm_core.h:493
#define T_IMEMO
Definition: ruby.h:511
unsigned long ID
Definition: ruby.h:86
size_t thread_vm_stack_size
Definition: vm_core.h:551
rb_thread_t * ruby_current_thread
Definition: vm.c:316
void rb_vm_bugreport(const void *)
Definition: vm_dump.c:931
VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp)
Definition: vm.c:889
unsigned int env_size
Definition: vm_core.h:878
static const VALUE * vm_block_ep(const struct rb_block *block)
Definition: vm_core.h:1348
rb_control_frame_t * rb_vm_get_ruby_level_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp)
Definition: vm.c:489
rb_block_handler_type
Definition: vm_core.h:608
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:1402
unsigned long VALUE
Definition: ruby.h:85
const rb_data_type_t ruby_threadptr_data_type
Definition: vm.c:2476
method_missing_reason
Definition: vm_core.h:203
RUBY_JMP_BUF rb_jmpbuf_t
Definition: vm_core.h:656
struct rb_thread_struct * main_thread
Definition: vm_core.h:490
ruby_vm_throw_flags
Definition: vm_core.h:173
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp)
Definition: vm.c:2025
unsigned int has_post
Definition: vm_core.h:316
VALUE first_proc
Definition: vm_core.h:779
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
RUBY_SYMBOL_EXPORT_BEGIN int rb_thread_check_trap_pending(void)
Definition: thread.c:1226
struct rb_at_exit_list * next
Definition: vm_core.h:471
unsigned int ci_kw_size
Definition: vm_core.h:385
static enum rb_block_type vm_block_type(const struct rb_block *block)
Definition: vm_core.h:1280
unsigned int ci_size
Definition: vm_core.h:384
static VALUE VM_BH_FROM_IFUNC_BLOCK(const struct rb_captured_block *captured)
Definition: vm_core.h:1230
#define VM_ENV_DATA_INDEX_FLAGS
Definition: vm_core.h:992
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt)
Definition: error.c:1044
const struct vm_ifunc * ifunc
Definition: vm_core.h:603
rb_atomic_t interrupt_flag
Definition: vm_core.h:761
rb_nativethread_cond_t interrupt_cond
Definition: vm_core.h:764
struct rb_calling_info * calling
Definition: vm_core.h:723
int rb_backtrace_iter_func(void *, VALUE, int, VALUE)
Definition: vm_core.h:1466
VALUE rb_binding_alloc(VALUE klass)
Definition: proc.c:308
struct rb_ensure_list * next
Definition: vm_core.h:692
rb_serial_t ic_serial
Definition: vm_core.h:187
const void * block_code
Definition: vm_core.h:637
static void ruby_exec_event_hook_orig(rb_thread_t *const th, const rb_event_flag_t flag, VALUE self, ID id, ID called_id, VALUE klass, VALUE data, int pop_p)
Definition: vm_core.h:1608
const rb_callable_method_entry_t * passed_bmethod_me
Definition: vm_core.h:720
struct rb_captured_block captured
Definition: vm_core.h:624
struct rb_at_exit_list rb_at_exit_list
#define VM_ENV_DATA_INDEX_ENV
Definition: vm_core.h:993
const ID * table
Definition: vm_core.h:353
static unsigned long VM_FRAME_TYPE(const rb_control_frame_t *cfp)
Definition: vm_core.h:1025
static VALUE env_size(void)
Definition: hash.c:4005
ruby_special_exceptions
Definition: vm_core.h:426
const VALUE * root_lep
Definition: vm_core.h:730
int8_t is_lambda
Definition: vm_core.h:870
void rb_vm_change_state(void)
static VALUE VM_BH_TO_PROC(VALUE block_handler)
Definition: vm_core.h:1391
const rb_cref_t * ic_cref
Definition: vm_core.h:188
VALUE first_args
Definition: vm_core.h:780
rb_iseq_t * rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, const struct rb_block *base_block)
Definition: iseq.c:664
void rb_vm_gvl_destroy(rb_vm_t *vm)
Definition: thread.c:342
struct rb_objspace * objspace
Definition: vm_core.h:542
VALUE top_wrapper
Definition: vm_core.h:727
const struct iseq_catch_table * catch_table
Definition: vm_core.h:366
VALUE root_svar
Definition: vm_core.h:731
rb_serial_t class_serial
Definition: vm_core.h:243
VALUE * stack_start
Definition: vm_core.h:785
size_t index
Definition: vm_core.h:190
unsigned long interrupt_mask
Definition: vm_core.h:762
void rb_threadptr_interrupt(rb_thread_t *th)
Definition: thread.c:426
#define ANYARGS
Definition: defines.h:173
unsigned int abort_on_exception
Definition: vm_core.h:813
static VALUE VM_ENV_BLOCK_HANDLER(const VALUE *ep)
Definition: vm_core.h:1086
VALUE marker
Definition: vm_core.h:686
rb_hook_list_t event_hooks
Definition: vm_core.h:526
#define FUNC_FASTCALL(x)
Definition: vm_core.h:938
struct rb_iseq_struct * local_iseq
Definition: vm_core.h:370
VALUE block_handler
Definition: vm_core.h:232
static VALUE VM_ENV_PROCVAL(const VALUE *ep)
Definition: vm_core.h:1129
rb_nativethread_id_t thread_id
Definition: vm_core.h:734
void rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo)
Definition: eval_error.c:76
rb_nativethread_lock_t thread_destruct_lock
Definition: vm_core.h:488
rb_control_frame_t *FUNC_FASTCALL rb_insn_func_t(rb_thread_t *, rb_control_frame_t *)
Definition: vm_core.h:942
const struct rb_block block
Definition: vm_core.h:867
void rb_set_coverages(VALUE)
Definition: thread.c:5010
static int vm_block_handler_verify(VALUE block_handler)
Definition: vm_core.h:1272
const VALUE * pc
Definition: vm_core.h:632
VALUE CDHASH
Definition: vm_core.h:935
static VALUE VM_BH_FROM_SYMBOL(VALUE symbol)
Definition: vm_core.h:1384
struct rb_call_cache * CALL_CACHE
Definition: vm_core.h:931
struct iseq_inline_cache_entry * IC
Definition: vm_core.h:929
const VALUE * rb_vm_ep_local_ep(const VALUE *ep)
Definition: vm.c:55
native_thread_data_t native_thread_data
Definition: vm_core.h:742
size_t thread_machine_stack_size
Definition: vm_core.h:552
struct rb_thread_struct * running_thread
Definition: vm_core.h:197
VALUE load_path_snapshot
Definition: vm_core.h:511
unsigned int thread_report_on_exception
Definition: vm_core.h:500
#define VM_UNREACHABLE(func)
Definition: vm_core.h:55
RUBY_SYMBOL_EXPORT_BEGIN rb_iseq_t * rb_iseq_new(NODE *, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type)
Definition: iseq.c:436
void rb_reset_coverages(void)
Definition: thread.c:5026
void rb_vm_at_exit_func(struct rb_vm_struct *)
Definition: vm_core.h:467
static void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value)
Definition: vm_core.h:1154
const rb_env_t * rb_vm_env_prev_env(const rb_env_t *env)
Definition: vm.c:739
static void VM_ENV_FLAGS_UNSET(const VALUE *ep, VALUE flag)
Definition: vm_core.h:1009
#define UNLIKELY(x)
Definition: ffi_common.h:126
int rb_vm_get_sourceline(const rb_control_frame_t *)
Definition: vm_backtrace.c:38
void rb_vm_inc_const_missing_count(void)
Definition: vm.c:323
rb_ensure_list_t * ensure_list
Definition: vm_core.h:809
VALUE loaded_features_snapshot
Definition: vm_core.h:515
const rb_iseq_t * iseq
Definition: vm_core.h:602
rb_jmpbuf_t root_jmpbuf
Definition: vm_core.h:806
int rb_atomic_t
Definition: ruby_atomic.h:120
const struct rb_iseq_struct * parent_iseq
Definition: vm_core.h:369
rb_global_vm_lock_t gvl
Definition: vm_core.h:487
const struct iseq_line_info_entry * line_info_table
Definition: vm_core.h:361
char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) *2+3]
Definition: vm_core.h:696
static VALUE VM_BH_FROM_ISEQ_BLOCK(const struct rb_captured_block *captured)
Definition: vm_core.h:1198
const char * name
Definition: nkf.c:208
const VALUE * opt_table
Definition: vm_core.h:333
rb_event_flag_t event
Definition: vm_core.h:1580
void rb_vmdebug_debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp)
Definition: vm_dump.c:373
struct rb_objspace * rb_objspace_alloc(void)
Definition: gc.c:1305
rb_jmpbuf_t buf
Definition: vm_core.h:665
size_t stack_size
Definition: vm_core.h:707
const VALUE * rb_vm_proc_local_ep(VALUE proc)
Definition: thread.c:558
VALUE local_storage_recursive_hash
Definition: vm_core.h:774
unsigned int line_info_size
Definition: vm_core.h:386
enum rb_block_type type
Definition: vm_core.h:628
struct rb_thread_list_struct * next
Definition: vm_core.h:681
struct rb_thread_struct rb_thread_t
struct rb_vm_tag * tag
Definition: vm_core.h:769
imemo_type
Definition: internal.h:737
unsigned int running
Definition: vm_core.h:498
uint32_t rb_event_flag_t
Definition: ruby.h:2095
struct rb_vm_tag * prev
Definition: vm_core.h:666
struct list_head living_threads
Definition: vm_core.h:494
unsigned int has_opt
Definition: vm_core.h:314
#define RTYPEDDATA_DATA(v)
Definition: ruby.h:1117
struct rb_call_info * CALL_INFO
Definition: vm_core.h:930
VALUE retval
Definition: vm_core.h:664
rb_block_type
Definition: vm_core.h:615
#define GC_GUARDED_PTR_REF(p)
Definition: vm_core.h:948
struct rb_postponed_job_struct * postponed_job_buffer
Definition: vm_core.h:532
vm_svar_index
Definition: vm_core.h:920
void rb_bug_context(const void *ctx, const char *fmt,...)
Definition: error.c:497
rb_nativethread_lock_t interrupt_lock
Definition: vm_core.h:763
VALUE load_path
Definition: vm_core.h:510
void rb_threadptr_check_signal(rb_thread_t *mth)
Definition: thread.c:4032
void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg)
Definition: vm_trace.c:381
VALUE pending_interrupt_queue
Definition: vm_core.h:757
RUBY_EXTERN VALUE rb_mRubyVMFrozenCore
Definition: vm_core.h:860
Definition: iseq.h:141
void rb_threadptr_execute_interrupts(rb_thread_t *, int)
Definition: thread.c:2025
size_t stack_maxsize
Definition: vm_core.h:787
unsigned int size
Definition: vm_core.h:324
#define SYMBOL_P(x)
Definition: ruby.h:382
#define mod(x, y)
Definition: date_strftime.c:28
VALUE path
Definition: vm_core.h:888
#define env
static int VM_FRAME_BMETHOD_P(const rb_control_frame_t *cfp)
Definition: vm_core.h:1037
#define NULL
Definition: _sdbm.c:102
static VALUE VM_ENV_ENVVAL(const VALUE *ep)
Definition: vm_core.h:1114
#define Qundef
Definition: ruby.h:439
VALUE stat_insn_usage
Definition: vm_core.h:797
RUBY_SYMBOL_EXPORT_BEGIN VALUE rb_iseq_eval(const rb_iseq_t *iseq)
Definition: vm.c:2004
static const VALUE * VM_ENV_PREV_EP(const VALUE *ep)
Definition: vm_core.h:1079
RUBY_EXTERN VALUE rb_cISeq
Definition: vm_core.h:858
static void VM_ENV_FLAGS_SET(const VALUE *ep, VALUE flag)
Definition: vm_core.h:1001
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, int argc, const VALUE *argv, VALUE block_handler)
Definition: vm.c:1150
union rb_captured_block::@202 code
struct rb_trace_arg_struct * trace_arg
Definition: vm_core.h:801
VALUE coverages
Definition: vm_core.h:538
char ** argv
Definition: ruby.c:184
rb_iseq_location_t location
Definition: vm_core.h:358
static const struct rb_captured_block * VM_BH_TO_IFUNC_BLOCK(VALUE block_handler)
Definition: vm_core.h:1238
#define VM_TAGGED_PTR_SET(p, tag)
Definition: vm_core.h:944