debase-ruby_core_source 0.10.9 → 0.10.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +1 -1
  4. data/Rakefile +6 -3
  5. data/debase-ruby_core_source.gemspec +2 -1
  6. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/addr2line.h +2 -3
  7. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/builtin.h +17 -2
  8. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/build_assert/build_assert.h +0 -0
  9. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/check_type/check_type.h +0 -0
  10. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/container_of/container_of.h +0 -0
  11. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/list/list.h +0 -0
  12. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/str/str.h +0 -0
  13. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/constant.h +10 -5
  14. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/debug_counter.h +127 -48
  15. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/dln.h +3 -18
  16. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/encindex.h +3 -2
  17. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/eval_intern.h +16 -7
  18. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/gc.h +13 -2
  19. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/hrtime.h +0 -0
  20. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/id.h +0 -0
  21. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/id_table.h +2 -0
  22. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/insns.inc +0 -4
  23. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/insns_info.inc +323 -536
  24. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
  25. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bignum.h +246 -0
  26. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bits.h +566 -0
  27. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
  28. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compar.h +50 -0
  29. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compile.h +32 -0
  30. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
  31. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/cont.h +25 -0
  33. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/dir.h +17 -0
  34. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enc.h +20 -0
  35. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/encoding.h +28 -0
  36. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enum.h +19 -0
  37. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enumerator.h +22 -0
  38. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/error.h +124 -0
  39. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/eval.h +33 -0
  40. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/file.h +39 -0
  41. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/fixnum.h +185 -0
  42. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
  43. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/hash.h +241 -0
  44. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
  45. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/inits.h +51 -0
  46. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/io.h +35 -0
  47. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/load.h +19 -0
  48. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/loadpath.h +17 -0
  49. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/math.h +24 -0
  50. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/missing.h +19 -0
  51. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/numeric.h +255 -0
  52. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/object.h +83 -0
  53. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/parse.h +23 -0
  54. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/proc.h +33 -0
  55. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/process.h +136 -0
  56. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/random.h +17 -0
  57. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/range.h +41 -0
  58. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/rational.h +71 -0
  59. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/re.h +29 -0
  60. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/sanitizers.h +191 -0
  61. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/scheduler.h +44 -0
  62. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
  63. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/signal.h +22 -0
  64. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
  65. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/string.h +140 -0
  66. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/struct.h +154 -0
  67. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/symbol.h +41 -0
  68. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/thread.h +54 -0
  69. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/time.h +35 -0
  70. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/transcode.h +21 -0
  71. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/util.h +31 -0
  72. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/variable.h +84 -0
  73. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
  74. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
  75. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
  76. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/iseq.h +11 -18
  77. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/known_errors.inc +0 -0
  78. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/method.h +21 -8
  79. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/mjit.h +89 -48
  80. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/mjit_compile.inc +2746 -2288
  81. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/node.h +32 -24
  82. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/node_name.inc +2 -2
  83. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/opt_sc.inc +0 -0
  84. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/optinsn.inc +0 -0
  85. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/optunifs.inc +0 -0
  86. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/parse.h +1 -0
  87. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/probes_helper.h +2 -0
  88. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
  89. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/regenc.h +0 -0
  90. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/regint.h +1 -1
  91. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/regparse.h +0 -0
  92. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/revision.h +2 -0
  93. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
  94. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
  95. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/siphash.h +0 -0
  96. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/symbol.h +4 -4
  97. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/thread_pthread.h +45 -5
  98. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/thread_win32.h +28 -3
  99. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/timev.h +1 -0
  100. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/transcode_data.h +2 -3
  101. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/transient_heap.h +6 -3
  102. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/variable.h +22 -0
  103. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/version.h +23 -11
  104. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vm.inc +707 -671
  105. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vm_call_iseq_optimized.inc +93 -86
  106. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_callinfo.h +456 -0
  107. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/vm_core.h +262 -194
  108. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
  109. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/vm_exec.h +9 -6
  110. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/vm_insnhelper.h +28 -26
  111. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vm_opts.h +6 -5
  112. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_sync.h +136 -0
  113. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vmtc.inc +0 -4
  114. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/addr2line.h +2 -3
  115. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/builtin.h +83 -0
  116. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/build_assert/build_assert.h +13 -13
  117. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/check_type/check_type.h +17 -17
  118. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/container_of/container_of.h +63 -63
  119. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/list/list.h +262 -262
  120. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/str/str.h +4 -4
  121. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/constant.h +10 -9
  122. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/darray.h +198 -0
  123. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/debug_counter.h +137 -48
  124. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/dln.h +3 -23
  125. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/encindex.h +3 -2
  126. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/eval_intern.h +34 -41
  127. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/gc.h +24 -11
  128. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/hrtime.h +9 -9
  129. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/id.h +4 -3
  130. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/id_table.h +3 -1
  131. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/insns.inc +6 -8
  132. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/insns_info.inc +1907 -2543
  133. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/array.h +113 -0
  134. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/bignum.h +246 -0
  135. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/bits.h +565 -0
  136. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/class.h +188 -0
  137. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compar.h +49 -0
  138. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compile.h +35 -0
  139. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compilers.h +107 -0
  140. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/complex.h +29 -0
  141. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/cont.h +24 -0
  142. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/dir.h +16 -0
  143. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enc.h +19 -0
  144. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/encoding.h +30 -0
  145. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enum.h +18 -0
  146. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enumerator.h +21 -0
  147. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/error.h +191 -0
  148. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/eval.h +32 -0
  149. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/file.h +38 -0
  150. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/fixnum.h +184 -0
  151. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/gc.h +175 -0
  152. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/hash.h +243 -0
  153. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/imemo.h +243 -0
  154. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/inits.h +50 -0
  155. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/io.h +38 -0
  156. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/load.h +18 -0
  157. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/loadpath.h +16 -0
  158. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/math.h +23 -0
  159. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/missing.h +18 -0
  160. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/numeric.h +271 -0
  161. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/object.h +83 -0
  162. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/parse.h +23 -0
  163. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/proc.h +32 -0
  164. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/process.h +137 -0
  165. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/random.h +16 -0
  166. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/range.h +40 -0
  167. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/rational.h +72 -0
  168. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/re.h +30 -0
  169. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/sanitizers.h +190 -0
  170. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/serial.h +23 -0
  171. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/signal.h +21 -0
  172. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/static_assert.h +16 -0
  173. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/string.h +141 -0
  174. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/struct.h +153 -0
  175. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/symbol.h +40 -0
  176. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/thread.h +53 -0
  177. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/time.h +34 -0
  178. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/transcode.h +20 -0
  179. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/util.h +27 -0
  180. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/variable.h +83 -0
  181. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/vm.h +132 -0
  182. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/warnings.h +16 -0
  183. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal.h +109 -0
  184. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/iseq.h +44 -35
  185. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/known_errors.inc +0 -0
  186. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/method.h +21 -4
  187. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/mjit.h +231 -0
  188. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/mjit_compile.inc +3322 -2940
  189. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/node.h +39 -23
  190. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/node_name.inc +210 -0
  191. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/opt_sc.inc +0 -2
  192. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/optinsn.inc +7 -7
  193. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/optunifs.inc +1 -1
  194. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/parse.h +9 -5
  195. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/probes_helper.h +9 -7
  196. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ractor_core.h +346 -0
  197. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/regenc.h +8 -8
  198. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/regint.h +16 -12
  199. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/regparse.h +2 -2
  200. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/revision.h +2 -0
  201. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ruby_assert.h +14 -0
  202. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ruby_atomic.h +23 -0
  203. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/siphash.h +0 -0
  204. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/symbol.h +14 -14
  205. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/thread_pthread.h +45 -5
  206. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/thread_win32.h +30 -5
  207. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/timev.h +1 -0
  208. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/transcode_data.h +49 -50
  209. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/transient_heap.h +6 -3
  210. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/variable.h +21 -0
  211. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/version.h +15 -4
  212. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/vm.inc +1033 -887
  213. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_call_iseq_optimized.inc +244 -0
  214. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_callinfo.h +454 -0
  215. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/vm_core.h +508 -362
  216. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_debug.h +119 -0
  217. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/vm_exec.h +22 -18
  218. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/vm_insnhelper.h +42 -32
  219. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/vm_opts.h +8 -5
  220. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_sync.h +137 -0
  221. data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/vmtc.inc +6 -8
  222. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit.h +63 -0
  223. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_asm.h +392 -0
  224. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_codegen.h +19 -0
  225. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_core.h +302 -0
  226. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_iface.h +38 -0
  227. data/lib/debase/ruby_core_source/version.rb +1 -1
  228. data/lib/debase/ruby_core_source.rb +0 -2
  229. metadata +240 -110
  230. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/internal.h +0 -2682
  231. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/revision.h +0 -2
  232. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_assert.h +0 -15
  233. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_atomic.h +0 -244
  234. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_call_iseq_optimized.inc +0 -237
  235. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_debug.h +0 -34
  236. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/internal.h +0 -2657
  237. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/mjit.h +0 -175
  238. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/node_name.inc +0 -208
  239. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/revision.h +0 -2
  240. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ruby_assert.h +0 -15
  241. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ruby_atomic.h +0 -244
  242. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_debug.h +0 -34
@@ -1,3 +1,5 @@
1
+ #ifndef RUBY_VM_CORE_H
2
+ #define RUBY_VM_CORE_H
1
3
  /**********************************************************************
2
4
 
3
5
  vm_core.h -
@@ -9,9 +11,6 @@
9
11
 
10
12
  **********************************************************************/
11
13
 
