debase-ruby_core_source 0.10.13 → 0.10.16

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 (303) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/debase-ruby_core_source.gemspec +3 -3
  4. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/addr2line.h +1 -1
  5. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-2.5.4-p155}/ccan/build_assert/build_assert.h +0 -0
  6. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-2.5.4-p155}/ccan/check_type/check_type.h +0 -0
  7. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-2.5.4-p155}/ccan/container_of/container_of.h +0 -0
  8. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/list/list.h +773 -0
  9. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-2.5.4-p155}/ccan/str/str.h +0 -0
  10. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/constant.h +51 -0
  11. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/debug_counter.h +109 -0
  12. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/dln.h +10 -9
  13. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/encindex.h +69 -0
  14. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/eval_intern.h +334 -0
  15. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/gc.h +27 -10
  16. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id.h +250 -0
  17. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id_table.h +31 -0
  18. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns.inc +217 -0
  19. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns_info.inc +1570 -0
  20. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/internal.h +2036 -0
  21. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/iseq.h +308 -0
  22. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/known_errors.inc +16 -1
  23. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/method.h +218 -0
  24. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node.h +115 -79
  25. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node_name.inc +12 -22
  26. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/opt_sc.inc +1601 -0
  27. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/optinsn.inc +103 -0
  28. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/optunifs.inc +28 -83
  29. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/parse.h +74 -60
  30. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/probes_helper.h +43 -0
  31. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/regenc.h +254 -0
  32. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regint.h +299 -211
  33. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regparse.h +45 -37
  34. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/revision.h +1 -0
  35. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ruby_assert.h +54 -0
  36. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/ruby_atomic.h +84 -26
  37. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/siphash.h +1 -1
  38. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/symbol.h +108 -0
  39. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_pthread.h +14 -11
  40. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_win32.h +2 -6
  41. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/timev.h +42 -0
  42. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/transcode_data.h +34 -12
  43. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/version.h +73 -0
  44. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm.inc +3667 -0
  45. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_call_iseq_optimized.inc +213 -0
  46. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_core.h +1768 -0
  47. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550/debug.h → ruby-2.5.4-p155/vm_debug.h} +4 -8
  48. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_exec.h +38 -30
  49. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_insnhelper.h +255 -0
  50. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_opts.h +14 -9
  51. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vmtc.inc +214 -0
  52. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/addr2line.h +0 -0
  53. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/builtin.h +1 -0
  54. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/build_assert/build_assert.h +40 -0
  55. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/check_type/check_type.h +63 -0
  56. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/container_of/container_of.h +142 -0
  57. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ccan/list/list.h +0 -0
  58. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/str/str.h +16 -0
  59. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/constant.h +0 -0
  60. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/darray.h +0 -0
  61. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/debug_counter.h +2 -0
  62. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/dln.h +0 -0
  63. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/encindex.h +0 -0
  64. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/eval_intern.h +32 -1
  65. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/gc.h +0 -1
  66. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/hrtime.h +0 -0
  67. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/id.h +0 -0
  68. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/id_table.h +0 -0
  69. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/insns.inc +4 -2
  70. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/insns_info.inc +309 -224
  71. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/array.h +0 -0
  72. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/bignum.h +0 -0
  73. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/bits.h +0 -0
  74. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/class.h +13 -5
  75. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/compar.h +0 -0
  76. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/compile.h +0 -0
  77. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/compilers.h +0 -0
  78. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/complex.h +0 -0
  79. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/cont.h +0 -0
  80. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/dir.h +0 -0
  81. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/enc.h +0 -0
  82. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/encoding.h +0 -0
  83. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/enum.h +0 -0
  84. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/enumerator.h +0 -0
  85. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/error.h +0 -0
  86. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/eval.h +0 -0
  87. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/file.h +0 -0
  88. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/fixnum.h +0 -0
  89. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/gc.h +12 -1
  90. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/hash.h +0 -0
  91. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/imemo.h +0 -0
  92. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/inits.h +0 -0
  93. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/io.h +0 -0
  94. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/load.h +0 -0
  95. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/loadpath.h +0 -0
  96. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/math.h +0 -0
  97. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/missing.h +0 -0
  98. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/numeric.h +0 -0
  99. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/object.h +0 -0
  100. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/parse.h +0 -0
  101. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/proc.h +0 -0
  102. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/process.h +0 -0
  103. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/random.h +0 -0
  104. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/range.h +0 -0
  105. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/rational.h +0 -0
  106. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/re.h +0 -0
  107. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/sanitizers.h +0 -0
  108. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/serial.h +0 -0
  109. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/signal.h +0 -0
  110. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/static_assert.h +0 -0
  111. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/string.h +0 -0
  112. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/struct.h +0 -0
  113. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/symbol.h +1 -0
  114. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/thread.h +0 -0
  115. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/time.h +0 -0
  116. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/transcode.h +0 -0
  117. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/util.h +0 -0
  118. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/variable.h +0 -0
  119. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/vm.h +2 -1
  120. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/warnings.h +0 -0
  121. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal.h +0 -0
  122. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/iseq.h +3 -1
  123. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/known_errors.inc +0 -0
  124. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/method.h +14 -6
  125. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/mjit.h +0 -0
  126. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/mjit_compile.inc +64 -7
  127. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/node.h +28 -17
  128. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/node_name.inc +0 -2
  129. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/opt_sc.inc +2 -0
  130. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/optinsn.inc +0 -0
  131. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/optunifs.inc +1 -1
  132. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/parse.h +0 -0
  133. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/probes_helper.h +0 -0
  134. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ractor_core.h +0 -0
  135. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/regenc.h +0 -0
  136. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/regint.h +0 -0
  137. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/regparse.h +0 -0
  138. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/revision.h +2 -0
  139. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ruby_assert.h +0 -0
  140. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ruby_atomic.h +0 -0
  141. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/siphash.h +0 -0
  142. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/symbol.h +0 -0
  143. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/thread_pthread.h +0 -0
  144. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/thread_win32.h +0 -0
  145. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/timev.h +0 -0
  146. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/transcode_data.h +0 -0
  147. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/transient_heap.h +0 -0
  148. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/variable.h +0 -0
  149. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/version.h +4 -4
  150. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm.inc +338 -283
  151. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_call_iseq_optimized.inc +0 -0
  152. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_callinfo.h +41 -8
  153. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_core.h +6 -2
  154. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_debug.h +8 -3
  155. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_exec.h +0 -0
  156. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_insnhelper.h +0 -0
  157. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_opts.h +0 -0
  158. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_sync.h +137 -0
  159. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vmtc.inc +4 -2
  160. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit.h +11 -1
  161. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_asm.h +21 -5
  162. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_codegen.h +5 -1
  163. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_core.h +11 -6
  164. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_iface.h +0 -0
  165. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/addr2line.h +20 -0
  166. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/builtin.h +84 -0
  167. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ccan/build_assert/build_assert.h +40 -0
  168. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ccan/check_type/check_type.h +63 -0
  169. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ccan/container_of/container_of.h +142 -0
  170. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ccan/list/list.h +789 -0
  171. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ccan/str/str.h +17 -0
  172. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/constant.h +55 -0
  173. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/darray.h +226 -0
  174. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/debug_counter.h +469 -0
  175. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/dln.h +31 -0
  176. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/encindex.h +70 -0
  177. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/eval_intern.h +339 -0
  178. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/gc.h +143 -0
  179. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/hrtime.h +216 -0
  180. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/id.h +295 -0
  181. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/id_table.h +36 -0
  182. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/insns.inc +249 -0
  183. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/insns_info.inc +9064 -0
  184. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/array.h +113 -0
  185. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/bignum.h +246 -0
  186. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/bits.h +565 -0
  187. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/class.h +211 -0
  188. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/cmdlineopt.h +61 -0
  189. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/compar.h +49 -0
  190. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/compile.h +35 -0
  191. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/compilers.h +107 -0
  192. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/complex.h +29 -0
  193. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/cont.h +24 -0
  194. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/dir.h +16 -0
  195. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/enc.h +19 -0
  196. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/encoding.h +30 -0
  197. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/enum.h +18 -0
  198. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/enumerator.h +21 -0
  199. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/error.h +191 -0
  200. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/eval.h +32 -0
  201. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/file.h +38 -0
  202. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/fixnum.h +184 -0
  203. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/gc.h +188 -0
  204. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/hash.h +243 -0
  205. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/imemo.h +243 -0
  206. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/inits.h +50 -0
  207. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/io.h +38 -0
  208. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/load.h +18 -0
  209. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/loadpath.h +16 -0
  210. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/math.h +23 -0
  211. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/missing.h +18 -0
  212. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/numeric.h +271 -0
  213. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/object.h +83 -0
  214. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/parse.h +23 -0
  215. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/proc.h +32 -0
  216. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/process.h +137 -0
  217. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/ractor.h +6 -0
  218. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/random.h +16 -0
  219. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/range.h +40 -0
  220. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/rational.h +72 -0
  221. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/re.h +30 -0
  222. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/sanitizers.h +190 -0
  223. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/serial.h +23 -0
  224. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/signal.h +21 -0
  225. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/static_assert.h +16 -0
  226. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/string.h +141 -0
  227. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/struct.h +153 -0
  228. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/symbol.h +41 -0
  229. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/thread.h +53 -0
  230. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/time.h +34 -0
  231. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/transcode.h +20 -0
  232. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/util.h +27 -0
  233. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/variable.h +83 -0
  234. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/vm.h +134 -0
  235. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal/warnings.h +16 -0
  236. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/internal.h +109 -0
  237. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/iseq.h +325 -0
  238. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/known_errors.inc +791 -0
  239. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/method.h +254 -0
  240. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/mjit.h +231 -0
  241. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/mjit_compile.inc +8333 -0
  242. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/node.h +510 -0
  243. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/node_name.inc +208 -0
  244. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/opt_sc.inc +109 -0
  245. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/optinsn.inc +128 -0
  246. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/optunifs.inc +43 -0
  247. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/parse.h +214 -0
  248. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/probes_helper.h +44 -0
  249. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ractor_core.h +346 -0
  250. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/regenc.h +255 -0
  251. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/regint.h +957 -0
  252. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/regparse.h +370 -0
  253. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/revision.h +2 -0
  254. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ruby_assert.h +14 -0
  255. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/ruby_atomic.h +23 -0
  256. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/siphash.h +48 -0
  257. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/symbol.h +119 -0
  258. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/thread_none.h +17 -0
  259. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/thread_pthread.h +115 -0
  260. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/thread_win32.h +61 -0
  261. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/timev.h +57 -0
  262. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/transcode_data.h +138 -0
  263. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/transient_heap.h +65 -0
  264. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/variable.h +21 -0
  265. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/version.h +91 -0
  266. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm.inc +5481 -0
  267. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_call_iseq_optimized.inc +244 -0
  268. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_callinfo.h +502 -0
  269. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_core.h +2089 -0
  270. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_debug.h +113 -0
  271. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_exec.h +197 -0
  272. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_insnhelper.h +262 -0
  273. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vm_opts.h +73 -0
  274. data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.2.0-preview1}/vm_sync.h +0 -0
  275. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/vmtc.inc +243 -0
  276. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/yjit.h +73 -0
  277. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/yjit_asm.h +408 -0
  278. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/yjit_codegen.h +23 -0
  279. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/yjit_core.h +307 -0
  280. data/lib/debase/ruby_core_source/ruby-3.2.0-preview1/yjit_iface.h +38 -0
  281. data/lib/debase/ruby_core_source/version.rb +1 -1
  282. metadata +284 -158
  283. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/constant.h +0 -34
  284. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/encdb.h +0 -167
  285. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/eval_intern.h +0 -234
  286. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/id.h +0 -177
  287. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns.inc +0 -179
  288. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns_info.inc +0 -695
  289. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/internal.h +0 -242
  290. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/iseq.h +0 -126
  291. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/method.h +0 -105
  292. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/opt_sc.inc +0 -670
  293. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/optinsn.inc +0 -30
  294. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/regenc.h +0 -219
  295. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/revision.h +0 -1
  296. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/timev.h +0 -21
  297. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/transdb.h +0 -189
  298. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/version.h +0 -52
  299. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm.inc +0 -3054
  300. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_core.h +0 -763
  301. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_insnhelper.h +0 -220
  302. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vmtc.inc +0 -97
  303. data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/revision.h +0 -2
