debase-ruby_core_source 3.4.1 → 4.0.0.preview2

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/addr2line.h +22 -0
  4. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/builtin.h +125 -0
  5. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/list/list.h +791 -0
  9. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/str/str.h +17 -0
  10. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/constant.h +53 -0
  11. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/darray.h +278 -0
  12. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/debug_counter.h +425 -0
  13. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/dln.h +33 -0
  14. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/encindex.h +70 -0
  15. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/eval_intern.h +331 -0
  16. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/hrtime.h +237 -0
  17. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/id.h +354 -0
  18. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/id_table.h +54 -0
  19. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/insns.inc +302 -0
  20. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/insns_info.inc +11241 -0
  21. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/array.h +154 -0
  22. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/basic_operators.h +65 -0
  23. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/bignum.h +245 -0
  24. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/bits.h +650 -0
  25. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/box.h +81 -0
  26. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/class.h +805 -0
  27. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/cmdlineopt.h +64 -0
  28. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/compar.h +29 -0
  29. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/compile.h +34 -0
  30. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/compilers.h +107 -0
  31. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/concurrent_set.h +21 -0
  33. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/cont.h +35 -0
  34. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/dir.h +16 -0
  35. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/enc.h +19 -0
  36. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/encoding.h +39 -0
  37. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/enum.h +18 -0
  38. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/enumerator.h +21 -0
  39. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/error.h +251 -0
  40. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/eval.h +41 -0
  41. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/file.h +38 -0
  42. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/fixnum.h +185 -0
  43. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/gc.h +358 -0
  44. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/hash.h +194 -0
  45. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/imemo.h +322 -0
  46. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/inits.h +51 -0
  47. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/io.h +163 -0
  48. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/load.h +20 -0
  49. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/loadpath.h +16 -0
  50. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/math.h +23 -0
  51. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/missing.h +19 -0
  52. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/numeric.h +275 -0
  53. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/object.h +63 -0
  54. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/parse.h +131 -0
  55. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/proc.h +30 -0
  56. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/process.h +124 -0
  57. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/ractor.h +10 -0
  58. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/random.h +17 -0
  59. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/range.h +40 -0
  60. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/rational.h +71 -0
  61. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/re.h +33 -0
  62. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/ruby_parser.h +102 -0
  63. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/sanitizers.h +346 -0
  64. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/serial.h +23 -0
  65. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/set_table.h +70 -0
  66. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/signal.h +25 -0
  67. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/st.h +11 -0
  68. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/static_assert.h +16 -0
  69. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/string.h +203 -0
  70. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/struct.h +160 -0
  71. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/symbol.h +46 -0
  72. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/thread.h +112 -0
  73. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/time.h +37 -0
  74. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/transcode.h +23 -0
  75. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/util.h +27 -0
  76. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/variable.h +74 -0
  77. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/vm.h +136 -0
  78. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/warnings.h +16 -0
  79. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal.h +105 -0
  80. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/iseq.h +357 -0
  81. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/known_errors.inc +1419 -0
  82. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/method.h +271 -0
  83. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/node.h +122 -0
  84. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/node_name.inc +224 -0
  85. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/optinsn.inc +128 -0
  86. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/optunifs.inc +41 -0
  87. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parse.h +244 -0
  88. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_bits.h +564 -0
  89. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_node.h +32 -0
  90. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_st.h +162 -0
  91. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_value.h +106 -0
  92. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/ast.h +8233 -0
  93. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/defines.h +260 -0
  94. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/diagnostic.h +458 -0
  95. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/encoding.h +283 -0
  96. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/extension.h +19 -0
  97. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/node.h +129 -0
  98. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/options.h +485 -0
  99. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/pack.h +163 -0
  100. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/parser.h +936 -0
  101. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/prettyprint.h +34 -0
  102. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/prism.h +408 -0
  103. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/regexp.h +43 -0
  104. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/static_literals.h +121 -0
  105. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_buffer.h +236 -0
  106. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_char.h +204 -0
  107. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_constant_pool.h +218 -0
  108. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_integer.h +130 -0
  109. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_list.h +103 -0
  110. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_memchr.h +29 -0
  111. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_newline_list.h +113 -0
  112. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_string.h +200 -0
  113. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_strncasecmp.h +32 -0
  114. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_strpbrk.h +46 -0
  115. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/version.h +29 -0
  116. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism_compile.h +106 -0
  117. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/probes_helper.h +42 -0
  118. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ractor_core.h +306 -0
  119. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/regenc.h +259 -0
  120. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/regint.h +1005 -0
  121. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/regparse.h +371 -0
  122. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/revision.h +5 -0
  123. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ruby_assert.h +14 -0
  124. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ruby_atomic.h +66 -0
  125. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/rubyparser.h +1394 -0
  126. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/shape.h +444 -0
  127. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/siphash.h +48 -0
  128. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/symbol.h +116 -0
  129. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/thread_none.h +21 -0
  130. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/thread_pthread.h +175 -0
  131. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/thread_win32.h +58 -0
  132. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/timev.h +58 -0
  133. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/transcode_data.h +138 -0
  134. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/variable.h +27 -0
  135. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/version.h +69 -0
  136. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm.inc +6183 -0
  137. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_call_iseq_optimized.inc +244 -0
  138. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_callinfo.h +640 -0
  139. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_core.h +2350 -0
  140. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_debug.h +124 -0
  141. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_exec.h +210 -0
  142. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_insnhelper.h +277 -0
  143. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_opts.h +67 -0
  144. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_sync.h +156 -0
  145. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vmtc.inc +289 -0
  146. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/yjit.h +81 -0
  147. data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/zjit.h +47 -0
  148. data/lib/debase/ruby_core_source/version.rb +1 -1
  149. metadata +148 -3
