debase-ruby_core_source 3.3.5 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.idea/vcs.xml +28 -0
  4. data/CHANGELOG.md +8 -0
  5. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/addr2line.h +22 -0
  6. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/builtin.h +119 -0
  7. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/build_assert/build_assert.h +40 -0
  8. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/check_type/check_type.h +63 -0
  9. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/container_of/container_of.h +142 -0
  10. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/list/list.h +791 -0
  11. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ccan/str/str.h +17 -0
  12. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/constant.h +53 -0
  13. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/darray.h +209 -0
  14. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/debug_counter.h +423 -0
  15. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/dln.h +32 -0
  16. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/encindex.h +70 -0
  17. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/eval_intern.h +324 -0
  18. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/hrtime.h +237 -0
  19. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/id.h +347 -0
  20. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/id_table.h +39 -0
  21. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/insns.inc +265 -0
  22. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/insns_info.inc +9902 -0
  23. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/array.h +152 -0
  24. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/basic_operators.h +64 -0
  25. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/bignum.h +244 -0
  26. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/bits.h +568 -0
  27. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/class.h +283 -0
  28. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/cmdlineopt.h +65 -0
  29. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/compar.h +29 -0
  30. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/compile.h +34 -0
  31. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/compilers.h +107 -0
  32. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/complex.h +29 -0
  33. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/cont.h +35 -0
  34. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/dir.h +16 -0
  35. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/enc.h +19 -0
  36. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/encoding.h +36 -0
  37. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/enum.h +18 -0
  38. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/enumerator.h +21 -0
  39. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/error.h +218 -0
  40. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/eval.h +33 -0
  41. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/file.h +38 -0
  42. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/fixnum.h +184 -0
  43. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/gc.h +322 -0
  44. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/hash.h +192 -0
  45. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/imemo.h +261 -0
  46. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/inits.h +47 -0
  47. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/io.h +143 -0
  48. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/load.h +18 -0
  49. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/loadpath.h +16 -0
  50. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/math.h +23 -0
  51. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/missing.h +19 -0
  52. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/numeric.h +274 -0
  53. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/object.h +63 -0
  54. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/parse.h +129 -0
  55. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/proc.h +30 -0
  56. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/process.h +124 -0
  57. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/ractor.h +6 -0
  58. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/random.h +17 -0
  59. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/range.h +40 -0
  60. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/rational.h +71 -0
  61. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/re.h +28 -0
  62. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/ruby_parser.h +102 -0
  63. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/sanitizers.h +326 -0
  64. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/serial.h +23 -0
  65. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/signal.h +24 -0
  66. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/st.h +11 -0
  67. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/static_assert.h +16 -0
  68. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/string.h +186 -0
  69. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/struct.h +127 -0
  70. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/symbol.h +45 -0
  71. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/thread.h +85 -0
  72. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/time.h +34 -0
  73. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/transcode.h +23 -0
  74. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/util.h +27 -0
  75. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/variable.h +72 -0
  76. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/vm.h +137 -0
  77. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal/warnings.h +16 -0
  78. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/internal.h +108 -0
  79. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/iseq.h +340 -0
  80. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/known_errors.inc +1419 -0
  81. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/method.h +255 -0
  82. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/node.h +111 -0
  83. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/node_name.inc +224 -0
  84. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/optinsn.inc +128 -0
  85. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/optunifs.inc +43 -0
  86. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parse.h +244 -0
  87. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_bits.h +564 -0
  88. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_node.h +32 -0
  89. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_st.h +162 -0
  90. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/parser_value.h +106 -0
  91. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/ast.h +7524 -0
  92. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/defines.h +242 -0
  93. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/diagnostic.h +450 -0
  94. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/encoding.h +283 -0
  95. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/extension.h +19 -0
  96. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/node.h +129 -0
  97. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/options.h +396 -0
  98. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/pack.h +163 -0
  99. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/parser.h +933 -0
  100. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/prettyprint.h +34 -0
  101. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/prism.h +336 -0
  102. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/regexp.h +43 -0
  103. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/static_literals.h +121 -0
  104. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_buffer.h +218 -0
  105. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_char.h +204 -0
  106. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_constant_pool.h +218 -0
  107. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_integer.h +126 -0
  108. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_list.h +97 -0
  109. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_memchr.h +29 -0
  110. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_newline_list.h +113 -0
  111. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_string.h +190 -0
  112. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_strncasecmp.h +32 -0
  113. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/util/pm_strpbrk.h +46 -0
  114. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism/version.h +29 -0
  115. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/prism_compile.h +99 -0
  116. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/probes_helper.h +42 -0
  117. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ractor_core.h +382 -0
  118. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/regenc.h +254 -0
  119. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/regint.h +1006 -0
  120. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/regparse.h +371 -0
  121. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/revision.h +5 -0
  122. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/rjit.h +101 -0
  123. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/rjit_c.h +165 -0
  124. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ruby_assert.h +14 -0
  125. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/ruby_atomic.h +23 -0
  126. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/rubyparser.h +1350 -0
  127. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/shape.h +234 -0
  128. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/siphash.h +48 -0
  129. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/symbol.h +123 -0
  130. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/thread_none.h +21 -0
  131. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/thread_pthread.h +168 -0
  132. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/thread_win32.h +58 -0
  133. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/timev.h +58 -0
  134. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/transcode_data.h +138 -0
  135. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/variable.h +39 -0
  136. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/version.h +69 -0
  137. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm.inc +5840 -0
  138. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_call_iseq_optimized.inc +244 -0
  139. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_callinfo.h +627 -0
  140. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_core.h +2222 -0
  141. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_debug.h +124 -0
  142. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_exec.h +199 -0
  143. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_insnhelper.h +277 -0
  144. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_opts.h +67 -0
  145. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vm_sync.h +137 -0
  146. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/vmtc.inc +259 -0
  147. data/lib/debase/ruby_core_source/ruby-3.4.0-preview2/yjit.h +79 -0
  148. data/lib/debase/ruby_core_source/version.rb +1 -1
  149. metadata +150 -6
