debase-ruby_core_source 3.3.1 → 3.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. checksums.yaml +4 -4
  2. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/addr2line.h +22 -0
  3. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/builtin.h +117 -0
  4. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ccan/build_assert/build_assert.h +40 -0
  5. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ccan/check_type/check_type.h +63 -0
  6. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ccan/container_of/container_of.h +142 -0
  7. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ccan/list/list.h +791 -0
  8. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ccan/str/str.h +17 -0
  9. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/constant.h +53 -0
  10. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/darray.h +246 -0
  11. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/debug_counter.h +423 -0
  12. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/dln.h +32 -0
  13. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/encindex.h +70 -0
  14. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/eval_intern.h +343 -0
  15. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/hrtime.h +227 -0
  16. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/id.h +343 -0
  17. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/id_table.h +39 -0
  18. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/insns.inc +251 -0
  19. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/insns_info.inc +9215 -0
  20. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/array.h +151 -0
  21. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/basic_operators.h +63 -0
  22. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/bignum.h +244 -0
  23. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/bits.h +568 -0
  24. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/class.h +277 -0
  25. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/cmdlineopt.h +65 -0
  26. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/compar.h +29 -0
  27. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/compile.h +34 -0
  28. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/compilers.h +107 -0
  29. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/complex.h +29 -0
  30. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/cont.h +35 -0
  31. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/dir.h +16 -0
  32. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/enc.h +19 -0
  33. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/encoding.h +35 -0
  34. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/enum.h +18 -0
  35. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/enumerator.h +21 -0
  36. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/error.h +216 -0
  37. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/eval.h +33 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/file.h +38 -0
  39. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/fixnum.h +184 -0
  40. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/gc.h +364 -0
  41. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/hash.h +191 -0
  42. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/imemo.h +240 -0
  43. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/inits.h +50 -0
  44. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/io.h +137 -0
  45. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/load.h +18 -0
  46. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/loadpath.h +16 -0
  47. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/math.h +23 -0
  48. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/missing.h +18 -0
  49. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/numeric.h +273 -0
  50. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/object.h +62 -0
  51. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/parse.h +108 -0
  52. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/proc.h +30 -0
  53. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/process.h +124 -0
  54. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/ractor.h +6 -0
  55. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/random.h +17 -0
  56. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/range.h +40 -0
  57. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/rational.h +71 -0
  58. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/re.h +28 -0
  59. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/ruby_parser.h +69 -0
  60. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/sanitizers.h +186 -0
  61. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/serial.h +23 -0
  62. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/signal.h +25 -0
  63. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/static_assert.h +16 -0
  64. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/string.h +160 -0
  65. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/struct.h +127 -0
  66. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/symbol.h +45 -0
  67. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/thread.h +78 -0
  68. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/time.h +34 -0
  69. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/transcode.h +23 -0
  70. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/util.h +27 -0
  71. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/variable.h +72 -0
  72. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/vm.h +136 -0
  73. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal/warnings.h +16 -0
  74. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/internal.h +112 -0
  75. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/iseq.h +338 -0
  76. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/known_errors.inc +791 -0
  77. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/method.h +254 -0
  78. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/node.h +128 -0
  79. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/node_name.inc +212 -0
  80. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/optinsn.inc +128 -0
  81. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/optunifs.inc +43 -0
  82. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/parse.h +243 -0
  83. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/parser_bits.h +564 -0
  84. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/parser_node.h +32 -0
  85. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/parser_st.h +162 -0
  86. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/parser_value.h +106 -0
  87. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/ast.h +4612 -0
  88. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/defines.h +94 -0
  89. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/diagnostic.h +297 -0
  90. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/encoding.h +248 -0
  91. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/extension.h +18 -0
  92. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/node.h +57 -0
  93. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/options.h +204 -0
  94. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/pack.h +152 -0
  95. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/parser.h +716 -0
  96. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/prettyprint.h +26 -0
  97. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/prism.h +272 -0
  98. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/regexp.h +33 -0
  99. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_buffer.h +146 -0
  100. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_char.h +205 -0
  101. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_constant_pool.h +191 -0
  102. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_list.h +97 -0
  103. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_memchr.h +29 -0
  104. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_newline_list.h +104 -0
  105. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_state_stack.h +42 -0
  106. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_string.h +150 -0
  107. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_string_list.h +44 -0
  108. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_strncasecmp.h +32 -0
  109. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/util/pm_strpbrk.h +43 -0
  110. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism/version.h +29 -0
  111. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/prism_compile.h +29 -0
  112. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/probes_helper.h +42 -0
  113. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ractor_core.h +393 -0
  114. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/regenc.h +254 -0
  115. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/regint.h +1006 -0
  116. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/regparse.h +371 -0
  117. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/revision.h +5 -0
  118. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/rjit.h +101 -0
  119. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/rjit_c.h +164 -0
  120. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ruby_assert.h +14 -0
  121. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/ruby_atomic.h +23 -0
  122. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/rubyparser.h +1405 -0
  123. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/shape.h +233 -0
  124. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/siphash.h +48 -0
  125. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/symbol.h +118 -0
  126. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/thread_none.h +21 -0
  127. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/thread_pthread.h +166 -0
  128. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/thread_win32.h +58 -0
  129. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/timev.h +58 -0
  130. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/transcode_data.h +138 -0
  131. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/variable.h +39 -0
  132. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/version.h +69 -0
  133. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm.inc +5436 -0
  134. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_call_iseq_optimized.inc +244 -0
  135. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_callinfo.h +614 -0
  136. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_core.h +2202 -0
  137. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_debug.h +122 -0
  138. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_exec.h +199 -0
  139. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_insnhelper.h +261 -0
  140. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_opts.h +67 -0
  141. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vm_sync.h +137 -0
  142. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/vmtc.inc +245 -0
  143. data/lib/debase/ruby_core_source/ruby-3.3.5-p100/yjit.h +72 -0
  144. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/addr2line.h +22 -0
  145. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/builtin.h +119 -0
  146. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ccan/build_assert/build_assert.h +40 -0
  147. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ccan/check_type/check_type.h +63 -0
  148. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ccan/container_of/container_of.h +142 -0
  149. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ccan/list/list.h +791 -0
  150. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ccan/str/str.h +17 -0
  151. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/constant.h +53 -0
  152. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/darray.h +191 -0
  153. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/debug_counter.h +423 -0
  154. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/dln.h +34 -0
  155. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/encindex.h +70 -0
  156. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/eval_intern.h +324 -0
  157. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/hrtime.h +237 -0
  158. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/id.h +343 -0
  159. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/id_table.h +39 -0
  160. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/insns.inc +259 -0
  161. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/insns_info.inc +9530 -0
  162. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/array.h +151 -0
  163. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/basic_operators.h +63 -0
  164. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/bignum.h +244 -0
  165. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/bits.h +568 -0
  166. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/class.h +283 -0
  167. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/cmdlineopt.h +65 -0
  168. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/compar.h +29 -0
  169. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/compile.h +34 -0
  170. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/compilers.h +107 -0
  171. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/complex.h +29 -0
  172. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/cont.h +35 -0
  173. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/dir.h +16 -0
  174. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/enc.h +19 -0
  175. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/encoding.h +36 -0
  176. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/enum.h +18 -0
  177. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/enumerator.h +21 -0
  178. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/error.h +216 -0
  179. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/eval.h +33 -0
  180. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/file.h +38 -0
  181. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/fixnum.h +184 -0
  182. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/gc.h +334 -0
  183. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/hash.h +191 -0
  184. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/imemo.h +260 -0
  185. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/inits.h +47 -0
  186. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/io.h +140 -0
  187. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/load.h +18 -0
  188. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/loadpath.h +16 -0
  189. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/math.h +23 -0
  190. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/missing.h +19 -0
  191. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/numeric.h +274 -0
  192. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/object.h +63 -0
  193. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/parse.h +117 -0
  194. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/proc.h +30 -0
  195. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/process.h +124 -0
  196. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/ractor.h +6 -0
  197. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/random.h +17 -0
  198. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/range.h +40 -0
  199. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/rational.h +71 -0
  200. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/re.h +28 -0
  201. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/ruby_parser.h +102 -0
  202. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/sanitizers.h +297 -0
  203. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/serial.h +23 -0
  204. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/signal.h +24 -0
  205. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/st.h +11 -0
  206. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/static_assert.h +16 -0
  207. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/string.h +182 -0
  208. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/struct.h +127 -0
  209. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/symbol.h +45 -0
  210. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/thread.h +79 -0
  211. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/time.h +34 -0
  212. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/transcode.h +23 -0
  213. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/util.h +27 -0
  214. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/variable.h +72 -0
  215. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/vm.h +137 -0
  216. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal/warnings.h +16 -0
  217. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/internal.h +108 -0
  218. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/iseq.h +340 -0
  219. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/known_errors.inc +1419 -0
  220. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/method.h +255 -0
  221. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/node.h +111 -0
  222. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/node_name.inc +224 -0
  223. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/optinsn.inc +128 -0
  224. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/optunifs.inc +43 -0
  225. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/parse.h +243 -0
  226. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/parser_bits.h +564 -0
  227. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/parser_node.h +32 -0
  228. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/parser_st.h +162 -0
  229. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/parser_value.h +106 -0
  230. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/ast.h +6245 -0
  231. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/defines.h +206 -0
  232. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/diagnostic.h +433 -0
  233. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/encoding.h +283 -0
  234. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/extension.h +19 -0
  235. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/node.h +150 -0
  236. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/options.h +305 -0
  237. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/pack.h +163 -0
  238. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/parser.h +891 -0
  239. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/prettyprint.h +34 -0
  240. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/prism.h +347 -0
  241. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/regexp.h +33 -0
  242. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/static_literals.h +120 -0
  243. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_buffer.h +218 -0
  244. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_char.h +205 -0
  245. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_constant_pool.h +226 -0
  246. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_integer.h +119 -0
  247. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_list.h +97 -0
  248. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_memchr.h +29 -0
  249. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_newline_list.h +102 -0
  250. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_string.h +174 -0
  251. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_string_list.h +44 -0
  252. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_strncasecmp.h +32 -0
  253. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_strpbrk.h +46 -0
  254. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/version.h +29 -0
  255. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism_compile.h +88 -0
  256. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/probes_helper.h +42 -0
  257. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ractor_core.h +393 -0
  258. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/regenc.h +254 -0
  259. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/regint.h +1010 -0
  260. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/regparse.h +371 -0
  261. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/revision.h +5 -0
  262. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/rjit.h +101 -0
  263. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/rjit_c.h +165 -0
  264. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ruby_assert.h +14 -0
  265. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/ruby_atomic.h +23 -0
  266. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/rubyparser.h +1430 -0
  267. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/shape.h +233 -0
  268. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/siphash.h +48 -0
  269. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/symbol.h +118 -0
  270. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/thread_none.h +21 -0
  271. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/thread_pthread.h +166 -0
  272. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/thread_win32.h +58 -0
  273. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/timev.h +58 -0
  274. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/transcode_data.h +138 -0
  275. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/variable.h +39 -0
  276. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/version.h +69 -0
  277. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm.inc +5643 -0
  278. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_call_iseq_optimized.inc +244 -0
  279. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_callinfo.h +605 -0
  280. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_core.h +2236 -0
  281. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_debug.h +124 -0
  282. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_exec.h +199 -0
  283. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_insnhelper.h +272 -0
  284. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_opts.h +67 -0
  285. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vm_sync.h +137 -0
  286. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/vmtc.inc +253 -0
  287. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/yjit.h +79 -0
  288. data/lib/debase/ruby_core_source/version.rb +1 -1
  289. metadata +289 -3
