debase-ruby_core_source 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/CHANGELOG.md +4 -0
  4. data/lib/debase/ruby_core_source.rb +1 -0
  5. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/addr2line.h +21 -0
  6. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/build_assert/build_assert.h +40 -0
  7. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/check_type/check_type.h +63 -0
  8. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/container_of/container_of.h +142 -0
  9. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/list/list.h +773 -0
  10. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ccan/str/str.h +16 -0
  11. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/constant.h +50 -0
  12. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/dln.h +51 -0
  13. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/encindex.h +67 -0
  14. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/eval_intern.h +325 -0
  15. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/gc.h +114 -0
  16. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/id.h +212 -0
  17. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/id_table.h +30 -0
  18. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/insns.inc +109 -0
  19. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/insns_info.inc +769 -0
  20. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/internal.h +1373 -0
  21. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/iseq.h +181 -0
  22. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/known_errors.inc +746 -0
  23. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/method.h +210 -0
  24. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/node.h +521 -0
  25. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/node_name.inc +208 -0
  26. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/opt_sc.inc +750 -0
  27. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/optinsn.inc +83 -0
  28. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/optunifs.inc +126 -0
  29. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/parse.h +204 -0
  30. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/probes_helper.h +43 -0
  31. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/regenc.h +234 -0
  32. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/regint.h +972 -0
  33. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/regparse.h +363 -0
  34. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/revision.h +1 -0
  35. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/ruby_atomic.h +233 -0
  36. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/siphash.h +48 -0
  37. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/symbol.h +108 -0
  38. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/thread_pthread.h +54 -0
  39. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/thread_win32.h +36 -0
  40. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/timev.h +42 -0
  41. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/transcode_data.h +139 -0
  42. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/version.h +55 -0
  43. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm.inc +3374 -0
  44. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_call_iseq_optimized.inc +212 -0
  45. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_core.h +1216 -0
  46. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_debug.h +37 -0
  47. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_exec.h +182 -0
  48. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_insnhelper.h +246 -0
  49. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vm_opts.h +57 -0
  50. data/lib/debase/ruby_core_source/ruby-2.3.0-preview1/vmtc.inc +107 -0
  51. data/lib/debase/ruby_core_source/version.rb +1 -1
  52. metadata +49 -3