@@ -0,0 +1,186 @@
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_NOEMBED FL_USER1
19
+ #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
20
+ #define STR_CHILLED FL_USER3
21
+
22
+ enum ruby_rstring_private_flags {
23
+ RSTRING_CHILLED = STR_CHILLED,
24
+ };
25
+
26
+ #ifdef rb_fstring_cstr
27
+ # undef rb_fstring_cstr
28
+ #endif
29
+
30
+ /* string.c */
31
+ VALUE rb_fstring(VALUE);
32
+ VALUE rb_fstring_cstr(const char *str);
33
+ VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
34
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
35
+ int rb_str_symname_p(VALUE);
36
+ VALUE rb_str_quote_unprintable(VALUE);
37
+ char *rb_str_fill_terminator(VALUE str, const int termlen);
38
+ void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
39
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
40
+ VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
41
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
42
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
43
+ rb_encoding *from, int ecflags, VALUE ecopts);
44
+ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
45
+ VALUE rb_str_escape(VALUE str);
46
+ size_t rb_str_memsize(VALUE);
47
+ char *rb_str_to_cstr(VALUE str);
48
+ const char *ruby_escaped_char(int c);
49
+ void rb_str_make_independent(VALUE str);
50
+ int rb_enc_str_coderange_scan(VALUE str, rb_encoding *enc);
51
+ int rb_ascii8bit_appendable_encoding_index(rb_encoding *enc, unsigned int code);
52
+ VALUE rb_str_include(VALUE str, VALUE arg);
53
+ VALUE rb_str_byte_substr(VALUE str, VALUE beg, VALUE len);
54
+ VALUE rb_str_tmp_frozen_no_embed_acquire(VALUE str);
55
+ void rb_str_make_embedded(VALUE);
56
+ VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE);
57
+ size_t rb_str_size_as_embedded(VALUE);
58
+ bool rb_str_reembeddable_p(VALUE);
59
+ VALUE rb_str_upto_endless_each(VALUE, int (*each)(VALUE, VALUE), VALUE);
60
+
61
+ static inline bool STR_EMBED_P(VALUE str);
62
+ static inline bool STR_SHARED_P(VALUE str);
63
+ static inline VALUE QUOTE(VALUE v);
64
+ static inline VALUE QUOTE_ID(ID v);
65
+ static inline bool is_ascii_string(VALUE str);
66
+ static inline bool is_broken_string(VALUE str);
67
+ static inline VALUE rb_str_eql_internal(const VALUE str1, const VALUE str2);
68
+
69
+ RUBY_SYMBOL_EXPORT_BEGIN
70
+ /* string.c (export) */
71
+ VALUE rb_str_tmp_frozen_acquire(VALUE str);
72
+ void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
73
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
74
+ RUBY_SYMBOL_EXPORT_END
75
+
76
+ VALUE rb_fstring_new(const char *ptr, long len);
77
+ VALUE rb_obj_as_string_result(VALUE str, VALUE obj);
78
+ VALUE rb_str_opt_plus(VALUE x, VALUE y);
79
+ VALUE rb_str_concat_literals(size_t num, const VALUE *strary);
80
+ VALUE rb_str_eql(VALUE str1, VALUE str2);
81
+ VALUE rb_id_quote_unprintable(ID);
82
+ VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc);
83
+ VALUE rb_enc_literal_str(const char *ptr, long len, rb_encoding *enc);
84
+
85
+ struct rb_execution_context_struct;
86
+ VALUE rb_ec_str_resurrect(struct rb_execution_context_struct *ec, VALUE str, bool chilled);
87
+
88
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
89
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
90
+ #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
91
+ #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
92
+
93
+ static inline VALUE
94
+ QUOTE(VALUE v)
95
+ {
96
+ return rb_str_quote_unprintable(v);
97
+ }
98
+
99
+ static inline VALUE
100
+ QUOTE_ID(ID i)
101
+ {
102
+ return rb_id_quote_unprintable(i);
103
+ }
104
+
105
+ static inline bool
106
+ STR_EMBED_P(VALUE str)
107
+ {
108
+ return ! FL_TEST_RAW(str, STR_NOEMBED);
109
+ }
110
+
111
+ static inline bool
112
+ STR_SHARED_P(VALUE str)
113
+ {
114
+ return FL_ALL_RAW(str, STR_NOEMBED | STR_SHARED);
115
+ }
116
+
117
+ static inline bool
118
+ CHILLED_STRING_P(VALUE obj)
119
+ {
120
+ return RB_TYPE_P(obj, T_STRING) && FL_TEST_RAW(obj, STR_CHILLED);
121
+ }
122
+
123
+ static inline void
124
+ CHILLED_STRING_MUTATED(VALUE str)
125
+ {
126
+ FL_UNSET_RAW(str, STR_CHILLED);
127
+ rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, "literal string will be frozen in the future");
128
+ }
129
+
130
+ static inline void
131
+ STR_CHILL_RAW(VALUE str)
132
+ {
133
+ FL_SET_RAW(str, STR_CHILLED);
134
+ }
135
+
136
+ static inline bool
137
+ is_ascii_string(VALUE str)
138
+ {
139
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT;
140
+ }
141
+
142
+ static inline bool
143
+ is_broken_string(VALUE str)
144
+ {
145
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN;
146
+ }
147
+
148
+ static inline bool
149
+ at_char_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
150
+ {
151
+ return rb_enc_left_char_head(s, p, e, enc) == p;
152
+ }
153
+
154
+ static inline bool
155
+ at_char_right_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
156
+ {
157
+ RUBY_ASSERT(s <= p);
158
+ RUBY_ASSERT(p <= e);
159
+
160
+ return rb_enc_right_char_head(s, p, e, enc) == p;
161
+ }
162
+
163
+ /* expect tail call optimization */
164
+ // YJIT needs this function to never allocate and never raise
165
+ static inline VALUE
166
+ rb_str_eql_internal(const VALUE str1, const VALUE str2)
167
+ {
168
+ const long len = RSTRING_LEN(str1);
169
+ const char *ptr1, *ptr2;
170
+
171
+ if (len != RSTRING_LEN(str2)) return Qfalse;
172
+ if (!rb_str_comparable(str1, str2)) return Qfalse;
173
+ if ((ptr1 = RSTRING_PTR(str1)) == (ptr2 = RSTRING_PTR(str2)))
174
+ return Qtrue;
175
+ if (memcmp(ptr1, ptr2, len) == 0)
176
+ return Qtrue;
177
+ return Qfalse;
178
+ }
179
+
180
+ #if __has_builtin(__builtin_constant_p)
181
+ # define rb_fstring_cstr(str) \
182
+ (__builtin_constant_p(str) ? \
183
+ rb_fstring_new((str), (long)strlen(str)) : \
184
+ (rb_fstring_cstr)(str))
185
+ #endif
186
+ #endif /* INTERNAL_STRING_H */
@@ -0,0 +1,127 @@
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
+ enum {
15
+ RSTRUCT_EMBED_LEN_MASK = RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 |
16
+ RUBY_FL_USER3 | RUBY_FL_USER2 | RUBY_FL_USER1,
17
+ RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
18
+ };
19
+
20
+ struct RStruct {
21
+ struct RBasic basic;
22
+ union {
23
+ struct {
24
+ long len;
25
+ const VALUE *ptr;
26
+ } heap;
27
+ /* This is a length 1 array because:
28
+ * 1. GCC has a bug that does not optimize C flexible array members
29
+ * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
30
+ * 2. Zero length arrays are not supported by all compilers
31
+ */
32
+ const VALUE ary[1];
33
+ } as;
34
+ };
35
+
36
+ #define RSTRUCT(obj) ((struct RStruct *)(obj))
37
+
38
+ #ifdef RSTRUCT_LEN
39
+ # undef RSTRUCT_LEN
40
+ #endif
41
+
42
+ #ifdef RSTRUCT_PTR
43
+ # undef RSTRUCT_PTR
44
+ #endif
45
+
46
+ #ifdef RSTRUCT_SET
47
+ # undef RSTRUCT_SET
48
+ #endif
49
+
50
+ #ifdef RSTRUCT_GET
51
+ # undef RSTRUCT_GET
52
+ #endif
53
+
54
+ #define RSTRUCT_LEN internal_RSTRUCT_LEN
55
+ #define RSTRUCT_SET internal_RSTRUCT_SET
56
+ #define RSTRUCT_GET internal_RSTRUCT_GET
57
+
58
+ /* struct.c */
59
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
60
+ VALUE rb_struct_lookup(VALUE s, VALUE idx);
61
+ VALUE rb_struct_s_keyword_init(VALUE klass);
62
+ static inline const VALUE *rb_struct_const_heap_ptr(VALUE st);
63
+ static inline long RSTRUCT_EMBED_LEN(VALUE st);
64
+ static inline long RSTRUCT_LEN(VALUE st);
65
+ static inline int RSTRUCT_LENINT(VALUE st);
66
+ static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st);
67
+ static inline void RSTRUCT_SET(VALUE st, long k, VALUE v);
68
+ static inline VALUE RSTRUCT_GET(VALUE st, long k);
69
+
70
+ static inline long
71
+ RSTRUCT_EMBED_LEN(VALUE st)
72
+ {
73
+ long ret = FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK);
74
+ ret >>= RSTRUCT_EMBED_LEN_SHIFT;
75
+ return ret;
76
+ }
77
+
78
+ static inline long
79
+ RSTRUCT_LEN(VALUE st)
80
+ {
81
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
82
+ return RSTRUCT_EMBED_LEN(st);
83
+ }
84
+ else {
85
+ return RSTRUCT(st)->as.heap.len;
86
+ }
87
+ }
88
+
89
+ static inline int
90
+ RSTRUCT_LENINT(VALUE st)
91
+ {
92
+ return rb_long2int(RSTRUCT_LEN(st));
93
+ }
94
+
95
+ static inline const VALUE *
96
+ RSTRUCT_CONST_PTR(VALUE st)
97
+ {
98
+ const struct RStruct *p = RSTRUCT(st);
99
+
100
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
101
+ return p->as.ary;
102
+ }
103
+ else {
104
+ return p->as.heap.ptr;
105
+ }
106
+ }
107
+
108
+ static inline void
109
+ RSTRUCT_SET(VALUE st, long k, VALUE v)
110
+ {
111
+ RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[k], v);
112
+ }
113
+
114
+ static inline VALUE
115
+ RSTRUCT_GET(VALUE st, long k)
116
+ {
117
+ return RSTRUCT_CONST_PTR(st)[k];
118
+ }
119
+
120
+ static inline const VALUE *
121
+ rb_struct_const_heap_ptr(VALUE st)
122
+ {
123
+ assert(!FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK));
124
+ return RSTRUCT(st)->as.heap.ptr;
125
+ }
126
+
127
+ #endif /* INTERNAL_STRUCT_H */
@@ -0,0 +1,45 @@
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
+ VALUE rb_to_symbol_type(VALUE obj);
21
+ VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
22
+ VALUE rb_sym_intern_ascii(const char *ptr, long len);
23
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
24
+ int rb_is_const_name(VALUE name);
25
+ int rb_is_class_name(VALUE name);
26
+ int rb_is_instance_name(VALUE name);
27
+ int rb_is_local_name(VALUE name);
28
+ PUREFUNC(int rb_is_const_sym(VALUE sym));
29
+ PUREFUNC(int rb_is_attrset_sym(VALUE sym));
30
+ ID rb_make_internal_id(void);
31
+ ID rb_make_temporary_id(size_t n);
32
+ void rb_gc_free_dsymbol(VALUE);
33
+ int rb_static_id_valid_p(ID id);
34
+
35
+ /* vm.c */
36
+ void rb_free_static_symid_str(void);
37
+
38
+ #if __has_builtin(__builtin_constant_p)
39
+ #define rb_sym_intern_ascii_cstr(ptr) \
40
+ (__builtin_constant_p(ptr) ? \
41
+ rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
42
+ rb_sym_intern_ascii_cstr(ptr))
43
+ #endif
44
+
45
+ #endif /* INTERNAL_SYMBOL_H */
@@ -0,0 +1,85 @@
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
+
17
+ #define RB_VM_SAVE_MACHINE_CONTEXT(th) \
18
+ do { \
19
+ FLUSH_REGISTER_WINDOWS; \
20
+ setjmp((th)->ec->machine.regs); \
21
+ SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
22
+ } while (0)
23
+
24
+ /* thread.c */
25
+ #define COVERAGE_INDEX_LINES 0
26
+ #define COVERAGE_INDEX_BRANCHES 1
27
+ #define COVERAGE_TARGET_LINES 1
28
+ #define COVERAGE_TARGET_BRANCHES 2
29
+ #define COVERAGE_TARGET_METHODS 4
30
+ #define COVERAGE_TARGET_ONESHOT_LINES 8
31
+ #define COVERAGE_TARGET_EVAL 16
32
+
33
+ #define RUBY_FATAL_THREAD_KILLED INT2FIX(0)
34
+ #define RUBY_FATAL_THREAD_TERMINATED INT2FIX(1)
35
+ #define RUBY_FATAL_FIBER_KILLED RB_INT2FIX(2)
36
+
37
+ VALUE rb_obj_is_mutex(VALUE obj);
38
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
39
+ void rb_thread_execute_interrupts(VALUE th);
40
+ VALUE rb_get_coverages(void);
41
+ int rb_get_coverage_mode(void);
42
+ VALUE rb_default_coverage(int);
43
+ VALUE rb_thread_shield_new(void);
44
+ bool rb_thread_shield_owned(VALUE self);
45
+ VALUE rb_thread_shield_wait(VALUE self);
46
+ VALUE rb_thread_shield_release(VALUE self);
47
+ VALUE rb_thread_shield_destroy(VALUE self);
48
+ int rb_thread_to_be_killed(VALUE thread);
49
+ void rb_thread_acquire_fork_lock(void);
50
+ void rb_thread_release_fork_lock(void);
51
+ void rb_thread_reset_fork_lock(void);
52
+ void rb_mutex_allow_trap(VALUE self, int val);
53
+ VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data);
54
+ VALUE rb_mutex_owned_p(VALUE self);
55
+ VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid);
56
+ void ruby_mn_threads_params(void);
57
+
58
+ int rb_thread_wait_for_single_fd(int fd, int events, struct timeval * timeout);
59
+
60
+ struct rb_io_close_wait_list {
61
+ struct ccan_list_head pending_fd_users;
62
+ VALUE closing_thread;
63
+ VALUE closing_fiber;
64
+ VALUE wakeup_mutex;
65
+ };
66
+ int rb_notify_fd_close(int fd, struct rb_io_close_wait_list *busy);
67
+ void rb_notify_fd_close_wait(struct rb_io_close_wait_list *busy);
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(rb_blocking_function_t *func, void *data1, int fd);
75
+ VALUE rb_thread_io_blocking_call(rb_blocking_function_t *func, void *data1, int fd, int events);
76
+
77
+ /* thread.c (export) */
78
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
79
+
80
+ RUBY_SYMBOL_EXPORT_END
81
+
82
+ int rb_threadptr_execute_interrupts(struct rb_thread_struct *th, int blocking_timing);
83
+ bool rb_thread_mn_schedulable(VALUE thread);
84
+
85
+ #endif /* INTERNAL_THREAD_H */
@@ -0,0 +1,34 @@
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
+ void ruby_reset_timezone(void);
32
+ RUBY_SYMBOL_EXPORT_END
33
+
34
+ #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 */
@@ -0,0 +1,72 @@
1
+ #ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_VARIABLE_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 variables.
10
+ */
11
+ #include "ruby/internal/config.h"
12
+ #include <stddef.h> /* for size_t */
13
+ #include "constant.h" /* for rb_const_entry_t */
14
+ #include "ruby/internal/stdbool.h" /* for bool */
15
+ #include "ruby/ruby.h" /* for VALUE */
16
+ #include "shape.h" /* for rb_shape_t */
17
+
18
+ /* variable.c */
19
+ void rb_gc_mark_global_tbl(void);
20
+ void rb_gc_update_global_tbl(void);
21
+ size_t rb_generic_ivar_memsize(VALUE);
22
+ VALUE rb_search_class_path(VALUE);
23
+ VALUE rb_attr_delete(VALUE, ID);
24
+ void rb_autoload_str(VALUE mod, ID id, VALUE file);
25
+ VALUE rb_autoload_at_p(VALUE, ID, int);
26
+ NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
27
+ rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
28
+ rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
29
+ void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
30
+ void rb_gvar_ractor_local(const char *name);
31
+
32
+ /**
33
+ * Sets the name of a module.
34
+ *
35
+ * Non-permanently named classes can have a temporary name assigned (or
36
+ * cleared). In that case the name will be used for `#inspect` and `#to_s`, and
37
+ * nested classes/modules will be named with the temporary name as a prefix.
38
+ *
39
+ * After the module is assigned to a constant, the temporary name will be
40
+ * discarded, and the name will be computed based on the nesting.
41
+ *
42
+ * @param[in] mod An instance of ::rb_cModule.
43
+ * @param[in] name An instance of ::rb_cString.
44
+ * @retval mod
45
+ */
46
+ VALUE rb_mod_set_temporary_name(VALUE, VALUE);
47
+
48
+ struct gen_ivtbl;
49
+ int rb_gen_ivtbl_get(VALUE obj, ID id, struct gen_ivtbl **ivtbl);
50
+ void rb_obj_copy_ivs_to_hash_table(VALUE obj, st_table *table);
51
+ void rb_obj_convert_to_too_complex(VALUE obj, st_table *table);
52
+ void rb_evict_ivars_to_hash(VALUE obj);
53
+
54
+ RUBY_SYMBOL_EXPORT_BEGIN
55
+ /* variable.c (export) */
56
+ void rb_mark_generic_ivar(VALUE obj);
57
+ void rb_ref_update_generic_ivar(VALUE);
58
+ void rb_mv_generic_ivar(VALUE src, VALUE dst);
59
+ VALUE rb_const_missing(VALUE klass, VALUE name);
60
+ int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
61
+ void rb_iv_tbl_copy(VALUE dst, VALUE src);
62
+ RUBY_SYMBOL_EXPORT_END
63
+
64
+ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
65
+ VALUE rb_gvar_get(ID);
66
+ VALUE rb_gvar_set(ID, VALUE);
67
+ VALUE rb_gvar_defined(ID);
68
+ void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
69
+ void rb_ensure_iv_list_size(VALUE obj, uint32_t len, uint32_t newsize);
70
+ attr_index_t rb_obj_ivar_set(VALUE obj, ID id, VALUE val);
71
+
72
+ #endif /* INTERNAL_VARIABLE_H */