@@ -0,0 +1,191 @@
1
+ /**
2
+ * @file pm_constant_pool.h
3
+ *
4
+ * A data structure that stores a set of strings.
5
+ *
6
+ * Each string is assigned a unique id, which can be used to compare strings for
7
+ * equality. This comparison ends up being much faster than strcmp, since it
8
+ * only requires a single integer comparison.
9
+ */
10
+ #ifndef PRISM_CONSTANT_POOL_H
11
+ #define PRISM_CONSTANT_POOL_H
12
+
13
+ #include "prism/defines.h"
14
+
15
+ #include <assert.h>
16
+ #include <stdbool.h>
17
+ #include <stdint.h>
18
+ #include <stdlib.h>
19
+ #include <string.h>
20
+
21
+ /**
22
+ * A constant id is a unique identifier for a constant in the constant pool.
23
+ */
24
+ typedef uint32_t pm_constant_id_t;
25
+
26
+ /**
27
+ * A list of constant IDs. Usually used to represent a set of locals.
28
+ */
29
+ typedef struct {
30
+ /** The number of constant ids in the list. */
31
+ size_t size;
32
+
33
+ /** The number of constant ids that have been allocated in the list. */
34
+ size_t capacity;
35
+
36
+ /** The constant ids in the list. */
37
+ pm_constant_id_t *ids;
38
+ } pm_constant_id_list_t;
39
+
40
+ /**
41
+ * Initialize a list of constant ids.
42
+ *
43
+ * @param list The list to initialize.
44
+ */
45
+ void pm_constant_id_list_init(pm_constant_id_list_t *list);
46
+
47
+ /**
48
+ * Append a constant id to a list of constant ids. Returns false if any
49
+ * potential reallocations fail.
50
+ *
51
+ * @param list The list to append to.
52
+ * @param id The id to append.
53
+ * @return Whether the append succeeded.
54
+ */
55
+ bool pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id);
56
+
57
+ /**
58
+ * Checks if the current constant id list includes the given constant id.
59
+ *
60
+ * @param list The list to check.
61
+ * @param id The id to check for.
62
+ * @return Whether the list includes the given id.
63
+ */
64
+ bool pm_constant_id_list_includes(pm_constant_id_list_t *list, pm_constant_id_t id);
65
+
66
+ /**
67
+ * Get the memory size of a list of constant ids.
68
+ *
69
+ * @param list The list to get the memory size of.
70
+ * @return The memory size of the list.
71
+ */
72
+ size_t pm_constant_id_list_memsize(pm_constant_id_list_t *list);
73
+
74
+ /**
75
+ * Free the memory associated with a list of constant ids.
76
+ *
77
+ * @param list The list to free.
78
+ */
79
+ void pm_constant_id_list_free(pm_constant_id_list_t *list);
80
+
81
+ /**
82
+ * The type of bucket in the constant pool hash map. This determines how the
83
+ * bucket should be freed.
84
+ */
85
+ typedef unsigned int pm_constant_pool_bucket_type_t;
86
+
87
+ /** By default, each constant is a slice of the source. */
88
+ static const pm_constant_pool_bucket_type_t PM_CONSTANT_POOL_BUCKET_DEFAULT = 0;
89
+
90
+ /** An owned constant is one for which memory has been allocated. */
91
+ static const pm_constant_pool_bucket_type_t PM_CONSTANT_POOL_BUCKET_OWNED = 1;
92
+
93
+ /** A constant constant is known at compile time. */
94
+ static const pm_constant_pool_bucket_type_t PM_CONSTANT_POOL_BUCKET_CONSTANT = 2;
95
+
96
+ /** A bucket in the hash map. */
97
+ typedef struct {
98
+ /** The incremental ID used for indexing back into the pool. */
99
+ unsigned int id: 30;
100
+
101
+ /** The type of the bucket, which determines how to free it. */
102
+ pm_constant_pool_bucket_type_t type: 2;
103
+
104
+ /** The hash of the bucket. */
105
+ uint32_t hash;
106
+ } pm_constant_pool_bucket_t;
107
+
108
+ /** A constant in the pool which effectively stores a string. */
109
+ typedef struct {
110
+ /** A pointer to the start of the string. */
111
+ const uint8_t *start;
112
+
113
+ /** The length of the string. */
114
+ size_t length;
115
+ } pm_constant_t;
116
+
117
+ /** The overall constant pool, which stores constants found while parsing. */
118
+ typedef struct {
119
+ /** The buckets in the hash map. */
120
+ pm_constant_pool_bucket_t *buckets;
121
+
122
+ /** The constants that are stored in the buckets. */
123
+ pm_constant_t *constants;
124
+
125
+ /** The number of buckets in the hash map. */
126
+ uint32_t size;
127
+
128
+ /** The number of buckets that have been allocated in the hash map. */
129
+ uint32_t capacity;
130
+ } pm_constant_pool_t;
131
+
132
+ /**
133
+ * Initialize a new constant pool with a given capacity.
134
+ *
135
+ * @param pool The pool to initialize.
136
+ * @param capacity The initial capacity of the pool.
137
+ * @return Whether the initialization succeeded.
138
+ */
139
+ bool pm_constant_pool_init(pm_constant_pool_t *pool, uint32_t capacity);
140
+
141
+ /**
142
+ * Return a pointer to the constant indicated by the given constant id.
143
+ *
144
+ * @param pool The pool to get the constant from.
145
+ * @param constant_id The id of the constant to get.
146
+ * @return A pointer to the constant.
147
+ */
148
+ pm_constant_t * pm_constant_pool_id_to_constant(const pm_constant_pool_t *pool, pm_constant_id_t constant_id);
149
+
150
+ /**
151
+ * Insert a constant into a constant pool that is a slice of a source string.
152
+ * Returns the id of the constant, or 0 if any potential calls to resize fail.
153
+ *
154
+ * @param pool The pool to insert the constant into.
155
+ * @param start A pointer to the start of the constant.
156
+ * @param length The length of the constant.
157
+ * @return The id of the constant.
158
+ */
159
+ pm_constant_id_t pm_constant_pool_insert_shared(pm_constant_pool_t *pool, const uint8_t *start, size_t length);
160
+
161
+ /**
162
+ * Insert a constant into a constant pool from memory that is now owned by the
163
+ * constant pool. Returns the id of the constant, or 0 if any potential calls to
164
+ * resize fail.
165
+ *
166
+ * @param pool The pool to insert the constant into.
167
+ * @param start A pointer to the start of the constant.
168
+ * @param length The length of the constant.
169
+ * @return The id of the constant.
170
+ */
171
+ pm_constant_id_t pm_constant_pool_insert_owned(pm_constant_pool_t *pool, const uint8_t *start, size_t length);
172
+
173
+ /**
174
+ * Insert a constant into a constant pool from memory that is constant. Returns
175
+ * the id of the constant, or 0 if any potential calls to resize fail.
176
+ *
177
+ * @param pool The pool to insert the constant into.
178
+ * @param start A pointer to the start of the constant.
179
+ * @param length The length of the constant.
180
+ * @return The id of the constant.
181
+ */
182
+ pm_constant_id_t pm_constant_pool_insert_constant(pm_constant_pool_t *pool, const uint8_t *start, size_t length);
183
+
184
+ /**
185
+ * Free the memory associated with a constant pool.
186
+ *
187
+ * @param pool The pool to free.
188
+ */
189
+ void pm_constant_pool_free(pm_constant_pool_t *pool);
190
+
191
+ #endif
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @file pm_list.h
3
+ *
4
+ * An abstract linked list.
5
+ */
6
+ #ifndef PRISM_LIST_H
7
+ #define PRISM_LIST_H
8
+
9
+ #include "prism/defines.h"
10
+
11
+ #include <stdbool.h>
12
+ #include <stddef.h>
13
+ #include <stdint.h>
14
+ #include <stdlib.h>
15
+
16
+ /**
17
+ * This struct represents an abstract linked list that provides common
18
+ * functionality. It is meant to be used any time a linked list is necessary to
19
+ * store data.
20
+ *
21
+ * The linked list itself operates off a set of pointers. Because the pointers
22
+ * are not necessarily sequential, they can be of any size. We use this fact to
23
+ * allow the consumer of this linked list to extend the node struct to include
24
+ * any data they want. This is done by using the pm_list_node_t as the first
25
+ * member of the struct.
26
+ *
27
+ * For example, if we want to store a list of integers, we can do the following:
28
+ *
29
+ * ```c
30
+ * typedef struct {
31
+ * pm_list_node_t node;
32
+ * int value;
33
+ * } pm_int_node_t;
34
+ *
35
+ * pm_list_t list = { 0 };
36
+ * pm_int_node_t *node = malloc(sizeof(pm_int_node_t));
37
+ * node->value = 5;
38
+ *
39
+ * pm_list_append(&list, &node->node);
40
+ * ```
41
+ *
42
+ * The pm_list_t struct is used to represent the overall linked list. It
43
+ * contains a pointer to the head and tail of the list. This allows for easy
44
+ * iteration and appending of new nodes.
45
+ */
46
+ typedef struct pm_list_node {
47
+ /** A pointer to the next node in the list. */
48
+ struct pm_list_node *next;
49
+ } pm_list_node_t;
50
+
51
+ /**
52
+ * This represents the overall linked list. It keeps a pointer to the head and
53
+ * tail so that iteration is easy and pushing new nodes is easy.
54
+ */
55
+ typedef struct {
56
+ /** The size of the list. */
57
+ size_t size;
58
+
59
+ /** A pointer to the head of the list. */
60
+ pm_list_node_t *head;
61
+
62
+ /** A pointer to the tail of the list. */
63
+ pm_list_node_t *tail;
64
+ } pm_list_t;
65
+
66
+ /**
67
+ * Returns true if the given list is empty.
68
+ *
69
+ * @param list The list to check.
70
+ * @return True if the given list is empty, otherwise false.
71
+ */
72
+ PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list);
73
+
74
+ /**
75
+ * Returns the size of the list.
76
+ *
77
+ * @param list The list to check.
78
+ * @return The size of the list.
79
+ */
80
+ PRISM_EXPORTED_FUNCTION size_t pm_list_size(pm_list_t *list);
81
+
82
+ /**
83
+ * Append a node to the given list.
84
+ *
85
+ * @param list The list to append to.
86
+ * @param node The node to append.
87
+ */
88
+ void pm_list_append(pm_list_t *list, pm_list_node_t *node);
89
+
90
+ /**
91
+ * Deallocate the internal state of the given list.
92
+ *
93
+ * @param list The list to free.
94
+ */
95
+ PRISM_EXPORTED_FUNCTION void pm_list_free(pm_list_t *list);
96
+
97
+ #endif
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @file pm_memchr.h
3
+ *
4
+ * A custom memchr implementation.
5
+ */
6
+ #ifndef PRISM_MEMCHR_H
7
+ #define PRISM_MEMCHR_H
8
+
9
+ #include "prism/defines.h"
10
+ #include "prism/encoding.h"
11
+
12
+ #include <stddef.h>
13
+
14
+ /**
15
+ * We need to roll our own memchr to handle cases where the encoding changes and
16
+ * we need to search for a character in a buffer that could be the trailing byte
17
+ * of a multibyte character.
18
+ *
19
+ * @param source The source string.
20
+ * @param character The character to search for.
21
+ * @param number The maximum number of bytes to search.
22
+ * @param encoding_changed Whether the encoding changed.
23
+ * @param encoding A pointer to the encoding.
24
+ * @return A pointer to the first occurrence of the character in the source
25
+ * string, or NULL if no such character exists.
26
+ */
27
+ void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
28
+
29
+ #endif
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @file pm_newline_list.h
3
+ *
4
+ * A list of byte offsets of newlines in a string.
5
+ *
6
+ * When compiling the syntax tree, it's necessary to know the line and column
7
+ * of many nodes. This is necessary to support things like error messages,
8
+ * tracepoints, etc.
9
+ *
10
+ * It's possible that we could store the start line, start column, end line, and
11
+ * end column on every node in addition to the offsets that we already store,
12
+ * but that would be quite a lot of memory overhead.
13
+ */
14
+ #ifndef PRISM_NEWLINE_LIST_H
15
+ #define PRISM_NEWLINE_LIST_H
16
+
17
+ #include "prism/defines.h"
18
+
19
+ #include <assert.h>
20
+ #include <stdbool.h>
21
+ #include <stddef.h>
22
+ #include <stdlib.h>
23
+
24
+ /**
25
+ * A list of offsets of newlines in a string. The offsets are assumed to be
26
+ * sorted/inserted in ascending order.
27
+ */
28
+ typedef struct {
29
+ /** A pointer to the start of the source string. */
30
+ const uint8_t *start;
31
+
32
+ /** The number of offsets in the list. */
33
+ size_t size;
34
+
35
+ /** The capacity of the list that has been allocated. */
36
+ size_t capacity;
37
+
38
+ /** The list of offsets. */
39
+ size_t *offsets;
40
+ } pm_newline_list_t;
41
+
42
+ /**
43
+ * A line and column in a string.
44
+ */
45
+ typedef struct {
46
+ /** The line number. */
47
+ size_t line;
48
+
49
+ /** The column number. */
50
+ size_t column;
51
+ } pm_line_column_t;
52
+
53
+ /**
54
+ * Initialize a new newline list with the given capacity. Returns true if the
55
+ * allocation of the offsets succeeds, otherwise returns false.
56
+ *
57
+ * @param list The list to initialize.
58
+ * @param start A pointer to the start of the source string.
59
+ * @param capacity The initial capacity of the list.
60
+ * @return True if the allocation of the offsets succeeds, otherwise false.
61
+ */
62
+ bool pm_newline_list_init(pm_newline_list_t *list, const uint8_t *start, size_t capacity);
63
+
64
+ /**
65
+ * Append a new offset to the newline list. Returns true if the reallocation of
66
+ * the offsets succeeds (if one was necessary), otherwise returns false.
67
+ *
68
+ * @param list The list to append to.
69
+ * @param cursor A pointer to the offset to append.
70
+ * @return True if the reallocation of the offsets succeeds (if one was
71
+ * necessary), otherwise false.
72
+ */
73
+ bool pm_newline_list_append(pm_newline_list_t *list, const uint8_t *cursor);
74
+
75
+ /**
76
+ * Conditionally append a new offset to the newline list, if the value passed in
77
+ * is a newline.
78
+ *
79
+ * @param list The list to append to.
80
+ * @param cursor A pointer to the offset to append.
81
+ * @return True if the reallocation of the offsets succeeds (if one was
82
+ * necessary), otherwise false.
83
+ */
84
+ bool pm_newline_list_check_append(pm_newline_list_t *list, const uint8_t *cursor);
85
+
86
+ /**
87
+ * Returns the line and column of the given offset. If the offset is not in the
88
+ * list, the line and column of the closest offset less than the given offset
89
+ * are returned.
90
+ *
91
+ * @param list The list to search.
92
+ * @param cursor A pointer to the offset to search for.
93
+ * @return The line and column of the given offset.
94
+ */
95
+ pm_line_column_t pm_newline_list_line_column(const pm_newline_list_t *list, const uint8_t *cursor);
96
+
97
+ /**
98
+ * Free the internal memory allocated for the newline list.
99
+ *
100
+ * @param list The list to free.
101
+ */
102
+ void pm_newline_list_free(pm_newline_list_t *list);
103
+
104
+ #endif
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @file pm_state_stack.h
3
+ *
4
+ * A stack of boolean values.
5
+ */
6
+ #ifndef PRISM_STATE_STACK_H
7
+ #define PRISM_STATE_STACK_H
8
+
9
+ #include "prism/defines.h"
10
+
11
+ #include <stdbool.h>
12
+ #include <stdint.h>
13
+
14
+ /**
15
+ * A struct that represents a stack of boolean values.
16
+ */
17
+ typedef uint32_t pm_state_stack_t;
18
+
19
+ /**
20
+ * Pushes a value onto the stack.
21
+ *
22
+ * @param stack The stack to push the value onto.
23
+ * @param value The value to push onto the stack.
24
+ */
25
+ void pm_state_stack_push(pm_state_stack_t *stack, bool value);
26
+
27
+ /**
28
+ * Pops a value off the stack.
29
+ *
30
+ * @param stack The stack to pop the value off of.
31
+ */
32
+ void pm_state_stack_pop(pm_state_stack_t *stack);
33
+
34
+ /**
35
+ * Returns the value at the top of the stack.
36
+ *
37
+ * @param stack The stack to get the value from.
38
+ * @return The value at the top of the stack.
39
+ */
40
+ bool pm_state_stack_p(pm_state_stack_t *stack);
41
+
42
+ #endif
@@ -0,0 +1,150 @@
1
+ /**
2
+ * @file pm_string.h
3
+ *
4
+ * A generic string type that can have various ownership semantics.
5
+ */
6
+ #ifndef PRISM_STRING_H
7
+ #define PRISM_STRING_H
8
+
9
+ #include "prism/defines.h"
10
+
11
+ #include <assert.h>
12
+ #include <stdbool.h>
13
+ #include <stddef.h>
14
+ #include <stdlib.h>
15
+ #include <string.h>
16
+
17
+ // The following headers are necessary to read files using demand paging.
18
+ #ifdef _WIN32
19
+ #include <windows.h>
20
+ #else
21
+ #include <fcntl.h>
22
+ #include <sys/mman.h>
23
+ #include <sys/stat.h>
24
+ #include <unistd.h>
25
+ #endif
26
+
27
+ /**
28
+ * A generic string type that can have various ownership semantics.
29
+ */
30
+ typedef struct {
31
+ /** A pointer to the start of the string. */
32
+ const uint8_t *source;
33
+
34
+ /** The length of the string in bytes of memory. */
35
+ size_t length;
36
+
37
+ /** The type of the string. This field determines how the string should be freed. */
38
+ enum {
39
+ /** This string is a constant string, and should not be freed. */
40
+ PM_STRING_CONSTANT,
41
+
42
+ /** This is a slice of another string, and should not be freed. */
43
+ PM_STRING_SHARED,
44
+
45
+ /** This string owns its memory, and should be freed using `pm_string_free`. */
46
+ PM_STRING_OWNED,
47
+
48
+ /** This string is a memory-mapped file, and should be freed using `pm_string_free`. */
49
+ PM_STRING_MAPPED
50
+ } type;
51
+ } pm_string_t;
52
+
53
+ /**
54
+ * Returns the size of the pm_string_t struct. This is necessary to allocate the
55
+ * correct amount of memory in the FFI backend.
56
+ *
57
+ * @return The size of the pm_string_t struct.
58
+ */
59
+ PRISM_EXPORTED_FUNCTION size_t pm_string_sizeof(void);
60
+
61
+ /**
62
+ * Defines an empty string. This is useful for initializing a string that will
63
+ * be filled in later.
64
+ */
65
+ #define PM_STRING_EMPTY ((pm_string_t) { .type = PM_STRING_CONSTANT, .source = NULL, .length = 0 })
66
+
67
+ /**
68
+ * Initialize a shared string that is based on initial input.
69
+ *
70
+ * @param string The string to initialize.
71
+ * @param start The start of the string.
72
+ * @param end The end of the string.
73
+ */
74
+ void pm_string_shared_init(pm_string_t *string, const uint8_t *start, const uint8_t *end);
75
+
76
+ /**
77
+ * Initialize an owned string that is responsible for freeing allocated memory.
78
+ *
79
+ * @param string The string to initialize.
80
+ * @param source The source of the string.
81
+ * @param length The length of the string.
82
+ */
83
+ void pm_string_owned_init(pm_string_t *string, uint8_t *source, size_t length);
84
+
85
+ /**
86
+ * Initialize a constant string that doesn't own its memory source.
87
+ *
88
+ * @param string The string to initialize.
89
+ * @param source The source of the string.
90
+ * @param length The length of the string.
91
+ */
92
+ void pm_string_constant_init(pm_string_t *string, const char *source, size_t length);
93
+
94
+ /**
95
+ * Read the file indicated by the filepath parameter into source and load its
96
+ * contents and size into the given `pm_string_t`. The given `pm_string_t`
97
+ * should be freed using `pm_string_free` when it is no longer used.
98
+ *
99
+ * We want to use demand paging as much as possible in order to avoid having to
100
+ * read the entire file into memory (which could be detrimental to performance
101
+ * for large files). This means that if we're on windows we'll use
102
+ * `MapViewOfFile`, on POSIX systems that have access to `mmap` we'll use
103
+ * `mmap`, and on other POSIX systems we'll use `read`.
104
+ *
105
+ * @param string The string to initialize.
106
+ * @param filepath The filepath to read.
107
+ * @return Whether or not the file was successfully mapped.
108
+ */
109
+ PRISM_EXPORTED_FUNCTION bool pm_string_mapped_init(pm_string_t *string, const char *filepath);
110
+
111
+ /**
112
+ * Returns the memory size associated with the string.
113
+ *
114
+ * @param string The string to get the memory size of.
115
+ * @return The size of the memory associated with the string.
116
+ */
117
+ size_t pm_string_memsize(const pm_string_t *string);
118
+
119
+ /**
120
+ * Ensure the string is owned. If it is not, then reinitialize it as owned and
121
+ * copy over the previous source.
122
+ *
123
+ * @param string The string to ensure is owned.
124
+ */
125
+ void pm_string_ensure_owned(pm_string_t *string);
126
+
127
+ /**
128
+ * Returns the length associated with the string.
129
+ *
130
+ * @param string The string to get the length of.
131
+ * @return The length of the string.
132
+ */
133
+ PRISM_EXPORTED_FUNCTION size_t pm_string_length(const pm_string_t *string);
134
+
135
+ /**
136
+ * Returns the start pointer associated with the string.
137
+ *
138
+ * @param string The string to get the start pointer of.
139
+ * @return The start pointer of the string.
140
+ */
141
+ PRISM_EXPORTED_FUNCTION const uint8_t * pm_string_source(const pm_string_t *string);
142
+
143
+ /**
144
+ * Free the associated memory of the given string.
145
+ *
146
+ * @param string The string to free.
147
+ */
148
+ PRISM_EXPORTED_FUNCTION void pm_string_free(pm_string_t *string);
149
+
150
+ #endif
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @file pm_string_list.h
3
+ *
4
+ * A list of strings.
5
+ */
6
+ #ifndef PRISM_STRING_LIST_H
7
+ #define PRISM_STRING_LIST_H
8
+
9
+ #include "prism/defines.h"
10
+ #include "prism/util/pm_string.h"
11
+
12
+ #include <stddef.h>
13
+ #include <stdlib.h>
14
+
15
+ /**
16
+ * A list of strings.
17
+ */
18
+ typedef struct {
19
+ /** The length of the string list. */
20
+ size_t length;
21
+
22
+ /** The capacity of the string list that has been allocated. */
23
+ size_t capacity;
24
+
25
+ /** A pointer to the start of the string list. */
26
+ pm_string_t *strings;
27
+ } pm_string_list_t;
28
+
29
+ /**
30
+ * Append a pm_string_t to the given string list.
31
+ *
32
+ * @param string_list The string list to append to.
33
+ * @param string The string to append.
34
+ */
35
+ void pm_string_list_append(pm_string_list_t *string_list, pm_string_t *string);
36
+
37
+ /**
38
+ * Free the memory associated with the string list.
39
+ *
40
+ * @param string_list The string list to free.
41
+ */
42
+ PRISM_EXPORTED_FUNCTION void pm_string_list_free(pm_string_list_t *string_list);
43
+
44
+ #endif
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file pm_strncasecmp.h
3
+ *
4
+ * A custom strncasecmp implementation.
5
+ */
6
+ #ifndef PRISM_STRNCASECMP_H
7
+ #define PRISM_STRNCASECMP_H
8
+
9
+ #include "prism/defines.h"
10
+
11
+ #include <ctype.h>
12
+ #include <stddef.h>
13
+ #include <stdint.h>
14
+
15
+ /**
16
+ * Compare two strings, ignoring case, up to the given length. Returns 0 if the
17
+ * strings are equal, a negative number if string1 is less than string2, or a
18
+ * positive number if string1 is greater than string2.
19
+ *
20
+ * Note that this is effectively our own implementation of strncasecmp, but it's
21
+ * not available on all of the platforms we want to support so we're rolling it
22
+ * here.
23
+ *
24
+ * @param string1 The first string to compare.
25
+ * @param string2 The second string to compare
26
+ * @param length The maximum number of characters to compare.
27
+ * @return 0 if the strings are equal, a negative number if string1 is less than
28
+ * string2, or a positive number if string1 is greater than string2.
29
+ */
30
+ int pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length);
31
+
32
+ #endif