@@ -0,0 +1,212 @@
1
+ #if 1 /* enable or disable this optimization */
2
+
3
+ /* DO NOT EDIT THIS FILE DIRECTLY
4
+ *
5
+ * This file is enerated by tool/mkcall_iseq.rb
6
+ */
7
+
8
+ static VALUE
9
+ vm_call_iseq_setup_normal_0start_0params_1locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
10
+ {
11
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 0, 1);
12
+ }
13
+
14
+ static VALUE
15
+ vm_call_iseq_setup_normal_0start_0params_2locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
16
+ {
17
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 0, 2);
18
+ }
19
+
20
+ static VALUE
21
+ vm_call_iseq_setup_normal_0start_0params_3locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
22
+ {
23
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 0, 3);
24
+ }
25
+
26
+ static VALUE
27
+ vm_call_iseq_setup_normal_0start_0params_4locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
28
+ {
29
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 0, 4);
30
+ }
31
+
32
+ static VALUE
33
+ vm_call_iseq_setup_normal_0start_0params_5locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
34
+ {
35
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 0, 5);
36
+ }
37
+
38
+ static VALUE
39
+ vm_call_iseq_setup_normal_0start_0params_6locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
40
+ {
41
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 0, 6);
42
+ }
43
+
44
+ static VALUE
45
+ vm_call_iseq_setup_normal_0start_1params_1locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
46
+ {
47
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 1, 1);
48
+ }
49
+
50
+ static VALUE
51
+ vm_call_iseq_setup_normal_0start_1params_2locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
52
+ {
53
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 1, 2);
54
+ }
55
+
56
+ static VALUE
57
+ vm_call_iseq_setup_normal_0start_1params_3locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
58
+ {
59
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 1, 3);
60
+ }
61
+
62
+ static VALUE
63
+ vm_call_iseq_setup_normal_0start_1params_4locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
64
+ {
65
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 1, 4);
66
+ }
67
+
68
+ static VALUE
69
+ vm_call_iseq_setup_normal_0start_1params_5locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
70
+ {
71
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 1, 5);
72
+ }
73
+
74
+ static VALUE
75
+ vm_call_iseq_setup_normal_0start_1params_6locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
76
+ {
77
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 1, 6);
78
+ }
79
+
80
+ static VALUE
81
+ vm_call_iseq_setup_normal_0start_2params_1locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
82
+ {
83
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 2, 1);
84
+ }
85
+
86
+ static VALUE
87
+ vm_call_iseq_setup_normal_0start_2params_2locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
88
+ {
89
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 2, 2);
90
+ }
91
+
92
+ static VALUE
93
+ vm_call_iseq_setup_normal_0start_2params_3locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
94
+ {
95
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 2, 3);
96
+ }
97
+
98
+ static VALUE
99
+ vm_call_iseq_setup_normal_0start_2params_4locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
100
+ {
101
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 2, 4);
102
+ }
103
+
104
+ static VALUE
105
+ vm_call_iseq_setup_normal_0start_2params_5locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
106
+ {
107
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 2, 5);
108
+ }
109
+
110
+ static VALUE
111
+ vm_call_iseq_setup_normal_0start_2params_6locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
112
+ {
113
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 2, 6);
114
+ }
115
+
116
+ static VALUE
117
+ vm_call_iseq_setup_normal_0start_3params_1locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
118
+ {
119
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 3, 1);
120
+ }
121
+
122
+ static VALUE
123
+ vm_call_iseq_setup_normal_0start_3params_2locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
124
+ {
125
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 3, 2);
126
+ }
127
+
128
+ static VALUE
129
+ vm_call_iseq_setup_normal_0start_3params_3locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
130
+ {
131
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 3, 3);
132
+ }
133
+
134
+ static VALUE
135
+ vm_call_iseq_setup_normal_0start_3params_4locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
136
+ {
137
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 3, 4);
138
+ }
139
+
140
+ static VALUE
141
+ vm_call_iseq_setup_normal_0start_3params_5locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
142
+ {
143
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 3, 5);
144
+ }
145
+
146
+ static VALUE
147
+ vm_call_iseq_setup_normal_0start_3params_6locals(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
148
+ {
149
+ return vm_call_iseq_setup_normal(th, cfp, calling, ci, cc, 0, 3, 6);
150
+ }
151
+
152
+ /* vm_call_iseq_handlers[param][local] */
153
+ static const vm_call_handler vm_call_iseq_handlers[][6] = {
154
+ {vm_call_iseq_setup_normal_0start_0params_1locals,
155
+ vm_call_iseq_setup_normal_0start_0params_2locals,
156
+ vm_call_iseq_setup_normal_0start_0params_3locals,
157
+ vm_call_iseq_setup_normal_0start_0params_4locals,
158
+ vm_call_iseq_setup_normal_0start_0params_5locals,
159
+ vm_call_iseq_setup_normal_0start_0params_6locals},
160
+ {vm_call_iseq_setup_normal_0start_1params_1locals,
161
+ vm_call_iseq_setup_normal_0start_1params_2locals,
162
+ vm_call_iseq_setup_normal_0start_1params_3locals,
163
+ vm_call_iseq_setup_normal_0start_1params_4locals,
164
+ vm_call_iseq_setup_normal_0start_1params_5locals,
165
+ vm_call_iseq_setup_normal_0start_1params_6locals},
166
+ {vm_call_iseq_setup_normal_0start_2params_1locals,
167
+ vm_call_iseq_setup_normal_0start_2params_2locals,
168
+ vm_call_iseq_setup_normal_0start_2params_3locals,
169
+ vm_call_iseq_setup_normal_0start_2params_4locals,
170
+ vm_call_iseq_setup_normal_0start_2params_5locals,
171
+ vm_call_iseq_setup_normal_0start_2params_6locals},
172
+ {vm_call_iseq_setup_normal_0start_3params_1locals,
173
+ vm_call_iseq_setup_normal_0start_3params_2locals,
174
+ vm_call_iseq_setup_normal_0start_3params_3locals,
175
+ vm_call_iseq_setup_normal_0start_3params_4locals,
176
+ vm_call_iseq_setup_normal_0start_3params_5locals,
177
+ vm_call_iseq_setup_normal_0start_3params_6locals}
178
+ };
179
+
180
+ static inline vm_call_handler
181
+ vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size)
182
+ {
183
+ if (UNLIKELY(ci->flag & VM_CALL_TAILCALL)) {
184
+ return vm_call_iseq_setup_tailcall_0start;
185
+ }
186
+ else if (0) { /* to disable optimize */
187
+ return vm_call_iseq_setup_normal_0start;
188
+ }
189
+ else {
190
+ if (param_size <= 3 &&
191
+ local_size <= 6) {
192
+ VM_ASSERT(local_size != 0);
193
+ return vm_call_iseq_handlers[param_size][local_size-1];
194
+ }
195
+ return vm_call_iseq_setup_normal_0start;
196
+ }
197
+ }
198
+
199
+ #else
200
+
201
+
202
+ static inline vm_call_handler
203
+ vm_call_iseq_setup_func(const struct rb_call_info *ci, struct rb_call_cache *cc)
204
+ {
205
+ if (UNLIKELY(ci->flag & VM_CALL_TAILCALL)) {
206
+ return vm_call_iseq_setup_tailcall_0start;
207
+ }
208
+ else {
209
+ return vm_call_iseq_setup_normal_0start;
210
+ }
211
+ }
212
+ #endif
@@ -0,0 +1,1216 @@
1
+ /**********************************************************************
2
+
3
+ vm_core.h -
4
+
5
+ $Author: ko1 $
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
+
23
+ /**
24
+ * VM Debug Level
25
+ *
26
+ * debug level:
27
+ * 0: no debug output
28
+ * 1: show instruction name
29
+ * 2: show stack frame when control stack frame is changed
30
+ * 3: show stack status
31
+ * 4: show register
32
+ * 5:
33
+ * 10: gc check
34
+ */
35
+
36
+ #ifndef VMDEBUG
37
+ #define VMDEBUG 0
38
+ #endif
39
+
40
+ #if 0
41
+ #undef VMDEBUG
42
+ #define VMDEBUG 3
43
+ #endif
44
+
45
+ #if VM_CHECK_MODE > 0
46
+ #define VM_ASSERT(expr) ( \
47
+ LIKELY(expr) ? (void)0 : \
48
+ rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr))
49
+ #else
50
+ #define VM_ASSERT(expr) ((void)0)
51
+ #endif
52
+
53
+ #define RUBY_VM_THREAD_MODEL 2
54
+
55
+ #include "ruby/ruby.h"
56
+ #include "ruby/st.h"
57
+
58
+ #include "node.h"
59
+ #include "vm_debug.h"
60
+ #include "vm_opts.h"
61
+ #include "id.h"
62
+ #include "method.h"
63
+ #include "ruby_atomic.h"
64
+ #include "ccan/list/list.h"
65
+
66
+ #include "ruby/thread_native.h"
67
+ #if defined(_WIN32)
68
+ #include "thread_win32.h"
69
+ #elif defined(HAVE_PTHREAD_H)
70
+ #include "thread_pthread.h"
71
+ #endif
72
+
73
+ #ifndef ENABLE_VM_OBJSPACE
74
+ #ifdef _WIN32
75
+ /*
76
+ * TODO: object space independent st_table.
77
+ * socklist and conlist will be freed exit_handler(), after object
78
+ * space destruction.
79
+ */
80
+ #define ENABLE_VM_OBJSPACE 0
81
+ #else
82
+ #define ENABLE_VM_OBJSPACE 1
83
+ #endif
84
+ #endif
85
+
86
+ #include <setjmp.h>
87
+ #include <signal.h>
88
+
89
+ #ifndef NSIG
90
+ # define NSIG (_SIGMAX + 1) /* For QNX */
91
+ #endif
92
+
93
+ #define RUBY_NSIG NSIG
94
+
95
+ #ifdef HAVE_STDARG_PROTOTYPES
96
+ #include <stdarg.h>
97
+ #define va_init_list(a,b) va_start((a),(b))
98
+ #else
99
+ #include <varargs.h>
100
+ #define va_init_list(a,b) va_start((a))
101
+ #endif
102
+
103
+ #if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
104
+ #define USE_SIGALTSTACK
105
+ #endif
106
+
107
+ /*****************/
108
+ /* configuration */
109
+ /*****************/
110
+
111
+ /* gcc ver. check */
112
+ #if defined(__GNUC__) && __GNUC__ >= 2
113
+
114
+ #if OPT_TOKEN_THREADED_CODE
115
+ #if OPT_DIRECT_THREADED_CODE
116
+ #undef OPT_DIRECT_THREADED_CODE
117
+ #endif
118
+ #endif
119
+
120
+ #else /* defined(__GNUC__) && __GNUC__ >= 2 */
121
+
122
+ /* disable threaded code options */
123
+ #if OPT_DIRECT_THREADED_CODE
124
+ #undef OPT_DIRECT_THREADED_CODE
125
+ #endif
126
+ #if OPT_TOKEN_THREADED_CODE
127
+ #undef OPT_TOKEN_THREADED_CODE
128
+ #endif
129
+ #endif
130
+
131
+ #ifdef __native_client__
132
+ #undef OPT_DIRECT_THREADED_CODE
133
+ #endif
134
+
135
+ /* call threaded code */
136
+ #if OPT_CALL_THREADED_CODE
137
+ #if OPT_DIRECT_THREADED_CODE
138
+ #undef OPT_DIRECT_THREADED_CODE
139
+ #endif /* OPT_DIRECT_THREADED_CODE */
140
+ #if OPT_STACK_CACHING
141
+ #undef OPT_STACK_CACHING
142
+ #endif /* OPT_STACK_CACHING */
143
+ #endif /* OPT_CALL_THREADED_CODE */
144
+
145
+ typedef unsigned long rb_num_t;
146
+
147
+ enum ruby_tag_type {
148
+ RUBY_TAG_RETURN = 0x1,
149
+ RUBY_TAG_BREAK = 0x2,
150
+ RUBY_TAG_NEXT = 0x3,
151
+ RUBY_TAG_RETRY = 0x4,
152
+ RUBY_TAG_REDO = 0x5,
153
+ RUBY_TAG_RAISE = 0x6,
154
+ RUBY_TAG_THROW = 0x7,
155
+ RUBY_TAG_FATAL = 0x8,
156
+ RUBY_TAG_MASK = 0xf
157
+ };
158
+ #define TAG_RETURN RUBY_TAG_RETURN
159
+ #define TAG_BREAK RUBY_TAG_BREAK
160
+ #define TAG_NEXT RUBY_TAG_NEXT
161
+ #define TAG_RETRY RUBY_TAG_RETRY
162
+ #define TAG_REDO RUBY_TAG_REDO
163
+ #define TAG_RAISE RUBY_TAG_RAISE
164
+ #define TAG_THROW RUBY_TAG_THROW
165
+ #define TAG_FATAL RUBY_TAG_FATAL
166
+ #define TAG_MASK RUBY_TAG_MASK
167
+
168
+ enum ruby_vm_throw_flags {
169
+ VM_THROW_NO_ESCAPE_FLAG = 0x8000,
170
+ VM_THROW_LEVEL_SHIFT = 16,
171
+ VM_THROW_STATE_MASK = 0xff
172
+ };
173
+
174
+ /* forward declarations */
175
+ struct rb_thread_struct;
176
+ struct rb_control_frame_struct;
177
+
178
+ /* iseq data type */
179
+ typedef struct rb_compile_option_struct rb_compile_option_t;
180
+
181
+ struct iseq_inline_cache_entry {
182
+ rb_serial_t ic_serial;
183
+ const rb_cref_t *ic_cref;
184
+ union {
185
+ size_t index;
186
+ VALUE value;
187
+ } ic_value;
188
+ };
189
+
190
+ union iseq_inline_storage_entry {
191
+ struct {
192
+ struct rb_thread_struct *running_thread;
193
+ VALUE value;
194
+ } once;
195
+ struct iseq_inline_cache_entry cache;
196
+ };
197
+
198
+ enum method_missing_reason {
199
+ MISSING_NOENTRY = 0x00,
200
+ MISSING_PRIVATE = 0x01,
201
+ MISSING_PROTECTED = 0x02,
202
+ MISSING_VCALL = 0x04,
203
+ MISSING_SUPER = 0x08,
204
+ MISSING_MISSING = 0x10,
205
+ MISSING_NONE = 0x20
206
+ };
207
+
208
+ struct rb_call_info {
209
+ /* fixed at compile time */
210
+ ID mid;
211
+ unsigned int flag;
212
+ int orig_argc;
213
+ };
214
+
215
+ struct rb_call_info_kw_arg {
216
+ int keyword_len;
217
+ VALUE keywords[1];
218
+ };
219
+
220
+ struct rb_call_info_with_kwarg {
221
+ struct rb_call_info ci;
222
+ struct rb_call_info_kw_arg *kw_arg;
223
+ };
224
+
225
+ struct rb_calling_info {
226
+ struct rb_block_struct *blockptr;
227
+ VALUE recv;
228
+ int argc;
229
+ };
230
+
231
+ struct rb_call_cache;
232
+ 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);
233
+
234
+ struct rb_call_cache {
235
+ /* inline cache: keys */
236
+ rb_serial_t method_state;
237
+ rb_serial_t class_serial;
238
+
239
+ /* inline cache: values */
240
+ const rb_callable_method_entry_t *me;
241
+
242
+ vm_call_handler call;
243
+
244
+ union {
245
+ unsigned int index; /* used by ivar */
246
+ enum method_missing_reason method_missing_reason; /* used by method_missing */
247
+ int inc_sp; /* used by cfunc */
248
+ } aux;
249
+ };
250
+
251
+ #if 1
252
+ #define GetCoreDataFromValue(obj, type, ptr) do { \
253
+ (ptr) = (type*)DATA_PTR(obj); \
254
+ } while (0)
255
+ #else
256
+ #define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct((obj), type, (ptr))
257
+ #endif
258
+
259
+ typedef struct rb_iseq_location_struct {
260
+ const VALUE path;
261
+ const VALUE absolute_path;
262
+ const VALUE base_label;
263
+ const VALUE label;
264
+ VALUE first_lineno; /* TODO: may be unsigned short */
265
+ } rb_iseq_location_t;
266
+
267
+ struct rb_iseq_constant_body {
268
+ enum iseq_type {
269
+ ISEQ_TYPE_TOP,
270
+ ISEQ_TYPE_METHOD,
271
+ ISEQ_TYPE_BLOCK,
272
+ ISEQ_TYPE_CLASS,
273
+ ISEQ_TYPE_RESCUE,
274
+ ISEQ_TYPE_ENSURE,
275
+ ISEQ_TYPE_EVAL,
276
+ ISEQ_TYPE_MAIN,
277
+ ISEQ_TYPE_DEFINED_GUARD
278
+ } type; /* instruction sequence type */
279
+
280
+ unsigned int stack_max; /* for stack overflow check */
281
+ /* sizeof(vars) + 1 */
282
+ unsigned int local_size;
283
+
284
+ unsigned int iseq_size;
285
+ const VALUE *iseq_encoded; /* encoded iseq (insn addr and operands) */
286
+
287
+ /**
288
+ * parameter information
289
+ *
290
+ * def m(a1, a2, ..., aM, # mandatory
291
+ * b1=(...), b2=(...), ..., bN=(...), # optional
292
+ * *c, # rest
293
+ * d1, d2, ..., dO, # post
294
+ * e1:(...), e2:(...), ..., eK:(...), # keyword
295
+ * **f, # keyword_rest
296
+ * &g) # block
297
+ * =>
298
+ *
299
+ * lead_num = M
300
+ * opt_num = N
301
+ * rest_start = M+N
302
+ * post_start = M+N+(*1)
303
+ * post_num = O
304
+ * keyword_num = K
305
+ * block_start = M+N+(*1)+O+K
306
+ * keyword_bits = M+N+(*1)+O+K+(&1)
307
+ * size = M+N+O+(*1)+K+(&1)+(**1) // parameter size.
308
+ */
309
+
310
+ struct {
311
+ struct {
312
+ unsigned int has_lead : 1;
313
+ unsigned int has_opt : 1;
314
+ unsigned int has_rest : 1;
315
+ unsigned int has_post : 1;
316
+ unsigned int has_kw : 1;
317
+ unsigned int has_kwrest : 1;
318
+ unsigned int has_block : 1;
319
+
320
+ unsigned int ambiguous_param0 : 1; /* {|a|} */
321
+ } flags;
322
+
323
+ unsigned int size;
324
+
325
+ int lead_num;
326
+ int opt_num;
327
+ int rest_start;
328
+ int post_start;
329
+ int post_num;
330
+ int block_start;
331
+
332
+ const VALUE *opt_table; /* (opt_num + 1) entries. */
333
+ /* opt_num and opt_table:
334
+ *
335
+ * def foo o1=e1, o2=e2, ..., oN=eN
336
+ * #=>
337
+ * # prologue code
338
+ * A1: e1
339
+ * A2: e2
340
+ * ...
341
+ * AN: eN
342
+ * AL: body
343
+ * opt_num = N
344
+ * opt_table = [A1, A2, ..., AN, AL]
345
+ */
346
+
347
+ const struct rb_iseq_param_keyword {
348
+ int num;
349
+ int required_num;
350
+ int bits_start;
351
+ int rest_start;
352
+ const ID *table;
353
+ const VALUE *default_values;
354
+ } *keyword;
355
+ } param;
356
+
357
+ rb_iseq_location_t location;
358
+
359
+ /* insn info, must be freed */
360
+ const struct iseq_line_info_entry *line_info_table;
361
+
362
+ const ID *local_table; /* must free */
363
+
364
+ /* catch table */
365
+ const struct iseq_catch_table *catch_table;
366
+
367
+ /* for child iseq */
368
+ const struct rb_iseq_struct *parent_iseq;
369
+ struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */
370
+
371
+ union iseq_inline_storage_entry *is_entries;
372
+ struct rb_call_info *ci_entries; /* struct rb_call_info ci_entries[ci_size];
373
+ * struct rb_call_info_with_kwarg cikw_entries[ci_kw_size];
374
+ * So that:
375
+ * struct rb_call_info_with_kwarg *cikw_entries = &body->ci_entries[ci_size];
376
+ */
377
+ struct rb_call_cache *cc_entries; /* size is ci_size = ci_kw_size */
378
+
379
+ const VALUE mark_ary; /* Array: includes operands which should be GC marked */
380
+
381
+ unsigned int local_table_size;
382
+ unsigned int is_size;
383
+ unsigned int ci_size;
384
+ unsigned int ci_kw_size;
385
+ unsigned int line_info_size;
386
+ };
387
+
388
+ struct rb_iseq_variable_body {
389
+ const VALUE coverage; /* coverage array */
390
+
391
+ rb_num_t flip_cnt;
392
+
393
+ /* original iseq, before encoding
394
+ * used for debug/dump (TODO: union with compile_data) */
395
+ VALUE *iseq;
396
+ };
397
+
398
+ /* T_IMEMO/iseq */
399
+ /* typedef rb_iseq_t is in method.h */
400
+ struct rb_iseq_struct {
401
+ VALUE flags;
402
+ struct iseq_compile_data *compile_data; /* used at compile time */
403
+ struct rb_iseq_constant_body *body;
404
+ struct rb_iseq_variable_body *variable_body;
405
+ VALUE dummy2;
406
+ };
407
+
408
+ enum ruby_special_exceptions {
409
+ ruby_error_reenter,
410
+ ruby_error_nomemory,
411
+ ruby_error_sysstack,
412
+ ruby_error_closed_stream,
413
+ ruby_special_error_count
414
+ };
415
+
416
+ enum ruby_basic_operators {
417
+ BOP_PLUS,
418
+ BOP_MINUS,
419
+ BOP_MULT,
420
+ BOP_DIV,
421
+ BOP_MOD,
422
+ BOP_EQ,
423
+ BOP_EQQ,
424
+ BOP_LT,
425
+ BOP_LE,
426
+ BOP_LTLT,
427
+ BOP_AREF,
428
+ BOP_ASET,
429
+ BOP_LENGTH,
430
+ BOP_SIZE,
431
+ BOP_EMPTY_P,
432
+ BOP_SUCC,
433
+ BOP_GT,
434
+ BOP_GE,
435
+ BOP_NOT,
436
+ BOP_NEQ,
437
+ BOP_MATCH,
438
+ BOP_FREEZE,
439
+
440
+ BOP_LAST_
441
+ };
442
+
443
+ #define GetVMPtr(obj, ptr) \
444
+ GetCoreDataFromValue((obj), rb_vm_t, (ptr))
445
+
446
+ struct rb_objspace;
447
+ struct rb_objspace *rb_objspace_alloc(void);
448
+ void rb_objspace_free(struct rb_objspace *);
449
+
450
+ typedef struct rb_hook_list_struct {
451
+ struct rb_event_hook_struct *hooks;
452
+ rb_event_flag_t events;
453
+ int need_clean;
454
+ } rb_hook_list_t;
455
+
456
+ typedef struct rb_vm_struct {
457
+ VALUE self;
458
+
459
+ rb_global_vm_lock_t gvl;
460
+ rb_nativethread_lock_t thread_destruct_lock;
461
+
462
+ struct rb_thread_struct *main_thread;
463
+ struct rb_thread_struct *running_thread;
464
+
465
+ struct list_head living_threads;
466
+ size_t living_thread_num;
467
+ VALUE thgroup_default;
468
+
469
+ int running;
470
+ int thread_abort_on_exception;
471
+ int trace_running;
472
+ volatile int sleeper;
473
+
474
+ /* object management */
475
+ VALUE mark_object_ary;
476
+ const VALUE special_exceptions[ruby_special_error_count];
477
+
478
+ /* load */
479
+ VALUE top_self;
480
+ VALUE load_path;
481
+ VALUE load_path_snapshot;
482
+ VALUE load_path_check_cache;
483
+ VALUE expanded_load_path;
484
+ VALUE loaded_features;
485
+ VALUE loaded_features_snapshot;
486
+ struct st_table *loaded_features_index;
487
+ struct st_table *loading_table;
488
+
489
+ /* signal */
490
+ struct {
491
+ VALUE cmd;
492
+ int safe;
493
+ } trap_list[RUBY_NSIG];
494
+
495
+ /* hook */
496
+ rb_hook_list_t event_hooks;
497
+
498
+ /* relation table of ensure - rollback for callcc */
499
+ struct st_table *ensure_rollback_table;
500
+
501
+ /* postponed_job */
502
+ struct rb_postponed_job_struct *postponed_job_buffer;
503
+ int postponed_job_index;
504
+
505
+ int src_encoding_index;
506
+
507
+ VALUE verbose, debug, orig_progname, progname;
508
+ VALUE coverages;
509
+
510
+ VALUE defined_module_hash;
511
+
512
+ struct rb_objspace *objspace;
513
+
514
+ /*
515
+ * @shyouhei notes that this is not for storing normal Ruby
516
+ * objects so do *NOT* mark this when you GC.
517
+ */
518
+ struct RArray at_exit;
519
+
520
+ VALUE *defined_strings;
521
+ st_table *frozen_strings;
522
+
523
+ /* params */
524
+ struct { /* size in byte */
525
+ size_t thread_vm_stack_size;
526
+ size_t thread_machine_stack_size;
527
+ size_t fiber_vm_stack_size;
528
+ size_t fiber_machine_stack_size;
529
+ } default_params;
530
+
531
+ short redefined_flag[BOP_LAST_];
532
+ } rb_vm_t;
533
+
534
+ /* default values */
535
+
536
+ #define RUBY_VM_SIZE_ALIGN 4096
537
+
538
+ #define RUBY_VM_THREAD_VM_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
539
+ #define RUBY_VM_THREAD_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
540
+ #define RUBY_VM_THREAD_MACHINE_STACK_SIZE ( 128 * 1024 * sizeof(VALUE)) /* 512 KB or 1024 KB */
541
+ #define RUBY_VM_THREAD_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
542
+
543
+ #define RUBY_VM_FIBER_VM_STACK_SIZE ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
544
+ #define RUBY_VM_FIBER_VM_STACK_SIZE_MIN ( 2 * 1024 * sizeof(VALUE)) /* 8 KB or 16 KB */
545
+ #define RUBY_VM_FIBER_MACHINE_STACK_SIZE ( 64 * 1024 * sizeof(VALUE)) /* 256 KB or 512 KB */
546
+ #define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
547
+
548
+ /* optimize insn */
549
+ #define FIXNUM_REDEFINED_OP_FLAG (1 << 0)
550
+ #define FLOAT_REDEFINED_OP_FLAG (1 << 1)
551
+ #define STRING_REDEFINED_OP_FLAG (1 << 2)
552
+ #define ARRAY_REDEFINED_OP_FLAG (1 << 3)
553
+ #define HASH_REDEFINED_OP_FLAG (1 << 4)
554
+ #define BIGNUM_REDEFINED_OP_FLAG (1 << 5)
555
+ #define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
556
+ #define TIME_REDEFINED_OP_FLAG (1 << 7)
557
+ #define REGEXP_REDEFINED_OP_FLAG (1 << 8)
558
+
559
+ #define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0))
560
+
561
+ #ifndef VM_DEBUG_BP_CHECK
562
+ #define VM_DEBUG_BP_CHECK 0
563
+ #endif
564
+
565
+ #ifndef VM_DEBUG_VERIFY_METHOD_CACHE
566
+ #define VM_DEBUG_VERIFY_METHOD_CACHE (VM_DEBUG_MODE != 0)
567
+ #endif
568
+
569
+ typedef struct rb_control_frame_struct {
570
+ const VALUE *pc; /* cfp[0] */
571
+ VALUE *sp; /* cfp[1] */
572
+ const rb_iseq_t *iseq; /* cfp[2] */
573
+ VALUE flag; /* cfp[3] */
574
+ VALUE self; /* cfp[4] / block[0] */
575
+ VALUE *ep; /* cfp[5] / block[1] */
576
+ const rb_iseq_t *block_iseq;/* cfp[6] / block[2] */
577
+ VALUE proc; /* cfp[7] / block[3] */
578
+
579
+ #if VM_DEBUG_BP_CHECK
580
+ VALUE *bp_check; /* cfp[8] */
581
+ #endif
582
+ } rb_control_frame_t;
583
+
584
+ typedef struct rb_block_struct {
585
+ VALUE self; /* share with method frame if it's only block */
586
+ VALUE *ep; /* share with method frame if it's only block */
587
+ const rb_iseq_t *iseq;
588
+ VALUE proc;
589
+ } rb_block_t;
590
+
591
+ extern const rb_data_type_t ruby_threadptr_data_type;
592
+
593
+ #define GetThreadPtr(obj, ptr) \
594
+ TypedData_Get_Struct((obj), rb_thread_t, &ruby_threadptr_data_type, (ptr))
595
+
596
+ enum rb_thread_status {
597
+ THREAD_RUNNABLE,
598
+ THREAD_STOPPED,
599
+ THREAD_STOPPED_FOREVER,
600
+ THREAD_KILLED
601
+ };
602
+
603
+ typedef RUBY_JMP_BUF rb_jmpbuf_t;
604
+
605
+ /*
606
+ the members which are written in TH_PUSH_TAG() should be placed at
607
+ the beginning and the end, so that entire region is accessible.
608
+ */
609
+ struct rb_vm_tag {
610
+ VALUE tag;
611
+ VALUE retval;
612
+ rb_jmpbuf_t buf;
613
+ struct rb_vm_tag *prev;
614
+ };
615
+
616
+ struct rb_vm_protect_tag {
617
+ struct rb_vm_protect_tag *prev;
618
+ };
619
+
620
+ struct rb_unblock_callback {
621
+ rb_unblock_function_t *func;
622
+ void *arg;
623
+ };
624
+
625
+ struct rb_mutex_struct;
626
+
627
+ typedef struct rb_thread_list_struct{
628
+ struct rb_thread_list_struct *next;
629
+ struct rb_thread_struct *th;
630
+ } rb_thread_list_t;
631
+
632
+ typedef struct rb_ensure_entry {
633
+ VALUE marker;
634
+ VALUE (*e_proc)(ANYARGS);
635
+ VALUE data2;
636
+ } rb_ensure_entry_t;
637
+
638
+ typedef struct rb_ensure_list {
639
+ struct rb_ensure_list *next;
640
+ struct rb_ensure_entry entry;
641
+ } rb_ensure_list_t;
642
+
643
+ typedef char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) * 2 + 3];
644
+
645
+ typedef struct rb_fiber_struct rb_fiber_t;
646
+
647
+ typedef struct rb_thread_struct {
648
+ struct list_node vmlt_node;
649
+ VALUE self;
650
+ rb_vm_t *vm;
651
+
652
+ /* execution information */
653
+ VALUE *stack; /* must free, must mark */
654
+ size_t stack_size; /* size in word (byte size / sizeof(VALUE)) */
655
+ rb_control_frame_t *cfp;
656
+ int safe_level;
657
+ int raised_flag;
658
+ VALUE last_status; /* $? */
659
+
660
+ /* passing state */
661
+ int state;
662
+
663
+ int waiting_fd;
664
+
665
+ /* for rb_iterate */
666
+ const rb_block_t *passed_block;
667
+
668
+ /* for bmethod */
669
+ const rb_callable_method_entry_t *passed_bmethod_me;
670
+
671
+ /* for cfunc */
672
+ struct rb_calling_info *calling;
673
+
674
+ /* for load(true) */
675
+ VALUE top_self;
676
+ VALUE top_wrapper;
677
+
678
+ /* eval env */
679
+ rb_block_t *base_block;
680
+
681
+ VALUE *root_lep;
682
+ VALUE root_svar;
683
+
684
+ /* thread control */
685
+ rb_nativethread_id_t thread_id;
686
+ #ifdef NON_SCALAR_THREAD_ID
687
+ rb_thread_id_string_t thread_id_string;
688
+ #endif
689
+ enum rb_thread_status status;
690
+ int to_kill;
691
+ int priority;
692
+
693
+ native_thread_data_t native_thread_data;
694
+ void *blocking_region_buffer;
695
+
696
+ VALUE thgroup;
697
+ VALUE value;
698
+
699
+ /* temporary place of errinfo */
700
+ VALUE errinfo;
701
+
702
+ /* temporary place of retval on OPT_CALL_THREADED_CODE */
703
+ #if OPT_CALL_THREADED_CODE
704
+ VALUE retval;
705
+ #endif
706
+
707
+ /* async errinfo queue */
708
+ VALUE pending_interrupt_queue;
709
+ VALUE pending_interrupt_mask_stack;
710
+ int pending_interrupt_queue_checked;
711
+
712
+ rb_atomic_t interrupt_flag;
713
+ unsigned long interrupt_mask;
714
+ rb_nativethread_lock_t interrupt_lock;
715
+ rb_nativethread_cond_t interrupt_cond;
716
+ struct rb_unblock_callback unblock;
717
+ VALUE locking_mutex;
718
+ struct rb_mutex_struct *keeping_mutexes;
719
+
720
+ struct rb_vm_tag *tag;
721
+ struct rb_vm_protect_tag *protect_tag;
722
+
723
+ /*! Thread-local state of evaluation context.
724
+ *
725
+ * If negative, this thread is evaluating the main program.
726
+ * If positive, this thread is evaluating a program under Kernel::eval
727
+ * family.
728
+ */
729
+ int parse_in_eval;
730
+
731
+ /*! Thread-local state of compiling context.
732
+ *
733
+ * If non-zero, the parser does not automatically print error messages to
734
+ * stderr. */
735
+ int mild_compile_error;
736
+
737
+ /* storage */
738
+ st_table *local_storage;
739
+ VALUE local_storage_recursive_hash;
740
+ VALUE local_storage_recursive_hash_for_trace;
741
+
742
+ rb_thread_list_t *join_list;
743
+
744
+ VALUE first_proc;
745
+ VALUE first_args;
746
+ VALUE (*first_func)(ANYARGS);
747
+
748
+ /* for GC */
749
+ struct {
750
+ VALUE *stack_start;
751
+ VALUE *stack_end;
752
+ size_t stack_maxsize;
753
+ #ifdef __ia64
754
+ VALUE *register_stack_start;
755
+ VALUE *register_stack_end;
756
+ size_t register_stack_maxsize;
757
+ #endif
758
+ jmp_buf regs;
759
+ } machine;
760
+
761
+ /* statistics data for profiler */
762
+ VALUE stat_insn_usage;
763
+
764
+ /* tracer */
765
+ rb_hook_list_t event_hooks;
766
+ struct rb_trace_arg_struct *trace_arg; /* trace information */
767
+
768
+ /* fiber */
769
+ rb_fiber_t *fiber;
770
+ rb_fiber_t *root_fiber;
771
+ rb_jmpbuf_t root_jmpbuf;
772
+
773
+ /* ensure & callcc */
774
+ rb_ensure_list_t *ensure_list;
775
+
776
+ /* misc */
777
+ enum method_missing_reason method_missing_reason;
778
+ int abort_on_exception;
779
+ #ifdef USE_SIGALTSTACK
780
+ void *altstack;
781
+ #endif
782
+ unsigned long running_time_us;
783
+ VALUE name;
784
+ } rb_thread_t;
785
+
786
+ typedef enum {
787
+ VM_DEFINECLASS_TYPE_CLASS = 0x00,
788
+ VM_DEFINECLASS_TYPE_SINGLETON_CLASS = 0x01,
789
+ VM_DEFINECLASS_TYPE_MODULE = 0x02,
790
+ /* 0x03..0x06 is reserved */
791
+ VM_DEFINECLASS_TYPE_MASK = 0x07
792
+ } rb_vm_defineclass_type_t;
793
+
794
+ #define VM_DEFINECLASS_TYPE(x) ((rb_vm_defineclass_type_t)(x) & VM_DEFINECLASS_TYPE_MASK)
795
+ #define VM_DEFINECLASS_FLAG_SCOPED 0x08
796
+ #define VM_DEFINECLASS_FLAG_HAS_SUPERCLASS 0x10
797
+ #define VM_DEFINECLASS_SCOPED_P(x) ((x) & VM_DEFINECLASS_FLAG_SCOPED)
798
+ #define VM_DEFINECLASS_HAS_SUPERCLASS_P(x) \
799
+ ((x) & VM_DEFINECLASS_FLAG_HAS_SUPERCLASS)
800
+
801
+ /* iseq.c */
802
+ RUBY_SYMBOL_EXPORT_BEGIN
803
+
804
+ /* node -> iseq */
805
+ rb_iseq_t *rb_iseq_new(NODE*, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type);
806
+ rb_iseq_t *rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, const rb_iseq_t *parent);
807
+ rb_iseq_t *rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path);
808
+ rb_iseq_t *rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE);
809
+ 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*);
810
+
811
+ /* src -> iseq */
812
+ rb_iseq_t *rb_iseq_compile(VALUE src, VALUE file, VALUE line);
813
+ rb_iseq_t *rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, rb_block_t *base_block);
814
+ rb_iseq_t *rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt);
815
+
816
+ VALUE rb_iseq_disasm(const rb_iseq_t *iseq);
817
+ int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);
818
+ const char *ruby_node_name(int node);
819
+
820
+ RUBY_EXTERN VALUE rb_cISeq;
821
+ RUBY_EXTERN VALUE rb_cRubyVM;
822
+ RUBY_EXTERN VALUE rb_cEnv;
823
+ RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
824
+ RUBY_SYMBOL_EXPORT_END
825
+
826
+ #define GetProcPtr(obj, ptr) \
827
+ GetCoreDataFromValue((obj), rb_proc_t, (ptr))
828
+
829
+ typedef struct {
830
+ rb_block_t block;
831
+ int8_t safe_level; /* 0..1 */
832
+ int8_t is_from_method; /* bool */
833
+ int8_t is_lambda; /* bool */
834
+ } rb_proc_t;
835
+
836
+ #define GetEnvPtr(obj, ptr) \
837
+ GetCoreDataFromValue((obj), rb_env_t, (ptr))
838
+
839
+ typedef struct {
840
+ int env_size;
841
+ rb_block_t block;
842
+ VALUE env[1]; /* flexible array */
843
+ } rb_env_t;
844
+
845
+ extern const rb_data_type_t ruby_binding_data_type;
846
+
847
+ #define GetBindingPtr(obj, ptr) \
848
+ GetCoreDataFromValue((obj), rb_binding_t, (ptr))
849
+
850
+ typedef struct {
851
+ VALUE env;
852
+ VALUE path;
853
+ unsigned short first_lineno;
854
+ } rb_binding_t;
855
+
856
+ /* used by compile time and send insn */
857
+
858
+ enum vm_check_match_type {
859
+ VM_CHECKMATCH_TYPE_WHEN = 1,
860
+ VM_CHECKMATCH_TYPE_CASE = 2,
861
+ VM_CHECKMATCH_TYPE_RESCUE = 3
862
+ };
863
+
864
+ #define VM_CHECKMATCH_TYPE_MASK 0x03
865
+ #define VM_CHECKMATCH_ARRAY 0x04
866
+
867
+ #define VM_CALL_ARGS_SPLAT (0x01 << 0) /* m(*args) */
868
+ #define VM_CALL_ARGS_BLOCKARG (0x01 << 1) /* m(&block) */
869
+ #define VM_CALL_FCALL (0x01 << 2) /* m(...) */
870
+ #define VM_CALL_VCALL (0x01 << 3) /* m */
871
+ #define VM_CALL_ARGS_SIMPLE (0x01 << 4) /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */
872
+ #define VM_CALL_BLOCKISEQ (0x01 << 5) /* has blockiseq */
873
+ #define VM_CALL_KWARG (0x01 << 6) /* has kwarg */
874
+ #define VM_CALL_TAILCALL (0x01 << 7) /* located at tail position */
875
+ #define VM_CALL_SUPER (0x01 << 8) /* super */
876
+ #define VM_CALL_OPT_SEND (0x01 << 9) /* internal flag */
877
+
878
+ enum vm_special_object_type {
879
+ VM_SPECIAL_OBJECT_VMCORE = 1,
880
+ VM_SPECIAL_OBJECT_CBASE,
881
+ VM_SPECIAL_OBJECT_CONST_BASE
882
+ };
883
+
884
+ enum vm_svar_index {
885
+ VM_SVAR_LASTLINE = 0, /* $_ */
886
+ VM_SVAR_BACKREF = 1, /* $~ */
887
+
888
+ VM_SVAR_EXTRA_START = 2,
889
+ VM_SVAR_FLIPFLOP_START = 2 /* flipflop */
890
+ };
891
+
892
+ #define VM_FRAME_MAGIC_METHOD 0x11
893
+ #define VM_FRAME_MAGIC_BLOCK 0x21
894
+ #define VM_FRAME_MAGIC_CLASS 0x31
895
+ #define VM_FRAME_MAGIC_TOP 0x41
896
+ #define VM_FRAME_MAGIC_CFUNC 0x61
897
+ #define VM_FRAME_MAGIC_PROC 0x71
898
+ #define VM_FRAME_MAGIC_IFUNC 0x81
899
+ #define VM_FRAME_MAGIC_EVAL 0x91
900
+ #define VM_FRAME_MAGIC_LAMBDA 0xa1
901
+ #define VM_FRAME_MAGIC_RESCUE 0xb1
902
+ #define VM_FRAME_MAGIC_DUMMY 0xc1
903
+ #define VM_FRAME_MAGIC_MASK_BITS 8
904
+ #define VM_FRAME_MAGIC_MASK (~(~(VALUE)0<<VM_FRAME_MAGIC_MASK_BITS))
905
+
906
+ #define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
907
+
908
+ /* other frame flag */
909
+ #define VM_FRAME_FLAG_PASSED 0x0100
910
+ #define VM_FRAME_FLAG_FINISH 0x0200
911
+ #define VM_FRAME_FLAG_BMETHOD 0x0400
912
+ #define VM_FRAME_TYPE_FINISH_P(cfp) (((cfp)->flag & VM_FRAME_FLAG_FINISH) != 0)
913
+ #define VM_FRAME_TYPE_BMETHOD_P(cfp) (((cfp)->flag & VM_FRAME_FLAG_BMETHOD) != 0)
914
+
915
+ #define RUBYVM_CFUNC_FRAME_P(cfp) \
916
+ (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
917
+
918
+ /* inline cache */
919
+ typedef struct iseq_inline_cache_entry *IC;
920
+ typedef struct rb_call_info *CALL_INFO;
921
+ typedef struct rb_call_cache *CALL_CACHE;
922
+
923
+ void rb_vm_change_state(void);
924
+
925
+ typedef VALUE CDHASH;
926
+
927
+ #ifndef FUNC_FASTCALL
928
+ #define FUNC_FASTCALL(x) x
929
+ #endif
930
+
931
+ typedef rb_control_frame_t *
932
+ (FUNC_FASTCALL(*rb_insn_func_t))(rb_thread_t *, rb_control_frame_t *);
933
+
934
+ #define GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
935
+ #define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)(p)) & ~0x03))
936
+ #define GC_GUARDED_PTR_P(p) (((VALUE)(p)) & 0x01)
937
+
938
+ /*
939
+ * block frame:
940
+ * ep[ 0]: prev frame
941
+ * ep[-1]: CREF (for *_eval)
942
+ *
943
+ * method frame:
944
+ * ep[ 0]: block pointer (ptr | VM_ENVVAL_BLOCK_PTR_FLAG)
945
+ */
946
+
947
+ #define VM_ENVVAL_BLOCK_PTR_FLAG 0x02
948
+ #define VM_ENVVAL_BLOCK_PTR(v) (GC_GUARDED_PTR(v) | VM_ENVVAL_BLOCK_PTR_FLAG)
949
+ #define VM_ENVVAL_BLOCK_PTR_P(v) ((v) & VM_ENVVAL_BLOCK_PTR_FLAG)
950
+ #define VM_ENVVAL_PREV_EP_PTR(v) ((VALUE)GC_GUARDED_PTR(v))
951
+ #define VM_ENVVAL_PREV_EP_PTR_P(v) (!(VM_ENVVAL_BLOCK_PTR_P(v)))
952
+
953
+ #define VM_EP_PREV_EP(ep) ((VALUE *)GC_GUARDED_PTR_REF((ep)[0]))
954
+ #define VM_EP_BLOCK_PTR(ep) ((rb_block_t *)GC_GUARDED_PTR_REF((ep)[0]))
955
+ #define VM_EP_LEP_P(ep) VM_ENVVAL_BLOCK_PTR_P((ep)[0])
956
+
957
+ VALUE *rb_vm_ep_local_ep(VALUE *ep);
958
+ rb_block_t *rb_vm_control_frame_block_ptr(const rb_control_frame_t *cfp);
959
+
960
+ #define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) ((cfp)+1)
961
+ #define RUBY_VM_NEXT_CONTROL_FRAME(cfp) ((cfp)-1)
962
+ #define RUBY_VM_END_CONTROL_FRAME(th) \
963
+ ((rb_control_frame_t *)((th)->stack + (th)->stack_size))
964
+ #define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
965
+ ((void *)(ecfp) > (void *)(cfp))
966
+ #define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
967
+ (!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
968
+
969
+ #define RUBY_VM_IFUNC_P(ptr) (RB_TYPE_P((VALUE)(ptr), T_IMEMO) && imemo_type((VALUE)ptr) == imemo_ifunc)
970
+ #define RUBY_VM_NORMAL_ISEQ_P(ptr) (RB_TYPE_P((VALUE)(ptr), T_IMEMO) && imemo_type((VALUE)ptr) == imemo_iseq)
971
+
972
+ #define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
973
+ #define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
974
+ ((rb_control_frame_t *)((VALUE *)(b) - 4))
975
+ /* magic number `4' is depend on rb_control_frame_t layout. */
976
+
977
+ /* VM related object allocate functions */
978
+ VALUE rb_thread_alloc(VALUE klass);
979
+ VALUE rb_proc_alloc(VALUE klass);
980
+ VALUE rb_binding_alloc(VALUE klass);
981
+
982
+ /* for debug */
983
+ extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
984
+ extern void rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp, VALUE *_pc);
985
+ extern void rb_vmdebug_debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp);
986
+
987
+ #define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
988
+ #define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
989
+ void rb_vm_bugreport(const void *);
990
+ NORETURN(void rb_bug_context(const void *, const char *fmt, ...));
991
+
992
+ /* functions about thread/vm execution */
993
+ RUBY_SYMBOL_EXPORT_BEGIN
994
+ VALUE rb_iseq_eval(const rb_iseq_t *iseq);
995
+ VALUE rb_iseq_eval_main(const rb_iseq_t *iseq);
996
+ RUBY_SYMBOL_EXPORT_END
997
+ int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
998
+
999
+ VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
1000
+ int argc, const VALUE *argv, const rb_block_t *blockptr);
1001
+ VALUE rb_vm_make_proc_lambda(rb_thread_t *th, const rb_block_t *block, VALUE klass, int8_t is_lambda);
1002
+ VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
1003
+ VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp);
1004
+ VALUE rb_vm_env_local_variables(const rb_env_t *env);
1005
+ VALUE rb_vm_env_prev_envval(const rb_env_t *env);
1006
+ VALUE rb_vm_proc_envval(const rb_proc_t *proc);
1007
+ VALUE *rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars);
1008
+ void rb_vm_inc_const_missing_count(void);
1009
+ void rb_vm_gvl_destroy(rb_vm_t *vm);
1010
+ VALUE rb_vm_call(rb_thread_t *th, VALUE recv, VALUE id, int argc,
1011
+ const VALUE *argv, const rb_callable_method_entry_t *me);
1012
+
1013
+ void rb_thread_start_timer_thread(void);
1014
+ void rb_thread_stop_timer_thread(void);
1015
+ void rb_thread_reset_timer_thread(void);
1016
+ void rb_thread_wakeup_timer_thread(void);
1017
+
1018
+ static inline void
1019
+ rb_vm_living_threads_init(rb_vm_t *vm)
1020
+ {
1021
+ list_head_init(&vm->living_threads);
1022
+ vm->living_thread_num = 0;
1023
+ }
1024
+
1025
+ static inline void
1026
+ rb_vm_living_threads_insert(rb_vm_t *vm, rb_thread_t *th)
1027
+ {
1028
+ list_add_tail(&vm->living_threads, &th->vmlt_node);
1029
+ vm->living_thread_num++;
1030
+ }
1031
+
1032
+ static inline void
1033
+ rb_vm_living_threads_remove(rb_vm_t *vm, rb_thread_t *th)
1034
+ {
1035
+ list_del(&th->vmlt_node);
1036
+ vm->living_thread_num--;
1037
+ }
1038
+
1039
+ int ruby_thread_has_gvl_p(void);
1040
+ typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
1041
+ rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
1042
+ rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
1043
+ int rb_vm_get_sourceline(const rb_control_frame_t *);
1044
+ VALUE rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method);
1045
+ void rb_vm_stack_to_heap(rb_thread_t *th);
1046
+ void ruby_thread_init_stack(rb_thread_t *th);
1047
+ int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, VALUE *klassp);
1048
+ void rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
1049
+
1050
+ void rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE exception_class, const char *mesg);
1051
+
1052
+ void rb_gc_mark_machine_stack(rb_thread_t *th);
1053
+
1054
+ int rb_autoloading_value(VALUE mod, ID id, VALUE* value);
1055
+
1056
+ void rb_vm_rewrite_cref(rb_cref_t *node, VALUE old_klass, VALUE new_klass, rb_cref_t **new_cref_ptr);
1057
+
1058
+ const rb_callable_method_entry_t *rb_vm_frame_method_entry(const rb_control_frame_t *cfp);
1059
+
1060
+ #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
1061
+
1062
+ #define RUBY_CONST_ASSERT(expr) (1/!!(expr)) /* expr must be a compile-time constant */
1063
+ #define VM_STACK_OVERFLOWED_P(cfp, sp, margin) \
1064
+ (!RUBY_CONST_ASSERT(sizeof(*(sp)) == sizeof(VALUE)) || \
1065
+ !RUBY_CONST_ASSERT(sizeof(*(cfp)) == sizeof(rb_control_frame_t)) || \
1066
+ ((rb_control_frame_t *)((sp) + (margin)) + 1) >= (cfp))
1067
+ #define WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) \
1068
+ if (LIKELY(!VM_STACK_OVERFLOWED_P(cfp, sp, margin))) {(void)0;} else /* overflowed */
1069
+ #define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) \
1070
+ WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) vm_stackoverflow()
1071
+ #define CHECK_VM_STACK_OVERFLOW(cfp, margin) \
1072
+ WHEN_VM_STACK_OVERFLOWED(cfp, (cfp)->sp, margin) vm_stackoverflow()
1073
+
1074
+ /* for thread */
1075
+
1076
+ #if RUBY_VM_THREAD_MODEL == 2
1077
+ extern rb_thread_t *ruby_current_thread;
1078
+ extern rb_vm_t *ruby_current_vm;
1079
+ extern rb_event_flag_t ruby_vm_event_flags;
1080
+
1081
+ #define GET_VM() ruby_current_vm
1082
+
1083
+ #ifndef OPT_CALL_CFUNC_WITHOUT_FRAME
1084
+ #define OPT_CALL_CFUNC_WITHOUT_FRAME 0
1085
+ #endif
1086
+
1087
+ #define GET_THREAD() vm_thread_with_frame(ruby_current_thread)
1088
+ #if OPT_CALL_CFUNC_WITHOUT_FRAME
1089
+ static inline rb_thread_t *
1090
+ vm_thread_with_frame(rb_thread_t *th)
1091
+ {
1092
+ if (UNLIKELY(th->passed_ci != 0)) {
1093
+ void rb_vm_call_cfunc_push_frame(rb_thread_t *th);
1094
+ rb_vm_call_cfunc_push_frame(th);
1095
+ }
1096
+ return th;
1097
+ }
1098
+ #else
1099
+ #define vm_thread_with_frame(th) (th)
1100
+ #endif
1101
+
1102
+ #define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
1103
+ #define rb_thread_set_current(th) do { \
1104
+ if ((th)->vm->running_thread != (th)) { \
1105
+ (th)->running_time_us = 0; \
1106
+ } \
1107
+ rb_thread_set_current_raw(th); \
1108
+ (th)->vm->running_thread = (th); \
1109
+ } while (0)
1110
+
1111
+ #else
1112
+ #error "unsupported thread model"
1113
+ #endif
1114
+
1115
+ enum {
1116
+ TIMER_INTERRUPT_MASK = 0x01,
1117
+ PENDING_INTERRUPT_MASK = 0x02,
1118
+ POSTPONED_JOB_INTERRUPT_MASK = 0x04,
1119
+ TRAP_INTERRUPT_MASK = 0x08
1120
+ };
1121
+
1122
+ #define RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TIMER_INTERRUPT_MASK)
1123
+ #define RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, PENDING_INTERRUPT_MASK)
1124
+ #define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
1125
+ #define RUBY_VM_SET_TRAP_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, TRAP_INTERRUPT_MASK)
1126
+ #define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & ~(th)->interrupt_mask & (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
1127
+ #define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
1128
+
1129
+ int rb_signal_buff_size(void);
1130
+ void rb_signal_exec(rb_thread_t *th, int sig);
1131
+ void rb_threadptr_check_signal(rb_thread_t *mth);
1132
+ void rb_threadptr_signal_raise(rb_thread_t *th, int sig);
1133
+ void rb_threadptr_signal_exit(rb_thread_t *th);
1134
+ void rb_threadptr_execute_interrupts(rb_thread_t *, int);
1135
+ void rb_threadptr_interrupt(rb_thread_t *th);
1136
+ void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
1137
+ void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
1138
+ void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
1139
+ int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th);
1140
+
1141
+ #define RUBY_VM_CHECK_INTS(th) ruby_vm_check_ints(th)
1142
+ static inline void
1143
+ ruby_vm_check_ints(rb_thread_t *th)
1144
+ {
1145
+ if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) {
1146
+ rb_threadptr_execute_interrupts(th, 0);
1147
+ }
1148
+ }
1149
+
1150
+ /* tracer */
1151
+ struct rb_trace_arg_struct {
1152
+ rb_event_flag_t event;
1153
+ rb_thread_t *th;
1154
+ rb_control_frame_t *cfp;
1155
+ VALUE self;
1156
+ ID id;
1157
+ VALUE klass;
1158
+ VALUE data;
1159
+
1160
+ int klass_solved;
1161
+
1162
+ /* calc from cfp */
1163
+ int lineno;
1164
+ VALUE path;
1165
+ };
1166
+
1167
+ void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg);
1168
+ void rb_threadptr_exec_event_hooks_and_pop_frame(struct rb_trace_arg_struct *trace_arg);
1169
+
1170
+ #define EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, pop_p_) do { \
1171
+ const rb_event_flag_t flag_arg_ = (flag_); \
1172
+ if (UNLIKELY(ruby_vm_event_flags & (flag_arg_))) { \
1173
+ /* defer evaluating the other arguments */ \
1174
+ ruby_exec_event_hook_orig(th_, flag_arg_, self_, id_, klass_, data_, pop_p_); \
1175
+ } \
1176
+ } while (0)
1177
+
1178
+ static inline void
1179
+ ruby_exec_event_hook_orig(rb_thread_t *const th, const rb_event_flag_t flag,
1180
+ VALUE self, ID id, VALUE klass, VALUE data, int pop_p)
1181
+ {
1182
+ if ((th->event_hooks.events | th->vm->event_hooks.events) & flag) {
1183
+ struct rb_trace_arg_struct trace_arg;
1184
+ trace_arg.event = flag;
1185
+ trace_arg.th = th;
1186
+ trace_arg.cfp = th->cfp;
1187
+ trace_arg.self = self;
1188
+ trace_arg.id = id;
1189
+ trace_arg.klass = klass;
1190
+ trace_arg.data = data;
1191
+ trace_arg.path = Qundef;
1192
+ trace_arg.klass_solved = 0;
1193
+ if (pop_p) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg);
1194
+ else rb_threadptr_exec_event_hooks(&trace_arg);
1195
+ }
1196
+ }
1197
+
1198
+ #define EXEC_EVENT_HOOK(th_, flag_, self_, id_, klass_, data_) \
1199
+ EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 0)
1200
+
1201
+ #define EXEC_EVENT_HOOK_AND_POP_FRAME(th_, flag_, self_, id_, klass_, data_) \
1202
+ EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 1)
1203
+
1204
+ RUBY_SYMBOL_EXPORT_BEGIN
1205
+
1206
+ int rb_thread_check_trap_pending(void);
1207
+
1208
+ extern VALUE rb_get_coverages(void);
1209
+ extern void rb_set_coverages(VALUE);
1210
+ extern void rb_reset_coverages(void);
1211
+
1212
+ void rb_postponed_job_flush(rb_vm_t *vm);
1213
+
1214
+ RUBY_SYMBOL_EXPORT_END
1215
+
1216
+ #endif /* RUBY_VM_CORE_H */