debase-ruby_core_source 0.10.6 → 0.10.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/debase/ruby_core_source.rb +2 -1
  4. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/addr2line.h +21 -0
  5. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/list/list.h +788 -0
  9. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/str/str.h +16 -0
  10. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/constant.h +54 -0
  11. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/debug_counter.h +378 -0
  12. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/dln.h +51 -0
  13. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/encindex.h +69 -0
  14. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/eval_intern.h +314 -0
  15. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/gc.h +129 -0
  16. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/hrtime.h +168 -0
  17. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/id.h +292 -0
  18. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/id_table.h +34 -0
  19. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/insns.inc +249 -0
  20. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/insns_info.inc +9614 -0
  21. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/internal.h +2682 -0
  22. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/iseq.h +312 -0
  23. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/known_errors.inc +791 -0
  24. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/method.h +232 -0
  25. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/mjit.h +179 -0
  26. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/mjit_compile.inc +7883 -0
  27. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/node.h +483 -0
  28. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/node_name.inc +210 -0
  29. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/opt_sc.inc +109 -0
  30. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/optinsn.inc +128 -0
  31. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/optunifs.inc +43 -0
  32. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/parse.h +210 -0
  33. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/probes_helper.h +42 -0
  34. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regenc.h +254 -0
  35. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regint.h +938 -0
  36. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regparse.h +370 -0
  37. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/revision.h +2 -0
  38. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_assert.h +15 -0
  39. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_atomic.h +244 -0
  40. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/siphash.h +48 -0
  41. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/symbol.h +119 -0
  42. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/thread_pthread.h +75 -0
  43. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/thread_win32.h +36 -0
  44. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/timev.h +56 -0
  45. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/transcode_data.h +139 -0
  46. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/transient_heap.h +62 -0
  47. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/version.h +77 -0
  48. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm.inc +5269 -0
  49. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_call_iseq_optimized.inc +237 -0
  50. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_core.h +1955 -0
  51. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_debug.h +34 -0
  52. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_exec.h +193 -0
  53. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_insnhelper.h +255 -0
  54. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_opts.h +70 -0
  55. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vmtc.inc +243 -0
  56. data/lib/debase/ruby_core_source/version.rb +1 -1
  57. metadata +55 -3
