datadog-ruby_core_source 3.4.2 → 3.5.0
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.
- checksums.yaml +4 -4
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/id.h +10 -5
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/id_table.h +15 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/array.h +2 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/basic_operators.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/bignum.h +22 -10
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/bits.h +14 -17
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/box.h +83 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/class.h +806 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/cmdlineopt.h +3 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/concurrent_set.h +21 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/cont.h +0 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/encoding.h +2 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/error.h +7 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/eval.h +10 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/gc.h +32 -5
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/hash.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/imemo.h +87 -22
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/inits.h +4 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/io.h +25 -5
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/load.h +2 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/numeric.h +49 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/object.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/re.h +5 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/sanitizers.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/set_table.h +70 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/signal.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/st.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/string.h +4 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/struct.h +41 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/symbol.h +4 -5
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/thread.h +15 -11
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/time.h +2 -5
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/variable.h +13 -9
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/vm.h +5 -4
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal.h +0 -3
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/iseq.h +10 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/method.h +21 -3
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/ast.h +360 -70
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/diagnostic.h +7 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/extension.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/options.h +49 -3
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/parser.h +3 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/prism.h +40 -15
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/regexp.h +2 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_buffer.h +8 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_integer.h +4 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_list.h +6 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_string.h +12 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/version.h +2 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism_compile.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ractor_core.h +63 -114
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/ruby_atomic.h +73 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/rubyparser.h +15 -2
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/shape.h +464 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/thread_pthread.h +13 -3
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/vm_core.h +228 -57
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- metadata +108 -106
- data/CHANGELOG.datadog.md +0 -19
- data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/class.h +0 -283
- data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ruby_atomic.h +0 -23
- data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/shape.h +0 -234
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/list/list.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/str/str.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/compar.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/compile.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/compilers.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/complex.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/dir.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/enc.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/enum.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/enumerator.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/file.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/fixnum.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/loadpath.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/math.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/missing.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/parse.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/proc.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/process.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/ractor.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/random.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/range.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/rational.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/ruby_parser.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/serial.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/static_assert.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/transcode.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/util.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/warnings.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/node.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/parser_st.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/parser_value.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/defines.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/encoding.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/node.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/pack.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/prettyprint.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/static_literals.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_char.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_constant_pool.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_memchr.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_newline_list.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_strncasecmp.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_strpbrk.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ruby_assert.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/thread_none.h +0 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/vm_debug.h +4 -4
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/vm_opts.h +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#ifndef RUBY_RACTOR_SAFE_TABLE_H
|
|
2
|
+
#define RUBY_RACTOR_SAFE_TABLE_H
|
|
3
|
+
|
|
4
|
+
#include "ruby/atomic.h"
|
|
5
|
+
#include "ruby/ruby.h"
|
|
6
|
+
|
|
7
|
+
struct rb_concurrent_set_funcs {
|
|
8
|
+
VALUE (*hash)(VALUE key);
|
|
9
|
+
bool (*cmp)(VALUE a, VALUE b);
|
|
10
|
+
VALUE (*create)(VALUE key, void *data);
|
|
11
|
+
void (*free)(VALUE key);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
VALUE rb_concurrent_set_new(const struct rb_concurrent_set_funcs *funcs, int capacity);
|
|
15
|
+
rb_atomic_t rb_concurrent_set_size(VALUE set_obj);
|
|
16
|
+
VALUE rb_concurrent_set_find(VALUE *set_obj_ptr, VALUE key);
|
|
17
|
+
VALUE rb_concurrent_set_find_or_insert(VALUE *set_obj_ptr, VALUE key, void *data);
|
|
18
|
+
VALUE rb_concurrent_set_delete_by_identity(VALUE set_obj, VALUE key);
|
|
19
|
+
void rb_concurrent_set_foreach_with_replace(VALUE set_obj, int (*callback)(VALUE *key, void *data), void *data);
|
|
20
|
+
|
|
21
|
+
#endif
|
|
@@ -31,5 +31,4 @@ VALUE rb_fiber_inherit_storage(struct rb_execution_context_struct *ec, struct rb
|
|
|
31
31
|
VALUE rb_fiberptr_self(struct rb_fiber_struct *fiber);
|
|
32
32
|
unsigned int rb_fiberptr_blocking(struct rb_fiber_struct *fiber);
|
|
33
33
|
struct rb_execution_context_struct * rb_fiberptr_get_ec(struct rb_fiber_struct *fiber);
|
|
34
|
-
|
|
35
34
|
#endif /* INTERNAL_CONT_H */
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#include "ruby/ruby.h" /* for ID */
|
|
12
12
|
#include "ruby/encoding.h" /* for rb_encoding */
|
|
13
13
|
|
|
14
|
-
#define rb_enc_autoload_p(enc) (!rb_enc_mbmaxlen(enc))
|
|
15
14
|
#define rb_is_usascii_enc(enc) ((enc) == rb_usascii_encoding())
|
|
16
15
|
#define rb_is_ascii8bit_enc(enc) ((enc) == rb_ascii8bit_encoding())
|
|
17
16
|
#define rb_is_locale_enc(enc) ((enc) == rb_locale_encoding())
|
|
@@ -24,11 +23,13 @@ rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
|
|
|
24
23
|
int rb_encdb_replicate(const char *alias, const char *orig);
|
|
25
24
|
int rb_encdb_alias(const char *alias, const char *orig);
|
|
26
25
|
int rb_enc_autoload(rb_encoding *enc);
|
|
26
|
+
bool rb_enc_autoload_p(rb_encoding *enc);
|
|
27
27
|
int rb_encdb_dummy(const char *name);
|
|
28
28
|
void rb_encdb_declare(const char *name);
|
|
29
29
|
void rb_enc_set_base(const char *name, const char *orig);
|
|
30
30
|
int rb_enc_set_dummy(int index);
|
|
31
31
|
void rb_enc_raw_set(VALUE obj, rb_encoding *enc);
|
|
32
|
+
int rb_enc_registered(const char *name);
|
|
32
33
|
|
|
33
34
|
PUREFUNC(int rb_data_is_encoding(VALUE obj));
|
|
34
35
|
|
|
@@ -241,4 +241,11 @@ rb_typeddata_is_instance_of_inline(VALUE obj, const rb_data_type_t *data_type)
|
|
|
241
241
|
return RB_TYPE_P(obj, T_DATA) && RTYPEDDATA_P(obj) && (RTYPEDDATA_TYPE(obj) == data_type);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
typedef enum {
|
|
245
|
+
rb_stack_overflow_prevention = 0, // VM stack overflow or about to machine stack overflow
|
|
246
|
+
rb_stack_overflow_signal = 1, // machine stack overflow but may be recoverable
|
|
247
|
+
rb_stack_overflow_fatal = 2, // fatal machine stack overflow
|
|
248
|
+
} ruby_stack_overflow_critical_level;
|
|
249
|
+
NORETURN(void rb_ec_stack_overflow(struct rb_execution_context_struct *ec, ruby_stack_overflow_critical_level crit));
|
|
250
|
+
|
|
244
251
|
#endif /* INTERNAL_ERROR_H */
|
|
@@ -11,17 +11,27 @@
|
|
|
11
11
|
* header (related to this file, but not the same role).
|
|
12
12
|
*/
|
|
13
13
|
#include "ruby/ruby.h" /* for ID */
|
|
14
|
+
#include "vm_core.h" /* for ID */
|
|
14
15
|
|
|
15
16
|
#define id_signo ruby_static_id_signo
|
|
16
17
|
#define id_status ruby_static_id_status
|
|
17
18
|
|
|
18
19
|
/* eval.c */
|
|
20
|
+
struct rb_refinements_data {
|
|
21
|
+
VALUE refinement;
|
|
22
|
+
VALUE refinements;
|
|
23
|
+
};
|
|
24
|
+
|
|
19
25
|
extern ID ruby_static_id_signo;
|
|
20
26
|
extern ID ruby_static_id_status;
|
|
21
27
|
VALUE rb_refinement_module_get_refined_class(VALUE module);
|
|
22
28
|
void rb_class_modify_check(VALUE);
|
|
23
29
|
NORETURN(VALUE rb_f_raise(int argc, VALUE *argv));
|
|
30
|
+
VALUE rb_exception_setup(int argc, VALUE *argv);
|
|
31
|
+
void rb_refinement_setup(struct rb_refinements_data *data, VALUE module, VALUE klass);
|
|
32
|
+
void rb_vm_using_module(VALUE module);
|
|
24
33
|
VALUE rb_top_main_class(const char *method);
|
|
34
|
+
VALUE rb_ec_ensure(rb_execution_context_t *ec, VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2);
|
|
25
35
|
|
|
26
36
|
/* eval_error.c */
|
|
27
37
|
VALUE rb_get_backtrace(VALUE info);
|
|
@@ -122,10 +122,12 @@ const char *rb_raw_obj_info(char *const buff, const size_t buff_size, VALUE obj)
|
|
|
122
122
|
struct rb_execution_context_struct; /* in vm_core.h */
|
|
123
123
|
struct rb_objspace; /* in vm_core.h */
|
|
124
124
|
|
|
125
|
-
#define
|
|
125
|
+
#define NEWOBJ_OF_WITH_SHAPE(var, T, c, f, shape_id, s, ec) \
|
|
126
126
|
T *(var) = (T *)(((f) & FL_WB_PROTECTED) ? \
|
|
127
|
-
rb_wb_protected_newobj_of((ec ? ec : GET_EC()), (c), (f) & ~FL_WB_PROTECTED, s) : \
|
|
128
|
-
rb_wb_unprotected_newobj_of((c), (f), s))
|
|
127
|
+
rb_wb_protected_newobj_of((ec ? ec : GET_EC()), (c), (f) & ~FL_WB_PROTECTED, shape_id, s) : \
|
|
128
|
+
rb_wb_unprotected_newobj_of((c), (f), shape_id, s))
|
|
129
|
+
|
|
130
|
+
#define NEWOBJ_OF(var, T, c, f, s, ec) NEWOBJ_OF_WITH_SHAPE(var, T, c, f, 0 /* ROOT_SHAPE_ID */, s, ec)
|
|
129
131
|
|
|
130
132
|
#ifndef RB_GC_OBJECT_METADATA_ENTRY_DEFINED
|
|
131
133
|
# define RB_GC_OBJECT_METADATA_ENTRY_DEFINED
|
|
@@ -201,6 +203,7 @@ RUBY_ATTR_MALLOC void *rb_xcalloc_mul_add_mul(size_t, size_t, size_t, size_t);
|
|
|
201
203
|
static inline void *ruby_sized_xrealloc_inlined(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
|
|
202
204
|
static inline void *ruby_sized_xrealloc2_inlined(void *ptr, size_t new_count, size_t elemsiz, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
|
|
203
205
|
static inline void ruby_sized_xfree_inlined(void *ptr, size_t size);
|
|
206
|
+
void rb_gc_obj_id_moved(VALUE obj);
|
|
204
207
|
|
|
205
208
|
void *rb_gc_ractor_cache_alloc(rb_ractor_t *ractor);
|
|
206
209
|
void rb_gc_ractor_cache_free(void *cache);
|
|
@@ -247,8 +250,8 @@ VALUE rb_gc_disable_no_rest(void);
|
|
|
247
250
|
|
|
248
251
|
/* gc.c (export) */
|
|
249
252
|
const char *rb_objspace_data_type_name(VALUE obj);
|
|
250
|
-
VALUE rb_wb_protected_newobj_of(struct rb_execution_context_struct *, VALUE, VALUE, size_t);
|
|
251
|
-
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE, size_t);
|
|
253
|
+
VALUE rb_wb_protected_newobj_of(struct rb_execution_context_struct *, VALUE, VALUE, uint32_t /* shape_id_t */, size_t);
|
|
254
|
+
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE, uint32_t /* shape_id_t */, size_t);
|
|
252
255
|
size_t rb_obj_memsize_of(VALUE);
|
|
253
256
|
struct rb_gc_object_metadata_entry *rb_gc_object_metadata(VALUE obj);
|
|
254
257
|
void rb_gc_mark_values(long n, const VALUE *values);
|
|
@@ -263,6 +266,26 @@ int rb_gc_modular_gc_loaded_p(void);
|
|
|
263
266
|
|
|
264
267
|
RUBY_SYMBOL_EXPORT_END
|
|
265
268
|
|
|
269
|
+
static inline VALUE
|
|
270
|
+
rb_obj_atomic_write(
|
|
271
|
+
VALUE a, VALUE *slot, VALUE b,
|
|
272
|
+
RBIMPL_ATTR_MAYBE_UNUSED()
|
|
273
|
+
const char *filename,
|
|
274
|
+
RBIMPL_ATTR_MAYBE_UNUSED()
|
|
275
|
+
int line)
|
|
276
|
+
{
|
|
277
|
+
#ifdef RGENGC_LOGGING_WRITE
|
|
278
|
+
RGENGC_LOGGING_WRITE(a, slot, b, filename, line);
|
|
279
|
+
#endif
|
|
280
|
+
|
|
281
|
+
RUBY_ATOMIC_VALUE_SET(*slot, b);
|
|
282
|
+
|
|
283
|
+
rb_obj_written(a, RUBY_Qundef /* ignore `oldv' now */, b, filename, line);
|
|
284
|
+
return a;
|
|
285
|
+
}
|
|
286
|
+
#define RB_OBJ_ATOMIC_WRITE(old, slot, young) \
|
|
287
|
+
RBIMPL_CAST(rb_obj_atomic_write((VALUE)(old), (VALUE *)(slot), (VALUE)(young), __FILE__, __LINE__))
|
|
288
|
+
|
|
266
289
|
int rb_ec_stack_check(struct rb_execution_context_struct *ec);
|
|
267
290
|
void rb_gc_writebarrier_remember(VALUE obj);
|
|
268
291
|
const char *rb_obj_info(VALUE obj);
|
|
@@ -330,4 +353,8 @@ ruby_sized_realloc_n(void *ptr, size_t new_count, size_t element_size, size_t ol
|
|
|
330
353
|
#define ruby_sized_xrealloc ruby_sized_xrealloc_inlined
|
|
331
354
|
#define ruby_sized_xrealloc2 ruby_sized_xrealloc2_inlined
|
|
332
355
|
#define ruby_sized_xfree ruby_sized_xfree_inlined
|
|
356
|
+
|
|
357
|
+
void rb_gc_verify_shareable(VALUE);
|
|
358
|
+
bool rb_gc_checking_shareable(void);
|
|
359
|
+
|
|
333
360
|
#endif /* INTERNAL_GC_H */
|
|
@@ -72,6 +72,7 @@ struct RHash {
|
|
|
72
72
|
/* hash.c */
|
|
73
73
|
void rb_hash_st_table_set(VALUE hash, st_table *st);
|
|
74
74
|
VALUE rb_hash_default_value(VALUE hash, VALUE key);
|
|
75
|
+
VALUE rb_hash_set_default(VALUE hash, VALUE ifnone);
|
|
75
76
|
VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
|
|
76
77
|
long rb_dbl_long_hash(double d);
|
|
77
78
|
st_table *rb_init_identtable(void);
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
#include "ruby/internal/config.h"
|
|
12
12
|
#include <stddef.h> /* for size_t */
|
|
13
|
+
#include "id_table.h"
|
|
13
14
|
#include "internal/array.h" /* for rb_ary_hidden_new_fill */
|
|
14
15
|
#include "ruby/internal/stdbool.h" /* for bool */
|
|
15
16
|
#include "ruby/ruby.h" /* for rb_block_call_func_t */
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
#define IMEMO_FL_USER3 FL_USER7
|
|
25
26
|
#define IMEMO_FL_USER4 FL_USER8
|
|
26
27
|
#define IMEMO_FL_USER5 FL_USER9
|
|
28
|
+
#define IMEMO_FL_USER6 FL_USER10
|
|
27
29
|
|
|
28
30
|
enum imemo_type {
|
|
29
31
|
imemo_env = 0,
|
|
@@ -35,11 +37,10 @@ enum imemo_type {
|
|
|
35
37
|
imemo_ment = 6,
|
|
36
38
|
imemo_iseq = 7,
|
|
37
39
|
imemo_tmpbuf = 8,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
imemo_constcache = 13,
|
|
40
|
+
imemo_callinfo = 10,
|
|
41
|
+
imemo_callcache = 11,
|
|
42
|
+
imemo_constcache = 12,
|
|
43
|
+
imemo_fields = 13,
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
/* CREF (Class REFerence) is defined in method.h */
|
|
@@ -92,9 +93,7 @@ struct vm_ifunc {
|
|
|
92
93
|
|
|
93
94
|
struct rb_imemo_tmpbuf_struct {
|
|
94
95
|
VALUE flags;
|
|
95
|
-
VALUE reserved;
|
|
96
96
|
VALUE *ptr; /* malloc'ed buffer */
|
|
97
|
-
struct rb_imemo_tmpbuf_struct *next; /* next imemo */
|
|
98
97
|
size_t cnt; /* buffer size in VALUE */
|
|
99
98
|
};
|
|
100
99
|
|
|
@@ -115,7 +114,8 @@ struct MEMO {
|
|
|
115
114
|
} u3;
|
|
116
115
|
};
|
|
117
116
|
|
|
118
|
-
#define IMEMO_NEW(T, type, v0) ((T *)rb_imemo_new((type), (v0), sizeof(T)))
|
|
117
|
+
#define IMEMO_NEW(T, type, v0) ((T *)rb_imemo_new((type), (v0), sizeof(T), false))
|
|
118
|
+
#define SHAREABLE_IMEMO_NEW(T, type, v0) ((T *)rb_imemo_new((type), (v0), sizeof(T), true))
|
|
119
119
|
|
|
120
120
|
/* ment is in method.h */
|
|
121
121
|
|
|
@@ -132,27 +132,23 @@ struct MEMO {
|
|
|
132
132
|
#ifndef RUBY_RUBYPARSER_H
|
|
133
133
|
typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
|
|
134
134
|
#endif
|
|
135
|
-
|
|
135
|
+
VALUE rb_imemo_new(enum imemo_type type, VALUE v0, size_t size, bool is_shareable);
|
|
136
|
+
VALUE rb_imemo_tmpbuf_new(void);
|
|
136
137
|
struct vm_ifunc *rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc);
|
|
137
138
|
static inline enum imemo_type imemo_type(VALUE imemo);
|
|
138
139
|
static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
|
|
139
140
|
static inline bool imemo_throw_data_p(VALUE imemo);
|
|
140
141
|
static inline struct vm_ifunc *rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data);
|
|
141
|
-
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer(void);
|
|
142
142
|
static inline void *RB_IMEMO_TMPBUF_PTR(VALUE v);
|
|
143
143
|
static inline void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
|
|
144
|
-
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str);
|
|
145
144
|
static inline void MEMO_V1_SET(struct MEMO *m, VALUE v);
|
|
146
145
|
static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
|
|
147
146
|
|
|
148
147
|
size_t rb_imemo_memsize(VALUE obj);
|
|
149
|
-
void rb_cc_table_mark(VALUE klass);
|
|
150
148
|
void rb_imemo_mark_and_move(VALUE obj, bool reference_updating);
|
|
151
|
-
void rb_cc_table_free(VALUE klass);
|
|
152
149
|
void rb_imemo_free(VALUE obj);
|
|
153
150
|
|
|
154
151
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
155
|
-
VALUE rb_imemo_new(enum imemo_type type, VALUE v0, size_t size);
|
|
156
152
|
const char *rb_imemo_name(enum imemo_type type);
|
|
157
153
|
RUBY_SYMBOL_EXPORT_END
|
|
158
154
|
|
|
@@ -202,12 +198,6 @@ rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data)
|
|
|
202
198
|
return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
|
|
203
199
|
}
|
|
204
200
|
|
|
205
|
-
static inline VALUE
|
|
206
|
-
rb_imemo_tmpbuf_auto_free_pointer(void)
|
|
207
|
-
{
|
|
208
|
-
return rb_imemo_new(imemo_tmpbuf, 0, sizeof(rb_imemo_tmpbuf_t));
|
|
209
|
-
}
|
|
210
|
-
|
|
211
201
|
static inline void *
|
|
212
202
|
RB_IMEMO_TMPBUF_PTR(VALUE v)
|
|
213
203
|
{
|
|
@@ -222,7 +212,7 @@ rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr)
|
|
|
222
212
|
}
|
|
223
213
|
|
|
224
214
|
static inline VALUE
|
|
225
|
-
|
|
215
|
+
rb_imemo_tmpbuf_new_from_an_RString(VALUE str)
|
|
226
216
|
{
|
|
227
217
|
const void *src;
|
|
228
218
|
VALUE imemo;
|
|
@@ -232,7 +222,7 @@ rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str)
|
|
|
232
222
|
|
|
233
223
|
StringValue(str);
|
|
234
224
|
/* create tmpbuf to keep the pointer before xmalloc */
|
|
235
|
-
imemo =
|
|
225
|
+
imemo = rb_imemo_tmpbuf_new();
|
|
236
226
|
tmpbuf = (rb_imemo_tmpbuf_t *)imemo;
|
|
237
227
|
len = RSTRING_LEN(str);
|
|
238
228
|
src = RSTRING_PTR(str);
|
|
@@ -254,4 +244,79 @@ MEMO_V2_SET(struct MEMO *m, VALUE v)
|
|
|
254
244
|
RB_OBJ_WRITE(m, &m->v2, v);
|
|
255
245
|
}
|
|
256
246
|
|
|
247
|
+
struct rb_fields {
|
|
248
|
+
struct RBasic basic;
|
|
249
|
+
union {
|
|
250
|
+
struct {
|
|
251
|
+
VALUE fields[1];
|
|
252
|
+
} embed;
|
|
253
|
+
struct {
|
|
254
|
+
VALUE *ptr;
|
|
255
|
+
} external;
|
|
256
|
+
struct {
|
|
257
|
+
// Note: the st_table could be embedded, but complex T_CLASS should be rare to
|
|
258
|
+
// non-existent, so not really worth the trouble.
|
|
259
|
+
st_table *table;
|
|
260
|
+
} complex;
|
|
261
|
+
} as;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// IMEMO/fields and T_OBJECT have exactly the same layout.
|
|
265
|
+
// This is useful for JIT and common codepaths.
|
|
266
|
+
#define OBJ_FIELD_HEAP ROBJECT_HEAP
|
|
267
|
+
STATIC_ASSERT(imemo_fields_flags, OBJ_FIELD_HEAP == IMEMO_FL_USER0);
|
|
268
|
+
STATIC_ASSERT(imemo_fields_embed_offset, offsetof(struct RObject, as.ary) == offsetof(struct rb_fields, as.embed.fields));
|
|
269
|
+
STATIC_ASSERT(imemo_fields_embed_offset, offsetof(struct RObject, as.heap.fields) == offsetof(struct rb_fields, as.external.ptr));
|
|
270
|
+
STATIC_ASSERT(imemo_fields_embed_offset, offsetof(struct RObject, as.heap.fields) == offsetof(struct rb_fields, as.complex.table));
|
|
271
|
+
|
|
272
|
+
#define IMEMO_OBJ_FIELDS(fields) ((struct rb_fields *)fields)
|
|
273
|
+
|
|
274
|
+
VALUE rb_imemo_fields_new(VALUE owner, size_t capa, bool shareable);
|
|
275
|
+
VALUE rb_imemo_fields_new_complex(VALUE owner, size_t capa, bool shareable);
|
|
276
|
+
VALUE rb_imemo_fields_new_complex_tbl(VALUE owner, st_table *tbl, bool shareable);
|
|
277
|
+
VALUE rb_imemo_fields_clone(VALUE fields_obj);
|
|
278
|
+
void rb_imemo_fields_clear(VALUE fields_obj);
|
|
279
|
+
|
|
280
|
+
static inline VALUE
|
|
281
|
+
rb_imemo_fields_owner(VALUE fields_obj)
|
|
282
|
+
{
|
|
283
|
+
RUBY_ASSERT(IMEMO_TYPE_P(fields_obj, imemo_fields));
|
|
284
|
+
|
|
285
|
+
return CLASS_OF(fields_obj);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
static inline VALUE *
|
|
289
|
+
rb_imemo_fields_ptr(VALUE fields_obj)
|
|
290
|
+
{
|
|
291
|
+
if (!fields_obj) {
|
|
292
|
+
return NULL;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
RUBY_ASSERT(IMEMO_TYPE_P(fields_obj, imemo_fields) || RB_TYPE_P(fields_obj, T_OBJECT));
|
|
296
|
+
|
|
297
|
+
if (UNLIKELY(FL_TEST_RAW(fields_obj, OBJ_FIELD_HEAP))) {
|
|
298
|
+
return IMEMO_OBJ_FIELDS(fields_obj)->as.external.ptr;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
return IMEMO_OBJ_FIELDS(fields_obj)->as.embed.fields;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
static inline st_table *
|
|
306
|
+
rb_imemo_fields_complex_tbl(VALUE fields_obj)
|
|
307
|
+
{
|
|
308
|
+
if (!fields_obj) {
|
|
309
|
+
return NULL;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
RUBY_ASSERT(IMEMO_TYPE_P(fields_obj, imemo_fields) || RB_TYPE_P(fields_obj, T_OBJECT));
|
|
313
|
+
RUBY_ASSERT(FL_TEST_RAW(fields_obj, OBJ_FIELD_HEAP));
|
|
314
|
+
|
|
315
|
+
// Some codepaths unconditionally access the fields_ptr, and assume it can be used as st_table if the
|
|
316
|
+
// shape is too_complex.
|
|
317
|
+
RUBY_ASSERT((st_table *)rb_imemo_fields_ptr(fields_obj) == IMEMO_OBJ_FIELDS(fields_obj)->as.complex.table);
|
|
318
|
+
|
|
319
|
+
return IMEMO_OBJ_FIELDS(fields_obj)->as.complex.table;
|
|
320
|
+
}
|
|
321
|
+
|
|
257
322
|
#endif /* INTERNAL_IMEMO_H */
|
|
@@ -14,10 +14,21 @@
|
|
|
14
14
|
struct rb_io;
|
|
15
15
|
|
|
16
16
|
#include "ruby/io.h" /* for rb_io_t */
|
|
17
|
+
#include "ccan/list/list.h"
|
|
18
|
+
#include "serial.h"
|
|
17
19
|
|
|
18
20
|
#define IO_WITHOUT_GVL(func, arg) rb_nogvl(func, arg, RUBY_UBF_IO, 0, RB_NOGVL_OFFLOAD_SAFE)
|
|
19
21
|
#define IO_WITHOUT_GVL_INT(func, arg) (int)(VALUE)IO_WITHOUT_GVL(func, arg)
|
|
20
22
|
|
|
23
|
+
// Represents an in-flight blocking operation:
|
|
24
|
+
struct rb_io_blocking_operation {
|
|
25
|
+
// The linked list data structure.
|
|
26
|
+
struct ccan_list_node list;
|
|
27
|
+
|
|
28
|
+
// The execution context of the blocking operation.
|
|
29
|
+
struct rb_execution_context_struct *ec;
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
/** Ruby's IO, metadata and buffers. */
|
|
22
33
|
struct rb_io {
|
|
23
34
|
|
|
@@ -111,6 +122,18 @@ struct rb_io {
|
|
|
111
122
|
* The timeout associated with this IO when performing blocking operations.
|
|
112
123
|
*/
|
|
113
124
|
VALUE timeout;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Threads that are performing a blocking operation without the GVL using
|
|
128
|
+
* this IO. On calling IO#close, these threads will be interrupted so that
|
|
129
|
+
* the operation can be cancelled.
|
|
130
|
+
*/
|
|
131
|
+
struct ccan_list_head blocking_operations;
|
|
132
|
+
struct rb_execution_context_struct *closing_ec;
|
|
133
|
+
VALUE wakeup_mutex;
|
|
134
|
+
|
|
135
|
+
// The fork generation of the blocking operations list.
|
|
136
|
+
rb_serial_t fork_generation;
|
|
114
137
|
};
|
|
115
138
|
|
|
116
139
|
/* io.c */
|
|
@@ -119,17 +142,14 @@ void rb_stdio_set_default_encoding(void);
|
|
|
119
142
|
VALUE rb_io_flush_raw(VALUE, int);
|
|
120
143
|
size_t rb_io_memsize(const rb_io_t *);
|
|
121
144
|
int rb_stderr_tty_p(void);
|
|
122
|
-
void rb_io_fptr_finalize_internal(void *ptr);
|
|
123
|
-
#ifdef rb_io_fptr_finalize
|
|
124
|
-
# undef rb_io_fptr_finalize
|
|
125
|
-
#endif
|
|
126
|
-
#define rb_io_fptr_finalize rb_io_fptr_finalize_internal
|
|
127
145
|
VALUE rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt);
|
|
128
146
|
|
|
129
147
|
VALUE rb_io_prep_stdin(void);
|
|
130
148
|
VALUE rb_io_prep_stdout(void);
|
|
131
149
|
VALUE rb_io_prep_stderr(void);
|
|
132
150
|
|
|
151
|
+
int rb_io_notify_close(struct rb_io *fptr);
|
|
152
|
+
|
|
133
153
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
134
154
|
/* io.c (export) */
|
|
135
155
|
void rb_maygvl_fd_fix_cloexec(int fd);
|
|
@@ -85,6 +85,7 @@ VALUE rb_int_cmp(VALUE x, VALUE y);
|
|
|
85
85
|
VALUE rb_int_equal(VALUE x, VALUE y);
|
|
86
86
|
VALUE rb_int_divmod(VALUE x, VALUE y);
|
|
87
87
|
VALUE rb_int_and(VALUE x, VALUE y);
|
|
88
|
+
VALUE rb_int_xor(VALUE x, VALUE y);
|
|
88
89
|
VALUE rb_int_lshift(VALUE x, VALUE y);
|
|
89
90
|
VALUE rb_int_rshift(VALUE x, VALUE y);
|
|
90
91
|
VALUE rb_int_div(VALUE x, VALUE y);
|
|
@@ -126,6 +127,54 @@ VALUE rb_int_bit_length(VALUE num);
|
|
|
126
127
|
VALUE rb_int_uminus(VALUE num);
|
|
127
128
|
VALUE rb_int_comp(VALUE num);
|
|
128
129
|
|
|
130
|
+
// Unified 128-bit integer structures that work with or without native support:
|
|
131
|
+
union rb_uint128 {
|
|
132
|
+
#ifdef WORDS_BIGENDIAN
|
|
133
|
+
struct {
|
|
134
|
+
uint64_t high;
|
|
135
|
+
uint64_t low;
|
|
136
|
+
} parts;
|
|
137
|
+
#else
|
|
138
|
+
struct {
|
|
139
|
+
uint64_t low;
|
|
140
|
+
uint64_t high;
|
|
141
|
+
} parts;
|
|
142
|
+
#endif
|
|
143
|
+
#ifdef HAVE_UINT128_T
|
|
144
|
+
uint128_t value;
|
|
145
|
+
#endif
|
|
146
|
+
};
|
|
147
|
+
typedef union rb_uint128 rb_uint128_t;
|
|
148
|
+
|
|
149
|
+
union rb_int128 {
|
|
150
|
+
#ifdef WORDS_BIGENDIAN
|
|
151
|
+
struct {
|
|
152
|
+
uint64_t high;
|
|
153
|
+
uint64_t low;
|
|
154
|
+
} parts;
|
|
155
|
+
#else
|
|
156
|
+
struct {
|
|
157
|
+
uint64_t low;
|
|
158
|
+
uint64_t high;
|
|
159
|
+
} parts;
|
|
160
|
+
#endif
|
|
161
|
+
#ifdef HAVE_UINT128_T
|
|
162
|
+
int128_t value;
|
|
163
|
+
#endif
|
|
164
|
+
};
|
|
165
|
+
typedef union rb_int128 rb_int128_t;
|
|
166
|
+
|
|
167
|
+
union uint128_int128_conversion {
|
|
168
|
+
rb_uint128_t uint128;
|
|
169
|
+
rb_int128_t int128;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Conversion functions for 128-bit integers:
|
|
173
|
+
rb_uint128_t rb_numeric_to_uint128(VALUE x);
|
|
174
|
+
rb_int128_t rb_numeric_to_int128(VALUE x);
|
|
175
|
+
VALUE rb_uint128_to_numeric(rb_uint128_t n);
|
|
176
|
+
VALUE rb_int128_to_numeric(rb_int128_t n);
|
|
177
|
+
|
|
129
178
|
static inline bool
|
|
130
179
|
INT_POSITIVE_P(VALUE num)
|
|
131
180
|
{
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include "ruby/ruby.h" /* for VALUE */
|
|
12
12
|
|
|
13
13
|
/* object.c */
|
|
14
|
-
size_t rb_obj_embedded_size(uint32_t
|
|
14
|
+
size_t rb_obj_embedded_size(uint32_t fields_count);
|
|
15
15
|
VALUE rb_class_allocate_instance(VALUE klass);
|
|
16
16
|
VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
|
|
17
17
|
NORETURN(void rb_undefined_alloc(VALUE klass));
|
|
@@ -25,4 +25,9 @@ int rb_match_count(VALUE match);
|
|
|
25
25
|
VALUE rb_reg_new_ary(VALUE ary, int options);
|
|
26
26
|
VALUE rb_reg_last_defined(VALUE match);
|
|
27
27
|
|
|
28
|
+
#define ARG_REG_OPTION_MASK \
|
|
29
|
+
(ONIG_OPTION_IGNORECASE|ONIG_OPTION_MULTILINE|ONIG_OPTION_EXTEND)
|
|
30
|
+
#define ARG_ENCODING_FIXED 16
|
|
31
|
+
#define ARG_ENCODING_NONE 32
|
|
32
|
+
|
|
28
33
|
#endif /* INTERNAL_RE_H */
|
data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/sanitizers.h
RENAMED
|
@@ -29,6 +29,13 @@
|
|
|
29
29
|
# endif
|
|
30
30
|
#endif
|
|
31
31
|
|
|
32
|
+
#ifdef HAVE_SANITIZER_TSAN_INTERFACE_H
|
|
33
|
+
# if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)
|
|
34
|
+
# define RUBY_TSAN_ENABLED
|
|
35
|
+
# include <sanitizer/tsan_interface.h>
|
|
36
|
+
# endif
|
|
37
|
+
#endif
|
|
38
|
+
|
|
32
39
|
#include "ruby/internal/stdbool.h" /* for bool */
|
|
33
40
|
#include "ruby/ruby.h" /* for VALUE */
|
|
34
41
|
|
|
@@ -42,6 +49,9 @@
|
|
|
42
49
|
#elif defined(RUBY_MSAN_ENABLED)
|
|
43
50
|
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
|
44
51
|
__attribute__((__no_sanitize__("memory"), __noinline__)) x
|
|
52
|
+
#elif defined(RUBY_TSAN_ENABLED)
|
|
53
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
|
54
|
+
__attribute__((__no_sanitize__("thread"), __noinline__)) x
|
|
45
55
|
#elif defined(NO_SANITIZE_ADDRESS)
|
|
46
56
|
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
|
47
57
|
NO_SANITIZE_ADDRESS(NOINLINE(x))
|
|
@@ -127,6 +137,7 @@ asan_poison_memory_region(const volatile void *ptr, size_t size)
|
|
|
127
137
|
#define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj))
|
|
128
138
|
#endif
|
|
129
139
|
|
|
140
|
+
#ifdef RUBY_ASAN_ENABLED
|
|
130
141
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
131
142
|
/**
|
|
132
143
|
* This is a variant of asan_poison_memory_region that takes a VALUE.
|
|
@@ -153,6 +164,11 @@ void *rb_asan_poisoned_object_p(VALUE obj);
|
|
|
153
164
|
void rb_asan_unpoison_object(VALUE obj, bool newobj_p);
|
|
154
165
|
|
|
155
166
|
RUBY_SYMBOL_EXPORT_END
|
|
167
|
+
#else
|
|
168
|
+
# define rb_asan_poison_object(obj) ((void)obj)
|
|
169
|
+
# define rb_asan_poisoned_object_p(obj) ((void)obj, NULL)
|
|
170
|
+
# define rb_asan_unpoison_object(obj, newobj_p) ((void)obj, (void)newobj_p)
|
|
171
|
+
#endif
|
|
156
172
|
|
|
157
173
|
/**
|
|
158
174
|
* This function asserts that a (formally poisoned) memory region from ptr to
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#ifndef INTERNAL_SET_TABLE_H
|
|
2
|
+
#define INTERNAL_SET_TABLE_H
|
|
3
|
+
|
|
4
|
+
#include "ruby/st.h"
|
|
5
|
+
|
|
6
|
+
struct set_table_entry;
|
|
7
|
+
|
|
8
|
+
typedef struct set_table_entry set_table_entry;
|
|
9
|
+
|
|
10
|
+
struct set_table {
|
|
11
|
+
/* Cached features of the table -- see st.c for more details. */
|
|
12
|
+
unsigned char entry_power, bin_power, size_ind;
|
|
13
|
+
/* How many times the table was rebuilt. */
|
|
14
|
+
unsigned int rebuilds_num;
|
|
15
|
+
const struct st_hash_type *type;
|
|
16
|
+
/* Number of entries currently in the table. */
|
|
17
|
+
st_index_t num_entries;
|
|
18
|
+
|
|
19
|
+
/* Start and bound index of entries in array entries.
|
|
20
|
+
entries_starts and entries_bound are in interval
|
|
21
|
+
[0,allocated_entries]. */
|
|
22
|
+
st_index_t entries_start, entries_bound;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Array of size 2^entry_power.
|
|
26
|
+
* Followed by st_index_t *bins, Array of bins used for access by keys.
|
|
27
|
+
*/
|
|
28
|
+
set_table_entry *entries;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
typedef struct set_table set_table;
|
|
32
|
+
|
|
33
|
+
typedef int set_foreach_callback_func(st_data_t, st_data_t);
|
|
34
|
+
typedef int set_foreach_check_callback_func(st_data_t, st_data_t, int);
|
|
35
|
+
typedef int set_update_callback_func(st_data_t *key, st_data_t arg, int existing);
|
|
36
|
+
|
|
37
|
+
#define set_table_size rb_set_table_size
|
|
38
|
+
size_t rb_set_table_size(const struct set_table *tbl);
|
|
39
|
+
#define set_init_table_with_size rb_set_init_table_with_size
|
|
40
|
+
set_table *rb_set_init_table_with_size(set_table *tab, const struct st_hash_type *, st_index_t);
|
|
41
|
+
#define set_init_numtable rb_set_init_numtable
|
|
42
|
+
set_table *rb_set_init_numtable(void);
|
|
43
|
+
#define set_init_numtable_with_size rb_set_init_numtable_with_size
|
|
44
|
+
set_table *rb_set_init_numtable_with_size(st_index_t size);
|
|
45
|
+
#define set_table_delete rb_set_table_delete
|
|
46
|
+
int rb_set_table_delete(set_table *, st_data_t *); /* returns 0:notfound 1:deleted */
|
|
47
|
+
#define set_insert rb_set_insert
|
|
48
|
+
int rb_set_insert(set_table *, st_data_t);
|
|
49
|
+
#define set_table_lookup rb_set_table_lookup
|
|
50
|
+
int rb_set_table_lookup(set_table *, st_data_t);
|
|
51
|
+
#define set_foreach_with_replace rb_set_foreach_with_replace
|
|
52
|
+
int rb_set_foreach_with_replace(set_table *tab, set_foreach_check_callback_func *func, set_update_callback_func *replace, st_data_t arg);
|
|
53
|
+
#define set_table_foreach rb_set_table_foreach
|
|
54
|
+
int rb_set_table_foreach(set_table *, set_foreach_callback_func *, st_data_t);
|
|
55
|
+
#define set_foreach_check rb_set_foreach_check
|
|
56
|
+
int rb_set_foreach_check(set_table *, set_foreach_check_callback_func *, st_data_t, st_data_t);
|
|
57
|
+
#define set_keys rb_set_keys
|
|
58
|
+
st_index_t rb_set_keys(set_table *table, st_data_t *keys, st_index_t size);
|
|
59
|
+
#define set_free_table rb_set_free_table
|
|
60
|
+
void rb_set_free_table(set_table *);
|
|
61
|
+
#define set_table_clear rb_set_table_clear
|
|
62
|
+
void rb_set_table_clear(set_table *);
|
|
63
|
+
#define set_copy rb_set_copy
|
|
64
|
+
set_table *rb_set_copy(set_table *new_table, set_table *old_table);
|
|
65
|
+
#define set_memsize rb_set_memsize
|
|
66
|
+
PUREFUNC(size_t rb_set_memsize(const set_table *));
|
|
67
|
+
#define set_compact_table rb_set_compact_table
|
|
68
|
+
void set_compact_table(set_table *tab);
|
|
69
|
+
|
|
70
|
+
#endif
|