12
- #ifndef RUBY_VM_CORE_H
13
- #define RUBY_VM_CORE_H
14
-
15
14
  /*
16
15
  * Enable check mode.
17
16
  * 1: enable local assertions.
@@ -46,6 +45,12 @@
46
45
  #define VMDEBUG 3
47
46
  #endif
48
47
 
48
+ #include "ruby/internal/config.h"
49
+
50
+ #include <stddef.h>
51
+ #include <signal.h>
52
+ #include <stdarg.h>
53
+
49
54
  #include "ruby_assert.h"
50
55
 
51
56
  #if VM_CHECK_MODE > 0
@@ -57,6 +62,26 @@
57
62
  #define VM_UNREACHABLE(func) UNREACHABLE
58
63
  #endif
59
64
 
65
+ #include <setjmp.h>
66
+
67
+ #include "ruby/internal/stdbool.h"
68
+ #include "ccan/list/list.h"
69
+ #include "id.h"
70
+ #include "internal.h"
71
+ #include "internal/array.h"
72
+ #include "internal/serial.h"
73
+ #include "internal/vm.h"
74
+ #include "method.h"
75
+ #include "node.h"
76
+ #include "ruby/ruby.h"
77
+ #include "ruby/st.h"
78
+ #include "ruby_atomic.h"
79
+ #include "vm_opts.h"
80
+ #include "darray.h"
81
+
82
+ #include "ruby/thread_native.h"
83
+ #include THREAD_IMPL_H
84
+
60
85
  #define RUBY_VM_THREAD_MODEL 2
61
86
 
62
87
  /*
@@ -69,26 +94,6 @@
69
94
  # define VM_INSN_INFO_TABLE_IMPL 2
70
95
  #endif
71
96
 
72
- #include "ruby/ruby.h"
73
- #include "ruby/st.h"
74
-
75
- #include "node.h"
76
- #include "vm_opts.h"
77
- #include "id.h"
78
- #include "method.h"
79
- #include "ruby_atomic.h"
80
- #include "ccan/list/list.h"
81
-
82
- #include "ruby/thread_native.h"
83
- #if defined(_WIN32)
84
- #include "thread_win32.h"
85
- #elif defined(HAVE_PTHREAD_H)
86
- #include "thread_pthread.h"
87
- #endif
88
-
89
- #include <setjmp.h>
90
- #include <signal.h>
91
-
92
97
  #if defined(NSIG_MAX) /* POSIX issue 8 */
93
98
  # undef NSIG
94
99
  # define NSIG NSIG_MAX
@@ -123,22 +128,15 @@
123
128
  /* define to 0 to test old code path */
124
129
  #define WAITPID_USE_SIGCHLD (RUBY_SIGCHLD || SIGCHLD_LOSSY)
125
130
 
126
- #ifdef HAVE_STDARG_PROTOTYPES
127
- #include <stdarg.h>
128
- #define va_init_list(a,b) va_start((a),(b))
129
- #else
130
- #include <varargs.h>
131
- #define va_init_list(a,b) va_start((a))
132
- #endif
133
-
134
131
  #if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
135
132
  # define USE_SIGALTSTACK
136
- void *rb_register_sigaltstack(void);
137
- # define RB_ALTSTACK_INIT(var) var = rb_register_sigaltstack()
138
- # define RB_ALTSTACK_FREE(var) xfree(var)
133
+ void *rb_allocate_sigaltstack(void);
134
+ void *rb_register_sigaltstack(void *);
135
+ # define RB_ALTSTACK_INIT(var, altstack) var = rb_register_sigaltstack(altstack)
136
+ # define RB_ALTSTACK_FREE(var) free(var)
139
137
  # define RB_ALTSTACK(var) var
140
138
  #else /* noop */
141
- # define RB_ALTSTACK_INIT(var)
139
+ # define RB_ALTSTACK_INIT(var, altstack)
142
140
  # define RB_ALTSTACK_FREE(var)
143
141
  # define RB_ALTSTACK(var) (0)
144
142
  #endif
@@ -182,28 +180,28 @@ typedef unsigned long rb_num_t;
182
180
  typedef signed long rb_snum_t;
183
181
 
184
182
  enum ruby_tag_type {
185
- RUBY_TAG_NONE = 0x0,
186
- RUBY_TAG_RETURN = 0x1,
187
- RUBY_TAG_BREAK = 0x2,
188
- RUBY_TAG_NEXT = 0x3,
189
- RUBY_TAG_RETRY = 0x4,
190
- RUBY_TAG_REDO = 0x5,
191
- RUBY_TAG_RAISE = 0x6,
192
- RUBY_TAG_THROW = 0x7,
193
- RUBY_TAG_FATAL = 0x8,
194
- RUBY_TAG_MASK = 0xf
183
+ RUBY_TAG_NONE = 0x0,
184
+ RUBY_TAG_RETURN = 0x1,
185
+ RUBY_TAG_BREAK = 0x2,
186
+ RUBY_TAG_NEXT = 0x3,
187
+ RUBY_TAG_RETRY = 0x4,
188
+ RUBY_TAG_REDO = 0x5,
189
+ RUBY_TAG_RAISE = 0x6,
190
+ RUBY_TAG_THROW = 0x7,
191
+ RUBY_TAG_FATAL = 0x8,
192
+ RUBY_TAG_MASK = 0xf
195
193
  };
196
194
 
197
- #define TAG_NONE RUBY_TAG_NONE
198
- #define TAG_RETURN RUBY_TAG_RETURN
199
- #define TAG_BREAK RUBY_TAG_BREAK
200
- #define TAG_NEXT RUBY_TAG_NEXT
201
- #define TAG_RETRY RUBY_TAG_RETRY
202
- #define TAG_REDO RUBY_TAG_REDO
203
- #define TAG_RAISE RUBY_TAG_RAISE
204
- #define TAG_THROW RUBY_TAG_THROW
205
- #define TAG_FATAL RUBY_TAG_FATAL
206
- #define TAG_MASK RUBY_TAG_MASK
195
+ #define TAG_NONE RUBY_TAG_NONE
196
+ #define TAG_RETURN RUBY_TAG_RETURN
197
+ #define TAG_BREAK RUBY_TAG_BREAK
198
+ #define TAG_NEXT RUBY_TAG_NEXT
199
+ #define TAG_RETRY RUBY_TAG_RETRY
200
+ #define TAG_REDO RUBY_TAG_REDO
201
+ #define TAG_RAISE RUBY_TAG_RAISE
202
+ #define TAG_THROW RUBY_TAG_THROW
203
+ #define TAG_FATAL RUBY_TAG_FATAL
204
+ #define TAG_MASK RUBY_TAG_MASK
207
205
 