@@ -0,0 +1,565 @@
1
+ #ifndef INTERNAL_BITS_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_BITS_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for bitwise integer algorithms.
10
+ * @see Henry S. Warren Jr., "Hacker's Delight" (2nd ed.), 2013.
11
+ * @see SEI CERT C Coding Standard INT32-C. "Ensure that operations on
12
+ * signed integers do not result in overflow"
13
+ * @see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
14
+ * @see https://clang.llvm.org/docs/LanguageExtensions.html#builtin-rotateleft
15
+ * @see https://clang.llvm.org/docs/LanguageExtensions.html#builtin-rotateright
16
+ * @see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/byteswap-uint64-byteswap-ulong-byteswap-ushort
17
+ * @see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/rotl-rotl64-rotr-rotr64
18
+ * @see https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64
19
+ * @see https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64
20
+ * @see https://docs.microsoft.com/en-us/cpp/intrinsics/lzcnt16-lzcnt-lzcnt64
21
+ * @see https://docs.microsoft.com/en-us/cpp/intrinsics/popcnt16-popcnt-popcnt64
22
+ * @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_lzcnt_u32
23
+ * @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_tzcnt_u32
24
+ * @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rotl64
25
+ * @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rotr64
26
+ * @see https://stackoverflow.com/a/776523
27
+ */
28
+ #include "ruby/internal/config.h"
29
+ #include <limits.h> /* for CHAR_BITS */
30
+ #include <stdint.h> /* for uintptr_t */
31
+ #include "internal/compilers.h" /* for MSC_VERSION_SINCE */
32
+
33
+ #if MSC_VERSION_SINCE(1310)
34
+ # include <stdlib.h> /* for _byteswap_uint64 */
35
+ #endif
36
+
37
+ #if defined(HAVE_X86INTRIN_H) && ! defined(MJIT_HEADER)
38
+ # /* Rule out MJIT_HEADER, which does not interface well with <immintrin.h> */
39
+ # include <x86intrin.h> /* for _lzcnt_u64 */
40
+ #elif MSC_VERSION_SINCE(1310)
41
+ # include <intrin.h> /* for the following intrinsics */
42
+ #endif
43
+
44
+ #if defined(_MSC_VER) && defined(__AVX__)
45
+ # pragma intrinsic(__popcnt)
46
+ # pragma intrinsic(__popcnt64)
47
+ #endif
48
+
49
+ #if defined(_MSC_VER) && defined(__AVX2__)
50
+ # pragma intrinsic(__lzcnt)
51
+ # pragma intrinsic(__lzcnt64)
52
+ #endif
53
+
54
+ #if MSC_VERSION_SINCE(1310)
55
+ # pragma intrinsic(_rotl)
56
+ # pragma intrinsic(_rotr)
57
+ # ifdef _WIN64
58
+ # pragma intrinsic(_rotl64)
59
+ # pragma intrinsic(_rotr64)
60
+ # endif
61
+ #endif
62
+
63
+ #if MSC_VERSION_SINCE(1400)
64
+ # pragma intrinsic(_BitScanForward)
65
+ # pragma intrinsic(_BitScanReverse)
66
+ # ifdef _WIN64
67
+ # pragma intrinsic(_BitScanForward64)
68
+ # pragma intrinsic(_BitScanReverse64)
69
+ # endif
70
+ #endif
71
+
72
+ #include "ruby/ruby.h" /* for VALUE */
73
+ #include "internal/static_assert.h" /* for STATIC_ASSERT */
74
+
75
+ /* The most significant bit of the lower part of half-long integer.
76
+ * If sizeof(long) == 4, this is 0x8000.
77
+ * If sizeof(long) == 8, this is 0x80000000.
78
+ */
79
+ #define HALF_LONG_MSB ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))
80
+
81
+ #define SIGNED_INTEGER_TYPE_P(T) (0 > ((T)0)-1)
82
+
83
+ #define SIGNED_INTEGER_MIN(T) \
84
+ ((sizeof(T) == sizeof(int8_t)) ? ((T)INT8_MIN) : \
85
+ ((sizeof(T) == sizeof(int16_t)) ? ((T)INT16_MIN) : \
86
+ ((sizeof(T) == sizeof(int32_t)) ? ((T)INT32_MIN) : \
87
+ ((sizeof(T) == sizeof(int64_t)) ? ((T)INT64_MIN) : \
88
+ 0))))
89
+
90
+ #define SIGNED_INTEGER_MAX(T) ((T)(SIGNED_INTEGER_MIN(T) ^ ((T)~(T)0)))
91
+
92
+ #define UNSIGNED_INTEGER_MAX(T) ((T)~(T)0)
93
+
94
+ #if __has_builtin(__builtin_mul_overflow_p)
95
+ # define MUL_OVERFLOW_P(a, b) \
96
+ __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
97
+ #elif __has_builtin(__builtin_mul_overflow)
98
+ # define MUL_OVERFLOW_P(a, b) \
99
+ __extension__ ({ __typeof__(a) c; __builtin_mul_overflow((a), (b), &c); })
100
+ #endif
101
+
102
+ #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
103
+ (a) == 0 ? 0 : \
104
+ (a) == -1 ? (b) < -(max) : \
105
+ (a) > 0 ? \
106
+ ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
107
+ ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
108
+
109
+ #if __has_builtin(__builtin_mul_overflow_p)
110
+ /* __builtin_mul_overflow_p can take bitfield */
111
+ /* and GCC permits bitfields for integers other than int */
112
+ # define MUL_OVERFLOW_FIXNUM_P(a, b) \
113
+ __extension__ ({ \
114
+ struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
115
+ __builtin_mul_overflow_p((a), (b), c.fixnum); \
116
+ })
117
+ #else
118
+ # define MUL_OVERFLOW_FIXNUM_P(a, b) \
119
+ MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
120
+ #endif
121
+
122
+ #ifdef MUL_OVERFLOW_P
123
+ # define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
124
+ # define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
125
+ # define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b)
126
+ #else
127
+ # define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
128
+ # define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
129
+ # define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
130
+ #endif
131
+
132
+ #ifdef HAVE_UINT128_T
133
+ # define bit_length(x) \
134
+ (unsigned int) \
135
+ (sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \
136
+ sizeof(x) <= sizeof(int64_t) ? 64 - nlz_int64((uint64_t)(x)) : \
137
+ 128 - nlz_int128((uint128_t)(x)))
138
+ #else
139
+ # define bit_length(x) \
140
+ (unsigned int) \
141
+ (sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \
142
+ 64 - nlz_int64((uint64_t)(x)))
143
+ #endif
144
+
145
+ #ifndef swap16
146
+ # define swap16 ruby_swap16
147
+ #endif
148
+
149
+ #ifndef swap32
150
+ # define swap32 ruby_swap32
151
+ #endif
152
+
153
+ #ifndef swap64
154
+ # define swap64 ruby_swap64
155
+ #endif
156
+
157
+ static inline uint16_t ruby_swap16(uint16_t);
158
+ static inline uint32_t ruby_swap32(uint32_t);
159
+ static inline uint64_t ruby_swap64(uint64_t);
160
+ static inline unsigned nlz_int(unsigned x);
161
+ static inline unsigned nlz_long(unsigned long x);
162
+ static inline unsigned nlz_long_long(unsigned long long x);
163
+ static inline unsigned nlz_intptr(uintptr_t x);
164
+ static inline unsigned nlz_int32(uint32_t x);
165
+ static inline unsigned nlz_int64(uint64_t x);
166
+ #ifdef HAVE_UINT128_T
167
+ static inline unsigned nlz_int128(uint128_t x);
168
+ #endif
169
+ static inline unsigned rb_popcount32(uint32_t x);
170
+ static inline unsigned rb_popcount64(uint64_t x);
171
+ static inline unsigned rb_popcount_intptr(uintptr_t x);
172
+ static inline int ntz_int32(uint32_t x);
173
+ static inline int ntz_int64(uint64_t x);
174
+ static inline int ntz_intptr(uintptr_t x);
175
+ static inline VALUE RUBY_BIT_ROTL(VALUE, int);
176
+ static inline VALUE RUBY_BIT_ROTR(VALUE, int);
177
+
178
+ static inline uint16_t
179
+ ruby_swap16(uint16_t x)
180
+ {
181
+ #if __has_builtin(__builtin_bswap16)
182
+ return __builtin_bswap16(x);
183
+
184
+ #elif MSC_VERSION_SINCE(1310)
185
+ return _byteswap_ushort(x);
186
+
187
+ #else
188
+ return (x << 8) | (x >> 8);
189
+
190
+ #endif
191
+ }
192
+
193
+ static inline uint32_t
194
+ ruby_swap32(uint32_t x)
195
+ {
196
+ #if __has_builtin(__builtin_bswap32)
197
+ return __builtin_bswap32(x);
198
+
199
+ #elif MSC_VERSION_SINCE(1310)
200
+ return _byteswap_ulong(x);
201
+
202
+ #else
203
+ x = ((x & 0x0000FFFF) << 16) | ((x & 0xFFFF0000) >> 16);
204
+ x = ((x & 0x00FF00FF) << 8) | ((x & 0xFF00FF00) >> 8);
205
+ return x;
206
+
207
+ #endif
208
+ }
209
+
210
+ static inline uint64_t
211
+ ruby_swap64(uint64_t x)
212
+ {
213
+ #if __has_builtin(__builtin_bswap64)
214
+ return __builtin_bswap64(x);
215
+
216
+ #elif MSC_VERSION_SINCE(1310)
217
+ return _byteswap_uint64(x);
218
+
219
+ #else
220
+ x = ((x & 0x00000000FFFFFFFFULL) << 32) | ((x & 0xFFFFFFFF00000000ULL) >> 32);
221
+ x = ((x & 0x0000FFFF0000FFFFULL) << 16) | ((x & 0xFFFF0000FFFF0000ULL) >> 16);
222
+ x = ((x & 0x00FF00FF00FF00FFULL) << 8) | ((x & 0xFF00FF00FF00FF00ULL) >> 8);
223
+ return x;
224
+
225
+ #endif
226
+ }
227
+
228
+ static inline unsigned int
229
+ nlz_int32(uint32_t x)
230
+ {
231
+ #if defined(_MSC_VER) && defined(__AVX2__)
232
+ /* Note: It seems there is no such thing like __LZCNT__ predefined in MSVC.
233
+ * AMD CPUs have had this instruction for decades (since K10) but for
234
+ * Intel, Haswell is the oldest one. We need to use __AVX2__ for maximum
235
+ * safety. */
236
+ return (unsigned int)__lzcnt(x);
237
+
238
+ #elif defined(__x86_64__) && defined(__LZCNT__) && ! defined(MJIT_HEADER)
239
+ return (unsigned int)_lzcnt_u32(x);
240
+
241
+ #elif MSC_VERSION_SINCE(1400) /* &&! defined(__AVX2__) */
242
+ unsigned long r;
243
+ return _BitScanReverse(&r, x) ? (31 - (int)r) : 32;
244
+
245
+ #elif __has_builtin(__builtin_clz)
246
+ STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT == 32);
247
+ return x ? (unsigned int)__builtin_clz(x) : 32;
248
+
249
+ #else
250
+ uint32_t y;
251
+ unsigned n = 32;
252
+ y = x >> 16; if (y) {n -= 16; x = y;}
253
+ y = x >> 8; if (y) {n -= 8; x = y;}
254
+ y = x >> 4; if (y) {n -= 4; x = y;}
255
+ y = x >> 2; if (y) {n -= 2; x = y;}
256
+ y = x >> 1; if (y) {return n - 2;}
257
+ return (unsigned int)(n - x);
258
+ #endif
259
+ }
260
+
261
+ static inline unsigned int
262
+ nlz_int64(uint64_t x)
263
+ {
264
+ #if defined(_MSC_VER) && defined(__AVX2__)
265
+ return (unsigned int)__lzcnt64(x);
266
+
267
+ #elif defined(__x86_64__) && defined(__LZCNT__) && ! defined(MJIT_HEADER)
268
+ return (unsigned int)_lzcnt_u64(x);
269
+
270
+ #elif defined(_WIN64) && MSC_VERSION_SINCE(1400) /* &&! defined(__AVX2__) */
271
+ unsigned long r;
272
+ return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64;
273
+
274
+ #elif __has_builtin(__builtin_clzl)
275
+ if (x == 0) {
276
+ return 64;
277
+ }
278
+ else if (sizeof(long) * CHAR_BIT == 64) {
279
+ return (unsigned int)__builtin_clzl((unsigned long)x);
280
+ }
281
+ else if (sizeof(long long) * CHAR_BIT == 64) {
282
+ return (unsigned int)__builtin_clzll((unsigned long long)x);
283
+ }
284
+ else {
285
+ /* :FIXME: Is there a way to make this branch a compile-time error? */
286
+ UNREACHABLE_RETURN(~0);
287
+ }
288
+
289
+ #else
290
+ uint64_t y;
291
+ unsigned int n = 64;
292
+ y = x >> 32; if (y) {n -= 32; x = y;}
293
+ y = x >> 16; if (y) {n -= 16; x = y;}
294
+ y = x >> 8; if (y) {n -= 8; x = y;}
295
+ y = x >> 4; if (y) {n -= 4; x = y;}
296
+ y = x >> 2; if (y) {n -= 2; x = y;}
297
+ y = x >> 1; if (y) {return n - 2;}
298
+ return (unsigned int)(n - x);
299
+
300
+ #endif
301
+ }
302
+
303
+ #ifdef HAVE_UINT128_T
304
+ static inline unsigned int
305
+ nlz_int128(uint128_t x)
306
+ {
307
+ uint64_t y = (uint64_t)(x >> 64);
308
+
309
+ if (x == 0) {
310
+ return 128;
311
+ }
312
+ else if (y == 0) {
313
+ return (unsigned int)nlz_int64(x) + 64;
314
+ }
315
+ else {
316
+ return (unsigned int)nlz_int64(y);
317
+ }
318
+ }
319
+ #endif
320
+
321
+ static inline unsigned int
322
+ nlz_int(unsigned int x)
323
+ {
324
+ if (sizeof(unsigned int) * CHAR_BIT == 32) {
325
+ return nlz_int32((uint32_t)x);
326
+ }
327
+ else if (sizeof(unsigned int) * CHAR_BIT == 64) {
328
+ return nlz_int64((uint64_t)x);
329
+ }
330
+ else {
331
+ UNREACHABLE_RETURN(~0);
332
+ }
333
+ }
334
+
335
+ static inline unsigned int
336
+ nlz_long(unsigned long x)
337
+ {
338
+ if (sizeof(unsigned long) * CHAR_BIT == 32) {
339
+ return nlz_int32((uint32_t)x);
340
+ }
341
+ else if (sizeof(unsigned long) * CHAR_BIT == 64) {
342
+ return nlz_int64((uint64_t)x);
343
+ }
344
+ else {
345
+ UNREACHABLE_RETURN(~0);
346
+ }
347
+ }
348
+
349
+ static inline unsigned int
350
+ nlz_long_long(unsigned long long x)
351
+ {
352
+ if (sizeof(unsigned long long) * CHAR_BIT == 64) {
353
+ return nlz_int64((uint64_t)x);
354
+ }
355
+ #ifdef HAVE_UINT128_T
356
+ else if (sizeof(unsigned long long) * CHAR_BIT == 128) {
357
+ return nlz_int128((uint128_t)x);
358
+ }
359
+ #endif
360
+ else {
361
+ UNREACHABLE_RETURN(~0);
362
+ }
363
+ }
364
+
365
+ static inline unsigned int
366
+ nlz_intptr(uintptr_t x)
367
+ {
368
+ if (sizeof(uintptr_t) == sizeof(unsigned int)) {
369
+ return nlz_int((unsigned int)x);
370
+ }
371
+ if (sizeof(uintptr_t) == sizeof(unsigned long)) {
372
+ return nlz_long((unsigned long)x);
373
+ }
374
+ if (sizeof(uintptr_t) == sizeof(unsigned long long)) {
375
+ return nlz_long_long((unsigned long long)x);
376
+ }
377
+ else {
378
+ UNREACHABLE_RETURN(~0);
379
+ }
380
+ }
381
+
382
+ static inline unsigned int
383
+ rb_popcount32(uint32_t x)
384
+ {
385
+ #if defined(_MSC_VER) && defined(__AVX__)
386
+ /* Note: CPUs since Nehalem and Barcelona have had this instruction so SSE
387
+ * 4.2 should suffice, but it seems there is no such thing like __SSE_4_2__
388
+ * predefined macro in MSVC. They do have __AVX__ so use it instead. */
389
+ return (unsigned int)__popcnt(x);
390
+
391
+ #elif __has_builtin(__builtin_popcount)
392
+ STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT >= 32);
393
+ return (unsigned int)__builtin_popcount(x);
394
+
395
+ #else
396
+ x = (x & 0x55555555) + (x >> 1 & 0x55555555);
397
+ x = (x & 0x33333333) + (x >> 2 & 0x33333333);
398
+ x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
399
+ x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
400
+ x = (x & 0x0000003f) + (x >>16 & 0x0000003f);
401
+ return (unsigned int)x;
402
+
403
+ #endif
404
+ }
405
+
406
+ static inline unsigned int
407
+ rb_popcount64(uint64_t x)
408
+ {
409
+ #if defined(_MSC_VER) && defined(__AVX__)
410
+ return (unsigned int)__popcnt64(x);
411
+
412
+ #elif __has_builtin(__builtin_popcount)
413
+ if (sizeof(long) * CHAR_BIT == 64) {
414
+ return (unsigned int)__builtin_popcountl((unsigned long)x);
415
+ }
416
+ else if (sizeof(long long) * CHAR_BIT == 64) {
417
+ return (unsigned int)__builtin_popcountll((unsigned long long)x);
418
+ }
419
+ else {
420
+ /* :FIXME: Is there a way to make this branch a compile-time error? */
421
+ UNREACHABLE_RETURN(~0);
422
+ }
423
+
424
+ #else
425
+ x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
426
+ x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
427
+ x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
428
+ x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
429
+ x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
430
+ x = (x & 0x000000000000007f) + (x >>32 & 0x000000000000007f);
431
+ return (unsigned int)x;
432
+
433
+ #endif
434
+ }
435
+
436
+ static inline unsigned int
437
+ rb_popcount_intptr(uintptr_t x)
438
+ {
439
+ if (sizeof(uintptr_t) * CHAR_BIT == 64) {
440
+ return rb_popcount64((uint64_t)x);
441
+ }
442
+ else if (sizeof(uintptr_t) * CHAR_BIT == 32) {
443
+ return rb_popcount32((uint32_t)x);
444
+ }
445
+ else {
446
+ UNREACHABLE_RETURN(~0);
447
+ }
448
+ }
449
+
450
+ static inline int
451
+ ntz_int32(uint32_t x)
452
+ {
453
+ #if defined(__x86_64__) && defined(__BMI__) && ! defined(MJIT_HEADER)
454
+ return (unsigned)_tzcnt_u32(x);
455
+
456
+ #elif MSC_VERSION_SINCE(1400)
457
+ /* :FIXME: Is there any way to issue TZCNT instead of BSF, apart from using
458
+ * assembly? Because issuing LZCNT seems possible (see nlz.h). */
459
+ unsigned long r;
460
+ return _BitScanForward(&r, x) ? (int)r : 32;
461
+
462
+ #elif __has_builtin(__builtin_ctz)
463
+ STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT == 32);
464
+ return x ? (unsigned)__builtin_ctz(x) : 32;
465
+
466
+ #else
467
+ return rb_popcount32((~x) & (x-1));
468
+
469
+ #endif
470
+ }
471
+
472
+ static inline int
473
+ ntz_int64(uint64_t x)
474
+ {
475
+ #if defined(__x86_64__) && defined(__BMI__) && ! defined(MJIT_HEADER)
476
+ return (unsigned)_tzcnt_u64(x);
477
+
478
+ #elif defined(_WIN64) && MSC_VERSION_SINCE(1400)
479
+ unsigned long r;
480
+ return _BitScanForward64(&r, x) ? (int)r : 64;
481
+
482
+ #elif __has_builtin(__builtin_ctzl)
483
+ if (x == 0) {
484
+ return 64;
485
+ }
486
+ else if (sizeof(long) * CHAR_BIT == 64) {
487
+ return (unsigned)__builtin_ctzl((unsigned long)x);
488
+ }
489
+ else if (sizeof(long long) * CHAR_BIT == 64) {
490
+ return (unsigned)__builtin_ctzll((unsigned long long)x);
491
+ }
492
+ else {
493
+ /* :FIXME: Is there a way to make this branch a compile-time error? */
494
+ UNREACHABLE_RETURN(~0);
495
+ }
496
+
497
+ #else
498
+ return rb_popcount64((~x) & (x-1));
499
+
500
+ #endif
501
+ }
502
+
503
+ static inline int
504
+ ntz_intptr(uintptr_t x)
505
+ {
506
+ if (sizeof(uintptr_t) * CHAR_BIT == 64) {
507
+ return ntz_int64((uint64_t)x);
508
+ }
509
+ else if (sizeof(uintptr_t) * CHAR_BIT == 32) {
510
+ return ntz_int32((uint32_t)x);
511
+ }
512
+ else {
513
+ UNREACHABLE_RETURN(~0);
514
+ }
515
+ }
516
+
517
+ static inline VALUE
518
+ RUBY_BIT_ROTL(VALUE v, int n)
519
+ {
520
+ #if __has_builtin(__builtin_rotateleft32) && (SIZEOF_VALUE * CHAR_BIT == 32)
521
+ return __builtin_rotateleft32(v, n);
522
+
523
+ #elif __has_builtin(__builtin_rotateleft64) && (SIZEOF_VALUE * CHAR_BIT == 64)
524
+ return __builtin_rotateleft64(v, n);
525
+
526
+ #elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 32)
527
+ return _rotl(v, n);
528
+
529
+ #elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 64)
530
+ return _rotl64(v, n);
531
+
532
+ #elif defined(_lrotl) && (SIZEOF_VALUE == SIZEOF_LONG)
533
+ return _lrotl(v, n);
534
+
535
+ #else
536
+ const int m = (sizeof(VALUE) * CHAR_BIT) - 1;
537
+ return (v << (n & m)) | (v >> (-n & m));
538
+ #endif
539
+ }
540
+
541
+ static inline VALUE
542
+ RUBY_BIT_ROTR(VALUE v, int n)
543
+ {
544
+ #if __has_builtin(__builtin_rotateright32) && (SIZEOF_VALUE * CHAR_BIT == 32)
545
+ return __builtin_rotateright32(v, n);
546
+
547
+ #elif __has_builtin(__builtin_rotateright64) && (SIZEOF_VALUE * CHAR_BIT == 64)
548
+ return __builtin_rotateright64(v, n);
549
+
550
+ #elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 32)
551
+ return _rotr(v, n);
552
+
553
+ #elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 64)
554
+ return _rotr64(v, n);
555
+
556
+ #elif defined(_lrotr) && (SIZEOF_VALUE == SIZEOF_LONG)
557
+ return _lrotr(v, n);
558
+
559
+ #else
560
+ const int m = (sizeof(VALUE) * CHAR_BIT) - 1;
561
+ return (v << (-n & m)) | (v >> (n & m));
562
+ #endif
563
+ }
564
+
565
+ #endif /* INTERNAL_BITS_H */