debase-ruby_core_source 4.0.1 → 4.1.0.preview1

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 (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/addr2line.h +22 -0
  4. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/builtin.h +127 -0
  5. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/list/list.h +791 -0
  9. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/str/str.h +17 -0
  10. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/constant.h +53 -0
  11. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/darray.h +295 -0
  12. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/debug_counter.h +428 -0
  13. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/dln.h +33 -0
  14. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/encindex.h +70 -0
  15. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/eval_intern.h +356 -0
  16. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/hrtime.h +237 -0
  17. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/id.h +365 -0
  18. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/id_table.h +74 -0
  19. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/insns.inc +315 -0
  20. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/insns_info.inc +11637 -0
  21. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/array.h +158 -0
  22. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/basic_operators.h +67 -0
  23. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/bignum.h +249 -0
  24. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/bits.h +647 -0
  25. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/box.h +103 -0
  26. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/class.h +797 -0
  27. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/cmdlineopt.h +64 -0
  28. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compar.h +30 -0
  29. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compile.h +34 -0
  30. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compilers.h +104 -0
  31. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/concurrent_set.h +21 -0
  33. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/cont.h +33 -0
  34. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/coverage.h +51 -0
  35. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/dir.h +16 -0
  36. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enc.h +19 -0
  37. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/encoding.h +40 -0
  38. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enum.h +18 -0
  39. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enumerator.h +21 -0
  40. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/error.h +287 -0
  41. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/eval.h +43 -0
  42. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/file.h +40 -0
  43. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/fixnum.h +185 -0
  44. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/gc.h +411 -0
  45. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/hash.h +220 -0
  46. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/imemo.h +302 -0
  47. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/inits.h +54 -0
  48. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/io.h +167 -0
  49. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/io_buffer.h +36 -0
  50. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/jit.h +23 -0
  51. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/load.h +20 -0
  52. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/loadpath.h +16 -0
  53. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/marshal.h +17 -0
  54. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/math.h +23 -0
  55. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/missing.h +19 -0
  56. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/numeric.h +326 -0
  57. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/object.h +88 -0
  58. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/objspace.h +24 -0
  59. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/parse.h +131 -0
  60. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/proc.h +34 -0
  61. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/process.h +124 -0
  62. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/ractor.h +9 -0
  63. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/random.h +17 -0
  64. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/range.h +46 -0
  65. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/rational.h +92 -0
  66. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/re.h +87 -0
  67. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/ruby_parser.h +109 -0
  68. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/sanitizers.h +346 -0
  69. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/scheduler.h +7 -0
  70. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/serial.h +23 -0
  71. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/set.h +20 -0
  72. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/set_table.h +77 -0
  73. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/signal.h +25 -0
  74. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/simd.h +18 -0
  75. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/st.h +32 -0
  76. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/static_assert.h +16 -0
  77. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/string.h +240 -0
  78. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/struct.h +120 -0
  79. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/symbol.h +46 -0
  80. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/thread.h +108 -0
  81. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/time.h +34 -0
  82. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/transcode.h +23 -0
  83. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/util.h +27 -0
  84. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/variable.h +81 -0
  85. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/vm.h +144 -0
  86. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/vm_map.h +95 -0
  87. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/warnings.h +16 -0
  88. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal.h +106 -0
  89. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/iseq.h +439 -0
  90. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/known_errors.inc +1419 -0
  91. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/method.h +279 -0
  92. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/node.h +122 -0
  93. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/node_name.inc +224 -0
  94. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/optinsn.inc +128 -0
  95. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/optunifs.inc +41 -0
  96. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parse.h +246 -0
  97. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_bits.h +647 -0
  98. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_node.h +32 -0
  99. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_st.h +161 -0
  100. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_value.h +116 -0
  101. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/arena.h +37 -0
  102. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/ast.h +10371 -0
  103. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/buffer.h +52 -0
  104. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/comments.h +43 -0
  105. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/accel.h +19 -0
  106. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/align.h +36 -0
  107. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/assume.h +25 -0
  108. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/exported.h +24 -0
  109. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/fallthrough.h +22 -0
  110. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/filesystem.h +32 -0
  111. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/flex_array.h +19 -0
  112. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/force_inline.h +21 -0
  113. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/format.h +25 -0
  114. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/inline.h +17 -0
  115. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nodiscard.h +22 -0
  116. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nonnull.h +18 -0
  117. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/unused.h +18 -0
  118. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/constant_pool.h +81 -0
  119. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/diagnostic.h +93 -0
  120. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/errors_format.h +53 -0
  121. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/excludes.h +29 -0
  122. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/extension.h +19 -0
  123. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/integer.h +41 -0
  124. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/allocator.h +68 -0
  125. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/allocator_debug.h +88 -0
  126. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/arena.h +108 -0
  127. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/bit.h +42 -0
  128. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/buffer.h +91 -0
  129. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/char.h +139 -0
  130. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/comments.h +20 -0
  131. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/constant_pool.h +152 -0
  132. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/diagnostic.h +389 -0
  133. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/encoding.h +242 -0
  134. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/integer.h +68 -0
  135. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/isinf.h +16 -0
  136. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/line_offset_list.h +34 -0
  137. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/list.h +62 -0
  138. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/magic_comments.h +23 -0
  139. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/memchr.h +15 -0
  140. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/node.h +32 -0
  141. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/options.h +224 -0
  142. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/parser.h +971 -0
  143. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/regexp.h +42 -0
  144. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/serialize.h +39 -0
  145. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/source.h +72 -0
  146. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/static_literals.h +100 -0
  147. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/stringy.h +35 -0
  148. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/strncasecmp.h +18 -0
  149. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/strpbrk.h +33 -0
  150. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/tokens.h +11 -0
  151. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/json.h +32 -0
  152. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/line_offset_list.h +61 -0
  153. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/magic_comments.h +35 -0
  154. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/node.h +94 -0
  155. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/options.h +335 -0
  156. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/parser.h +348 -0
  157. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/prettyprint.h +31 -0
  158. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/prism.h +131 -0
  159. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/serialize.h +115 -0
  160. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/source.h +155 -0
  161. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/stream.h +28 -0
  162. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/string_query.h +63 -0
  163. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/stringy.h +72 -0
  164. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/version.h +38 -0
  165. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism_compile.h +204 -0
  166. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism_xallocator.h +6 -0
  167. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/probes_helper.h +42 -0
  168. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ractor_core.h +421 -0
  169. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regenc.h +261 -0
  170. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regint.h +983 -0
  171. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regparse.h +371 -0
  172. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/revision.h +5 -0
  173. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ruby_assert.h +14 -0
  174. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ruby_atomic.h +115 -0
  175. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/rubyparser.h +1389 -0
  176. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/shape.h +733 -0
  177. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/siphash.h +48 -0
  178. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/symbol.h +116 -0
  179. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_none.h +25 -0
  180. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_pthread.h +63 -0
  181. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_sched.h +271 -0
  182. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_win32.h +48 -0
  183. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/timev.h +58 -0
  184. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/transcode_data.h +138 -0
  185. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/variable.h +26 -0
  186. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/version.h +69 -0
  187. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm.inc +6457 -0
  188. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_call_iseq_optimized.inc +244 -0
  189. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_callinfo.h +688 -0
  190. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_core.h +2509 -0
  191. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_debug.h +124 -0
  192. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_exec.h +202 -0
  193. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_insnhelper.h +280 -0
  194. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_opts.h +65 -0
  195. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_sync.h +160 -0
  196. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vmtc.inc +302 -0
  197. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/yjit.h +87 -0
  198. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/zjit.h +221 -0
  199. data/lib/debase/ruby_core_source/version.rb +1 -1
  200. metadata +2930 -2724
@@ -0,0 +1,48 @@
1
+ #ifndef SIPHASH_H
2
+ #define SIPHASH_H 1
3
+ #include <stdlib.h>
4
+ #ifdef HAVE_STDINT_H
5
+ #include <stdint.h>
6
+ #endif
7
+ #ifdef HAVE_INTTYPES_H
8
+ #include <inttypes.h>
9
+ #endif
10
+
11
+ #ifndef HAVE_UINT64_T
12
+ typedef struct {
13
+ uint32_t u32[2];
14
+ } sip_uint64_t;
15
+ #define uint64_t sip_uint64_t
16
+ #else
17
+ typedef uint64_t sip_uint64_t;
18
+ #endif
19
+
20
+ typedef struct {
21
+ int c;
22
+ int d;
23
+ uint64_t v[4];
24
+ uint8_t buf[sizeof(uint64_t)];
25
+ uint8_t buflen;
26
+ uint8_t msglen_byte;
27
+ } sip_state;
28
+
29
+ typedef struct sip_interface_st sip_interface;
30
+
31
+ typedef struct {
32
+ sip_state state[1];
33
+ const sip_interface *methods;
34
+ } sip_hash;
35
+
36
+ sip_hash *sip_hash_new(const uint8_t key[16], int c, int d);
37
+ sip_hash *sip_hash_init(sip_hash *h, const uint8_t key[16], int c, int d);
38
+ int sip_hash_update(sip_hash *h, const uint8_t *data, size_t len);
39
+ int sip_hash_final(sip_hash *h, uint8_t **digest, size_t *len);
40
+ int sip_hash_final_integer(sip_hash *h, uint64_t *digest);
41
+ int sip_hash_digest(sip_hash *h, const uint8_t *data, size_t data_len, uint8_t **digest, size_t *digest_len);
42
+ int sip_hash_digest_integer(sip_hash *h, const uint8_t *data, size_t data_len, uint64_t *digest);
43
+ void sip_hash_free(sip_hash *h);
44
+ void sip_hash_dump(sip_hash *h);
45
+
46
+ NO_SANITIZE("unsigned-integer-overflow", uint64_t sip_hash13(const uint8_t key[16], const uint8_t *data, size_t len));
47
+
48
+ #endif
@@ -0,0 +1,116 @@
1
+ #ifndef RUBY_SYMBOL_H
2
+ #define RUBY_SYMBOL_H 1
3
+ /**********************************************************************
4
+
5
+ symbol.h -
6
+
7
+ $Author$
8
+ created at: Tue Jul 8 15:49:54 JST 2014
9
+
10
+ Copyright (C) 2014 Yukihiro Matsumoto
11
+
12
+ **********************************************************************/
13
+
14
+ #include "id.h"
15
+ #include "ruby/encoding.h"
16
+
17
+ #define DYNAMIC_ID_P(id) (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)
18
+ #define STATIC_ID2SYM(id) (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
19
+
20
+ #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
21
+ #define rb_id2sym(id) \
22
+ RB_GNUC_EXTENSION_BLOCK(__builtin_constant_p(id) && !DYNAMIC_ID_P(id) ? \
23
+ STATIC_ID2SYM(id) : rb_id2sym(id))
24
+ #endif
25
+
26
+ struct RSymbol {
27
+ struct RBasic basic;
28
+ st_index_t hashval;
29
+ VALUE fstr;
30
+ ID id;
31
+ };
32
+
33
+ #define RSYMBOL(obj) ((struct RSymbol *)(obj))
34
+
35
+ #define is_notop_id(id) ((id)>tLAST_OP_ID)
36
+ #define is_local_id(id) (id_type(id)==ID_LOCAL)
37
+ #define is_global_id(id) (id_type(id)==ID_GLOBAL)
38
+ #define is_instance_id(id) (id_type(id)==ID_INSTANCE)
39
+ #define is_attrset_id(id) ((id)==idASET||id_type(id)==ID_ATTRSET)
40
+ #define is_const_id(id) (id_type(id)==ID_CONST)
41
+ #define is_class_id(id) (id_type(id)==ID_CLASS)
42
+ #define is_internal_id(id) (id_type(id)==ID_INTERNAL)
43
+
44
+ static inline int
45
+ id_type(ID id)
46
+ {
47
+ if (is_notop_id(id)) {
48
+ return (int)(id&ID_SCOPE_MASK);
49
+ }
50
+ else {
51
+ return -1;
52
+ }
53
+ }
54
+
55
+ typedef uint32_t rb_id_serial_t;
56
+ static const uint32_t RB_ID_SERIAL_MAX = /* 256M on LP32 */
57
+ UINT32_MAX >>
58
+ ((sizeof(ID)-sizeof(rb_id_serial_t))*CHAR_BIT < RUBY_ID_SCOPE_SHIFT ?
59
+ RUBY_ID_SCOPE_SHIFT : 0);
60
+
61
+ static inline rb_id_serial_t
62
+ rb_id_to_serial(ID id)
63
+ {
64
+ if (is_notop_id(id)) {
65
+ return (rb_id_serial_t)(id >> ID_SCOPE_SHIFT);
66
+ }
67
+ else {
68
+ return (rb_id_serial_t)id;
69
+ }
70
+ }
71
+
72
+ static inline int
73
+ sym_type(VALUE sym)
74
+ {
75
+ ID id;
76
+ if (STATIC_SYM_P(sym)) {
77
+ id = RSHIFT(sym, RUBY_SPECIAL_SHIFT);
78
+ if (id<=tLAST_OP_ID) {
79
+ return -1;
80
+ }
81
+ }
82
+ else {
83
+ id = RSYMBOL(sym)->id;
84
+ }
85
+ return (int)(id&ID_SCOPE_MASK);
86
+ }
87
+
88
+ #define is_local_sym(sym) (sym_type(sym)==ID_LOCAL)
89
+ #define is_global_sym(sym) (sym_type(sym)==ID_GLOBAL)
90
+ #define is_instance_sym(sym) (sym_type(sym)==ID_INSTANCE)
91
+ #define is_attrset_sym(sym) (sym_type(sym)==ID_ATTRSET)
92
+ #define is_const_sym(sym) (sym_type(sym)==ID_CONST)
93
+ #define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
94
+ #define is_internal_sym(sym) (sym_type(sym)==ID_INTERNAL)
95
+
96
+ #ifndef RIPPER
97
+ RUBY_FUNC_EXPORTED
98
+ #else
99
+ RUBY_EXTERN
100
+ #endif
101
+ const uint_least32_t ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
102
+
103
+ static inline int
104
+ is_global_name_punct(const int c)
105
+ {
106
+ if (c <= 0x20 || 0x7e < c) return 0;
107
+ return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
108
+ }
109
+
110
+ RUBY_SYMBOL_EXPORT_BEGIN
111
+
112
+ int rb_enc_symname_type(const char *name, rb_len_t len, rb_encoding *enc, unsigned int allowed_attrset);
113
+ size_t rb_sym_immortal_count(void);
114
+
115
+ RUBY_SYMBOL_EXPORT_END
116
+ #endif
@@ -0,0 +1,25 @@
1
+ #ifndef RUBY_THREAD_NONE_H
2
+ #define RUBY_THREAD_NONE_H
3
+
4
+ #define RB_NATIVETHREAD_LOCK_INIT (void)(0)
5
+ #define RB_NATIVETHREAD_COND_INIT (void)(0)
6
+
7
+ // no-thread impl doesn't use TLS but define this to avoid using tls key
8
+ // based implementation in vm.c
9
+ #define RB_THREAD_LOCAL_SPECIFIER
10
+
11
+ // This model brings its own scheduler stubs (thread_none.c) instead of the
12
+ // common one; thread.c keys off this.
13
+ #define RB_THREAD_SCHED_NONE 1
14
+
15
+ // The scheduler's types are shared with the threaded platforms: the code that
16
+ // reads them (vm_sync.c, ractor.c, thread.c) is compiled for every thread
17
+ // model, so it needs the real fields even here, where nothing ever runs
18
+ // concurrently and they all stay zero. thread_none.c only ever passes the
19
+ // structs around, never looks inside them.
20
+ #include "thread_sched.h"
21
+
22
+ RUBY_EXTERN struct rb_execution_context_struct *ruby_current_ec;
23
+ NOINLINE(struct rb_execution_context_struct *rb_current_ec_noinline(void)); // for assertions
24
+
25
+ #endif /* RUBY_THREAD_NONE_H */
@@ -0,0 +1,63 @@
1
+ #ifndef RUBY_THREAD_PTHREAD_H
2
+ #define RUBY_THREAD_PTHREAD_H
3
+ /**********************************************************************
4
+
5
+ thread_pthread.h -
6
+
7
+ $Author$
8
+
9
+ Copyright (C) 2004-2007 Koichi Sasada
10
+
11
+ This platform runs the common scheduler; see thread_sched.h for its data
12
+ structures and thread_sched.c for the implementation.
13
+
14
+ **********************************************************************/
15
+
16
+ #ifdef HAVE_PTHREAD_NP_H
17
+ #include <pthread_np.h>
18
+ #endif
19
+
20
+ #define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
21
+ #define RB_NATIVETHREAD_COND_INIT PTHREAD_COND_INITIALIZER
22
+
23
+ // TLS can not be accessed across .so on arm64 and perhaps ppc64le too.
24
+ #if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__)
25
+ # define RB_THREAD_CURRENT_EC_NOINLINE
26
+ #endif
27
+
28
+ #include "thread_sched.h"
29
+
30
+ #ifdef RB_THREAD_LOCAL_SPECIFIER
31
+ NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *));
32
+
33
+ # ifdef RB_THREAD_CURRENT_EC_NOINLINE
34
+ NOINLINE(struct rb_execution_context_struct *rb_current_ec(void));
35
+ # else
36
+ RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;
37
+
38
+ // for RUBY_DEBUG_LOG()
39
+ RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER rb_atomic_t ruby_nt_serial;
40
+ #define RUBY_NT_SERIAL 1
41
+ # endif
42
+ #else
43
+ typedef pthread_key_t native_tls_key_t;
44
+
45
+ static inline void *
46
+ native_tls_get(native_tls_key_t key)
47
+ {
48
+ // return value should be checked by caller
49
+ return pthread_getspecific(key);
50
+ }
51
+
52
+ static inline void
53
+ native_tls_set(native_tls_key_t key, void *ptr)
54
+ {
55
+ if (UNLIKELY(pthread_setspecific(key, ptr) != 0)) {
56
+ rb_bug("pthread_setspecific error");
57
+ }
58
+ }
59
+
60
+ RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
61
+ #endif
62
+
63
+ #endif /* RUBY_THREAD_PTHREAD_H */
@@ -0,0 +1,271 @@
1
+ #ifndef RUBY_THREAD_SCHED_H
2
+ #define RUBY_THREAD_SCHED_H
3
+ /**********************************************************************
4
+
5
+ thread_sched.h - data structures of the thread/ractor scheduler
6
+
7
+ The scheduler itself lives in thread_sched.c and is shared by every
8
+ platform. This header holds the types it works on; it is included from
9
+ the platform header (thread_pthread.h / thread_win32.h), which adds the
10
+ platform specific members and the thread local storage plumbing.
11
+
12
+ == platform primitive layer ==
13
+
14
+ thread_sched.c is built on top of the following, which the platform
15
+ implementation (THREAD_IMPL_SRC) has to provide before including it:
16
+
17
+ * rb_native_mutex_*() / rb_native_cond_*() (ruby/thread_native.h)
18
+ * native_thread_create0() / native_thread_destroy() and friends
19
+ * native_thread_interrupt() -- poke a thread out of a blocking call
20
+ * timer_thread_polling() -- the timer thread's blocking wait
21
+ * timer_thread_wakeup_force() -- wake that wait up
22
+ * TIMER_THREAD_CREATED_P()
23
+ * USE_MN_THREADS -- 1 enables the M:N scheduler
24
+ (when 0 the platform supplies the stubs listed at the bottom of
25
+ thread_sched_mn.c)
26
+
27
+ **********************************************************************/
28
+
29
+ // How a thread_sched_wait_events() wait ended. "unavailable" (could not be
30
+ // registered) is not "the event fired": the caller must fall back, not proceed.
31
+ enum thread_sched_wait_result {
32
+ thread_sched_wait_event, // an event the caller asked for fired
33
+ thread_sched_wait_timeout, // the timeout expired before any event
34
+ thread_sched_wait_unavailable, // not registered; the caller must fall back
35
+ };
36
+
37
+ // this data should be protected by timer_th.waiting_lock
38
+ struct rb_thread_sched_waiting {
39
+ enum thread_sched_waiting_flag {
40
+ thread_sched_waiting_none = 0x00,
41
+ thread_sched_waiting_timeout = 0x01,
42
+ thread_sched_waiting_io_read = 0x02,
43
+ thread_sched_waiting_io_write = 0x08,
44
+ thread_sched_waiting_io_force = 0x40, // ignore readable
45
+ } flags;
46
+
47
+ struct {
48
+ // should be compat with hrtime.h
49
+ #ifdef MY_RUBY_BUILD_MAY_TIME_TRAVEL
50
+ int128_t timeout;
51
+ #else
52
+ uint64_t timeout;
53
+ #endif
54
+ uint32_t event_serial;
55
+ int fd; // -1 for timeout only
56
+ int result;
57
+ } data;
58
+
59
+ // connected to a timer_th wheel slot (timed) or timer_th.waiting_untimed
60
+ struct ccan_list_node node;
61
+
62
+ /* which wheel slot `node` is on; meaningful only while flags has
63
+ * thread_sched_waiting_timeout */
64
+ uint8_t wheel_lvl;
65
+ uint8_t wheel_slot;
66
+
67
+ // connected to rb_fd_waiters.waiters of data.fd
68
+ struct ccan_list_node fd_node;
69
+ };
70
+
71
+ // One entry per fd with waiters; fds stay dense, so a table indexed by fd fits.
72
+ // Entries live in fixed chunks: growing must not move a live list head.
73
+ struct rb_fd_waiters {
74
+ struct ccan_list_head waiters; // rb_thread_sched_waiting.fd_node
75
+
76
+ // The io flags currently armed in epoll/kqueue for this fd: the union of
77
+ // what its waiters asked for.
78
+ uint32_t armed_flags;
79
+
80
+ // epoll only: the fd is in the interest set (kept across oneshot disarms).
81
+ bool registered;
82
+
83
+ // Bumped on full disarm. Events carry the generation they were armed with,
84
+ // so one queued before the fd was disarmed (and reused) is recognised.
85
+ uint32_t generation;
86
+ };
87
+
88
+ // per-Thread scheduler helper data
89
+ struct rb_thread_sched_item {
90
+ struct {
91
+ struct ccan_list_node ubf;
92
+
93
+ // connected to ractor->threads.sched.reqdyq
94
+ // locked by ractor->threads.sched.lock
95
+ struct ccan_list_node readyq;
96
+ // Indicates whether thread is on the readyq.
97
+ // There is no clear relationship between this and th->status.
98
+ bool is_ready;
99
+
100
+ } node;
101
+
102
+ struct rb_thread_sched_waiting waiting_reason;
103
+ uint32_t event_serial;
104
+
105
+ // wakes pending on this thread (timer thread or an fd shard claim);
106
+ // under timer_th.wake_pending_lock
107
+ uint32_t wake_pending_cnt;
108
+
109
+ // parked on its own condvar with a deadline; under the sched lock (see
110
+ // ubf_waiting). Always false for an M:N thread: its deadline lives on the
111
+ // timer wheel, and its early wake comes from the timer thread instead.
112
+ bool waiting_timed;
113
+
114
+ bool malloc_stack;
115
+ void *context_stack;
116
+ size_t context_stack_size;
117
+ struct coroutine_context *context;
118
+ };
119
+
120
+ struct rb_native_thread {
121
+ rb_atomic_t serial;
122
+ struct rb_vm_struct *vm;
123
+
124
+ rb_nativethread_id_t thread_id;
125
+
126
+ #ifdef RB_THREAD_T_HAS_NATIVE_ID
127
+ int tid;
128
+ #endif
129
+
130
+ #if defined(_WIN32)
131
+ // signalled by native_thread_interrupt() to break this thread out of a
132
+ // blocking w32_wait_events()
133
+ HANDLE interrupt_event;
134
+ // a high-resolution timer that ends a timed wait on readyq at its
135
+ // deadline rather than at the next timer tick (NULL if unavailable)
136
+ HANDLE wait_timer;
137
+ #endif
138
+
139
+ struct rb_thread_struct *running_thread;
140
+
141
+ // The running thread on this shared nt, for the barrier/timeslice scans.
142
+ // While a scan holds running_th_lock the thread cannot finish parking.
143
+ rb_nativethread_lock_t running_th_lock;
144
+ struct rb_thread_struct *running_th;
145
+ struct ccan_list_node snts_node; // in vm->ractor.sched.ntlist.snts
146
+ // in vm->ractor.sched.ntlist.running_dnts while running_thread runs
147
+ struct ccan_list_node running_dnts_node;
148
+ // barrier_serial stamped by the barrier's counting walk; this nt's
149
+ // deregistration during that barrier decrements the snapshot count
150
+ uint32_t barrier_counted_serial;
151
+
152
+ // to control native thread; use sched->lock
153
+ rb_nativethread_cond_t readyq;
154
+
155
+ #ifdef USE_SIGALTSTACK
156
+ void *altstack;
157
+ #endif
158
+
159
+ struct coroutine_context *nt_context;
160
+ int dedicated;
161
+
162
+ // set when this thread came back from a blocking region with no room left
163
+ // in the shared pool; it ends when it next asks for work
164
+ bool retiring;
165
+
166
+ // A terminating coroutine records its context here before its final
167
+ // transfer; this nt's loop reclaims it. coroutine_transfer() cannot be
168
+ // used because a terminating coroutine never resumes to return a value.
169
+ struct coroutine_context *dead_co;
170
+ };
171
+
172
+ // <windows.h> defines these as macros, and the field names below (and in the
173
+ // rest of the interpreter) would be rewritten by them.
174
+ #undef except
175
+ #undef try
176
+ #undef leave
177
+ #undef finally
178
+
179
+ // per-Ractor
180
+ struct rb_thread_sched {
181
+ rb_nativethread_lock_t lock_;
182
+ #if VM_CHECK_MODE
183
+ struct rb_thread_struct *lock_owner;
184
+ #endif
185
+ struct rb_thread_struct *running; // running thread or NULL
186
+ // Most recently running thread or NULL. If this thread wakes up before the newly running
187
+ // thread completes the transfer of control, it can interrupt and resume running.
188
+ // The new thread clears this field when it takes control.
189
+ struct rb_thread_struct *runnable_hot_th;
190
+ int runnable_hot_th_waiting;
191
+ bool is_running;
192
+
193
+ bool enable_mn_threads;
194
+
195
+ struct ccan_list_head readyq;
196
+ int readyq_cnt;
197
+ // ractor scheduling
198
+ // When not linked in vm->ractor.sched.grq, this node is kept
199
+ // self-linked (ccan_list_node_init), so "linked?" can be read off the
200
+ // node itself: enqueuers assert it, and direct transfers cancel an
201
+ // outstanding entry (see ractor_sched_cancel_enq).
202
+ struct ccan_list_node grq_node;
203
+ struct ccan_list_node timeslice_node; // self-linked = not on timeslice.scheds
204
+ };
205
+
206
+ struct rb_thread_context;
207
+
208
+ // A coroutine (M:N) thread's teardown runs coroutine_thread_terminated
209
+ // instead of the dedicated-thread path in thread_start_func_2; see the
210
+ // comments there and in thread_sched_mn.c. th->sched.context is cleared in
211
+ // that epilogue, so this also reads as "did not tear down yet".
212
+ // (Only meaningful when USE_MN_THREADS -- gate uses accordingly; the macro
213
+ // itself is a plain pointer test and always compiles.)
214
+ #define th_has_coroutine(th) ((th)->sched.context != NULL)
215
+
216
+ struct rb_ractor_struct;
217
+
218
+ // VM wide: what schedules Ractors onto native threads. One per VM, in
219
+ // rb_vm_struct.ractor.sched.
220
+ struct rb_ractor_sched {
221
+ rb_nativethread_lock_t lock;
222
+ struct rb_ractor_struct *lock_owner;
223
+ bool locked;
224
+
225
+ rb_nativethread_cond_t cond; // GRQ
226
+ rb_atomic_t snt_cnt; // count of shared NTs; lock-free (see native_thread_dedicated_inc)
227
+ unsigned int dnt_cnt; // count of dedicated NTs; logging only (USE_RUBY_DEBUG_LOG), not atomic
228
+
229
+ unsigned int max_cpu;
230
+ struct ccan_list_head grq; // // Global Ready Queue
231
+ rb_atomic_t winding_cnt; // native threads between a coroutine epilogue and its reclaim; ruby_vm_destruct waits for 0
232
+ unsigned int grq_cnt;
233
+
234
+ // What the barrier walk visits: threads running on dedicated
235
+ // nts, and the shared nts (whose running_th fields hold the rest).
236
+ struct {
237
+ rb_nativethread_lock_t lock;
238
+ struct ccan_list_head running_dnts;
239
+ struct ccan_list_head snts;
240
+ } ntlist;
241
+
242
+ // scheds whose readyq holds waiters: the timer ticks their
243
+ // running thread (timeslice_scan) and prunes drained entries.
244
+ struct {
245
+ rb_nativethread_lock_t lock;
246
+ struct ccan_list_head scheds;
247
+ } timeslice;
248
+
249
+ // true if timeslice timer is not enable
250
+ bool timeslice_wait_inf;
251
+
252
+ // barrier
253
+ rb_nativethread_cond_t barrier_complete_cond;
254
+ rb_nativethread_cond_t barrier_release_cond;
255
+ // bool; nonzero while a stop-the-world section is active. Set
256
+ // before the barrier walks the running records; a record moved
257
+ // after the walk sees it (thread_sched_setup_running_threads).
258
+ rb_atomic_t barrier_is_waiting;
259
+ unsigned int barrier_joined_cnt; // threads joined so far; under sched.lock
260
+ unsigned int barrier_running_cnt; // runners counted by the barrier's walk; under sched.lock
261
+ unsigned int barrier_serial;
262
+ struct rb_ractor_struct *barrier_ractor;
263
+ unsigned int barrier_lock_rec;
264
+ };
265
+
266
+ void rb_ractor_sched_wait(struct rb_execution_context_struct *ec, struct rb_ractor_struct *cr, rb_unblock_function_t *ptr, void *arg);
267
+ void rb_ractor_sched_wakeup(struct rb_ractor_struct *r, struct rb_thread_struct *th);
268
+ void rb_ractor_sched_wait_terminate(struct rb_vm_struct *vm, rb_nativethread_cond_t *cond, unsigned long msec);
269
+ void rb_thread_wake_fence(struct rb_thread_struct *th);
270
+
271
+ #endif /* RUBY_THREAD_SCHED_H */
@@ -0,0 +1,48 @@
1
+ #ifndef RUBY_THREAD_WIN32_H
2
+ #define RUBY_THREAD_WIN32_H
3
+ /**********************************************************************
4
+
5
+ thread_win32.h -
6
+
7
+ $Author$
8
+
9
+ Copyright (C) 2004-2007 Koichi Sasada
10
+
11
+ This platform runs the common scheduler; see thread_sched.h for its data
12
+ structures and thread_sched.c for the implementation.
13
+
14
+ **********************************************************************/
15
+
16
+ /* interface */
17
+
18
+ # ifdef __CYGWIN__
19
+ # undef _WIN32
20
+ # endif
21
+
22
+ WINBASEAPI BOOL WINAPI
23
+ TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
24
+
25
+ #include "thread_sched.h"
26
+
27
+ typedef DWORD native_tls_key_t; // TLS index
28
+
29
+ static inline void *
30
+ native_tls_get(native_tls_key_t key)
31
+ {
32
+ // return value should be checked by caller.
33
+ return TlsGetValue(key);
34
+ }
35
+
36
+ static inline void
37
+ native_tls_set(native_tls_key_t key, void *ptr)
38
+ {
39
+ if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
40
+ rb_bug("TlsSetValue() error");
41
+ }
42
+ }
43
+
44
+ RUBY_SYMBOL_EXPORT_BEGIN
45
+ RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
46
+ RUBY_SYMBOL_EXPORT_END
47
+
48
+ #endif /* RUBY_THREAD_WIN32_H */
@@ -0,0 +1,58 @@
1
+ #ifndef RUBY_TIMEV_H
2
+ #define RUBY_TIMEV_H
3
+ #include "ruby/ruby.h"
4
+
5
+ struct vtm {
6
+ VALUE year; /* 2000 for example. Integer. */
7
+ VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
8
+ VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
9
+ VALUE zone; /* "JST", "EST", "EDT", etc. as String */
10
+ unsigned int yday:9; /* 1..366 */
11
+ unsigned int mon:4; /* 1..12 */
12
+ unsigned int mday:5; /* 1..31 */
13
+ unsigned int hour:5; /* 0..23 */
14
+ unsigned int min:6; /* 0..59 */
15
+ unsigned int sec:6; /* 0..60 */
16
+ unsigned int wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
17
+ unsigned int isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
18
+
19
+ /* Flags for struct time_object */
20
+ unsigned int tzmode:3; /* 0:localtime 1:utc 2:fixoff 3:uninitialized */
21
+ unsigned int tm_got:1;
22
+ };
23
+
24
+ #define TIME_SCALE 1000000000
25
+
26
+ #ifndef TYPEOF_TIMEVAL_TV_SEC
27
+ # define TYPEOF_TIMEVAL_TV_SEC time_t
28
+ #endif
29
+ #ifndef TYPEOF_TIMEVAL_TV_USEC
30
+ # if INT_MAX >= 1000000
31
+ # define TYPEOF_TIMEVAL_TV_USEC int
32
+ # else
33
+ # define TYPEOF_TIMEVAL_TV_USEC long
34
+ # endif
35
+ #endif
36
+
37
+ #if SIZEOF_TIME_T == SIZEOF_LONG
38
+ typedef unsigned long unsigned_time_t;
39
+ #elif SIZEOF_TIME_T == SIZEOF_INT
40
+ typedef unsigned int unsigned_time_t;
41
+ #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
42
+ typedef unsigned LONG_LONG unsigned_time_t;
43
+ #else
44
+ # error cannot find integer type which size is same as time_t.
45
+ #endif
46
+
47
+ /* strftime.c */
48
+ #ifdef RUBY_ENCODING_H
49
+ VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
50
+ VALUE time, const struct vtm *vtm, struct timespec *ts, int gmt);
51
+ VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
52
+ VALUE time, const struct vtm *vtm, VALUE timev, int gmt);
53
+ #endif
54
+
55
+ /* time.c */
56
+ VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time);
57
+
58
+ #endif