208
206
  enum ruby_vm_throw_flags {
209
207
  VM_THROW_NO_ESCAPE_FLAG = 0x8000,
@@ -217,47 +215,88 @@ struct rb_control_frame_struct;
217
215
  /* iseq data type */
218
216
  typedef struct rb_compile_option_struct rb_compile_option_t;
219
217
 
220
- struct iseq_inline_cache_entry {
221
- rb_serial_t ic_serial;
222
- const rb_cref_t *ic_cref;
223
- union {
224
- size_t index;
225
- VALUE value;
226
- } ic_value;
218
+ union ic_serial_entry {
219
+ rb_serial_t raw;
220
+ VALUE data[2];
227
221
  };
228
222
 
229
- union iseq_inline_storage_entry {
230
- struct {
231
- struct rb_thread_struct *running_thread;
232
- VALUE value;
233
- } once;
234
- struct iseq_inline_cache_entry cache;
223
+ // imemo_constcache
224
+ struct iseq_inline_constant_cache_entry {
225
+ VALUE flags;
226
+
227
+ VALUE value; // v0
228
+ union ic_serial_entry ic_serial; // v1, v2
229
+ const rb_cref_t *ic_cref; // v3
230
+ };
231
+ STATIC_ASSERT(sizeof_iseq_inline_constant_cache_entry,
232
+ (offsetof(struct iseq_inline_constant_cache_entry, ic_cref) +
233
+ sizeof(const rb_cref_t *)) <= sizeof(struct RObject));
234
+
235
+ #if SIZEOF_SERIAL_T <= SIZEOF_VALUE
236
+
237
+ #define GET_IC_SERIAL(ice) (ice)->ic_serial.raw
238
+ #define SET_IC_SERIAL(ice, v) (ice)->ic_serial.raw = (v)
239
+
240
+ #else
241
+
242
+ static inline rb_serial_t
243
+ get_ic_serial(const struct iseq_inline_constant_cache_entry *ice)
244
+ {
245
+ union ic_serial_entry tmp;
246
+ tmp.data[0] = ice->ic_serial.data[0];
247
+ tmp.data[1] = ice->ic_serial.data[1];
248
+ return tmp.raw;
249
+ }
250
+
251
+ #define GET_IC_SERIAL(ice) get_ic_serial(ice)
252
+
253
+ static inline void
254
+ set_ic_serial(struct iseq_inline_constant_cache_entry *ice, rb_serial_t v)
255
+ {
256
+ union ic_serial_entry tmp;
257
+ tmp.raw = v;
258
+ ice->ic_serial.data[0] = tmp.data[0];
259
+ ice->ic_serial.data[1] = tmp.data[1];
260
+ }
261
+
262
+ #define SET_IC_SERIAL(ice, v) set_ic_serial((ice), (v))
263
+
264
+ #endif
265
+
266
+ struct iseq_inline_constant_cache {
267
+ struct iseq_inline_constant_cache_entry *entry;
268
+ // For YJIT: the index to the opt_getinlinecache instruction in the same iseq.
269
+ // It's set during compile time and constant once set.
270
+ unsigned get_insn_idx;
271
+ };
272
+
273
+ struct iseq_inline_iv_cache_entry {
274
+ struct rb_iv_index_tbl_entry *entry;
235
275
  };
236
276
 
237
- struct rb_call_info_kw_arg {
238
- int keyword_len;
239
- VALUE keywords[1];
277
+ struct iseq_inline_cvar_cache_entry {
278
+ struct rb_cvar_class_tbl_entry *entry;
240
279
  };
241
280
 
242
- struct rb_call_info_with_kwarg {
243
- struct rb_call_info ci;
244
- struct rb_call_info_kw_arg *kw_arg;
281
+ union iseq_inline_storage_entry {
282
+ struct {
283
+ struct rb_thread_struct *running_thread;
284
+ VALUE value;
285
+ } once;
286
+ struct iseq_inline_constant_cache ic_cache;
287
+ struct iseq_inline_iv_cache_entry iv_cache;
245
288
  };
246
289
 
247
290
  struct rb_calling_info {
291
+ const struct rb_callinfo *ci;
292
+ const struct rb_callcache *cc;
248
293
  VALUE block_handler;
249
294
  VALUE recv;
250
295
  int argc;
251
296
  int kw_splat;
252
297
  };
253
298
 
254
- struct rb_kwarg_call_data {
255
- struct rb_call_cache cc;
256
- struct rb_call_info_with_kwarg ci_kw;
257
- };
258
-
259
299
  struct rb_execution_context_struct;
260
- typedef VALUE (*vm_call_handler)(struct rb_execution_context_struct *ec, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, struct rb_call_data *cd);
261
300
 
262
301
  #if 1
263
302
  #define CoreDataFromValue(obj, type) (type*)DATA_PTR(obj)
@@ -282,11 +321,11 @@ static inline VALUE
282
321
  pathobj_path(VALUE pathobj)
283
322
  {
284
323
  if (RB_TYPE_P(pathobj, T_STRING)) {
285
- return pathobj;
324
+ return pathobj;
286
325
  }
287
326
  else {
288
- VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
289
- return RARRAY_AREF(pathobj, PATHOBJ_PATH);
327
+ VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
328
+ return RARRAY_AREF(pathobj, PATHOBJ_PATH);
290
329
  }
291
330
  }
292
331
 
@@ -294,28 +333,32 @@ static inline VALUE
294
333
  pathobj_realpath(VALUE pathobj)
295
334
  {
296
335
  if (RB_TYPE_P(pathobj, T_STRING)) {
297
- return pathobj;
336
+ return pathobj;
298
337
  }
299
338
  else {
300
- VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
301
- return RARRAY_AREF(pathobj, PATHOBJ_REALPATH);
339
+ VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
340
+ return RARRAY_AREF(pathobj, PATHOBJ_REALPATH);
302
341
  }
303
342
  }
304
343
 
305
344
  /* Forward declarations */
306
345
  struct rb_mjit_unit;
307
346
 
347
+ // List of YJIT block versions
348
+ typedef rb_darray(struct yjit_block_version *) rb_yjit_block_array_t;
349
+ typedef rb_darray(rb_yjit_block_array_t) rb_yjit_block_array_array_t;
350
+
308
351
  struct rb_iseq_constant_body {
309
352
  enum iseq_type {
310
- ISEQ_TYPE_TOP,
311
- ISEQ_TYPE_METHOD,
312
- ISEQ_TYPE_BLOCK,
313
- ISEQ_TYPE_CLASS,
314
- ISEQ_TYPE_RESCUE,
315
- ISEQ_TYPE_ENSURE,
316
- ISEQ_TYPE_EVAL,
317
- ISEQ_TYPE_MAIN,
318
- ISEQ_TYPE_PLAIN
353
+ ISEQ_TYPE_TOP,
354
+ ISEQ_TYPE_METHOD,
355
+ ISEQ_TYPE_BLOCK,
356
+ ISEQ_TYPE_CLASS,
357
+ ISEQ_TYPE_RESCUE,
358
+ ISEQ_TYPE_ENSURE,
359
+ ISEQ_TYPE_EVAL,
360
+ ISEQ_TYPE_MAIN,
361
+ ISEQ_TYPE_PLAIN
319
362
  } type; /* instruction sequence type */
320
363
 
321
364
  unsigned int iseq_size;
@@ -345,67 +388,67 @@ struct rb_iseq_constant_body {
345
388
  */
346
389
 
347
390
  struct {
348
- struct {
349
- unsigned int has_lead : 1;
350
- unsigned int has_opt : 1;
351
- unsigned int has_rest : 1;
352
- unsigned int has_post : 1;
353
- unsigned int has_kw : 1;
354
- unsigned int has_kwrest : 1;
355
- unsigned int has_block : 1;
356
-
357
- unsigned int ambiguous_param0 : 1; /* {|a|} */
358
- unsigned int accepts_no_kwarg : 1;
391
+ struct {
392
+ unsigned int has_lead : 1;
393
+ unsigned int has_opt : 1;
394
+ unsigned int has_rest : 1;
395
+ unsigned int has_post : 1;
396
+ unsigned int has_kw : 1;
397
+ unsigned int has_kwrest : 1;
398
+ unsigned int has_block : 1;
399
+
400
+ unsigned int ambiguous_param0 : 1; /* {|a|} */
401
+ unsigned int accepts_no_kwarg : 1;
359
402
  unsigned int ruby2_keywords: 1;
360
- } flags;
361
-
362
- unsigned int size;
363
-
364
- int lead_num;
365
- int opt_num;
366
- int rest_start;
367
- int post_start;
368
- int post_num;
369
- int block_start;
370
-
371
- const VALUE *opt_table; /* (opt_num + 1) entries. */
372
- /* opt_num and opt_table:
373
- *
374
- * def foo o1=e1, o2=e2, ..., oN=eN
375
- * #=>
376
- * # prologue code
377
- * A1: e1
378
- * A2: e2
379
- * ...
380
- * AN: eN
381
- * AL: body
382
- * opt_num = N
383
- * opt_table = [A1, A2, ..., AN, AL]
384
- */
385
-
386
- const struct rb_iseq_param_keyword {
387
- int num;
388
- int required_num;
389
- int bits_start;
390
- int rest_start;
391
- const ID *table;
403
+ } flags;
404
+
405
+ unsigned int size;
406
+
407
+ int lead_num;
408
+ int opt_num;
409
+ int rest_start;
410
+ int post_start;
411
+ int post_num;
412
+ int block_start;
413
+
414
+ const VALUE *opt_table; /* (opt_num + 1) entries. */
415
+ /* opt_num and opt_table:
416
+ *
417
+ * def foo o1=e1, o2=e2, ..., oN=eN
418
+ * #=>
419
+ * # prologue code
420
+ * A1: e1
421
+ * A2: e2
422
+ * ...
423
+ * AN: eN
424
+ * AL: body
425
+ * opt_num = N
426
+ * opt_table = [A1, A2, ..., AN, AL]
427
+ */
428
+
429
+ const struct rb_iseq_param_keyword {
430
+ int num;
431
+ int required_num;
432
+ int bits_start;
433
+ int rest_start;
434
+ const ID *table;
392
435
  VALUE *default_values;
393
- } *keyword;
436
+ } *keyword;
394
437
  } param;
395
438
 
396
439
  rb_iseq_location_t location;
397
440
 
398
441
  /* insn info, must be freed */
399
442
  struct iseq_insn_info {
400
- const struct iseq_insn_info_entry *body;
401
- unsigned int *positions;
402
- unsigned int size;
443
+ const struct iseq_insn_info_entry *body;
444
+ unsigned int *positions;
445
+ unsigned int size;
403
446
  #if VM_INSN_INFO_TABLE_IMPL == 2
404
- struct succ_index_table *succ_index_table;
447
+ struct succ_index_table *succ_index_table;
405
448
  #endif
406
449
  } insns_info;
407
450
 
408
- const ID *local_table; /* must free */
451
+ const ID *local_table; /* must free */
409
452
 
410
453
  /* catch table */
411
454
  struct iseq_catch_table *catch_table;
@@ -415,27 +458,29 @@ struct rb_iseq_constant_body {
415
458
  struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */
416
459
 
417
460
  union iseq_inline_storage_entry *is_entries;
418
- struct rb_call_data *call_data; /* A buffer for two arrays:
419
- * struct rb_call_data calls[ci_size];
420
- * struct rb_kwarg_call_data kw_calls[ci_kw_size];
421
- * Such that:
422
- * struct rb_kwarg_call_data *kw_calls = &body->call_data[ci_size];
423
- */
461
+ struct rb_call_data *call_data; //struct rb_call_data calls[ci_size];
424
462
 
425
463
  struct {
426
- rb_snum_t flip_count;
427
- VALUE coverage;
464
+ rb_snum_t flip_count;
465
+ VALUE script_lines;
466
+ VALUE coverage;
428
467
  VALUE pc2branchindex;
429
- VALUE *original_iseq;
468
+ VALUE *original_iseq;
430
469
  } variable;
431
470
 
432
471
  unsigned int local_table_size;
433
472
  unsigned int is_size;
434
473
  unsigned int ci_size;
435
- unsigned int ci_kw_size;
436
474
  unsigned int stack_max; /* for stack overflow check */
437
475
 
438
476
  char catch_except_p; /* If a frame of this ISeq may catch exception, set TRUE */
477
+ // If true, this ISeq is leaf *and* backtraces are not used, for example,
478
+ // by rb_profile_frames. We verify only leafness on VM_CHECK_MODE though.
479
+ // Note that GC allocations might use backtraces due to
480
+ // ObjectSpace#trace_object_allocations.
481
+ // For more details, see: https://bugs.ruby-lang.org/issues/16956
482
+ bool builtin_inline_p;
483
+ struct rb_id_table *outer_variables;
439
484
 
440
485
  #if USE_MJIT
441
486
  /* The following fields are MJIT related info. */
@@ -444,6 +489,8 @@ struct rb_iseq_constant_body {
444
489
  long unsigned total_calls; /* number of total calls with `mjit_exec()` */
445
490
  struct rb_mjit_unit *jit_unit;
446
491
  #endif
492
+
493
+ rb_yjit_block_array_array_t yjit_blocks; // empty, or has a size equal to iseq_size
447
494
  };
448
495
 
449
496
  /* T_IMEMO/iseq */
@@ -455,12 +502,12 @@ struct rb_iseq_struct {
455
502
  struct rb_iseq_constant_body *body; /* 3 */
456
503
 
457
504
  union { /* 4, 5 words */
458
- struct iseq_compile_data *compile_data; /* used at compile time */
505
+ struct iseq_compile_data *compile_data; /* used at compile time */
459
506
 
460
- struct {
461
- VALUE obj;
462
- int index;
463
- } loader;
507
+ struct {
508
+ VALUE obj;
509
+ int index;
510
+ } loader;
464
511
 
465
512
  struct {
466
513
  struct rb_hook_list_struct *local_hooks;
@@ -482,7 +529,7 @@ rb_iseq_check(const rb_iseq_t *iseq)
482
529
  {
483
530
  #if USE_LAZY_LOAD
484
531
  if (iseq->body == NULL) {
485
- rb_iseq_complete((rb_iseq_t *)iseq);
532
+ rb_iseq_complete((rb_iseq_t *)iseq);
486
533
  }
487
534
  #endif
488
535
  return iseq;
@@ -492,7 +539,7 @@ static inline const rb_iseq_t *
492
539
  def_iseq_ptr(rb_method_definition_t *def)
493
540
  {
494
541
  //TODO: re-visit. to check the bug, enable this assertion.
495
- #if 1 || VM_CHECK_MODE > 0
542
+ #if VM_CHECK_MODE > 0
496
543
  if (def->type != VM_METHOD_TYPE_ISEQ) rb_bug("def_iseq_ptr: not iseq (%d)", def->type);
497
544
  #endif
498
545
  return rb_iseq_check(def->body.iseq.iseqptr);
@@ -571,12 +618,30 @@ typedef const struct rb_builtin_function *RB_BUILTIN;
571
618
  typedef struct rb_vm_struct {
572
619
  VALUE self;
573
620
 
574
- rb_global_vm_lock_t gvl;
621
+ struct {
622
+ struct list_head set;
623
+ unsigned int cnt;
624
+ unsigned int blocking_cnt;
575
625
 
576
- struct rb_thread_struct *main_thread;
626
+ struct rb_ractor_struct *main_ractor;
627
+ struct rb_thread_struct *main_thread; // == vm->ractor.main_ractor->threads.main
577
628
 
578
- /* persists across uncontended GVL release/acquire for time slice */
579
- const struct rb_thread_struct *running_thread;
629
+ struct {
630
+ // monitor
631
+ rb_nativethread_lock_t lock;
632
+ struct rb_ractor_struct *lock_owner;
633
+ unsigned int lock_rec;
634
+
635
+ // barrier
636
+ bool barrier_waiting;
637
+ unsigned int barrier_cnt;
638
+ rb_nativethread_cond_t barrier_cond;
639
+
640
+ // join at exit
641
+ rb_nativethread_cond_t terminate_cond;
642
+ bool terminate_waiting;
643
+ } sync;
644
+ } ractor;
580
645
 
581
646
  #ifdef USE_SIGALTSTACK
582
647
  void *main_altstack;
@@ -587,9 +652,6 @@ typedef struct rb_vm_struct {
587
652
  struct list_head waiting_pids; /* PID > 0: <=> struct waitpid_state */
588
653
  struct list_head waiting_grps; /* PID <= 0: <=> struct waitpid_state */
589
654
  struct list_head waiting_fds; /* <=> struct waiting_fd */
590
- struct list_head living_threads;
591
- VALUE thgroup_default;
592
- int living_thread_num;
593
655
 
594
656
  /* set in single-threaded processes only: */
595
657
  volatile int ubf_async_safe;
@@ -597,9 +659,7 @@ typedef struct rb_vm_struct {
597
659
  unsigned int running: 1;
598
660
  unsigned int thread_abort_on_exception: 1;
599
661
  unsigned int thread_report_on_exception: 1;
600
-
601
- unsigned int safe_level_: 1;
602
- int sleeper;
662
+ unsigned int thread_ignore_deadlock: 1;
603
663
 
604
664
  /* object management */
605
665
  VALUE mark_object_ary;
@@ -613,23 +673,21 @@ typedef struct rb_vm_struct {
613
673
  VALUE expanded_load_path;
614
674
  VALUE loaded_features;
615
675
  VALUE loaded_features_snapshot;
676
+ VALUE loaded_features_realpaths;
616
677
  struct st_table *loaded_features_index;
617
678
  struct st_table *loading_table;
618
679
 
619
680
  /* signal */
620
681
  struct {
621
- VALUE cmd[RUBY_NSIG];
682
+ VALUE cmd[RUBY_NSIG];
622
683
  } trap_list;
623
684
 
624
- /* hook */
625
- rb_hook_list_t global_hooks;
626
-
627
685
  /* relation table of ensure - rollback for callcc */
628
686
  struct st_table *ensure_rollback_table;
629
687
 
630
688
  /* postponed_job (async-signal-safe, NOT thread-safe) */
631
689
  struct rb_postponed_job_struct *postponed_job_buffer;
632
- int postponed_job_index;
690
+ rb_atomic_t postponed_job_index;
633
691
 
634
692
  int src_encoding_index;
635
693
 
@@ -637,8 +695,8 @@ typedef struct rb_vm_struct {
637
695
  struct list_head workqueue; /* <=> rb_workqueue_job.jnode */
638
696
  rb_nativethread_lock_t workqueue_lock;
639
697
 
640
- VALUE verbose, debug, orig_progname, progname;
641
- VALUE coverages;
698
+ VALUE orig_progname, progname;
699
+ VALUE coverages, me2counter;
642
700
  int coverage_mode;
643
701
 
644
702
  st_table * defined_module_hash;
@@ -647,18 +705,28 @@ typedef struct rb_vm_struct {
647
705
 
648
706
  rb_at_exit_list *at_exit;
649
707
 
650
- VALUE *defined_strings;
651
708
  st_table *frozen_strings;
652
709
 
653
710
  const struct rb_builtin_function *builtin_function_table;
654
711
  int builtin_inline_index;
655
712
 
713
+ struct rb_id_table *negative_cme_table;
714
+
715
+ #ifndef VM_GLOBAL_CC_CACHE_TABLE_SIZE
716
+ #define VM_GLOBAL_CC_CACHE_TABLE_SIZE 1023
717
+ #endif
718
+ const struct rb_callcache *global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]; // vm_eval.c
719
+
720
+ #if defined(USE_VM_CLOCK) && USE_VM_CLOCK
721
+ uint32_t clock;
722
+ #endif
723
+
656
724
  /* params */
657
725
  struct { /* size in byte */
658
- size_t thread_vm_stack_size;
659
- size_t thread_machine_stack_size;
660
- size_t fiber_vm_stack_size;
661
- size_t fiber_machine_stack_size;
726
+ size_t thread_vm_stack_size;
727
+ size_t thread_machine_stack_size;
728
+ size_t fiber_vm_stack_size;
729
+ size_t fiber_machine_stack_size;
662
730
  } default_params;
663
731
 
664
732
  short redefined_flag[BOP_LAST_];
@@ -723,9 +791,9 @@ struct rb_captured_block {
723
791
  VALUE self;
724
792
  const VALUE *ep;
725
793
  union {
726
- const rb_iseq_t *iseq;
727
- const struct vm_ifunc *ifunc;
728
- VALUE val;
794
+ const rb_iseq_t *iseq;
795
+ const struct vm_ifunc *ifunc;
796
+ VALUE val;
729
797
  } code;
730
798
  };
731
799
 
@@ -745,25 +813,27 @@ enum rb_block_type {
745
813
 
746
814
  struct rb_block {
747
815
  union {
748
- struct rb_captured_block captured;
749
- VALUE symbol;
750
- VALUE proc;
816
+ struct rb_captured_block captured;
817
+ VALUE symbol;
818
+ VALUE proc;
751
819
  } as;
752
820
  enum rb_block_type type;
753
821
  };
754
822
 
755
823
  typedef struct rb_control_frame_struct {
756
- const VALUE *pc; /* cfp[0] */
757
- VALUE *sp; /* cfp[1] */
758
- const rb_iseq_t *iseq; /* cfp[2] */
759
- VALUE self; /* cfp[3] / block[0] */
760
- const VALUE *ep; /* cfp[4] / block[1] */
761
- const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc */
824
+ const VALUE *pc; /* cfp[0] */
825
+ VALUE *sp; /* cfp[1] */
826
+ const rb_iseq_t *iseq; /* cfp[2] */
827
+ VALUE self; /* cfp[3] / block[0] */
828
+ const VALUE *ep; /* cfp[4] / block[1] */
829
+ const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc or forwarded block handler */
762
830
  VALUE *__bp__; /* cfp[6] */ /* outside vm_push_frame, use vm_base_ptr instead. */
763
831
 
764
832
  #if VM_DEBUG_BP_CHECK
765
- VALUE *bp_check; /* cfp[7] */
833
+ VALUE *bp_check; /* cfp[7] */
766
834
  #endif
835
+ // Return address for YJIT code
836
+ void *jit_return;
767
837
  } rb_control_frame_t;
768
838
 
769
839
  extern const rb_data_type_t ruby_threadptr_data_type;
@@ -797,16 +867,13 @@ struct rb_vm_tag {
797
867
  rb_jmpbuf_t buf;
798
868
  struct rb_vm_tag *prev;
799
869
  enum ruby_tag_type state;
870
+ unsigned int lock_rec;
800
871
  };
801
872
 
802
873
  STATIC_ASSERT(rb_vm_tag_buf_offset, offsetof(struct rb_vm_tag, buf) > 0);
803
874
  STATIC_ASSERT(rb_vm_tag_buf_end,
804
- offsetof(struct rb_vm_tag, buf) + sizeof(rb_jmpbuf_t) <
805
- sizeof(struct rb_vm_tag));
806
-
807
- struct rb_vm_protect_tag {
808
- struct rb_vm_protect_tag *prev;
809
- };
875
+ offsetof(struct rb_vm_tag, buf) + sizeof(rb_jmpbuf_t) <
876
+ sizeof(struct rb_vm_tag));
810
877
 
811
878
  struct rb_unblock_callback {
812
879
  rb_unblock_function_t *func;
@@ -815,11 +882,6 @@ struct rb_unblock_callback {
815
882
 
816
883
  struct rb_mutex_struct;
817
884
 
818
- typedef struct rb_thread_list_struct{
819
- struct rb_thread_list_struct *next;
820
- struct rb_thread_struct *th;
821
- } rb_thread_list_t;
822
-
823
885
  typedef struct rb_ensure_entry {
824
886
  VALUE marker;
825
887
  VALUE (*e_proc)(VALUE);
@@ -835,24 +897,32 @@ typedef char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) * 2 + 3];
835
897
 
836
898
  typedef struct rb_fiber_struct rb_fiber_t;
837
899
 
838
- typedef struct rb_execution_context_struct {
900
+ struct rb_waiting_list {
901
+ struct rb_waiting_list *next;
902
+ struct rb_thread_struct *thread;
903
+ struct rb_fiber_struct *fiber;
904
+ };
905
+
906
+ struct rb_execution_context_struct {
839
907
  /* execution information */
840
- VALUE *vm_stack; /* must free, must mark */
908
+ VALUE *vm_stack; /* must free, must mark */
841
909
  size_t vm_stack_size; /* size in word (byte size / sizeof(VALUE)) */
842
910
  rb_control_frame_t *cfp;
843
911
 
844
912
  struct rb_vm_tag *tag;
845
- struct rb_vm_protect_tag *protect_tag;
846
913
 
847
914
  /* interrupt flags */
848
915
  rb_atomic_t interrupt_flag;
849
916
  rb_atomic_t interrupt_mask; /* size should match flag */
917
+ #if defined(USE_VM_CLOCK) && USE_VM_CLOCK
918
+ uint32_t checked_clock;
919
+ #endif
850
920
 
851
921
  rb_fiber_t *fiber_ptr;
852
922
  struct rb_thread_struct *thread_ptr;
853
923
 
854
924
  /* storage (ec (fiber) local) */
855
- st_table *local_storage;
925
+ struct rb_id_table *local_storage;
856
926
  VALUE local_storage_recursive_hash;
857
927
  VALUE local_storage_recursive_hash_for_trace;
858
928
 
@@ -879,12 +949,17 @@ typedef struct rb_execution_context_struct {
879
949
 
880
950
  /* for GC */
881
951
  struct {
882
- VALUE *stack_start;
883
- VALUE *stack_end;
884
- size_t stack_maxsize;
885
- RUBY_ALIGNAS(SIZEOF_VALUE) jmp_buf regs;
952
+ VALUE *stack_start;
953
+ VALUE *stack_end;
954
+ size_t stack_maxsize;
955
+ RUBY_ALIGNAS(SIZEOF_VALUE) jmp_buf regs;
886
956
  } machine;
887
- } rb_execution_context_t;
957
+ };
958
+
959
+ #ifndef rb_execution_context_t
960
+ typedef struct rb_execution_context_struct rb_execution_context_t;
961
+ #define rb_execution_context_t rb_execution_context_t
962
+ #endif
888
963
 
889
964
  // for builtin.h
890
965
  #define VM_CORE_H_EC_DEFINED 1
@@ -902,9 +977,20 @@ void rb_ec_initialize_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t
902
977
  // @param ec the execution context to update.
903
978
  void rb_ec_clear_vm_stack(rb_execution_context_t *ec);
904
979
 
980
+ struct rb_ext_config {
981
+ bool ractor_safe;
982
+ };
983
+
984
+ typedef struct rb_ractor_struct rb_ractor_t;
985
+
986
+ #if defined(__linux__) || defined(__FreeBSD__)
987
+ # define RB_THREAD_T_HAS_NATIVE_ID
988
+ #endif
989
+
905
990
  typedef struct rb_thread_struct {
906
- struct list_node vmlt_node;
991
+ struct list_node lt_node; // managed by a ractor
907
992
  VALUE self;
993
+ rb_ractor_t *ractor;
908
994
  rb_vm_t *vm;
909
995
 
910
996
  rb_execution_context_t *ec;
@@ -922,6 +1008,9 @@ typedef struct rb_thread_struct {
922
1008
  rb_nativethread_id_t thread_id;
923
1009
  #ifdef NON_SCALAR_THREAD_ID
924
1010
  rb_thread_id_string_t thread_id_string;
1011
+ #endif
1012
+ #ifdef RB_THREAD_T_HAS_NATIVE_ID
1013
+ int tid;
925
1014
  #endif
926
1015
  BITFIELD(enum rb_thread_status, status, 2);
927
1016
  /* bit flags */
@@ -953,7 +1042,7 @@ typedef struct rb_thread_struct {
953
1042
  VALUE locking_mutex;
954
1043
  struct rb_mutex_struct *keeping_mutexes;
955
1044
 
956
- rb_thread_list_t *join_list;
1045
+ struct rb_waiting_list *join_list;
957
1046
 
958
1047
  union {
959
1048
  struct {
@@ -967,9 +1056,10 @@ typedef struct rb_thread_struct {
967
1056
  } func;
968
1057
  } invoke_arg;
969
1058
 
970
- enum {
1059
+ enum thread_invoke_type {
971
1060
  thread_invoke_type_none = 0,
972
1061
  thread_invoke_type_proc,
1062
+ thread_invoke_type_ractor_proc,
973
1063
  thread_invoke_type_func
974
1064
  } invoke_type;
975
1065
 
@@ -978,11 +1068,18 @@ typedef struct rb_thread_struct {
978
1068
 
979
1069
  /* fiber */
980
1070
  rb_fiber_t *root_fiber;
981
- rb_jmpbuf_t root_jmpbuf;
1071
+
1072
+ VALUE scheduler;
1073
+ unsigned blocking;
982
1074
 
983
1075
  /* misc */
984
1076
  VALUE name;
985
1077
 
1078
+ struct rb_ext_config ext_config;
1079
+
1080
+ #ifdef USE_SIGALTSTACK
1081
+ void *altstack;
1082
+ #endif
986
1083
  } rb_thread_t;
987
1084
 
988
1085
  typedef enum {
@@ -1004,11 +1101,13 @@ typedef enum {
1004
1101
  RUBY_SYMBOL_EXPORT_BEGIN
1005
1102
 
1006
1103
  /* node -> iseq */
1007
- rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
1008
- rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
1009
- rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent);
1010
- rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno,
1011
- const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*);
1104
+ rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
1105
+ rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
1106
+ rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent);
1107
+ rb_iseq_t *rb_iseq_new_eval (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth);
1108
+ rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth,
1109
+ enum iseq_type, const rb_compile_option_t*);
1110
+
1012
1111
  struct iseq_link_anchor;
1013
1112
  struct rb_iseq_new_with_callback_callback_func {
1014
1113
  VALUE flags;
@@ -1043,10 +1142,17 @@ RUBY_SYMBOL_EXPORT_END
1043
1142
 
1044
1143
  typedef struct {
1045
1144
  const struct rb_block block;
1046
- unsigned int is_from_method: 1; /* bool */
1047
- unsigned int is_lambda: 1; /* bool */
1145
+ unsigned int is_from_method: 1; /* bool */
1146
+ unsigned int is_lambda: 1; /* bool */
1147
+ unsigned int is_isolated: 1; /* bool */
1048
1148
  } rb_proc_t;
1049
1149
 
1150
+ RUBY_SYMBOL_EXPORT_BEGIN
1151
+ VALUE rb_proc_isolate(VALUE self);
1152
+ VALUE rb_proc_isolate_bang(VALUE self);
1153
+ VALUE rb_proc_ractor_make_shareable(VALUE self);
1154
+ RUBY_SYMBOL_EXPORT_END
1155
+
1050
1156
  typedef struct {
1051
1157
  VALUE flags; /* imemo header */
1052
1158
  rb_iseq_t *iseq;
@@ -1077,35 +1183,6 @@ enum vm_check_match_type {
1077
1183
  #define VM_CHECKMATCH_TYPE_MASK 0x03
1078
1184
  #define VM_CHECKMATCH_ARRAY 0x04
1079
1185
 
1080
- enum vm_call_flag_bits {
1081
- VM_CALL_ARGS_SPLAT_bit, /* m(*args) */
1082
- VM_CALL_ARGS_BLOCKARG_bit, /* m(&block) */
1083
- VM_CALL_FCALL_bit, /* m(...) */
1084
- VM_CALL_VCALL_bit, /* m */
1085
- VM_CALL_ARGS_SIMPLE_bit, /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */
1086
- VM_CALL_BLOCKISEQ_bit, /* has blockiseq */
1087
- VM_CALL_KWARG_bit, /* has kwarg */
1088
- VM_CALL_KW_SPLAT_bit, /* m(**opts) */
1089
- VM_CALL_TAILCALL_bit, /* located at tail position */
1090
- VM_CALL_SUPER_bit, /* super */
1091
- VM_CALL_ZSUPER_bit, /* zsuper */
1092
- VM_CALL_OPT_SEND_bit, /* internal flag */
1093
- VM_CALL__END
1094
- };
1095
-
1096
- #define VM_CALL_ARGS_SPLAT (0x01 << VM_CALL_ARGS_SPLAT_bit)
1097
- #define VM_CALL_ARGS_BLOCKARG (0x01 << VM_CALL_ARGS_BLOCKARG_bit)
1098
- #define VM_CALL_FCALL (0x01 << VM_CALL_FCALL_bit)
1099
- #define VM_CALL_VCALL (0x01 << VM_CALL_VCALL_bit)
1100
- #define VM_CALL_ARGS_SIMPLE (0x01 << VM_CALL_ARGS_SIMPLE_bit)
1101
- #define VM_CALL_BLOCKISEQ (0x01 << VM_CALL_BLOCKISEQ_bit)
1102
- #define VM_CALL_KWARG (0x01 << VM_CALL_KWARG_bit)
1103
- #define VM_CALL_KW_SPLAT (0x01 << VM_CALL_KW_SPLAT_bit)
1104
- #define VM_CALL_TAILCALL (0x01 << VM_CALL_TAILCALL_bit)
1105
- #define VM_CALL_SUPER (0x01 << VM_CALL_SUPER_bit)
1106
- #define VM_CALL_ZSUPER (0x01 << VM_CALL_ZSUPER_bit)
1107
- #define VM_CALL_OPT_SEND (0x01 << VM_CALL_OPT_SEND_bit)
1108
-
1109
1186
  enum vm_special_object_type {
1110
1187
  VM_SPECIAL_OBJECT_VMCORE = 1,
1111
1188
  VM_SPECIAL_OBJECT_CBASE,
@@ -1121,10 +1198,12 @@ enum vm_svar_index {
1121
1198
  };
1122
1199
 
1123
1200
  /* inline cache */
1124
- typedef struct iseq_inline_cache_entry *IC;
1201
+ typedef struct iseq_inline_constant_cache *IC;
1202
+ typedef struct iseq_inline_iv_cache_entry *IVC;
1203
+ typedef struct iseq_inline_cvar_cache_entry *ICVARC;
1125
1204
  typedef union iseq_inline_storage_entry *ISE;
1126
- typedef struct rb_call_info *CALL_INFO;
1127
- typedef struct rb_call_cache *CALL_CACHE;
1205
+ typedef const struct rb_callinfo *CALL_INFO;
1206
+ typedef const struct rb_callcache *CALL_CACHE;
1128
1207
  typedef struct rb_call_data *CALL_DATA;
1129
1208
 
1130
1209
  typedef VALUE CDHASH;
@@ -1145,11 +1224,11 @@ typedef rb_control_frame_t *
1145
1224
 
1146
1225
  enum {
1147
1226
  /* Frame/Environment flag bits:
1148
- * MMMM MMMM MMMM MMMM ____ FFFF FFFF EEEX (LSB)
1227
+ * MMMM MMMM MMMM MMMM ____ _FFF FFFF EEEX (LSB)
1149
1228
  *
1150
1229
  * X : tag for GC marking (It seems as Fixnum)
1151
1230
  * EEE : 3 bits Env flags
1152
- * FF..: 8 bits Frame flags
1231
+ * FF..: 7 bits Frame flags
1153
1232
  * MM..: 15 bits frame magic (to check frame corruption)
1154
1233
  */
1155
1234
 
@@ -1167,19 +1246,19 @@ enum {
1167
1246
  VM_FRAME_MAGIC_MASK = 0x7fff0001,
1168
1247
 
1169
1248
  /* frame flag */
1170
- VM_FRAME_FLAG_PASSED = 0x0010,
1171
1249
  VM_FRAME_FLAG_FINISH = 0x0020,
1172
1250
  VM_FRAME_FLAG_BMETHOD = 0x0040,
1173
1251
  VM_FRAME_FLAG_CFRAME = 0x0080,
1174
1252
  VM_FRAME_FLAG_LAMBDA = 0x0100,
1175
1253
  VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM = 0x0200,
1176
1254
  VM_FRAME_FLAG_CFRAME_KW = 0x0400,
1177
- VM_FRAME_FLAG_CFRAME_EMPTY_KW = 0x0800, /* -- Remove In 3.0 -- */
1255
+ VM_FRAME_FLAG_PASSED = 0x0800,
1178
1256
 
1179
1257
  /* env flag */
1180
1258
  VM_ENV_FLAG_LOCAL = 0x0002,
1181
1259
  VM_ENV_FLAG_ESCAPED = 0x0004,
1182
- VM_ENV_FLAG_WB_REQUIRED = 0x0008
1260
+ VM_ENV_FLAG_WB_REQUIRED = 0x0008,
1261
+ VM_ENV_FLAG_ISOLATED = 0x0010,
1183
1262
  };
1184
1263
 
1185
1264
  #define VM_ENV_DATA_SIZE ( 3)
@@ -1235,13 +1314,6 @@ VM_FRAME_CFRAME_KW_P(const rb_control_frame_t *cfp)
1235
1314
  return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME_KW) != 0;
1236
1315
  }
1237
1316
 
1238
- /* -- Remove In 3.0 -- */
1239
- static inline int
1240
- VM_FRAME_CFRAME_EMPTY_KW_P(const rb_control_frame_t *cfp)
1241
- {
1242
- return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME_EMPTY_KW) != 0;
1243
- }
1244
-
1245
1317
  static inline int
1246
1318
  VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
1247
1319
  {
@@ -1324,6 +1396,7 @@ vm_assert_env(VALUE obj)
1324
1396
  }
1325
1397
  #endif
1326
1398
 
1399
+ RBIMPL_ATTR_NONNULL((1))
1327
1400
  static inline VALUE
1328
1401
  VM_ENV_ENVVAL(const VALUE *ep)
1329
1402
  {
@@ -1333,6 +1406,7 @@ VM_ENV_ENVVAL(const VALUE *ep)
1333
1406
  return envval;
1334
1407
  }
1335
1408
 
1409
+ RBIMPL_ATTR_NONNULL((1))
1336
1410
  static inline const rb_env_t *
1337
1411
  VM_ENV_ENVVAL_PTR(const VALUE *ep)
1338
1412
  {
@@ -1398,13 +1472,13 @@ VM_BH_ISEQ_BLOCK_P(VALUE block_handler)
1398
1472
  {
1399
1473
  if ((block_handler & 0x03) == 0x01) {
1400
1474
  #if VM_CHECK_MODE > 0
1401
- struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1402
- VM_ASSERT(imemo_type_p(captured->code.val, imemo_iseq));
1475
+ struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
1476
+ VM_ASSERT(imemo_type_p(captured->code.val, imemo_iseq));
1403
1477
  #endif
1404
- return 1;
1478
+ return 1;
1405
1479
  }
1406
1480
  else {
1407
- return 0;
1481
+ return 0;
1408
1482
  }
1409
1483
  }
1410
1484
 
@@ -1429,13 +1503,13 @@ VM_BH_IFUNC_P(VALUE block_handler)
1429
1503
  {
1430
1504
  if ((block_handler & 0x03) == 0x03) {
1431
1505
  #if VM_CHECK_MODE > 0
1432
- struct rb_captured_block *captured = (void *)(block_handler & ~0x03);
1433
- VM_ASSERT(imemo_type_p(captured->code.val, imemo_ifunc));
1506
+ struct rb_captured_block *captured = (void *)(block_handler & ~0x03);
1507
+ VM_ASSERT(imemo_type_p(captured->code.val, imemo_ifunc));
1434
1508
  #endif
1435
- return 1;
1509
+ return 1;
1436
1510
  }
1437
1511
  else {
1438
- return 0;
1512
+ return 0;
1439
1513
  }
1440
1514
  }
1441
1515
 
@@ -1467,17 +1541,17 @@ static inline enum rb_block_handler_type
1467
1541
  vm_block_handler_type(VALUE block_handler)
1468
1542
  {
1469
1543
  if (VM_BH_ISEQ_BLOCK_P(block_handler)) {
1470
- return block_handler_type_iseq;
1544
+ return block_handler_type_iseq;
1471
1545
  }
1472
1546
  else if (VM_BH_IFUNC_P(block_handler)) {
1473
- return block_handler_type_ifunc;
1547
+ return block_handler_type_ifunc;
1474
1548
  }
1475
1549
  else if (SYMBOL_P(block_handler)) {
1476
- return block_handler_type_symbol;
1550
+ return block_handler_type_symbol;
1477
1551
  }
1478
1552
  else {
1479
- VM_ASSERT(rb_obj_is_proc(block_handler));
1480
- return block_handler_type_proc;
1553
+ VM_ASSERT(rb_obj_is_proc(block_handler));
1554
+ return block_handler_type_proc;
1481
1555
  }
1482
1556
  }
1483
1557
 
@@ -1485,7 +1559,13 @@ static inline void
1485
1559
  vm_block_handler_verify(MAYBE_UNUSED(VALUE block_handler))
1486
1560
  {
1487
1561
  VM_ASSERT(block_handler == VM_BLOCK_HANDLER_NONE ||
1488
- (vm_block_handler_type(block_handler), 1));
1562
+ (vm_block_handler_type(block_handler), 1));
1563
+ }
1564
+
1565
+ static inline int
1566
+ vm_cfp_forwarded_bh_p(const rb_control_frame_t *cfp, VALUE block_handler)
1567
+ {
1568
+ return ((VALUE) cfp->block_code) == block_handler;
1489
1569
  }
1490
1570
 
1491
1571
  static inline enum rb_block_type
@@ -1494,17 +1574,17 @@ vm_block_type(const struct rb_block *block)
1494
1574
  #if VM_CHECK_MODE > 0
1495
1575
  switch (block->type) {
1496
1576
  case block_type_iseq:
1497
- VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_iseq));
1498
- break;
1577
+ VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_iseq));
1578
+ break;
1499
1579
  case block_type_ifunc:
1500
- VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_ifunc));
1501
- break;
1580
+ VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_ifunc));
1581
+ break;
1502
1582
  case block_type_symbol:
1503
- VM_ASSERT(SYMBOL_P(block->as.symbol));
1504
- break;
1583
+ VM_ASSERT(SYMBOL_P(block->as.symbol));
1584
+ break;
1505
1585
  case block_type_proc:
1506
- VM_ASSERT(rb_obj_is_proc(block->as.proc));
1507
- break;
1586
+ VM_ASSERT(rb_obj_is_proc(block->as.proc));
1587
+ break;
1508
1588
  }
1509
1589
  #endif
1510
1590
  return block->type;
@@ -1571,11 +1651,11 @@ vm_block_self(const struct rb_block *block)
1571
1651
  switch (vm_block_type(block)) {
1572
1652
  case block_type_iseq:
1573
1653
  case block_type_ifunc:
1574
- return block->as.captured.self;
1654
+ return block->as.captured.self;
1575
1655
  case block_type_proc:
1576
- return vm_block_self(vm_proc_block(block->as.proc));
1656
+ return vm_block_self(vm_proc_block(block->as.proc));
1577
1657
  case block_type_symbol:
1578
- return Qundef;
1658
+ return Qundef;
1579
1659
  }
1580
1660
  VM_UNREACHABLE(vm_block_self);
1581
1661
  return Qundef;
@@ -1627,7 +1707,8 @@ extern void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const
1627
1707
  #define SDR() rb_vmdebug_stack_dump_raw(GET_EC(), GET_EC()->cfp)
1628
1708
  #define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp))
1629
1709
  void rb_vm_bugreport(const void *);
1630
- typedef RETSIGTYPE (*ruby_sighandler_t)(int);
1710
+ typedef void (*ruby_sighandler_t)(int);
1711
+ RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 5)
1631
1712
  NORETURN(void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt, ...));
1632
1713
 
1633
1714
  /* functions about thread/vm execution */
@@ -1664,13 +1745,12 @@ VALUE rb_vm_env_local_variables(const rb_env_t *env);
1664
1745
  const rb_env_t *rb_vm_env_prev_env(const rb_env_t *env);
1665
1746
  const VALUE *rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const ID *dynvars);
1666
1747
  void rb_vm_inc_const_missing_count(void);
1667
- void rb_vm_gvl_destroy(rb_vm_t *vm);
1668
- VALUE rb_vm_call(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc,
1669
- const VALUE *argv, const rb_callable_method_entry_t *me);
1670
1748
  VALUE rb_vm_call_kw(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc,
1671
1749
  const VALUE *argv, const rb_callable_method_entry_t *me, int kw_splat);
1672
1750
  MJIT_STATIC void rb_vm_pop_frame(rb_execution_context_t *ec);
1673
1751
 
1752
+ void rb_gvl_destroy(rb_global_vm_lock_t *gvl);
1753
+
1674
1754
  void rb_thread_start_timer_thread(void);
1675
1755
  void rb_thread_stop_timer_thread(void);
1676
1756
  void rb_thread_reset_timer_thread(void);
@@ -1683,22 +1763,7 @@ rb_vm_living_threads_init(rb_vm_t *vm)
1683
1763
  list_head_init(&vm->waiting_pids);
1684
1764
  list_head_init(&vm->workqueue);
1685
1765
  list_head_init(&vm->waiting_grps);
1686
- list_head_init(&vm->living_threads);
1687
- vm->living_thread_num = 0;
1688
- }
1689
-
1690
- static inline void
1691
- rb_vm_living_threads_insert(rb_vm_t *vm, rb_thread_t *th)
1692
- {
1693
- list_add_tail(&vm->living_threads, &th->vmlt_node);
1694
- vm->living_thread_num++;
1695
- }
1696
-
1697
- static inline void
1698
- rb_vm_living_threads_remove(rb_vm_t *vm, rb_thread_t *th)
1699
- {
1700
- list_del(&th->vmlt_node);
1701
- vm->living_thread_num--;
1766
+ list_head_init(&vm->ractor.set);
1702
1767
  }
1703
1768
 
1704
1769
  typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
@@ -1707,6 +1772,8 @@ rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(const rb_execution_cont
1707
1772
  int rb_vm_get_sourceline(const rb_control_frame_t *);
1708
1773
  void rb_vm_stack_to_heap(rb_execution_context_t *ec);
1709
1774
  void ruby_thread_init_stack(rb_thread_t *th);
1775
+ rb_thread_t * ruby_thread_from_native(void);
1776
+ int ruby_thread_set_native(rb_thread_t *th);
1710
1777
  int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp);
1711
1778
  void rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp);
1712
1779
  MJIT_STATIC VALUE rb_vm_bh_to_procval(const rb_execution_context_t *ec, VALUE block_handler);
@@ -1724,36 +1791,39 @@ MJIT_STATIC const rb_callable_method_entry_t *rb_vm_frame_method_entry(const rb_
1724
1791
 
1725
1792
  #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
1726
1793
 
1727
- #define RUBY_CONST_ASSERT(expr) (1/!!(expr)) /* expr must be a compile-time constant */
1728
- #define VM_STACK_OVERFLOWED_P(cfp, sp, margin) \
1729
- (!RUBY_CONST_ASSERT(sizeof(*(sp)) == sizeof(VALUE)) || \
1730
- !RUBY_CONST_ASSERT(sizeof(*(cfp)) == sizeof(rb_control_frame_t)) || \
1731
- ((rb_control_frame_t *)((sp) + (margin)) + 1) >= (cfp))
1732
- #define WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) \
1733
- if (LIKELY(!VM_STACK_OVERFLOWED_P(cfp, sp, margin))) {(void)0;} else /* overflowed */
1734
- #define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) \
1735
- WHEN_VM_STACK_OVERFLOWED(cfp, sp, margin) vm_stackoverflow()
1794
+ #define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) do { \
1795
+ STATIC_ASSERT(sizeof_sp, sizeof(*(sp)) == sizeof(VALUE)); \
1796
+ STATIC_ASSERT(sizeof_cfp, sizeof(*(cfp)) == sizeof(rb_control_frame_t)); \
1797
+ const struct rb_control_frame_struct *bound = (void *)&(sp)[(margin)]; \
1798
+ if (UNLIKELY((cfp) <= &bound[1])) { \
1799
+ vm_stackoverflow(); \
1800
+ } \
1801
+ } while (0)
1802
+
1736
1803
  #define CHECK_VM_STACK_OVERFLOW(cfp, margin) \
1737
- WHEN_VM_STACK_OVERFLOWED(cfp, (cfp)->sp, margin) vm_stackoverflow()
1804
+ CHECK_VM_STACK_OVERFLOW0((cfp), (cfp)->sp, (margin))
1738
1805
 
1739
1806
  VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr);
1740
1807
 
1808
+ rb_execution_context_t *rb_vm_main_ractor_ec(rb_vm_t *vm); // ractor.c
1809
+
1741
1810
  /* for thread */
1742
1811
 
1743
1812
  #if RUBY_VM_THREAD_MODEL == 2
1744
- RUBY_SYMBOL_EXPORT_BEGIN
1813
+ MJIT_SYMBOL_EXPORT_BEGIN
1745
1814
 
1815
+ RUBY_EXTERN struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
1746
1816
  RUBY_EXTERN rb_vm_t *ruby_current_vm_ptr;
1747
- RUBY_EXTERN rb_execution_context_t *ruby_current_execution_context_ptr;
1748
1817
  RUBY_EXTERN rb_event_flag_t ruby_vm_event_flags;
1749
1818
  RUBY_EXTERN rb_event_flag_t ruby_vm_event_enabled_global_flags;
1750
1819
  RUBY_EXTERN unsigned int ruby_vm_event_local_num;
1751
1820
 
1752
- RUBY_SYMBOL_EXPORT_END
1821
+ MJIT_SYMBOL_EXPORT_END
1753
1822
 
1754
1823
  #define GET_VM() rb_current_vm()
1824
+ #define GET_RACTOR() rb_current_ractor()
1755
1825
  #define GET_THREAD() rb_current_thread()
1756
- #define GET_EC() rb_current_execution_context()
1826
+ #define GET_EC() rb_current_execution_context(true)
1757
1827
 
1758
1828
  static inline rb_thread_t *
1759
1829
  rb_ec_thread_ptr(const rb_execution_context_t *ec)
@@ -1761,22 +1831,45 @@ rb_ec_thread_ptr(const rb_execution_context_t *ec)
1761
1831
  return ec->thread_ptr;
1762
1832
  }
1763
1833
 
1834
+ static inline rb_ractor_t *
1835
+ rb_ec_ractor_ptr(const rb_execution_context_t *ec)
1836
+ {
1837
+ const rb_thread_t *th = rb_ec_thread_ptr(ec);
1838
+ if (th) {
1839
+ VM_ASSERT(th->ractor != NULL);
1840
+ return th->ractor;
1841
+ }
1842
+ else {
1843
+ return NULL;
1844
+ }
1845
+ }
1846
+
1764
1847
  static inline rb_vm_t *
1765
1848
  rb_ec_vm_ptr(const rb_execution_context_t *ec)
1766
1849
  {
1767
1850
  const rb_thread_t *th = rb_ec_thread_ptr(ec);
1768
1851
  if (th) {
1769
- return th->vm;
1852
+ return th->vm;
1770
1853
  }
1771
1854
  else {
1772
- return NULL;
1855
+ return NULL;
1773
1856
  }
1774
1857
  }
1775
1858
 
1776
1859
  static inline rb_execution_context_t *
1777
- rb_current_execution_context(void)
1778
- {
1779
- return ruby_current_execution_context_ptr;
1860
+ rb_current_execution_context(bool expect_ec)
1861
+ {
1862
+ #ifdef RB_THREAD_LOCAL_SPECIFIER
1863
+ #ifdef __APPLE__
1864
+ rb_execution_context_t *ec = rb_current_ec();
1865
+ #else
1866
+ rb_execution_context_t *ec = ruby_current_ec;
1867
+ #endif
1868
+ #else
1869
+ rb_execution_context_t *ec = native_tls_get(ruby_current_ec_key);
1870
+ #endif
1871
+ VM_ASSERT(!expect_ec || ec != NULL);
1872
+ return ec;
1780
1873
  }
1781
1874
 
1782
1875
  static inline rb_thread_t *
@@ -1786,30 +1879,47 @@ rb_current_thread(void)
1786
1879
  return rb_ec_thread_ptr(ec);
1787
1880
  }
1788
1881
 
1882
+ static inline rb_ractor_t *
1883
+ rb_current_ractor(void)
1884
+ {
1885
+ if (ruby_single_main_ractor) {
1886
+ return ruby_single_main_ractor;
1887
+ }
1888
+ else {
1889
+ const rb_execution_context_t *ec = GET_EC();
1890
+ return rb_ec_ractor_ptr(ec);
1891
+ }
1892
+ }
1893
+
1789
1894
  static inline rb_vm_t *
1790
1895
  rb_current_vm(void)
1791
1896
  {
1897
+ #if 0 // TODO: reconsider the assertions
1792
1898
  VM_ASSERT(ruby_current_vm_ptr == NULL ||
1793
- ruby_current_execution_context_ptr == NULL ||
1794
- rb_ec_thread_ptr(GET_EC()) == NULL ||
1795
- rb_ec_vm_ptr(GET_EC()) == ruby_current_vm_ptr);
1899
+ ruby_current_execution_context_ptr == NULL ||
1900
+ rb_ec_thread_ptr(GET_EC()) == NULL ||
1901
+ rb_ec_thread_ptr(GET_EC())->status == THREAD_KILLED ||
1902
+ rb_ec_vm_ptr(GET_EC()) == ruby_current_vm_ptr);
1903
+ #endif
1904
+
1796
1905
  return ruby_current_vm_ptr;
1797
1906
  }
1798
1907
 
1799
- static inline void
1800
- rb_thread_set_current_raw(const rb_thread_t *th)
1801
- {
1802
- ruby_current_execution_context_ptr = th->ec;
1803
- }
1908
+ void rb_ec_vm_lock_rec_release(const rb_execution_context_t *ec,
1909
+ unsigned int recorded_lock_rec,
1910
+ unsigned int current_lock_rec);
1804
1911
 
1805
- static inline void
1806
- rb_thread_set_current(rb_thread_t *th)
1912
+ static inline unsigned int
1913
+ rb_ec_vm_lock_rec(const rb_execution_context_t *ec)
1807
1914
  {
1808
- if (th->vm->running_thread != th) {
1809
- th->running_time_us = 0;
1915
+ rb_vm_t *vm = rb_ec_vm_ptr(ec);
1916
+
1917
+ if (vm->ractor.sync.lock_owner != rb_ec_ractor_ptr(ec)) {
1918
+ return 0;
1919
+ }
1920
+ else {
1921
+ return vm->ractor.sync.lock_rec;
1810
1922
  }
1811
- rb_thread_set_current_raw(th);
1812
- th->vm->running_thread = th;
1813
1923
  }
1814
1924
 
1815
1925
  #else
@@ -1820,16 +1930,33 @@ enum {
1820
1930
  TIMER_INTERRUPT_MASK = 0x01,
1821
1931
  PENDING_INTERRUPT_MASK = 0x02,
1822
1932
  POSTPONED_JOB_INTERRUPT_MASK = 0x04,
1823
- TRAP_INTERRUPT_MASK = 0x08
1933
+ TRAP_INTERRUPT_MASK = 0x08,
1934
+ TERMINATE_INTERRUPT_MASK = 0x10,
1935
+ VM_BARRIER_INTERRUPT_MASK = 0x20,
1824
1936
  };
1825
1937
 
1826
- #define RUBY_VM_SET_TIMER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TIMER_INTERRUPT_MASK)
1827
- #define RUBY_VM_SET_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, PENDING_INTERRUPT_MASK)
1828
- #define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
1829
- #define RUBY_VM_SET_TRAP_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TRAP_INTERRUPT_MASK)
1830
- #define RUBY_VM_INTERRUPTED(ec) ((ec)->interrupt_flag & ~(ec)->interrupt_mask & \
1831
- (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
1832
- #define RUBY_VM_INTERRUPTED_ANY(ec) ((ec)->interrupt_flag & ~(ec)->interrupt_mask)
1938
+ #define RUBY_VM_SET_TIMER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TIMER_INTERRUPT_MASK)
1939
+ #define RUBY_VM_SET_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, PENDING_INTERRUPT_MASK)
1940
+ #define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
1941
+ #define RUBY_VM_SET_TRAP_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TRAP_INTERRUPT_MASK)
1942
+ #define RUBY_VM_SET_TERMINATE_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TERMINATE_INTERRUPT_MASK)
1943
+ #define RUBY_VM_SET_VM_BARRIER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, VM_BARRIER_INTERRUPT_MASK)
1944
+ #define RUBY_VM_INTERRUPTED(ec) ((ec)->interrupt_flag & ~(ec)->interrupt_mask & \
1945
+ (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
1946
+
1947
+ static inline bool
1948
+ RUBY_VM_INTERRUPTED_ANY(rb_execution_context_t *ec)
1949
+ {
1950
+ #if defined(USE_VM_CLOCK) && USE_VM_CLOCK
1951
+ uint32_t current_clock = rb_ec_vm_ptr(ec)->clock;
1952
+
1953
+ if (current_clock != ec->checked_clock) {
1954
+ ec->checked_clock = current_clock;
1955
+ RUBY_VM_SET_TIMER_INTERRUPT(ec);
1956
+ }
1957
+ #endif
1958
+ return ec->interrupt_flag & ~(ec)->interrupt_mask;
1959
+ }
1833
1960
 
1834
1961
  VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
1835
1962
  int rb_signal_buff_size(void);
@@ -1842,11 +1969,17 @@ void rb_threadptr_interrupt(rb_thread_t *th);
1842
1969
  void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
1843
1970
  void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
1844
1971
  void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
1972
+ VALUE rb_ec_get_errinfo(const rb_execution_context_t *ec);
1845
1973
  void rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo);
1846
1974
  void rb_execution_context_update(const rb_execution_context_t *ec);
1847
1975
  void rb_execution_context_mark(const rb_execution_context_t *ec);
1848
1976
  void rb_fiber_close(rb_fiber_t *fib);
1849
1977
  void Init_native_thread(rb_thread_t *th);
1978
+ int rb_vm_check_ints_blocking(rb_execution_context_t *ec);
1979
+
1980
+ // vm_sync.h
1981
+ void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond);
1982
+ void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec);
1850
1983
 
1851
1984
  #define RUBY_VM_CHECK_INTS(ec) rb_vm_check_ints(ec)
1852
1985
  static inline void
@@ -1854,7 +1987,7 @@ rb_vm_check_ints(rb_execution_context_t *ec)
1854
1987
  {
1855
1988
  VM_ASSERT(ec == GET_EC());
1856
1989
  if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {
1857
- rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);
1990
+ rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);
1858
1991
  }
1859
1992
  }
1860
1993
 
@@ -1915,17 +2048,24 @@ rb_exec_event_hook_orig(rb_execution_context_t *ec, rb_hook_list_t *hooks, rb_ev
1915
2048
  rb_exec_event_hooks(&trace_arg, hooks, pop_p);
1916
2049
  }
1917
2050
 
2051
+ struct rb_ractor_pub {
2052
+ VALUE self;
2053
+ uint32_t id;
2054
+ rb_hook_list_t hooks;
2055
+ };
2056
+
1918
2057
  static inline rb_hook_list_t *
1919
- rb_vm_global_hooks(const rb_execution_context_t *ec)
2058
+ rb_ec_ractor_hooks(const rb_execution_context_t *ec)
1920
2059
  {
1921
- return &rb_ec_vm_ptr(ec)->global_hooks;
2060
+ struct rb_ractor_pub *cr_pub = (struct rb_ractor_pub *)rb_ec_ractor_ptr(ec);
2061
+ return &cr_pub->hooks;
1922
2062
  }
1923
2063
 
1924
2064
  #define EXEC_EVENT_HOOK(ec_, flag_, self_, id_, called_id_, klass_, data_) \
1925
- EXEC_EVENT_HOOK_ORIG(ec_, rb_vm_global_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 0)
2065
+ EXEC_EVENT_HOOK_ORIG(ec_, rb_ec_ractor_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 0)
1926
2066
 
1927
2067
  #define EXEC_EVENT_HOOK_AND_POP_FRAME(ec_, flag_, self_, id_, called_id_, klass_, data_) \
1928
- EXEC_EVENT_HOOK_ORIG(ec_, rb_vm_global_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 1)
2068
+ EXEC_EVENT_HOOK_ORIG(ec_, rb_ec_ractor_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 1)
1929
2069
 
1930
2070
  static inline void
1931
2071
  rb_exec_event_hook_script_compiled(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE eval_script)
@@ -1949,9 +2089,15 @@ extern VALUE rb_get_coverages(void);
1949
2089
  extern void rb_set_coverages(VALUE, int, VALUE);
1950
2090
  extern void rb_clear_coverages(void);
1951
2091
  extern void rb_reset_coverages(void);
2092
+ extern void rb_resume_coverages(void);
2093
+ extern void rb_suspend_coverages(void);
1952
2094
 
1953
2095
  void rb_postponed_job_flush(rb_vm_t *vm);
1954
2096
 
2097
+ // ractor.c
2098
+ RUBY_EXTERN VALUE rb_eRactorUnsafeError;
2099
+ RUBY_EXTERN VALUE rb_eRactorIsolationError;
2100
+
1955
2101
  RUBY_SYMBOL_EXPORT_END
1956
2102
 
1957
2103
  #endif /* RUBY_VM_CORE_H */