datadog-ruby_core_source 3.4.0 → 3.4.1

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 (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.datadog.md +4 -0
  3. data/README.md +8 -5
  4. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/build_assert/build_assert.h +40 -0
  5. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/check_type/check_type.h +63 -0
  6. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/container_of/container_of.h +142 -0
  7. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/list/list.h +791 -0
  8. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ccan/str/str.h +17 -0
  9. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/id.h +352 -0
  10. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/id_table.h +39 -0
  11. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/array.h +152 -0
  12. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/basic_operators.h +65 -0
  13. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/bignum.h +244 -0
  14. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/bits.h +650 -0
  15. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/class.h +283 -0
  16. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/cmdlineopt.h +61 -0
  17. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/compar.h +29 -0
  18. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/compile.h +34 -0
  19. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/compilers.h +107 -0
  20. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/complex.h +29 -0
  21. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/cont.h +35 -0
  22. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/dir.h +16 -0
  23. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/enc.h +19 -0
  24. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/encoding.h +38 -0
  25. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/enum.h +18 -0
  26. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/enumerator.h +21 -0
  27. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/error.h +244 -0
  28. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/eval.h +33 -0
  29. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/file.h +38 -0
  30. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/fixnum.h +185 -0
  31. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/gc.h +333 -0
  32. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/hash.h +193 -0
  33. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/imemo.h +257 -0
  34. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/inits.h +47 -0
  35. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/io.h +143 -0
  36. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/load.h +18 -0
  37. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/loadpath.h +16 -0
  38. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/math.h +23 -0
  39. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/missing.h +19 -0
  40. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/numeric.h +274 -0
  41. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/object.h +63 -0
  42. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/parse.h +131 -0
  43. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/proc.h +30 -0
  44. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/process.h +124 -0
  45. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/ractor.h +10 -0
  46. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/random.h +17 -0
  47. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/range.h +40 -0
  48. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/rational.h +71 -0
  49. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/re.h +28 -0
  50. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/ruby_parser.h +102 -0
  51. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/sanitizers.h +330 -0
  52. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/serial.h +23 -0
  53. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/signal.h +24 -0
  54. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/st.h +11 -0
  55. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/static_assert.h +16 -0
  56. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/string.h +199 -0
  57. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/struct.h +119 -0
  58. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/symbol.h +47 -0
  59. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/thread.h +108 -0
  60. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/time.h +37 -0
  61. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/transcode.h +23 -0
  62. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/util.h +27 -0
  63. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/variable.h +70 -0
  64. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/vm.h +137 -0
  65. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/warnings.h +16 -0
  66. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal.h +108 -0
  67. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/iseq.h +351 -0
  68. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/method.h +258 -0
  69. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/node.h +122 -0
  70. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/parser_st.h +162 -0
  71. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/parser_value.h +106 -0
  72. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/ast.h +7964 -0
  73. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/defines.h +260 -0
  74. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/diagnostic.h +451 -0
  75. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/encoding.h +283 -0
  76. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/extension.h +19 -0
  77. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/node.h +129 -0
  78. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/options.h +442 -0
  79. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/pack.h +163 -0
  80. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/parser.h +933 -0
  81. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/prettyprint.h +34 -0
  82. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/prism.h +383 -0
  83. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/regexp.h +43 -0
  84. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/static_literals.h +121 -0
  85. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_buffer.h +228 -0
  86. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_char.h +204 -0
  87. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_constant_pool.h +218 -0
  88. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_integer.h +126 -0
  89. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_list.h +97 -0
  90. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_memchr.h +29 -0
  91. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_newline_list.h +113 -0
  92. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_string.h +190 -0
  93. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_strncasecmp.h +32 -0
  94. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/util/pm_strpbrk.h +46 -0
  95. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism/version.h +29 -0
  96. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/prism_compile.h +105 -0
  97. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ractor_core.h +382 -0
  98. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ruby_assert.h +14 -0
  99. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ruby_atomic.h +23 -0
  100. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/rubyparser.h +1380 -0
  101. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/shape.h +234 -0
  102. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/thread_none.h +21 -0
  103. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/thread_pthread.h +167 -0
  104. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/vm_core.h +2235 -0
  105. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/vm_debug.h +124 -0
  106. data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/vm_opts.h +67 -0
  107. data/lib/datadog/ruby_core_source/version.rb +1 -1
  108. metadata +105 -2
@@ -0,0 +1,199 @@
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_fstring(VALUE);
34
+ VALUE rb_fstring_cstr(const char *str);
35
+ VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
36
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
37
+ int rb_str_symname_p(VALUE);
38
+ VALUE rb_str_quote_unprintable(VALUE);
39
+ char *rb_str_fill_terminator(VALUE str, const int termlen);
40
+ void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
41
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
42
+ VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
43
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
44
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
45
+ rb_encoding *from, int ecflags, VALUE ecopts);
46
+ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
47
+ VALUE rb_str_escape(VALUE str);
48
+ size_t rb_str_memsize(VALUE);
49
+ char *rb_str_to_cstr(VALUE str);
50
+ const char *ruby_escaped_char(int c);
51
+ void rb_str_make_independent(VALUE str);
52
+ int rb_enc_str_coderange_scan(VALUE str, rb_encoding *enc);
53
+ int rb_ascii8bit_appendable_encoding_index(rb_encoding *enc, unsigned int code);
54
+ VALUE rb_str_include(VALUE str, VALUE arg);
55
+ VALUE rb_str_byte_substr(VALUE str, VALUE beg, VALUE len);
56
+ VALUE rb_str_substr_two_fixnums(VALUE str, VALUE beg, VALUE len, int empty);
57
+ VALUE rb_str_tmp_frozen_no_embed_acquire(VALUE str);
58
+ void rb_str_make_embedded(VALUE);
59
+ VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE);
60
+ size_t rb_str_size_as_embedded(VALUE);
61
+ bool rb_str_reembeddable_p(VALUE);
62
+ VALUE rb_str_upto_endless_each(VALUE, int (*each)(VALUE, VALUE), VALUE);
63
+ VALUE rb_str_with_debug_created_info(VALUE, VALUE, int);
64
+ VALUE rb_str_frozen_bare_string(VALUE);
65
+
66
+ /* error.c */
67
+ void rb_warn_unchilled_literal(VALUE str);
68
+ void rb_warn_unchilled_symbol_to_s(VALUE str);
69
+
70
+ static inline bool STR_EMBED_P(VALUE str);
71
+ static inline bool STR_SHARED_P(VALUE str);
72
+ static inline VALUE QUOTE(VALUE v);
73
+ static inline VALUE QUOTE_ID(ID v);
74
+ static inline bool is_ascii_string(VALUE str);
75
+ static inline bool is_broken_string(VALUE str);
76
+ static inline VALUE rb_str_eql_internal(const VALUE str1, const VALUE str2);
77
+
78
+ RUBY_SYMBOL_EXPORT_BEGIN
79
+ /* string.c (export) */
80
+ VALUE rb_str_tmp_frozen_acquire(VALUE str);
81
+ void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
82
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
83
+ RUBY_SYMBOL_EXPORT_END
84
+
85
+ VALUE rb_fstring_new(const char *ptr, long len);
86
+ VALUE rb_obj_as_string_result(VALUE str, VALUE obj);
87
+ VALUE rb_str_opt_plus(VALUE x, VALUE y);
88
+ VALUE rb_str_concat_literals(size_t num, const VALUE *strary);
89
+ VALUE rb_str_eql(VALUE str1, VALUE str2);
90
+ VALUE rb_id_quote_unprintable(ID);
91
+ VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc);
92
+ VALUE rb_enc_literal_str(const char *ptr, long len, rb_encoding *enc);
93
+
94
+ struct rb_execution_context_struct;
95
+ VALUE rb_ec_str_resurrect(struct rb_execution_context_struct *ec, VALUE str, bool chilled);
96
+
97
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
98
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
99
+ #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
100
+ #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
101
+
102
+ static inline VALUE
103
+ QUOTE(VALUE v)
104
+ {
105
+ return rb_str_quote_unprintable(v);
106
+ }
107
+
108
+ static inline VALUE
109
+ QUOTE_ID(ID i)
110
+ {
111
+ return rb_id_quote_unprintable(i);
112
+ }
113
+
114
+ static inline bool
115
+ STR_EMBED_P(VALUE str)
116
+ {
117
+ return ! FL_TEST_RAW(str, STR_NOEMBED);
118
+ }
119
+
120
+ static inline bool
121
+ STR_SHARED_P(VALUE str)
122
+ {
123
+ return FL_ALL_RAW(str, STR_NOEMBED | STR_SHARED);
124
+ }
125
+
126
+ static inline bool
127
+ CHILLED_STRING_P(VALUE obj)
128
+ {
129
+ return RB_TYPE_P(obj, T_STRING) && FL_TEST_RAW(obj, STR_CHILLED);
130
+ }
131
+
132
+ static inline void
133
+ CHILLED_STRING_MUTATED(VALUE str)
134
+ {
135
+ VALUE chilled_reason = RB_FL_TEST_RAW(str, STR_CHILLED);
136
+ FL_UNSET_RAW(str, STR_CHILLED);
137
+ switch (chilled_reason) {
138
+ case STR_CHILLED_SYMBOL_TO_S:
139
+ rb_warn_unchilled_symbol_to_s(str);
140
+ break;
141
+ case STR_CHILLED_LITERAL:
142
+ rb_warn_unchilled_literal(str);
143
+ break;
144
+ default:
145
+ rb_bug("RString was chilled for multiple reasons");
146
+ }
147
+ }
148
+
149
+ static inline bool
150
+ is_ascii_string(VALUE str)
151
+ {
152
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT;
153
+ }
154
+
155
+ static inline bool
156
+ is_broken_string(VALUE str)
157
+ {
158
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN;
159
+ }
160
+
161
+ static inline bool
162
+ at_char_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
163
+ {
164
+ return rb_enc_left_char_head(s, p, e, enc) == p;
165
+ }
166
+
167
+ static inline bool
168
+ at_char_right_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
169
+ {
170
+ RUBY_ASSERT(s <= p);
171
+ RUBY_ASSERT(p <= e);
172
+
173
+ return rb_enc_right_char_head(s, p, e, enc) == p;
174
+ }
175
+
176
+ /* expect tail call optimization */
177
+ // YJIT needs this function to never allocate and never raise
178
+ static inline VALUE
179
+ rb_str_eql_internal(const VALUE str1, const VALUE str2)
180
+ {
181
+ const long len = RSTRING_LEN(str1);
182
+ const char *ptr1, *ptr2;
183
+
184
+ if (len != RSTRING_LEN(str2)) return Qfalse;
185
+ if (!rb_str_comparable(str1, str2)) return Qfalse;
186
+ if ((ptr1 = RSTRING_PTR(str1)) == (ptr2 = RSTRING_PTR(str2)))
187
+ return Qtrue;
188
+ if (memcmp(ptr1, ptr2, len) == 0)
189
+ return Qtrue;
190
+ return Qfalse;
191
+ }
192
+
193
+ #if __has_builtin(__builtin_constant_p)
194
+ # define rb_fstring_cstr(str) \
195
+ (__builtin_constant_p(str) ? \
196
+ rb_fstring_new((str), (long)strlen(str)) : \
197
+ (rb_fstring_cstr)(str))
198
+ #endif
199
+ #endif /* INTERNAL_STRING_H */
@@ -0,0 +1,119 @@
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 long RSTRUCT_EMBED_LEN(VALUE st);
63
+ static inline long RSTRUCT_LEN(VALUE st);
64
+ static inline int RSTRUCT_LENINT(VALUE st);
65
+ static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st);
66
+ static inline void RSTRUCT_SET(VALUE st, long k, VALUE v);
67
+ static inline VALUE RSTRUCT_GET(VALUE st, long k);
68
+
69
+ static inline long
70
+ RSTRUCT_EMBED_LEN(VALUE st)
71
+ {
72
+ long ret = FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK);
73
+ ret >>= RSTRUCT_EMBED_LEN_SHIFT;
74
+ return ret;
75
+ }
76
+
77
+ static inline long
78
+ RSTRUCT_LEN(VALUE st)
79
+ {
80
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
81
+ return RSTRUCT_EMBED_LEN(st);
82
+ }
83
+ else {
84
+ return RSTRUCT(st)->as.heap.len;
85
+ }
86
+ }
87
+
88
+ static inline int
89
+ RSTRUCT_LENINT(VALUE st)
90
+ {
91
+ return rb_long2int(RSTRUCT_LEN(st));
92
+ }
93
+
94
+ static inline const VALUE *
95
+ RSTRUCT_CONST_PTR(VALUE st)
96
+ {
97
+ const struct RStruct *p = RSTRUCT(st);
98
+
99
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
100
+ return p->as.ary;
101
+ }
102
+ else {
103
+ return p->as.heap.ptr;
104
+ }
105
+ }
106
+
107
+ static inline void
108
+ RSTRUCT_SET(VALUE st, long k, VALUE v)
109
+ {
110
+ RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[k], v);
111
+ }
112
+
113
+ static inline VALUE
114
+ RSTRUCT_GET(VALUE st, long k)
115
+ {
116
+ return RSTRUCT_CONST_PTR(st)[k];
117
+ }
118
+
119
+ #endif /* INTERNAL_STRUCT_H */
@@ -0,0 +1,47 @@
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(void);
21
+ void rb_sym_global_symbols_update_references(void);
22
+ VALUE rb_to_symbol_type(VALUE obj);
23
+ VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
24
+ VALUE rb_sym_intern_ascii(const char *ptr, long len);
25
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
26
+ int rb_is_const_name(VALUE name);
27
+ int rb_is_class_name(VALUE name);
28
+ int rb_is_instance_name(VALUE name);
29
+ int rb_is_local_name(VALUE name);
30
+ PUREFUNC(int rb_is_const_sym(VALUE sym));
31
+ PUREFUNC(int rb_is_attrset_sym(VALUE sym));
32
+ ID rb_make_internal_id(void);
33
+ ID rb_make_temporary_id(size_t n);
34
+ void rb_gc_free_dsymbol(VALUE);
35
+ int rb_static_id_valid_p(ID id);
36
+
37
+ /* vm.c */
38
+ void rb_free_static_symid_str(void);
39
+
40
+ #if __has_builtin(__builtin_constant_p)
41
+ #define rb_sym_intern_ascii_cstr(ptr) \
42
+ (__builtin_constant_p(ptr) ? \
43
+ rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
44
+ rb_sym_intern_ascii_cstr(ptr))
45
+ #endif
46
+
47
+ #endif /* INTERNAL_SYMBOL_H */
@@ -0,0 +1,108 @@
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
+ void rb_ec_check_ints(struct rb_execution_context_struct *ec);
70
+
71
+ RUBY_SYMBOL_EXPORT_BEGIN
72
+
73
+ void *rb_thread_prevent_fork(void *(*func)(void *), void *data); /* for ext/socket/raddrinfo.c */
74
+
75
+ /* Temporary. This API will be removed (renamed). */
76
+ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
77
+ VALUE rb_thread_io_blocking_call(rb_blocking_function_t *func, void *data1, int fd, int events);
78
+
79
+ /* thread.c (export) */
80
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
81
+
82
+ RUBY_SYMBOL_EXPORT_END
83
+
84
+ int rb_threadptr_execute_interrupts(struct rb_thread_struct *th, int blocking_timing);
85
+ bool rb_thread_mn_schedulable(VALUE thread);
86
+
87
+ // interrupt exec
88
+
89
+ typedef VALUE (rb_interrupt_exec_func_t)(void *data);
90
+
91
+ enum rb_interrupt_exec_flag {
92
+ rb_interrupt_exec_flag_none = 0x00,
93
+ rb_interrupt_exec_flag_value_data = 0x01,
94
+ };
95
+
96
+ // interrupt the target_th and run func.
97
+ struct rb_ractor_struct;
98
+
99
+ void rb_threadptr_interrupt_exec(struct rb_thread_struct *target_th,
100
+ rb_interrupt_exec_func_t *func, void *data, enum rb_interrupt_exec_flag flags);
101
+
102
+ // create a thread in the target_r and run func on the created thread.
103
+ void rb_ractor_interrupt_exec(struct rb_ractor_struct *target_r,
104
+ rb_interrupt_exec_func_t *func, void *data, enum rb_interrupt_exec_flag flags);
105
+
106
+ void rb_threadptr_interrupt_exec_task_mark(struct rb_thread_struct *th);
107
+
108
+ #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 */
@@ -0,0 +1,70 @@
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
+ VALUE rb_const_missing(VALUE klass, VALUE name);
58
+ int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
59
+ void rb_iv_tbl_copy(VALUE dst, VALUE src);
60
+ RUBY_SYMBOL_EXPORT_END
61
+
62
+ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
63
+ VALUE rb_gvar_get(ID);
64
+ VALUE rb_gvar_set(ID, VALUE);
65
+ VALUE rb_gvar_defined(ID);
66
+ void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
67
+ void rb_ensure_iv_list_size(VALUE obj, uint32_t len, uint32_t newsize);
68
+ attr_index_t rb_obj_ivar_set(VALUE obj, ID id, VALUE val);
69
+
70
+ #endif /* INTERNAL_VARIABLE_H */