debase-ruby_core_source 3.2.1 → 3.2.2

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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/darray.h +246 -0
  4. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/debug_counter.h +7 -10
  5. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/eval_intern.h +3 -1
  6. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/id.h +44 -0
  7. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/insns_info.inc +68 -94
  8. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/array.h +2 -20
  9. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/bits.h +6 -2
  10. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/class.h +7 -2
  11. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/cmdlineopt.h +3 -1
  12. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/compile.h +0 -1
  13. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/error.h +24 -2
  14. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/gc.h +28 -0
  15. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/hash.h +18 -44
  16. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/io.h +137 -0
  17. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/parse.h +133 -0
  18. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/process.h +0 -14
  19. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/range.h +2 -2
  20. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/re.h +1 -1
  21. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/ruby_parser.h +69 -0
  22. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/signal.h +4 -0
  23. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/string.h +15 -0
  24. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/struct.h +9 -34
  25. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/thread.h +13 -0
  26. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/variable.h +16 -33
  27. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/vm.h +5 -0
  28. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/iseq.h +4 -4
  29. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/method.h +1 -1
  30. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/node.h +125 -0
  31. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/parse.h +6 -4
  32. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_bits.h +564 -0
  33. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_node.h +133 -0
  34. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_st.h +162 -0
  35. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_value.h +106 -0
  36. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ractor_core.h +3 -3
  37. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/revision.h +5 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rubyparser.h +628 -0
  39. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/symbol.h +1 -1
  40. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/thread_pthread.h +11 -13
  41. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/thread_win32.h +0 -5
  42. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/version.h +1 -1
  43. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm.inc +303 -404
  44. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_callinfo.h +50 -16
  45. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_core.h +29 -47
  46. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_exec.h +11 -10
  47. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_insnhelper.h +20 -23
  48. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_opts.h +0 -5
  49. data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/yjit.h +4 -6
  50. data/lib/debase/ruby_core_source/version.rb +1 -1
  51. metadata +119 -115
  52. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/darray.h +0 -179
  53. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/io.h +0 -38
  54. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/parse.h +0 -25
  55. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node.h +0 -514
  56. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/opt_sc.inc +0 -109
  57. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/revision.h +0 -5
  58. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transient_heap.h +0 -65
  59. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/addr2line.h +0 -0
  60. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/builtin.h +0 -0
  61. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/build_assert/build_assert.h +0 -0
  62. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/check_type/check_type.h +0 -0
  63. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/container_of/container_of.h +0 -0
  64. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/list/list.h +0 -0
  65. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ccan/str/str.h +0 -0
  66. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/constant.h +0 -0
  67. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/dln.h +0 -0
  68. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/encindex.h +0 -0
  69. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/hrtime.h +0 -0
  70. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/id_table.h +0 -0
  71. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/insns.inc +0 -0
  72. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/basic_operators.h +0 -0
  73. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/bignum.h +0 -0
  74. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/compar.h +0 -0
  75. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/compilers.h +0 -0
  76. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/complex.h +0 -0
  77. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/cont.h +0 -0
  78. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/dir.h +0 -0
  79. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/enc.h +0 -0
  80. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/encoding.h +0 -0
  81. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/enum.h +0 -0
  82. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/enumerator.h +0 -0
  83. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/eval.h +0 -0
  84. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/file.h +0 -0
  85. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/fixnum.h +0 -0
  86. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/imemo.h +0 -0
  87. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/inits.h +0 -0
  88. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/load.h +0 -0
  89. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/loadpath.h +0 -0
  90. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/math.h +0 -0
  91. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/missing.h +0 -0
  92. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/numeric.h +0 -0
  93. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/object.h +0 -0
  94. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/proc.h +0 -0
  95. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/ractor.h +0 -0
  96. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/random.h +0 -0
  97. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/rational.h +0 -0
  98. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/sanitizers.h +0 -0
  99. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/serial.h +0 -0
  100. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/static_assert.h +0 -0
  101. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/symbol.h +0 -0
  102. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/time.h +0 -0
  103. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/transcode.h +0 -0
  104. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/util.h +0 -0
  105. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal/warnings.h +0 -0
  106. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/internal.h +0 -0
  107. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/known_errors.inc +0 -0
  108. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/node_name.inc +0 -0
  109. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/optinsn.inc +0 -0
  110. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/optunifs.inc +0 -0
  111. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/probes_helper.h +0 -0
  112. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/regenc.h +0 -0
  113. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/regint.h +0 -0
  114. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/regparse.h +0 -0
  115. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/rjit.h +0 -0
  116. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/rjit_c.h +0 -0
  117. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ruby_assert.h +0 -0
  118. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/ruby_atomic.h +0 -0
  119. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/shape.h +0 -0
  120. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/siphash.h +0 -0
  121. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/thread_none.h +0 -0
  122. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/timev.h +0 -0
  123. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/transcode_data.h +0 -0
  124. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/variable.h +0 -0
  125. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_call_iseq_optimized.inc +0 -0
  126. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_debug.h +0 -0
  127. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vm_sync.h +0 -0
  128. /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview1 → ruby-3.3.0-preview2}/vmtc.inc +0 -0