@@ -0,0 +1,16 @@
1
+ #ifndef INTERNAL_STATIC_ASSERT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STATIC_ASSERT_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 C11 shim for _Static_assert.
10
+ */
11
+ #include "ruby/internal/static_assert.h"
12
+ #ifndef STATIC_ASSERT
13
+ # define STATIC_ASSERT RBIMPL_STATIC_ASSERT
14
+ #endif
15
+
16
+ #endif /* INTERNAL_STATIC_ASSERT_H */
@@ -0,0 +1,203 @@
1
+ #ifndef INTERNAL_STRING_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STRING_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 String.
10
+ */
11
+ #include "ruby/internal/config.h"
12
+ #include <stddef.h> /* for size_t */
13
+ #include "internal/compilers.h" /* for __has_builtin */
14
+ #include "ruby/internal/stdbool.h" /* for bool */
15
+ #include "ruby/encoding.h" /* for rb_encoding */
16
+ #include "ruby/ruby.h" /* for VALUE */
17
+
18
+ #define STR_SHARED FL_USER0 /* = ELTS_SHARED */
19
+ #define STR_NOEMBED FL_USER1
20
+ #define STR_CHILLED (FL_USER2 | FL_USER3)
21
+ #define STR_CHILLED_LITERAL FL_USER2
22
+ #define STR_CHILLED_SYMBOL_TO_S FL_USER3
23
+
24
+ enum ruby_rstring_private_flags {
25
+ RSTRING_CHILLED = STR_CHILLED,
26
+ };
27
+
28
+ #ifdef rb_fstring_cstr
29
+ # undef rb_fstring_cstr
30
+ #endif
31
+
32
+ /* string.c */
33
+ VALUE rb_str_dup_m(VALUE str);
34
+ VALUE rb_fstring(VALUE);
35
+ VALUE rb_fstring_cstr(const char *str);
36
+ VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
37
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
38
+ int rb_str_symname_p(VALUE);
39
+ VALUE rb_str_quote_unprintable(VALUE);
40
+ char *rb_str_fill_terminator(VALUE str, const int termlen);
41
+ void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
42
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
43
+ VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
44
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
45
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
46
+ rb_encoding *from, int ecflags, VALUE ecopts);
47
+ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
48
+ VALUE rb_str_escape(VALUE str);
49
+ size_t rb_str_memsize(VALUE);
50
+ char *rb_str_to_cstr(VALUE str);
51
+ const char *ruby_escaped_char(int c);
52
+ void rb_str_make_independent(VALUE str);
53
+ int rb_enc_str_coderange_scan(VALUE str, rb_encoding *enc);
54
+ int rb_ascii8bit_appendable_encoding_index(rb_encoding *enc, unsigned int code);
55
+ VALUE rb_str_include(VALUE str, VALUE arg);
56
+ VALUE rb_str_byte_substr(VALUE str, VALUE beg, VALUE len);
57
+ VALUE rb_str_substr_two_fixnums(VALUE str, VALUE beg, VALUE len, int empty);
58
+ VALUE rb_str_tmp_frozen_no_embed_acquire(VALUE str);
59
+ void rb_str_make_embedded(VALUE);
60
+ VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE);
61
+ size_t rb_str_size_as_embedded(VALUE);
62
+ bool rb_str_reembeddable_p(VALUE);
63
+ VALUE rb_str_upto_endless_each(VALUE, int (*each)(VALUE, VALUE), VALUE);
64
+ VALUE rb_str_with_debug_created_info(VALUE, VALUE, int);
65
+ VALUE rb_str_frozen_bare_string(VALUE);
66
+
67
+ /* error.c */
68
+ void rb_warn_unchilled_literal(VALUE str);
69
+ void rb_warn_unchilled_symbol_to_s(VALUE str);
70
+
71
+ static inline bool STR_EMBED_P(VALUE str);
72
+ static inline bool STR_SHARED_P(VALUE str);
73
+ static inline VALUE QUOTE(VALUE v);
74
+ static inline VALUE QUOTE_ID(ID v);
75
+ static inline bool is_ascii_string(VALUE str);
76
+ static inline bool is_broken_string(VALUE str);
77
+ static inline VALUE rb_str_eql_internal(const VALUE str1, const VALUE str2);
78
+
79
+ RUBY_SYMBOL_EXPORT_BEGIN
80
+ /* string.c (export) */
81
+ VALUE rb_str_tmp_frozen_acquire(VALUE str);
82
+ void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
83
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
84
+ RUBY_SYMBOL_EXPORT_END
85
+
86
+ VALUE rb_fstring_new(const char *ptr, long len);
87
+ void rb_gc_free_fstring(VALUE obj);
88
+ bool rb_obj_is_fstring_table(VALUE obj);
89
+ void Init_fstring_table();
90
+ VALUE rb_obj_as_string_result(VALUE str, VALUE obj);
91
+ VALUE rb_str_opt_plus(VALUE x, VALUE y);
92
+ VALUE rb_str_concat_literals(size_t num, const VALUE *strary);
93
+ VALUE rb_str_eql(VALUE str1, VALUE str2);
94
+ VALUE rb_id_quote_unprintable(ID);
95
+ VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc);
96
+ VALUE rb_enc_literal_str(const char *ptr, long len, rb_encoding *enc);
97
+
98
+ struct rb_execution_context_struct;
99
+ VALUE rb_ec_str_resurrect(struct rb_execution_context_struct *ec, VALUE str, bool chilled);
100
+
101
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
102
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
103
+ #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
104
+ #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
105
+
106
+ static inline VALUE
107
+ QUOTE(VALUE v)
108
+ {
109
+ return rb_str_quote_unprintable(v);
110
+ }
111
+
112
+ static inline VALUE
113
+ QUOTE_ID(ID i)
114
+ {
115
+ return rb_id_quote_unprintable(i);
116
+ }
117
+
118
+ static inline bool
119
+ STR_EMBED_P(VALUE str)
120
+ {
121
+ return ! FL_TEST_RAW(str, STR_NOEMBED);
122
+ }
123
+
124
+ static inline bool
125
+ STR_SHARED_P(VALUE str)
126
+ {
127
+ return FL_ALL_RAW(str, STR_NOEMBED | STR_SHARED);
128
+ }
129
+
130
+ static inline bool
131
+ CHILLED_STRING_P(VALUE obj)
132
+ {
133
+ return RB_TYPE_P(obj, T_STRING) && FL_TEST_RAW(obj, STR_CHILLED);
134
+ }
135
+
136
+ static inline void
137
+ CHILLED_STRING_MUTATED(VALUE str)
138
+ {
139
+ VALUE chilled_reason = RB_FL_TEST_RAW(str, STR_CHILLED);
140
+ FL_UNSET_RAW(str, STR_CHILLED);
141
+ switch (chilled_reason) {
142
+ case STR_CHILLED_SYMBOL_TO_S:
143
+ rb_warn_unchilled_symbol_to_s(str);
144
+ break;
145
+ case STR_CHILLED_LITERAL:
146
+ rb_warn_unchilled_literal(str);
147
+ break;
148
+ default:
149
+ rb_bug("RString was chilled for multiple reasons");
150
+ }
151
+ }
152
+
153
+ static inline bool
154
+ is_ascii_string(VALUE str)
155
+ {
156
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT;
157
+ }
158
+
159
+ static inline bool
160
+ is_broken_string(VALUE str)
161
+ {
162
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN;
163
+ }
164
+
165
+ static inline bool
166
+ at_char_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
167
+ {
168
+ return rb_enc_left_char_head(s, p, e, enc) == p;
169
+ }
170
+
171
+ static inline bool
172
+ at_char_right_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
173
+ {
174
+ RUBY_ASSERT(s <= p);
175
+ RUBY_ASSERT(p <= e);
176
+
177
+ return rb_enc_right_char_head(s, p, e, enc) == p;
178
+ }
179
+
180
+ /* expect tail call optimization */
181
+ // YJIT needs this function to never allocate and never raise
182
+ static inline VALUE
183
+ rb_str_eql_internal(const VALUE str1, const VALUE str2)
184
+ {
185
+ const long len = RSTRING_LEN(str1);
186
+ const char *ptr1, *ptr2;
187
+
188
+ if (len != RSTRING_LEN(str2)) return Qfalse;
189
+ if (!rb_str_comparable(str1, str2)) return Qfalse;
190
+ if ((ptr1 = RSTRING_PTR(str1)) == (ptr2 = RSTRING_PTR(str2)))
191
+ return Qtrue;
192
+ if (memcmp(ptr1, ptr2, len) == 0)
193
+ return Qtrue;
194
+ return Qfalse;
195
+ }
196
+
197
+ #if __has_builtin(__builtin_constant_p)
198
+ # define rb_fstring_cstr(str) \
199
+ (__builtin_constant_p(str) ? \
200
+ rb_fstring_new((str), (long)strlen(str)) : \
201
+ (rb_fstring_cstr)(str))
202
+ #endif
203
+ #endif /* INTERNAL_STRING_H */
@@ -0,0 +1,160 @@
1
+ #ifndef INTERNAL_STRUCT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STRUCT_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 Struct.
10
+ */
11
+ #include "ruby/internal/stdbool.h" /* for bool */
12
+ #include "ruby/ruby.h" /* for struct RBasic */
13
+
14
+ /* Flags of RStruct
15
+ *
16
+ * 1-7: RSTRUCT_EMBED_LEN
17
+ * If non-zero, the struct is embedded (its contents follow the
18
+ * header, rather than being on a separately allocated buffer) and
19
+ * these bits are the length of the Struct.
20
+ * 8: RSTRUCT_GEN_FIELDS
21
+ * The struct is embedded and has no space left to store the
22
+ * IMEMO/fields reference. Any ivar this struct may have will be in
23
+ * the generic_fields_tbl. This flag doesn't imply the struct has
24
+ * ivars.
25
+ */
26
+ enum {
27
+ RSTRUCT_EMBED_LEN_MASK = RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 |
28
+ RUBY_FL_USER3 | RUBY_FL_USER2 | RUBY_FL_USER1,
29
+ RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
30
+ RSTRUCT_GEN_FIELDS = RUBY_FL_USER8,
31
+ };
32
+
33
+ struct RStruct {
34
+ struct RBasic basic;
35
+ union {
36
+ struct {
37
+ long len;
38
+ const VALUE *ptr;
39
+ VALUE fields_obj;
40
+ } heap;
41
+ /* This is a length 1 array because:
42
+ * 1. GCC has a bug that does not optimize C flexible array members
43
+ * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
44
+ * 2. Zero length arrays are not supported by all compilers
45
+ */
46
+ const VALUE ary[1];
47
+ } as;
48
+ };
49
+
50
+ #define RSTRUCT(obj) ((struct RStruct *)(obj))
51
+
52
+ #ifdef RSTRUCT_LEN
53
+ # undef RSTRUCT_LEN
54
+ #endif
55
+
56
+ #ifdef RSTRUCT_PTR
57
+ # undef RSTRUCT_PTR
58
+ #endif
59
+
60
+ #ifdef RSTRUCT_SET
61
+ # undef RSTRUCT_SET
62
+ #endif
63
+
64
+ #ifdef RSTRUCT_GET
65
+ # undef RSTRUCT_GET
66
+ #endif
67
+
68
+ #define RSTRUCT_LEN internal_RSTRUCT_LEN
69
+ #define RSTRUCT_SET internal_RSTRUCT_SET
70
+ #define RSTRUCT_GET internal_RSTRUCT_GET
71
+
72
+ /* struct.c */
73
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
74
+ VALUE rb_struct_lookup(VALUE s, VALUE idx);
75
+ VALUE rb_struct_s_keyword_init(VALUE klass);
76
+ static inline long RSTRUCT_EMBED_LEN(VALUE st);
77
+ static inline long RSTRUCT_LEN(VALUE st);
78
+ static inline int RSTRUCT_LENINT(VALUE st);
79
+ static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st);
80
+ static inline void RSTRUCT_SET(VALUE st, long k, VALUE v);
81
+ static inline VALUE RSTRUCT_GET(VALUE st, long k);
82
+
83
+ static inline long
84
+ RSTRUCT_EMBED_LEN(VALUE st)
85
+ {
86
+ long ret = FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK);
87
+ ret >>= RSTRUCT_EMBED_LEN_SHIFT;
88
+ return ret;
89
+ }
90
+
91
+ static inline long
92
+ RSTRUCT_LEN(VALUE st)
93
+ {
94
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
95
+ return RSTRUCT_EMBED_LEN(st);
96
+ }
97
+ else {
98
+ return RSTRUCT(st)->as.heap.len;
99
+ }
100
+ }
101
+
102
+ static inline int
103
+ RSTRUCT_LENINT(VALUE st)
104
+ {
105
+ return rb_long2int(RSTRUCT_LEN(st));
106
+ }
107
+
108
+ static inline const VALUE *
109
+ RSTRUCT_CONST_PTR(VALUE st)
110
+ {
111
+ const struct RStruct *p = RSTRUCT(st);
112
+
113
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
114
+ return p->as.ary;
115
+ }
116
+ else {
117
+ return p->as.heap.ptr;
118
+ }
119
+ }
120
+
121
+ static inline void
122
+ RSTRUCT_SET(VALUE st, long k, VALUE v)
123
+ {
124
+ RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[k], v);
125
+ }
126
+
127
+ static inline VALUE
128
+ RSTRUCT_GET(VALUE st, long k)
129
+ {
130
+ return RSTRUCT_CONST_PTR(st)[k];
131
+ }
132
+
133
+ static inline VALUE
134
+ RSTRUCT_FIELDS_OBJ(VALUE st)
135
+ {
136
+ const long embed_len = RSTRUCT_EMBED_LEN(st);
137
+ VALUE fields_obj;
138
+ if (embed_len) {
139
+ RUBY_ASSERT(!FL_TEST_RAW(st, RSTRUCT_GEN_FIELDS));
140
+ fields_obj = RSTRUCT_GET(st, embed_len);
141
+ }
142
+ else {
143
+ fields_obj = RSTRUCT(st)->as.heap.fields_obj;
144
+ }
145
+ return fields_obj;
146
+ }
147
+
148
+ static inline void
149
+ RSTRUCT_SET_FIELDS_OBJ(VALUE st, VALUE fields_obj)
150
+ {
151
+ const long embed_len = RSTRUCT_EMBED_LEN(st);
152
+ if (embed_len) {
153
+ RUBY_ASSERT(!FL_TEST_RAW(st, RSTRUCT_GEN_FIELDS));
154
+ RSTRUCT_SET(st, embed_len, fields_obj);
155
+ }
156
+ else {
157
+ RB_OBJ_WRITE(st, &RSTRUCT(st)->as.heap.fields_obj, fields_obj);
158
+ }
159
+ }
160
+ #endif /* INTERNAL_STRUCT_H */
@@ -0,0 +1,46 @@
1
+ #ifndef INTERNAL_SYMBOL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SYMBOL_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 Symbol.
10
+ */
11
+ #include "ruby/ruby.h" /* for VALUE */
12
+ #include "ruby/encoding.h" /* for rb_encoding */
13
+ #include "internal/compilers.h" /* for __has_builtin */
14
+
15
+ #ifdef rb_sym_intern_ascii_cstr
16
+ # undef rb_sym_intern_ascii_cstr
17
+ #endif
18
+
19
+ /* symbol.c */
20
+ void rb_sym_global_symbols_mark_and_move(void);
21
+ VALUE rb_to_symbol_type(VALUE obj);
22
+ VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
23
+ VALUE rb_sym_intern_ascii(const char *ptr, long len);
24
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
25
+ int rb_is_const_name(VALUE name);
26
+ int rb_is_class_name(VALUE name);
27
+ int rb_is_instance_name(VALUE name);
28
+ int rb_is_local_name(VALUE name);
29
+ PUREFUNC(int rb_is_const_sym(VALUE sym));
30
+ PUREFUNC(int rb_is_attrset_sym(VALUE sym));
31
+ ID rb_make_internal_id(void);
32
+ ID rb_make_temporary_id(size_t n);
33
+ bool rb_obj_is_symbol_table(VALUE obj);
34
+ void rb_sym_global_symbol_table_foreach_weak_reference(int (*callback)(VALUE *key, void *data), void *data);
35
+ void rb_gc_free_dsymbol(VALUE);
36
+ int rb_static_id_valid_p(ID id);
37
+ void rb_free_global_symbol_table(void);
38
+
39
+ #if __has_builtin(__builtin_constant_p)
40
+ #define rb_sym_intern_ascii_cstr(ptr) \
41
+ (__builtin_constant_p(ptr) ? \
42
+ rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
43
+ rb_sym_intern_ascii_cstr(ptr))
44
+ #endif
45
+
46
+ #endif /* INTERNAL_SYMBOL_H */
@@ -0,0 +1,112 @@
1
+ #ifndef INTERNAL_THREAD_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_THREAD_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 Thread.
10
+ */
11
+ #include "ruby/ruby.h" /* for VALUE */
12
+ #include "ruby/intern.h" /* for rb_blocking_function_t */
13
+ #include "ccan/list/list.h" /* for list in rb_io_close_wait_list */
14
+
15
+ struct rb_thread_struct; /* in vm_core.h */
16
+ struct rb_io;
17
+
18
+ #define RB_VM_SAVE_MACHINE_CONTEXT(th) \
19
+ do { \
20
+ FLUSH_REGISTER_WINDOWS; \
21
+ setjmp((th)->ec->machine.regs); \
22
+ SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
23
+ } while (0)
24
+
25
+ /* thread.c */
26
+ #define COVERAGE_INDEX_LINES 0
27
+ #define COVERAGE_INDEX_BRANCHES 1
28
+ #define COVERAGE_TARGET_LINES 1
29
+ #define COVERAGE_TARGET_BRANCHES 2
30
+ #define COVERAGE_TARGET_METHODS 4
31
+ #define COVERAGE_TARGET_ONESHOT_LINES 8
32
+ #define COVERAGE_TARGET_EVAL 16
33
+
34
+ #define RUBY_FATAL_THREAD_KILLED INT2FIX(0)
35
+ #define RUBY_FATAL_THREAD_TERMINATED INT2FIX(1)
36
+ #define RUBY_FATAL_FIBER_KILLED RB_INT2FIX(2)
37
+
38
+ VALUE rb_obj_is_mutex(VALUE obj);
39
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
40
+ void rb_thread_execute_interrupts(VALUE th);
41
+ VALUE rb_get_coverages(void);
42
+ int rb_get_coverage_mode(void);
43
+ VALUE rb_default_coverage(int);
44
+ VALUE rb_thread_shield_new(void);
45
+ bool rb_thread_shield_owned(VALUE self);
46
+ VALUE rb_thread_shield_wait(VALUE self);
47
+ VALUE rb_thread_shield_release(VALUE self);
48
+ VALUE rb_thread_shield_destroy(VALUE self);
49
+ int rb_thread_to_be_killed(VALUE thread);
50
+ void rb_thread_acquire_fork_lock(void);
51
+ void rb_thread_release_fork_lock(void);
52
+ void rb_thread_reset_fork_lock(void);
53
+ void rb_mutex_allow_trap(VALUE self, int val);
54
+ VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data);
55
+ VALUE rb_mutex_owned_p(VALUE self);
56
+ VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid);
57
+ void ruby_mn_threads_params(void);
58
+
59
+ int rb_thread_io_wait(struct rb_io *io, int events, struct timeval * timeout);
60
+ int rb_thread_wait_for_single_fd(int fd, int events, struct timeval * timeout);
61
+
62
+ size_t rb_thread_io_close_interrupt(struct rb_io *);
63
+ void rb_thread_io_close_wait(struct rb_io *);
64
+
65
+ void rb_ec_check_ints(struct rb_execution_context_struct *ec);
66
+
67
+ void rb_thread_free_native_thread(void *th_ptr);
68
+
69
+ RUBY_SYMBOL_EXPORT_BEGIN
70
+
71
+ void *rb_thread_prevent_fork(void *(*func)(void *), void *data); /* for ext/socket/raddrinfo.c */
72
+
73
+ /* Temporary. This API will be removed (renamed). */
74
+ VALUE rb_thread_io_blocking_region(struct rb_io *io, rb_blocking_function_t *func, void *data1);
75
+ VALUE rb_thread_io_blocking_call(struct rb_io *io, rb_blocking_function_t *func, void *data1, int events);
76
+
77
+ // Invoke the given function, with the specified argument, in a way that `IO#close` from another execution context can interrupt it.
78
+ VALUE rb_thread_io_blocking_operation(VALUE self, VALUE(*function)(VALUE), VALUE argument);
79
+
80
+ /* thread.c (export) */
81
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
82
+
83
+ RUBY_SYMBOL_EXPORT_END
84
+
85
+ int rb_threadptr_execute_interrupts(struct rb_thread_struct *th, int blocking_timing);
86
+ bool rb_thread_mn_schedulable(VALUE thread);
87
+
88
+ bool rb_thread_resolve_unblock_function(rb_unblock_function_t **unblock_function, void **data2, struct rb_thread_struct *thread);
89
+
90
+ // interrupt exec
91
+
92
+ typedef VALUE (rb_interrupt_exec_func_t)(void *data);
93
+
94
+ enum rb_interrupt_exec_flag {
95
+ rb_interrupt_exec_flag_none = 0x00,
96
+ rb_interrupt_exec_flag_value_data = 0x01,
97
+ rb_interrupt_exec_flag_new_thread = 0x02,
98
+ };
99
+
100
+ // interrupt the target_th and run func.
101
+ struct rb_ractor_struct;
102
+
103
+ void rb_threadptr_interrupt_exec(struct rb_thread_struct *target_th,
104
+ rb_interrupt_exec_func_t *func, void *data, enum rb_interrupt_exec_flag flags);
105
+
106
+ // create a thread in the target_r and run func on the created thread.
107
+ void rb_ractor_interrupt_exec(struct rb_ractor_struct *target_r,
108
+ rb_interrupt_exec_func_t *func, void *data, enum rb_interrupt_exec_flag flags);
109
+
110
+ void rb_threadptr_interrupt_exec_task_mark(struct rb_thread_struct *th);
111
+
112
+ #endif /* INTERNAL_THREAD_H */
@@ -0,0 +1,37 @@
1
+ #ifndef INTERNAL_TIME_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_TIME_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 Time.
10
+ */
11
+ #include "ruby/internal/config.h" /* for SIGNEDNESS_OF_TIME_T */
12
+ #include "internal/bits.h" /* for SIGNED_INTEGER_MAX */
13
+ #include "ruby/ruby.h" /* for VALUE */
14
+
15
+ #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
16
+ # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
17
+ # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
18
+ #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
19
+ # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
20
+ # define TIMET_MIN ((time_t)0)
21
+ #endif
22
+
23
+ struct timeval; /* <- in <sys/time.h> or <winsock2.h> */
24
+
25
+ /* time.c */
26
+ struct timeval rb_time_timeval(VALUE);
27
+
28
+ RUBY_SYMBOL_EXPORT_BEGIN
29
+ /* time.c (export) */
30
+ void ruby_reset_leap_second_info(void);
31
+ #ifdef RBIMPL_ATTR_DEPRECATED_INTERNAL_ONLY
32
+ RBIMPL_ATTR_DEPRECATED_INTERNAL_ONLY()
33
+ #endif
34
+ void ruby_reset_timezone(const char *);
35
+ RUBY_SYMBOL_EXPORT_END
36
+
37
+ #endif /* INTERNAL_TIME_H */
@@ -0,0 +1,23 @@
1
+ #ifndef INTERNAL_TRANSCODE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_TRANSCODE_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 Encoding::Converter.
10
+ */
11
+ #include "ruby/internal/config.h"
12
+ #include <stddef.h> /* for size_t */
13
+ #include "ruby/ruby.h" /* for VALUE */
14
+ #include "ruby/encoding.h" /* for rb_econv_t */
15
+
16
+ /* transcode.c */
17
+ extern VALUE rb_cEncodingConverter;
18
+ size_t rb_econv_memsize(rb_econv_t *);
19
+
20
+ /* vm.c */
21
+ void rb_free_transcoder_table(void);
22
+
23
+ #endif /* INTERNAL_TRANSCODE_H */
@@ -0,0 +1,27 @@
1
+ #ifndef INTERNAL_UTIL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_UTIL_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 corresponding util.c.
10
+ * @warning DO NOT ADD RANDOM GARBAGE HERE THIS FILE IS FOR util.c
11
+ */
12
+ #include "ruby/internal/config.h"
13
+ #include <stddef.h> /* for size_t */
14
+
15
+ #ifdef HAVE_SYS_TYPES_H
16
+ # include <sys/types.h> /* for ssize_t (note: on Windows ssize_t is */
17
+ #endif /* `#define`d in ruby/config.h) */
18
+
19
+ /* util.c */
20
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
21
+ char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
22
+
23
+ RUBY_SYMBOL_EXPORT_BEGIN
24
+ /* util.c (export) */
25
+ RUBY_SYMBOL_EXPORT_END
26
+
27
+ #endif /* INTERNAL_UTIL_H */