@@ -0,0 +1,16 @@
1
+ /* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
2
+ #ifndef CCAN_STR_H
3
+ #define CCAN_STR_H
4
+ /**
5
+ * stringify - Turn expression into a string literal
6
+ * @expr: any C expression
7
+ *
8
+ * Example:
9
+ * #define PRINT_COND_IF_FALSE(cond) \
10
+ * ((cond) || printf("%s is false!", stringify(cond)))
11
+ */
12
+ #define stringify(expr) stringify_1(expr)
13
+ /* Double-indirection required to stringify expansions */
14
+ #define stringify_1(expr) #expr
15
+
16
+ #endif /* CCAN_STR_H */
@@ -0,0 +1,54 @@
1
+ /**********************************************************************
2
+
3
+ constant.h -
4
+
5
+ $Author$
6
+ created at: Sun Nov 15 00:09:33 2009
7
+
8
+ Copyright (C) 2009 Yusuke Endoh
9
+
10
+ **********************************************************************/
11
+ #ifndef CONSTANT_H
12
+ #define CONSTANT_H
13
+
14
+ typedef enum {
15
+ CONST_DEPRECATED = 0x100,
16
+
17
+ CONST_VISIBILITY_MASK = 0xff,
18
+ CONST_PUBLIC = 0x00,
19
+ CONST_PRIVATE,
20
+ CONST_VISIBILITY_MAX
21
+ } rb_const_flag_t;
22
+
23
+ #define RB_CONST_PRIVATE_P(ce) \
24
+ (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
25
+ #define RB_CONST_PUBLIC_P(ce) \
26
+ (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
27
+
28
+ #define RB_CONST_DEPRECATED_P(ce) \
29
+ ((ce)->flag & CONST_DEPRECATED)
30
+
31
+ typedef struct rb_const_entry_struct {
32
+ rb_const_flag_t flag;
33
+ int line;
34
+ VALUE value; /* should be mark */
35
+ VALUE file; /* should be mark */
36
+ } rb_const_entry_t;
37
+
38
+ VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
39
+ VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
40
+ VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
41
+ void rb_free_const_table(struct rb_id_table *tbl);
42
+ VALUE rb_public_const_get(VALUE klass, ID id);
43
+ VALUE rb_public_const_get_at(VALUE klass, ID id);
44
+ VALUE rb_public_const_get_from(VALUE klass, ID id);
45
+ int rb_public_const_defined(VALUE klass, ID id);
46
+ int rb_public_const_defined_at(VALUE klass, ID id);
47
+ int rb_public_const_defined_from(VALUE klass, ID id);
48
+ rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
49
+ int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
50
+ VALUE rb_const_source_location(VALUE, ID);
51
+ VALUE rb_const_source_location_from(VALUE, ID);
52
+ VALUE rb_const_source_location_at(VALUE, ID);
53
+
54
+ #endif /* CONSTANT_H */
@@ -0,0 +1,378 @@
1
+ /**********************************************************************
2
+
3
+ debug_counter.h -
4
+
5
+ created at: Tue Feb 21 16:51:18 2017
6
+
7
+ Copyright (C) 2017 Koichi Sasada
8
+
9
+ **********************************************************************/
10
+
11
+ #ifndef USE_DEBUG_COUNTER
12
+ #define USE_DEBUG_COUNTER 0
13
+ #endif
14
+
15
+ #ifdef RB_DEBUG_COUNTER
16
+
17
+ /*
18
+ * method cache (mc) counts.
19
+ *
20
+ * * mc_inline_hit/miss: inline mc hit/miss counts (VM send insn)
21
+ * * mc_global_hit/miss: global method cache hit/miss counts
22
+ * two types: (1) inline cache miss (VM send insn)
23
+ * (2) called from C (rb_funcall).
24
+ * * mc_global_state_miss: inline mc miss by global_state miss.
25
+ * * mc_class_serial_miss: ... by mc_class_serial_miss
26
+ * * mc_cme_complement: callable_method_entry complement counts.
27
+ * * mc_cme_complement_hit: callable_method_entry cache hit counts.
28
+ * * mc_search_super: search_method() call counts.
29
+ * * mc_miss_by_nome: inline mc miss by no ment.
30
+ * * mc_miss_by_distinct: ... by distinct ment.
31
+ * * mc_miss_by_refine: ... by ment being refined.
32
+ * * mc_miss_by_visi: ... by visibility change.
33
+ * * mc_miss_spurious: spurious inline mc misshit.
34
+ */
35
+ RB_DEBUG_COUNTER(mc_inline_hit)
36
+ RB_DEBUG_COUNTER(mc_inline_miss)
37
+ RB_DEBUG_COUNTER(mc_global_hit)
38
+ RB_DEBUG_COUNTER(mc_global_miss)
39
+ RB_DEBUG_COUNTER(mc_global_state_miss)
40
+ RB_DEBUG_COUNTER(mc_class_serial_miss)
41
+ RB_DEBUG_COUNTER(mc_cme_complement)
42
+ RB_DEBUG_COUNTER(mc_cme_complement_hit)
43
+ RB_DEBUG_COUNTER(mc_search_super)
44
+ RB_DEBUG_COUNTER(mc_miss_by_nome)
45
+ RB_DEBUG_COUNTER(mc_miss_by_distinct)
46
+ RB_DEBUG_COUNTER(mc_miss_by_refine)
47
+ RB_DEBUG_COUNTER(mc_miss_by_visi)
48
+ RB_DEBUG_COUNTER(mc_miss_spurious)
49
+
50
+ /*
51
+ * call cache fastpath usage
52
+ */
53
+ RB_DEBUG_COUNTER(ccf_general)
54
+ RB_DEBUG_COUNTER(ccf_iseq_setup)
55
+ RB_DEBUG_COUNTER(ccf_iseq_setup_0start)
56
+ RB_DEBUG_COUNTER(ccf_iseq_setup_tailcall_0start)
57
+ RB_DEBUG_COUNTER(ccf_iseq_fix) /* several functions created with tool/mk_call_iseq_optimized.rb */
58
+ RB_DEBUG_COUNTER(ccf_iseq_opt) /* has_opt == TRUE (has optional parameters), but other flags are FALSE */
59
+ RB_DEBUG_COUNTER(ccf_iseq_kw1) /* vm_call_iseq_setup_kwparm_kwarg() */
60
+ RB_DEBUG_COUNTER(ccf_iseq_kw2) /* vm_call_iseq_setup_kwparm_nokwarg() */
61
+ RB_DEBUG_COUNTER(ccf_cfunc)
62
+ RB_DEBUG_COUNTER(ccf_ivar) /* attr_reader */
63
+ RB_DEBUG_COUNTER(ccf_attrset) /* attr_writer */
64
+ RB_DEBUG_COUNTER(ccf_method_missing)
65
+ RB_DEBUG_COUNTER(ccf_zsuper)
66
+ RB_DEBUG_COUNTER(ccf_bmethod)
67
+ RB_DEBUG_COUNTER(ccf_opt_send)
68
+ RB_DEBUG_COUNTER(ccf_opt_call)
69
+ RB_DEBUG_COUNTER(ccf_opt_block_call)
70
+ RB_DEBUG_COUNTER(ccf_super_method)
71
+
72
+ /*
73
+ * control frame push counts.
74
+ *
75
+ * * frame_push: frame push counts.
76
+ * * frame_push_*: frame push counts per each type.
77
+ * * frame_R2R: Ruby frame to Ruby frame
78
+ * * frame_R2C: Ruby frame to C frame
79
+ * * frame_C2C: C frame to C frame
80
+ * * frame_C2R: C frame to Ruby frame
81
+ */
82
+ RB_DEBUG_COUNTER(frame_push)
83
+ RB_DEBUG_COUNTER(frame_push_method)
84
+ RB_DEBUG_COUNTER(frame_push_block)
85
+ RB_DEBUG_COUNTER(frame_push_class)
86
+ RB_DEBUG_COUNTER(frame_push_top)
87
+ RB_DEBUG_COUNTER(frame_push_cfunc)
88
+ RB_DEBUG_COUNTER(frame_push_ifunc)
89
+ RB_DEBUG_COUNTER(frame_push_eval)
90
+ RB_DEBUG_COUNTER(frame_push_rescue)
91
+ RB_DEBUG_COUNTER(frame_push_dummy)
92
+
93
+ RB_DEBUG_COUNTER(frame_R2R)
94
+ RB_DEBUG_COUNTER(frame_R2C)
95
+ RB_DEBUG_COUNTER(frame_C2C)
96
+ RB_DEBUG_COUNTER(frame_C2R)
97
+
98
+ /* instance variable counts
99
+ *
100
+ * * ivar_get_ic_hit/miss: ivar_get inline cache (ic) hit/miss counts (VM insn)
101
+ * * ivar_get_ic_miss_serial: ivar_get ic miss reason by serial (VM insn)
102
+ * * ivar_get_ic_miss_unset: ... by unset (VM insn)
103
+ * * ivar_get_ic_miss_noobject: ... by "not T_OBJECT" (VM insn)
104
+ * * ivar_set_...: same counts with ivar_set (VM insn)
105
+ * * ivar_get/set_base: call counts of "rb_ivar_get/set()".
106
+ * because of (1) ic miss.
107
+ * (2) direct call by C extensions.
108
+ */
109
+ RB_DEBUG_COUNTER(ivar_get_ic_hit)
110
+ RB_DEBUG_COUNTER(ivar_get_ic_miss)
111
+ RB_DEBUG_COUNTER(ivar_get_ic_miss_serial)
112
+ RB_DEBUG_COUNTER(ivar_get_ic_miss_unset)
113
+ RB_DEBUG_COUNTER(ivar_get_ic_miss_noobject)
114
+ RB_DEBUG_COUNTER(ivar_set_ic_hit)
115
+ RB_DEBUG_COUNTER(ivar_set_ic_miss)
116
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_serial)
117
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_unset)
118
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_oorange)
119
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_noobject)
120
+ RB_DEBUG_COUNTER(ivar_get_base)
121
+ RB_DEBUG_COUNTER(ivar_set_base)
122
+
123
+ /* local variable counts
124
+ *
125
+ * * lvar_get: total lvar get counts (VM insn)
126
+ * * lvar_get_dynamic: lvar get counts if accessing upper env (VM insn)
127
+ * * lvar_set*: same as "get"
128
+ * * lvar_set_slowpath: counts using vm_env_write_slowpath()
129
+ */
130
+ RB_DEBUG_COUNTER(lvar_get)
131
+ RB_DEBUG_COUNTER(lvar_get_dynamic)
132
+ RB_DEBUG_COUNTER(lvar_set)
133
+ RB_DEBUG_COUNTER(lvar_set_dynamic)
134
+ RB_DEBUG_COUNTER(lvar_set_slowpath)
135
+
136
+ /* GC counts:
137
+ *
138
+ * * count: simple count
139
+ * * _minor: minor gc
140
+ * * _major: major gc
141
+ * * other suffix is corresponding to last_gc_info or
142
+ * gc_profile_record_flag in gc.c.
143
+ */
144
+ RB_DEBUG_COUNTER(gc_count)
145
+ RB_DEBUG_COUNTER(gc_minor_newobj)
146
+ RB_DEBUG_COUNTER(gc_minor_malloc)
147
+ RB_DEBUG_COUNTER(gc_minor_method)
148
+ RB_DEBUG_COUNTER(gc_minor_capi)
149
+ RB_DEBUG_COUNTER(gc_minor_stress)
150
+ RB_DEBUG_COUNTER(gc_major_nofree)
151
+ RB_DEBUG_COUNTER(gc_major_oldgen)
152
+ RB_DEBUG_COUNTER(gc_major_shady)
153
+ RB_DEBUG_COUNTER(gc_major_force)
154
+ RB_DEBUG_COUNTER(gc_major_oldmalloc)
155
+
156
+ RB_DEBUG_COUNTER(gc_isptr_trial)
157
+ RB_DEBUG_COUNTER(gc_isptr_range)
158
+ RB_DEBUG_COUNTER(gc_isptr_align)
159
+ RB_DEBUG_COUNTER(gc_isptr_maybe)
160
+
161
+ /* object allocation counts:
162
+ *
163
+ * * obj_newobj: newobj counts
164
+ * * obj_newobj_slowpath: newobj with slowpath counts
165
+ * * obj_newobj_wb_unprotected: newobj for wb_unprotecte.
166
+ * * obj_free: obj_free() counts
167
+ * * obj_promote: promoted counts (oldgen)
168
+ * * obj_wb_unprotect: wb unprotect counts
169
+ *
170
+ * * obj_[type]_[attr]: *free'ed counts* for each type.
171
+ * Note that it is not a allocated counts.
172
+ * * [type]
173
+ * * _obj: T_OBJECT
174
+ * * _str: T_STRING
175
+ * * _ary: T_ARRAY
176
+ * * _xxx: T_XXX (hash, struct, ...)
177
+ *
178
+ * * [attr]
179
+ * * _ptr: R?? is not embed.
180
+ * * _embed: R?? is embed.
181
+ * * _transient: R?? uses transient heap.
182
+ * * type specific attr.
183
+ * * str_shared: str is shared.
184
+ * * str_nofree: nofree
185
+ * * str_fstr: fstr
186
+ * * hash_empty: hash is empty
187
+ * * hash_1_4: has 1 to 4 entries
188
+ * * hash_5_8: has 5 to 8 entries
189
+ * * hash_g8: has n entries (n>8)
190
+ * * match_under4: has under 4 oniguruma regions allocated
191
+ * * match_ge4: has n regions allocated (4<=n<8)
192
+ * * match_ge8: has n regions allocated (8<=n)
193
+ * * data_empty: T_DATA but no memory free.
194
+ * * data_xfree: free'ed by xfree().
195
+ * * data_imm_free: free'ed immediately.
196
+ * * data_zombie: free'ed with zombie.
197
+ * * imemo_*: T_IMEMO with each type.
198
+ */
199
+ RB_DEBUG_COUNTER(obj_newobj)
200
+ RB_DEBUG_COUNTER(obj_newobj_slowpath)
201
+ RB_DEBUG_COUNTER(obj_newobj_wb_unprotected)
202
+ RB_DEBUG_COUNTER(obj_free)
203
+ RB_DEBUG_COUNTER(obj_promote)
204
+ RB_DEBUG_COUNTER(obj_wb_unprotect)
205
+
206
+ RB_DEBUG_COUNTER(obj_obj_embed)
207
+ RB_DEBUG_COUNTER(obj_obj_transient)
208
+ RB_DEBUG_COUNTER(obj_obj_ptr)
209
+
210
+ RB_DEBUG_COUNTER(obj_str_ptr)
211
+ RB_DEBUG_COUNTER(obj_str_embed)
212
+ RB_DEBUG_COUNTER(obj_str_shared)
213
+ RB_DEBUG_COUNTER(obj_str_nofree)
214
+ RB_DEBUG_COUNTER(obj_str_fstr)
215
+
216
+ RB_DEBUG_COUNTER(obj_ary_embed)
217
+ RB_DEBUG_COUNTER(obj_ary_transient)
218
+ RB_DEBUG_COUNTER(obj_ary_ptr)
219
+ RB_DEBUG_COUNTER(obj_ary_extracapa)
220
+ /*
221
+ ary_shared_create: shared ary by Array#dup and so on.
222
+ ary_shared: finished in shard.
223
+ ary_shared_root_occupied: shared_root but has only 1 refcnt.
224
+ The number (ary_shared - ary_shared_root_occupied) is meaningful.
225
+ */
226
+ RB_DEBUG_COUNTER(obj_ary_shared_create)
227
+ RB_DEBUG_COUNTER(obj_ary_shared)
228
+ RB_DEBUG_COUNTER(obj_ary_shared_root_occupied)
229
+
230
+ RB_DEBUG_COUNTER(obj_hash_empty)
231
+ RB_DEBUG_COUNTER(obj_hash_1)
232
+ RB_DEBUG_COUNTER(obj_hash_2)
233
+ RB_DEBUG_COUNTER(obj_hash_3)
234
+ RB_DEBUG_COUNTER(obj_hash_4)
235
+ RB_DEBUG_COUNTER(obj_hash_5_8)
236
+ RB_DEBUG_COUNTER(obj_hash_g8)
237
+
238
+ RB_DEBUG_COUNTER(obj_hash_null)
239
+ RB_DEBUG_COUNTER(obj_hash_ar)
240
+ RB_DEBUG_COUNTER(obj_hash_st)
241
+ RB_DEBUG_COUNTER(obj_hash_transient)
242
+ RB_DEBUG_COUNTER(obj_hash_force_convert)
243
+
244
+ RB_DEBUG_COUNTER(obj_struct_embed)
245
+ RB_DEBUG_COUNTER(obj_struct_transient)
246
+ RB_DEBUG_COUNTER(obj_struct_ptr)
247
+
248
+ RB_DEBUG_COUNTER(obj_regexp_ptr)
249
+
250
+ RB_DEBUG_COUNTER(obj_data_empty)
251
+ RB_DEBUG_COUNTER(obj_data_xfree)
252
+ RB_DEBUG_COUNTER(obj_data_imm_free)
253
+ RB_DEBUG_COUNTER(obj_data_zombie)
254
+
255
+ RB_DEBUG_COUNTER(obj_match_under4)
256
+ RB_DEBUG_COUNTER(obj_match_ge4)
257
+ RB_DEBUG_COUNTER(obj_match_ge8)
258
+ RB_DEBUG_COUNTER(obj_match_ptr)
259
+ RB_DEBUG_COUNTER(obj_file_ptr)
260
+ RB_DEBUG_COUNTER(obj_bignum_ptr)
261
+
262
+ RB_DEBUG_COUNTER(obj_symbol)
263
+
264
+ RB_DEBUG_COUNTER(obj_imemo_ment)
265
+ RB_DEBUG_COUNTER(obj_imemo_iseq)
266
+ RB_DEBUG_COUNTER(obj_imemo_env)
267
+ RB_DEBUG_COUNTER(obj_imemo_tmpbuf)
268
+ RB_DEBUG_COUNTER(obj_imemo_ast)
269
+ RB_DEBUG_COUNTER(obj_imemo_cref)
270
+ RB_DEBUG_COUNTER(obj_imemo_svar)
271
+ RB_DEBUG_COUNTER(obj_imemo_throw_data)
272
+ RB_DEBUG_COUNTER(obj_imemo_ifunc)
273
+ RB_DEBUG_COUNTER(obj_imemo_memo)
274
+ RB_DEBUG_COUNTER(obj_imemo_parser_strterm)
275
+
276
+ RB_DEBUG_COUNTER(obj_iclass_ptr)
277
+ RB_DEBUG_COUNTER(obj_class_ptr)
278
+ RB_DEBUG_COUNTER(obj_module_ptr)
279
+
280
+ /* ar_table */
281
+ RB_DEBUG_COUNTER(artable_hint_hit)
282
+ RB_DEBUG_COUNTER(artable_hint_miss)
283
+ RB_DEBUG_COUNTER(artable_hint_notfound)
284
+
285
+ /* heap function counts
286
+ *
287
+ * * heap_xmalloc/realloc/xfree: call counts
288
+ */
289
+ RB_DEBUG_COUNTER(heap_xmalloc)
290
+ RB_DEBUG_COUNTER(heap_xrealloc)
291
+ RB_DEBUG_COUNTER(heap_xfree)
292
+
293
+ /* transient_heap */
294
+ RB_DEBUG_COUNTER(theap_alloc)
295
+ RB_DEBUG_COUNTER(theap_alloc_fail)
296
+ RB_DEBUG_COUNTER(theap_evacuate)
297
+
298
+ /* mjit_exec() counts */
299
+ RB_DEBUG_COUNTER(mjit_exec)
300
+ RB_DEBUG_COUNTER(mjit_exec_not_added)
301
+ RB_DEBUG_COUNTER(mjit_exec_not_added_add_iseq)
302
+ RB_DEBUG_COUNTER(mjit_exec_not_ready)
303
+ RB_DEBUG_COUNTER(mjit_exec_not_compiled)
304
+ RB_DEBUG_COUNTER(mjit_exec_call_func)
305
+
306
+ /* MJIT <-> VM frame push counts */
307
+ RB_DEBUG_COUNTER(mjit_frame_VM2VM)
308
+ RB_DEBUG_COUNTER(mjit_frame_VM2JT)
309
+ RB_DEBUG_COUNTER(mjit_frame_JT2JT)
310
+ RB_DEBUG_COUNTER(mjit_frame_JT2VM)
311
+
312
+ /* MJIT cancel counters */
313
+ RB_DEBUG_COUNTER(mjit_cancel)
314
+ RB_DEBUG_COUNTER(mjit_cancel_ivar_inline)
315
+ RB_DEBUG_COUNTER(mjit_cancel_send_inline)
316
+ RB_DEBUG_COUNTER(mjit_cancel_opt_insn) /* CALL_SIMPLE_METHOD */
317
+ RB_DEBUG_COUNTER(mjit_cancel_invalidate_all)
318
+
319
+ /* rb_mjit_unit_list length */
320
+ RB_DEBUG_COUNTER(mjit_length_unit_queue)
321
+ RB_DEBUG_COUNTER(mjit_length_active_units)
322
+ RB_DEBUG_COUNTER(mjit_length_compact_units)
323
+ RB_DEBUG_COUNTER(mjit_length_stale_units)
324
+
325
+ /* Other MJIT counters */
326
+ RB_DEBUG_COUNTER(mjit_compile_failures)
327
+
328
+ /* load (not implemented yet) */
329
+ /*
330
+ RB_DEBUG_COUNTER(load_files)
331
+ RB_DEBUG_COUNTER(load_path_is_not_realpath)
332
+ */
333
+ #endif
334
+
335
+ #ifndef RUBY_DEBUG_COUNTER_H
336
+ #define RUBY_DEBUG_COUNTER_H 1
337
+
338
+ #if !defined(__GNUC__) && USE_DEBUG_COUNTER
339
+ #error "USE_DEBUG_COUNTER is not supported by other than __GNUC__"
340
+ #endif
341
+
342
+ enum rb_debug_counter_type {
343
+ #define RB_DEBUG_COUNTER(name) RB_DEBUG_COUNTER_##name,
344
+ #include __FILE__
345
+ RB_DEBUG_COUNTER_MAX
346
+ #undef RB_DEBUG_COUNTER
347
+ };
348
+
349
+ #if USE_DEBUG_COUNTER
350
+ #include "ruby/ruby.h"
351
+
352
+ extern size_t rb_debug_counter[];
353
+
354
+ inline static int
355
+ rb_debug_counter_add(enum rb_debug_counter_type type, int add, int cond)
356
+ {
357
+ if (cond) {
358
+ rb_debug_counter[(int)type] += add;
359
+ }
360
+ return cond;
361
+ }
362
+
363
+ VALUE rb_debug_counter_reset(VALUE klass);
364
+ VALUE rb_debug_counter_show(VALUE klass);
365
+
366
+ #define RB_DEBUG_COUNTER_INC(type) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, 1)
367
+ #define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !(cond)))
368
+ #define RB_DEBUG_COUNTER_INC_IF(type, cond) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, (cond))
369
+
370
+ #else
371
+ #define RB_DEBUG_COUNTER_INC(type) ((void)0)
372
+ #define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (cond)
373
+ #define RB_DEBUG_COUNTER_INC_IF(type, cond) (cond)
374
+ #endif
375
+
376
+ void rb_debug_counter_show_results(const char *msg);
377
+
378
+ #endif /* RUBY_DEBUG_COUNTER_H */