@@ -65,8 +65,12 @@ struct rb_callinfo {
65
65
  VALUE argc;
66
66
  };
67
67
 
68
- #ifndef USE_EMBED_CI
68
+ #if !defined(USE_EMBED_CI) || (USE_EMBED_CI+0)
69
+ #undef USE_EMBED_CI
69
70
  #define USE_EMBED_CI 1
71
+ #else
72
+ #undef USE_EMBED_CI
73
+ #define USE_EMBED_CI 0
70
74
  #endif
71
75
 
72
76
  #if SIZEOF_VALUE == 8
@@ -96,7 +100,9 @@ struct rb_callinfo {
96
100
  static inline bool
97
101
  vm_ci_packed_p(const struct rb_callinfo *ci)
98
102
  {
99
- #if USE_EMBED_CI
103
+ if (!USE_EMBED_CI) {
104
+ return 0;
105
+ }
100
106
  if (LIKELY(((VALUE)ci) & 0x01)) {
101
107
  return 1;
102
108
  }
@@ -104,9 +110,6 @@ vm_ci_packed_p(const struct rb_callinfo *ci)
104
110
  VM_ASSERT(IMEMO_TYPE_P(ci, imemo_callinfo));
105
111
  return 0;
106
112
  }
107
- #else
108
- return 0;
109
- #endif
110
113
  }
111
114
 
112
115
  static inline bool
@@ -196,12 +199,10 @@ vm_ci_dump(const struct rb_callinfo *ci)
196
199
  static inline const struct rb_callinfo *
197
200
  vm_ci_new_(ID mid, unsigned int flag, unsigned int argc, const struct rb_callinfo_kwarg *kwarg, const char *file, int line)
198
201
  {
199
- #if USE_EMBED_CI
200
- if (VM_CI_EMBEDDABLE_P(mid, flag, argc, kwarg)) {
202
+ if (USE_EMBED_CI && VM_CI_EMBEDDABLE_P(mid, flag, argc, kwarg)) {
201
203
  RB_DEBUG_COUNTER_INC(ci_packed);
202
204
  return vm_ci_new_id(mid, flag, argc, kwarg);
203
205
  }
204
- #endif
205
206
 
206
207
  const bool debug = 0;
207
208
  if (debug) ruby_debug_printf("%s:%d ", file, line);
@@ -295,6 +296,17 @@ struct rb_callcache {
295
296
  #define VM_CALLCACHE_UNMARKABLE FL_FREEZE
296
297
  #define VM_CALLCACHE_ON_STACK FL_EXIVAR
297
298
 
299
+ #define VM_CALLCACHE_IVAR IMEMO_FL_USER0
300
+ #define VM_CALLCACHE_BF IMEMO_FL_USER1
301
+ #define VM_CALLCACHE_SUPER IMEMO_FL_USER2
302
+ #define VM_CALLCACHE_REFINEMENT IMEMO_FL_USER3
303
+
304
+ enum vm_cc_type {
305
+ cc_type_normal, // chained from ccs
306
+ cc_type_super,
307
+ cc_type_refinement,
308
+ };
309
+
298
310
  extern const struct rb_callcache *rb_vm_empty_cc(void);
299
311
  extern const struct rb_callcache *rb_vm_empty_cc_for_super(void);
300
312
 
@@ -311,14 +323,39 @@ vm_cc_attr_index_initialize(const struct rb_callcache *cc, shape_id_t shape_id)
311
323
  static inline const struct rb_callcache *
312
324
  vm_cc_new(VALUE klass,
313
325
  const struct rb_callable_method_entry_struct *cme,
314
- vm_call_handler call)
326
+ vm_call_handler call,
327
+ enum vm_cc_type type)
315
328
  {
316
329
  const struct rb_callcache *cc = (const struct rb_callcache *)rb_imemo_new(imemo_callcache, (VALUE)cme, (VALUE)call, 0, klass);
330
+
331
+ switch (type) {
332
+ case cc_type_normal:
333
+ break;
334
+ case cc_type_super:
335
+ *(VALUE *)&cc->flags |= VM_CALLCACHE_SUPER;
336
+ break;
337
+ case cc_type_refinement:
338
+ *(VALUE *)&cc->flags |= VM_CALLCACHE_REFINEMENT;
339
+ break;
340
+ }
341
+
317
342
  vm_cc_attr_index_initialize(cc, INVALID_SHAPE_ID);
318
343
  RB_DEBUG_COUNTER_INC(cc_new);
319
344
  return cc;
320
345
  }
321
346
 
347
+ static inline bool
348
+ vm_cc_super_p(const struct rb_callcache *cc)
349
+ {
350
+ return (cc->flags & VM_CALLCACHE_SUPER) != 0;
351
+ }
352
+
353
+ static inline bool
354
+ vm_cc_refinement_p(const struct rb_callcache *cc)
355
+ {
356
+ return (cc->flags & VM_CALLCACHE_REFINEMENT) != 0;
357
+ }
358
+
322
359
  #define VM_CC_ON_STACK(clazz, call, aux, cme) \
323
360
  (struct rb_callcache) { \
324
361
  .flags = T_IMEMO | \
@@ -438,9 +475,6 @@ vm_cc_valid_p(const struct rb_callcache *cc, const rb_callable_method_entry_t *c
438
475
 
439
476
  /* callcache: mutate */
440
477
 
441
- #define VM_CALLCACH_IVAR IMEMO_FL_USER0
442
- #define VM_CALLCACH_BF IMEMO_FL_USER1
443
-
444
478
  static inline void
445
479
  vm_cc_call_set(const struct rb_callcache *cc, vm_call_handler call)
446
480
  {
@@ -460,13 +494,13 @@ vm_cc_attr_index_set(const struct rb_callcache *cc, attr_index_t index, shape_id
460
494
  VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
461
495
  VM_ASSERT(cc != vm_cc_empty());
462
496
  *attr_value = (attr_index_t)(index + 1) | ((uintptr_t)(dest_shape_id) << SHAPE_FLAG_SHIFT);
463
- *(VALUE *)&cc->flags |= VM_CALLCACH_IVAR;
497
+ *(VALUE *)&cc->flags |= VM_CALLCACHE_IVAR;
464
498
  }
465
499
 
466
500
  static inline bool
467
501
  vm_cc_ivar_p(const struct rb_callcache *cc)
468
502
  {
469
- return (cc->flags & VM_CALLCACH_IVAR) != 0;
503
+ return (cc->flags & VM_CALLCACHE_IVAR) != 0;
470
504
  }
471
505
 
472
506
  static inline void
@@ -495,13 +529,13 @@ vm_cc_bf_set(const struct rb_callcache *cc, const struct rb_builtin_function *bf
495
529
  VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
496
530
  VM_ASSERT(cc != vm_cc_empty());
497
531
  *(const struct rb_builtin_function **)&cc->aux_.bf = bf;
498
- *(VALUE *)&cc->flags |= VM_CALLCACH_BF;
532
+ *(VALUE *)&cc->flags |= VM_CALLCACHE_BF;
499
533
  }
500
534
 
501
535
  static inline bool
502
536
  vm_cc_bf_p(const struct rb_callcache *cc)
503
537
  {
504
- return (cc->flags & VM_CALLCACH_BF) != 0;
538
+ return (cc->flags & VM_CALLCACHE_BF) != 0;
505
539
  }
506
540
 
507
541
  static inline void
@@ -132,18 +132,9 @@ extern int ruby_assert_critical_section_entered;
132
132
  #define RUBY_NSIG NSIG
133
133
 
134
134
  #if defined(SIGCLD)
135
- # define RUBY_SIGCHLD (SIGCLD)
135
+ # define RUBY_SIGCHLD (SIGCLD)
136
136
  #elif defined(SIGCHLD)
137
- # define RUBY_SIGCHLD (SIGCHLD)
138
- #else
139
- # define RUBY_SIGCHLD (0)
140
- #endif
141
-
142
- /* platforms with broken or non-existent SIGCHLD work by polling */
143
- #if defined(__APPLE__)
144
- # define SIGCHLD_LOSSY (1)
145
- #else
146
- # define SIGCHLD_LOSSY (0)
137
+ # define RUBY_SIGCHLD (SIGCHLD)
147
138
  #endif
148
139
 
149
140
  #if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
@@ -191,9 +182,6 @@ void *rb_register_sigaltstack(void *);
191
182
  #if OPT_DIRECT_THREADED_CODE
192
183
  #undef OPT_DIRECT_THREADED_CODE
193
184
  #endif /* OPT_DIRECT_THREADED_CODE */
194
- #if OPT_STACK_CACHING
195
- #undef OPT_STACK_CACHING
196
- #endif /* OPT_STACK_CACHING */
197
185
  #endif /* OPT_CALL_THREADED_CODE */
198
186
 
199
187
  void rb_vm_encoded_insn_data_table_init(void);
@@ -290,7 +278,7 @@ union iseq_inline_storage_entry {
290
278
  };
291
279
 
292
280
  struct rb_calling_info {
293
- const struct rb_callinfo *ci;
281
+ const struct rb_call_data *cd;
294
282
  const struct rb_callcache *cc;
295
283
  VALUE block_handler;
296
284
  VALUE recv;
@@ -515,10 +503,17 @@ struct rb_iseq_constant_body {
515
503
  const rb_iseq_t *mandatory_only_iseq;
516
504
 
517
505
  #if USE_RJIT || USE_YJIT
518
- // Function pointer for JIT code
519
- rb_jit_func_t jit_func;
520
- // Number of total calls with jit_exec()
521
- long unsigned total_calls;
506
+ // Function pointer for JIT code on jit_exec()
507
+ rb_jit_func_t jit_entry;
508
+ // Number of calls on jit_exec()
509
+ long unsigned jit_entry_calls;
510
+ #endif
511
+
512
+ #if USE_YJIT
513
+ // Function pointer for JIT code on jit_exec_exception()
514
+ rb_jit_func_t jit_exception;
515
+ // Number of calls on jit_exec_exception()
516
+ long unsigned jit_exception_calls;
522
517
  #endif
523
518
 
524
519
  #if USE_RJIT
@@ -557,22 +552,21 @@ struct rb_iseq_struct {
557
552
 
558
553
  #define ISEQ_BODY(iseq) ((iseq)->body)
559
554
 
560
- #ifndef USE_LAZY_LOAD
555
+ #if !defined(USE_LAZY_LOAD) || !(USE_LAZY_LOAD+0)
561
556
  #define USE_LAZY_LOAD 0
562
557
  #endif
563
558
 
564
- #if USE_LAZY_LOAD
565
- const rb_iseq_t *rb_iseq_complete(const rb_iseq_t *iseq);
559
+ #if !USE_LAZY_LOAD
560
+ static inline const rb_iseq_t *rb_iseq_complete(const rb_iseq_t *iseq) {return 0;}
566
561
  #endif
562
+ const rb_iseq_t *rb_iseq_complete(const rb_iseq_t *iseq);
567
563
 
568
564
  static inline const rb_iseq_t *
569
565
  rb_iseq_check(const rb_iseq_t *iseq)
570
566
  {
571
- #if USE_LAZY_LOAD
572
- if (ISEQ_BODY(iseq) == NULL) {
567
+ if (USE_LAZY_LOAD && ISEQ_BODY(iseq) == NULL) {
573
568
  rb_iseq_complete((rb_iseq_t *)iseq);
574
569
  }
575
- #endif
576
570
  return iseq;
577
571
  }
578
572
 
@@ -819,19 +813,16 @@ struct rb_block {
819
813
  };
820
814
 
821
815
  typedef struct rb_control_frame_struct {
822
- const VALUE *pc; /* cfp[0] */
823
- VALUE *sp; /* cfp[1] */
824
- const rb_iseq_t *iseq; /* cfp[2] */
825
- VALUE self; /* cfp[3] / block[0] */
826
- const VALUE *ep; /* cfp[4] / block[1] */
827
- const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc or forwarded block handler */
828
- VALUE *__bp__; /* cfp[6] */ /* outside vm_push_frame, use vm_base_ptr instead. */
829
-
816
+ const VALUE *pc; // cfp[0]
817
+ VALUE *sp; // cfp[1]
818
+ const rb_iseq_t *iseq; // cfp[2]
819
+ VALUE self; // cfp[3] / block[0]
820
+ const VALUE *ep; // cfp[4] / block[1]
821
+ const void *block_code; // cfp[5] / block[2] -- iseq, ifunc, or forwarded block handler
822
+ void *jit_return; // cfp[6] -- return address for JIT code
830
823
  #if VM_DEBUG_BP_CHECK
831
- VALUE *bp_check; /* cfp[7] */
824
+ VALUE *bp_check; // cfp[7]
832
825
  #endif
833
- // Return address for YJIT code
834
- void *jit_return;
835
826
  } rb_control_frame_t;
836
827
 
837
828
  extern const rb_data_type_t ruby_threadptr_data_type;
@@ -1559,12 +1550,6 @@ vm_block_handler_verify(MAYBE_UNUSED(VALUE block_handler))
1559
1550
  (vm_block_handler_type(block_handler), 1));
1560
1551
  }
1561
1552
 
1562
- static inline int
1563
- vm_cfp_forwarded_bh_p(const rb_control_frame_t *cfp, VALUE block_handler)
1564
- {
1565
- return ((VALUE) cfp->block_code) == block_handler;
1566
- }
1567
-
1568
1553
  static inline enum rb_block_type
1569
1554
  vm_block_type(const struct rb_block *block)
1570
1555
  {
@@ -1695,11 +1680,7 @@ VALUE rb_proc_dup(VALUE self);
1695
1680
  /* for debug */
1696
1681
  extern void rb_vmdebug_stack_dump_raw(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
1697
1682
  extern void rb_vmdebug_debug_print_pre(const rb_execution_context_t *ec, const rb_control_frame_t *cfp, const VALUE *_pc);
1698
- extern void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const rb_control_frame_t *cfp
1699
- #if OPT_STACK_CACHING
1700
- , VALUE reg_a, VALUE reg_b
1701
- #endif
1702
- );
1683
+ extern void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
1703
1684
 
1704
1685
  #define SDR() rb_vmdebug_stack_dump_raw(GET_EC(), GET_EC()->cfp)
1705
1686
  #define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp))
@@ -1771,6 +1752,7 @@ rb_thread_t * ruby_thread_from_native(void);
1771
1752
  int ruby_thread_set_native(rb_thread_t *th);
1772
1753
  int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp);
1773
1754
  void rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp);
1755
+ void rb_vm_env_write(const VALUE *ep, int index, VALUE v);
1774
1756
  VALUE rb_vm_bh_to_procval(const rb_execution_context_t *ec, VALUE block_handler);
1775
1757
 
1776
1758
  void rb_vm_register_special_exception_str(enum ruby_special_exceptions sp, VALUE exception_class, VALUE mesg);
@@ -21,11 +21,7 @@ typedef rb_iseq_t *ISEQ;
21
21
  #define DEBUG_ENTER_INSN(insn) \
22
22
  rb_vmdebug_debug_print_pre(ec, GET_CFP(), GET_PC());
23
23
 
24
- #if OPT_STACK_CACHING
25
- #define SC_REGS() , reg_a, reg_b
26
- #else
27
24
  #define SC_REGS()
28
- #endif
29
25
 
30
26
  #define DEBUG_END_INSN() \
31
27
  rb_vmdebug_debug_print_post(ec, GET_CFP() SC_REGS());
@@ -40,10 +36,6 @@ typedef rb_iseq_t *ISEQ;
40
36
  #define throwdebug if(0)ruby_debug_printf
41
37
  /* #define throwdebug ruby_debug_printf */
42
38
 
43
- #ifndef USE_INSNS_COUNTER
44
- #define USE_INSNS_COUNTER 0
45
- #endif
46
-
47
39
  /************************************************/
48
40
  #if defined(DISPATCH_XXX)
49
41
  error !
@@ -80,8 +72,7 @@ error !
80
72
  (reg_cfp->pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded), \
81
73
  RSTRING_PTR(rb_iseq_path(reg_cfp->iseq)), \
82
74
  rb_iseq_line_no(reg_cfp->iseq, reg_pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded)); \
83
- } \
84
- if (USE_INSNS_COUNTER) vm_insns_counter_count_insn(BIN(insn));
75
+ }
85
76
 
86
77
  #define INSN_DISPATCH_SIG(insn)
87
78
 
@@ -174,10 +165,20 @@ default: \
174
165
  #define THROW_EXCEPTION(exc) return (VALUE)(exc)
175
166
  #endif
176
167
 
168
+ // Run the interpreter from the JIT
169
+ #define VM_EXEC(ec, val) do { \
170
+ if (val == Qundef) { \
171
+ VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \
172
+ val = vm_exec(ec); \
173
+ } \
174
+ } while (0)
175
+
176
+ // Run the JIT from the interpreter
177
177
  #define JIT_EXEC(ec, val) do { \
178
178
  rb_jit_func_t func; \
179
179
  if (val == Qundef && (func = jit_compile(ec))) { \
180
180
  val = func(ec, ec->cfp); \
181
+ RESTORE_REGS(); /* fix cfp for tailcall */ \
181
182
  if (ec->tag->state) THROW_EXCEPTION(val); \
182
183
  } \
183
184
  } while (0)
@@ -20,30 +20,29 @@ RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state;
20
20
  # define RJIT_STATS RUBY_DEBUG
21
21
  #endif
22
22
 
23
+ #if USE_YJIT // We want vm_insns_count on any YJIT-enabled build
24
+ // Increment vm_insns_count for --yjit-stats. We increment this even when
25
+ // --yjit or --yjit-stats is not used because branching to skip it is slower.
26
+ // We also don't use ATOMIC_INC for performance, allowing inaccuracy on Ractors.
27
+ #define YJIT_COLLECT_USAGE_INSN(insn) rb_vm_insns_count++
28
+ #else
29
+ #define YJIT_COLLECT_USAGE_INSN(insn) // none
30
+ #endif
31
+
32
+ #if RJIT_STATS
33
+ #define RJIT_COLLECT_USAGE_INSN(insn) rb_rjit_collect_vm_usage_insn(insn)
34
+ #else
35
+ #define RJIT_COLLECT_USAGE_INSN(insn) // none
36
+ #endif
37
+
23
38
  #if VM_COLLECT_USAGE_DETAILS
24
39
  #define COLLECT_USAGE_INSN(insn) vm_collect_usage_insn(insn)
25
40
  #define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op)))
26
-
27
41
  #define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s))
28
- #elif RJIT_STATS && YJIT_STATS
29
- // Both flags could be enabled at the same time. You need to call both in that case.
30
- #define COLLECT_USAGE_INSN(insn) rb_rjit_collect_vm_usage_insn(insn); rb_yjit_collect_vm_usage_insn(insn)
31
- #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
32
- #define COLLECT_USAGE_REGISTER(reg, s) /* none */
33
- #elif RJIT_STATS
34
- // for --rjit-stats
35
- #define COLLECT_USAGE_INSN(insn) rb_rjit_collect_vm_usage_insn(insn)
36
- #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
37
- #define COLLECT_USAGE_REGISTER(reg, s) /* none */
38
- #elif YJIT_STATS
39
- /* for --yjit-stats */
40
- #define COLLECT_USAGE_INSN(insn) rb_yjit_collect_vm_usage_insn(insn)
41
- #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
42
- #define COLLECT_USAGE_REGISTER(reg, s) /* none */
43
42
  #else
44
- #define COLLECT_USAGE_INSN(insn) /* none */
45
- #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
46
- #define COLLECT_USAGE_REGISTER(reg, s) /* none */
43
+ #define COLLECT_USAGE_INSN(insn) YJIT_COLLECT_USAGE_INSN(insn); RJIT_COLLECT_USAGE_INSN(insn)
44
+ #define COLLECT_USAGE_OPERAND(insn, n, op) // none
45
+ #define COLLECT_USAGE_REGISTER(reg, s) // none
47
46
  #endif
48
47
 
49
48
  /**********************************************************/
@@ -182,10 +181,8 @@ CC_SET_FASTPATH(const struct rb_callcache *cc, vm_call_handler func, bool enable
182
181
  /**********************************************************/
183
182
 
184
183
  #define CALL_SIMPLE_METHOD() do { \
185
- rb_snum_t x = leaf ? INSN_ATTR(width) : 0; \
186
- rb_snum_t y = attr_width_opt_send_without_block(0); \
187
- rb_snum_t z = x - y; \
188
- ADD_PC(z); \
184
+ rb_snum_t insn_width = attr_width_opt_send_without_block(0); \
185
+ ADD_PC(-insn_width); \
189
186
  DISPATCH_ORIGINAL_INSN(opt_send_without_block); \
190
187
  } while (0)
191
188
 
@@ -54,17 +54,12 @@
54
54
  #define OPT_OPERANDS_UNIFICATION 1
55
55
  #define OPT_INSTRUCTIONS_UNIFICATION 0
56
56
  #define OPT_UNIFY_ALL_COMBINATION 0
57
- #define OPT_STACK_CACHING 0
58
57
 
59
58
  /* misc */
60
59
  #ifndef OPT_SUPPORT_JOKE
61
60
  #define OPT_SUPPORT_JOKE 0
62
61
  #endif
63
62
 
64
- #ifndef OPT_SUPPORT_CALL_C_FUNCTION
65
- #define OPT_SUPPORT_CALL_C_FUNCTION 0
66
- #endif
67
-
68
63
  #ifndef VM_COLLECT_USAGE_DETAILS
69
64
  #define VM_COLLECT_USAGE_DETAILS 0
70
65
  #endif
@@ -27,13 +27,12 @@
27
27
  // Expose these as declarations since we are building YJIT.
28
28
  bool rb_yjit_enabled_p(void);
29
29
  bool rb_yjit_compile_new_iseqs(void);
30
- unsigned rb_yjit_call_threshold(void);
30
+ bool rb_yjit_threshold_hit(const rb_iseq_t *const iseq, unsigned long total_calls);
31
31
  void rb_yjit_invalidate_all_method_lookup_assumptions(void);
32
32
  void rb_yjit_cme_invalidate(rb_callable_method_entry_t *cme);
33
- void rb_yjit_collect_vm_usage_insn(int insn);
34
33
  void rb_yjit_collect_binding_alloc(void);
35
34
  void rb_yjit_collect_binding_set(void);
36
- bool rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec);
35
+ void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception);
37
36
  void rb_yjit_init(void);
38
37
  void rb_yjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
39
38
  void rb_yjit_constant_state_changed(ID id);
@@ -50,13 +49,12 @@ void rb_yjit_tracing_invalidate_all(void);
50
49
 
51
50
  static inline bool rb_yjit_enabled_p(void) { return false; }
52
51
  static inline bool rb_yjit_compile_new_iseqs(void) { return false; }
53
- static inline unsigned rb_yjit_call_threshold(void) { return UINT_MAX; }
52
+ static inline bool rb_yjit_threshold_hit(const rb_iseq_t *const iseq, unsigned long total_calls) { return false; }
54
53
  static inline void rb_yjit_invalidate_all_method_lookup_assumptions(void) {}
55
54
  static inline void rb_yjit_cme_invalidate(rb_callable_method_entry_t *cme) {}
56
- static inline void rb_yjit_collect_vm_usage_insn(int insn) {}
57
55
  static inline void rb_yjit_collect_binding_alloc(void) {}
58
56
  static inline void rb_yjit_collect_binding_set(void) {}
59
- static inline bool rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec) { return false; }
57
+ static inline void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception) {}
60
58
  static inline void rb_yjit_init(void) {}
61
59
  static inline void rb_yjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) {}
62
60
  static inline void rb_yjit_constant_state_changed(ID id) {}
@@ -1,5 +1,5 @@
1
1
  module Debase
2
2
  module RubyCoreSource
3
- VERSION = '3.2.1'
3
+ VERSION = '3.2.2'
4
4
  end
5
5
  end