debase-ruby_core_source 3.3.5 → 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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.idea/vcs.xml +28 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +14 -0
- data/Rakefile +3 -1
- data/debase-ruby_core_source.gemspec +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/builtin.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/darray.h +22 -6
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/debug_counter.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/dln.h +0 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/id.h +9 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/insns.inc +10 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/insns_info.inc +819 -312
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/array.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/basic_operators.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/bits.h +82 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/class.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/encoding.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/error.h +28 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/fixnum.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/gc.h +24 -28
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/hash.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/imemo.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/io.h +4 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/parse.h +16 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/proc.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/ractor.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/sanitizers.h +60 -39
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/string.h +34 -18
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/thread.h +29 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/vm.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/known_errors.inc +103 -103
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/method.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/optunifs.inc +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parse.h +5 -4
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/ast.h +2156 -453
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/defines.h +44 -7
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/diagnostic.h +24 -6
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/extension.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/node.h +0 -21
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/options.h +94 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/parser.h +82 -40
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/prism.h +47 -11
- data/lib/debase/ruby_core_source/ruby-3.4.0-p-1/prism/regexp.h +43 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/static_literals.h +3 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_char.h +1 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_constant_pool.h +0 -8
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_integer.h +22 -15
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_newline_list.h +11 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_string.h +28 -12
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/version.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism_compile.h +23 -12
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ractor_core.h +9 -20
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/regint.h +0 -4
- data/lib/debase/ruby_core_source/ruby-3.4.0-p-1/revision.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/rubyparser.h +171 -250
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/shape.h +2 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/symbol.h +6 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/thread_pthread.h +26 -25
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/version.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm.inc +467 -207
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_callinfo.h +24 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_core.h +62 -48
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_insnhelper.h +7 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_sync.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vmtc.inc +10 -2
- data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/yjit.h +1 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- data/lib/debase/ruby_core_source.rb +4 -2
- data/test/deduce_source_dir_test.rb +31 -0
- metadata +163 -150
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/regexp.h +0 -33
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_string_list.h +0 -44
- data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/revision.h +0 -5
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/addr2line.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/build_assert/build_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/check_type/check_type.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/container_of/container_of.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/list/list.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/str/str.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/constant.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/encindex.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/eval_intern.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/hrtime.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/id_table.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/bignum.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/cmdlineopt.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/compar.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/compile.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/compilers.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/complex.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/cont.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/dir.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/enc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/enum.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/enumerator.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/eval.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/file.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/inits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/load.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/loadpath.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/math.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/missing.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/numeric.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/object.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/process.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/random.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/range.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/rational.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/re.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/ruby_parser.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/serial.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/signal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/static_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/struct.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/symbol.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/time.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/transcode.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/util.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/variable.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/warnings.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/iseq.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/node.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/node_name.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/optinsn.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_bits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_node.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_value.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/encoding.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/pack.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/prettyprint.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_buffer.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_list.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_memchr.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_strncasecmp.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_strpbrk.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/probes_helper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/regenc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/regparse.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/rjit.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/rjit_c.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ruby_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ruby_atomic.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/siphash.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/thread_none.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/thread_win32.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/timev.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/transcode_data.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/variable.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_call_iseq_optimized.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_debug.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_exec.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_opts.h +0 -0
|
@@ -37,6 +37,7 @@ size_t rb_ary_size_as_embedded(VALUE ary);
|
|
|
37
37
|
void rb_ary_make_embedded(VALUE ary);
|
|
38
38
|
bool rb_ary_embeddable_p(VALUE ary);
|
|
39
39
|
VALUE rb_ary_diff(VALUE ary1, VALUE ary2);
|
|
40
|
+
RUBY_EXTERN VALUE rb_cArray_empty_frozen;
|
|
40
41
|
|
|
41
42
|
static inline VALUE rb_ary_entry_internal(VALUE ary, long offset);
|
|
42
43
|
static inline bool ARY_PTR_USING_P(VALUE ary);
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
|
|
91
91
|
#define UNSIGNED_INTEGER_MAX(T) ((T)~(T)0)
|
|
92
92
|
|
|
93
|
+
#ifndef MUL_OVERFLOW_SIGNED_INTEGER_P
|
|
93
94
|
#if __has_builtin(__builtin_mul_overflow_p)
|
|
94
95
|
# define MUL_OVERFLOW_P(a, b) \
|
|
95
96
|
__builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
|
|
@@ -131,6 +132,87 @@
|
|
|
131
132
|
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
|
132
133
|
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
|
133
134
|
#endif
|
|
135
|
+
#endif
|
|
136
|
+
|
|
137
|
+
#ifndef ADD_OVERFLOW_SIGNED_INTEGER_P
|
|
138
|
+
#if __has_builtin(__builtin_add_overflow_p)
|
|
139
|
+
# define ADD_OVERFLOW_P(a, b) \
|
|
140
|
+
__builtin_add_overflow_p((a), (b), (__typeof__(a * b))0)
|
|
141
|
+
#elif __has_builtin(__builtin_add_overflow)
|
|
142
|
+
# define ADD_OVERFLOW_P(a, b) \
|
|
143
|
+
__extension__ ({ __typeof__(a) c; __builtin_add_overflow((a), (b), &c); })
|
|
144
|
+
#endif
|
|
145
|
+
|
|
146
|
+
#define ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
|
|
147
|
+
(a) > 0 ? (b) > (max) - (a) : (b) < (min) - (a))
|
|
148
|
+
|
|
149
|
+
#if __has_builtin(__builtin_add_overflow_p)
|
|
150
|
+
/* __builtin_add_overflow_p can take bitfield */
|
|
151
|
+
/* and GCC permits bitfields for integers other than int */
|
|
152
|
+
# define ADD_OVERFLOW_FIXNUM_P(a, b) \
|
|
153
|
+
__extension__ ({ \
|
|
154
|
+
struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
|
|
155
|
+
__builtin_add_overflow_p((a), (b), c.fixnum); \
|
|
156
|
+
})
|
|
157
|
+
#else
|
|
158
|
+
# define ADD_OVERFLOW_FIXNUM_P(a, b) \
|
|
159
|
+
ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
|
160
|
+
#endif
|
|
161
|
+
|
|
162
|
+
#if defined(ADD_OVERFLOW_P) && defined(USE___BUILTIN_ADD_OVERFLOW_LONG_LONG)
|
|
163
|
+
# define ADD_OVERFLOW_LONG_LONG_P(a, b) ADD_OVERFLOW_P(a, b)
|
|
164
|
+
#else
|
|
165
|
+
# define ADD_OVERFLOW_LONG_LONG_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
|
166
|
+
#endif
|
|
167
|
+
|
|
168
|
+
#ifdef ADD_OVERFLOW_P
|
|
169
|
+
# define ADD_OVERFLOW_LONG_P(a, b) ADD_OVERFLOW_P(a, b)
|
|
170
|
+
# define ADD_OVERFLOW_INT_P(a, b) ADD_OVERFLOW_P(a, b)
|
|
171
|
+
#else
|
|
172
|
+
# define ADD_OVERFLOW_LONG_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
|
173
|
+
# define ADD_OVERFLOW_INT_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
|
174
|
+
#endif
|
|
175
|
+
#endif
|
|
176
|
+
|
|
177
|
+
#ifndef SUB_OVERFLOW_SIGNED_INTEGER_P
|
|
178
|
+
#if __has_builtin(__builtin_sub_overflow_p)
|
|
179
|
+
# define SUB_OVERFLOW_P(a, b) \
|
|
180
|
+
__builtin_sub_overflow_p((a), (b), (__typeof__(a * b))0)
|
|
181
|
+
#elif __has_builtin(__builtin_sub_overflow)
|
|
182
|
+
# define SUB_OVERFLOW_P(a, b) \
|
|
183
|
+
__extension__ ({ __typeof__(a) c; __builtin_sub_overflow((a), (b), &c); })
|
|
184
|
+
#endif
|
|
185
|
+
|
|
186
|
+
#define SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
|
|
187
|
+
(b) > 0 ? (a) < (min) + (b) : (a) > (max) + (b))
|
|
188
|
+
|
|
189
|
+
#if __has_builtin(__builtin_sub_overflow_p)
|
|
190
|
+
/* __builtin_sub_overflow_p can take bitfield */
|
|
191
|
+
/* and GCC permits bitfields for integers other than int */
|
|
192
|
+
# define SUB_OVERFLOW_FIXNUM_P(a, b) \
|
|
193
|
+
__extension__ ({ \
|
|
194
|
+
struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
|
|
195
|
+
__builtin_sub_overflow_p((a), (b), c.fixnum); \
|
|
196
|
+
})
|
|
197
|
+
#else
|
|
198
|
+
# define SUB_OVERFLOW_FIXNUM_P(a, b) \
|
|
199
|
+
SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
|
200
|
+
#endif
|
|
201
|
+
|
|
202
|
+
#if defined(SUB_OVERFLOW_P) && defined(USE___BUILTIN_SUB_OVERFLOW_LONG_LONG)
|
|
203
|
+
# define SUB_OVERFLOW_LONG_LONG_P(a, b) SUB_OVERFLOW_P(a, b)
|
|
204
|
+
#else
|
|
205
|
+
# define SUB_OVERFLOW_LONG_LONG_P(a, b) SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
|
206
|
+
#endif
|
|
207
|
+
|
|
208
|
+
#ifdef SUB_OVERFLOW_P
|
|
209
|
+
# define SUB_OVERFLOW_LONG_P(a, b) SUB_OVERFLOW_P(a, b)
|
|
210
|
+
# define SUB_OVERFLOW_INT_P(a, b) SUB_OVERFLOW_P(a, b)
|
|
211
|
+
#else
|
|
212
|
+
# define SUB_OVERFLOW_LONG_P(a, b) SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
|
213
|
+
# define SUB_OVERFLOW_INT_P(a, b) SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
|
214
|
+
#endif
|
|
215
|
+
#endif
|
|
134
216
|
|
|
135
217
|
#ifdef HAVE_UINT128_T
|
|
136
218
|
# define bit_length(x) \
|
|
@@ -83,7 +83,7 @@ struct RClass {
|
|
|
83
83
|
struct rb_id_table *m_tbl;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
// Assert that classes can be embedded in
|
|
86
|
+
// Assert that classes can be embedded in heaps[2] (which has 160B slot size)
|
|
87
87
|
STATIC_ASSERT(sizeof_rb_classext_t, sizeof(struct RClass) + sizeof(rb_classext_t) <= 4 * RVALUE_SIZE);
|
|
88
88
|
|
|
89
89
|
struct RClass_and_rb_classext_t {
|
|
@@ -28,6 +28,8 @@ 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
|
+
void rb_enc_raw_set(VALUE obj, rb_encoding *enc);
|
|
32
|
+
|
|
31
33
|
PUREFUNC(int rb_data_is_encoding(VALUE obj));
|
|
32
34
|
|
|
33
35
|
/* vm.c */
|
|
@@ -72,6 +72,7 @@ const char *rb_builtin_type_name(int t);
|
|
|
72
72
|
const char *rb_builtin_class_name(VALUE x);
|
|
73
73
|
PRINTF_ARGS(void rb_warn_deprecated(const char *fmt, const char *suggest, ...), 1, 3);
|
|
74
74
|
PRINTF_ARGS(void rb_warn_deprecated_to_remove(const char *removal, const char *fmt, const char *suggest, ...), 2, 4);
|
|
75
|
+
PRINTF_ARGS(void rb_warn_reserved_name(const char *removal, const char *fmt, ...), 2, 3);
|
|
75
76
|
#if RUBY_DEBUG
|
|
76
77
|
# include "ruby/version.h"
|
|
77
78
|
# define RUBY_VERSION_SINCE(major, minor) (RUBY_API_VERSION_CODE >= (major * 10000) + (minor) * 100)
|
|
@@ -110,6 +111,14 @@ rb_deprecated_method_to_be_removed(const char *removal)
|
|
|
110
111
|
RBIMPL_ATTR_DIAGNOSE_IF(RUBY_VERSION_STRING_SINCE(removal), "deprecated method to be removed", "error")
|
|
111
112
|
{
|
|
112
113
|
}
|
|
114
|
+
|
|
115
|
+
RBIMPL_ATTR_FORCEINLINE()
|
|
116
|
+
static void
|
|
117
|
+
rb_diagnose_reserved_name_at(const char *coming)
|
|
118
|
+
RBIMPL_ATTR_DIAGNOSE_IF(!RUBY_VERSION_isdigit(coming[0]), "malformed version number", "error")
|
|
119
|
+
RBIMPL_ATTR_DIAGNOSE_IF(RUBY_VERSION_STRING_SINCE(coming), "reserved name already in use", "error")
|
|
120
|
+
{
|
|
121
|
+
}
|
|
113
122
|
# else
|
|
114
123
|
RBIMPL_ATTR_ERROR(("deprecated"))
|
|
115
124
|
void rb_deprecated_method_to_be_removed(const char *);
|
|
@@ -117,16 +126,32 @@ void rb_deprecated_method_to_be_removed(const char *);
|
|
|
117
126
|
(sizeof(char[1-2*(!RUBY_VERSION_isdigit(removal[0]) || RUBY_VERSION_STRING_SINCE(removal))])!=1 ? \
|
|
118
127
|
rb_deprecated_method_to_be_removed(removal) : \
|
|
119
128
|
RBIMPL_ASSERT_NOTHING)
|
|
129
|
+
|
|
130
|
+
RBIMPL_ATTR_ERROR(("deprecated"))
|
|
131
|
+
void rb_diagnose_reserved_name_at(const char *);
|
|
132
|
+
# define rb_diagnose_reserved_name_at(coming) \
|
|
133
|
+
(sizeof(char[1-2*(!RUBY_VERSION_isdigit(coming[0]) || RUBY_VERSION_STRING_SINCE(coming))])!=1 ? \
|
|
134
|
+
rb_diagnose_reserved_name_at(coming) : \
|
|
135
|
+
RBIMPL_ASSERT_NOTHING)
|
|
136
|
+
|
|
120
137
|
# endif
|
|
121
138
|
# define rb_warn_deprecated_to_remove_at(removal, ...) \
|
|
122
139
|
(rb_deprecated_method_to_be_removed(#removal), \
|
|
123
140
|
rb_warn_deprecated_to_remove(#removal, __VA_ARGS__))
|
|
141
|
+
|
|
142
|
+
# define rb_warn_reserved_name_at(coming, ...) \
|
|
143
|
+
(rb_diagnose_reserved_name_at(#coming), \
|
|
144
|
+
rb_warn_reserved_name(#coming, __VA_ARGS__))
|
|
124
145
|
# endif
|
|
125
146
|
#endif
|
|
126
147
|
#ifndef rb_warn_deprecated_to_remove_at
|
|
127
148
|
# define rb_warn_deprecated_to_remove_at(removal, ...) \
|
|
128
149
|
rb_warn_deprecated_to_remove(#removal, __VA_ARGS__)
|
|
129
150
|
#endif
|
|
151
|
+
#ifndef rb_warn_reserved_name_at
|
|
152
|
+
# define rb_warn_reserved_name_at(removal, ...) \
|
|
153
|
+
rb_warn_reserved_name(#removal, __VA_ARGS__)
|
|
154
|
+
#endif
|
|
130
155
|
#ifndef RUBY_VERSION_SINCE
|
|
131
156
|
# define RUBY_VERSION_SINCE(major, minor) 0
|
|
132
157
|
#endif
|
|
@@ -142,6 +167,8 @@ VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*,
|
|
|
142
167
|
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
|
143
168
|
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
|
144
169
|
PRINTF_ARGS(void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
|
|
170
|
+
PRINTF_ARGS(void rb_enc_compile_warning(rb_encoding *enc, const char *file, int line, const char *fmt, ...), 4, 5);
|
|
171
|
+
PRINTF_ARGS(void rb_enc_compile_warn(rb_encoding *enc, const char *file, int line, const char *fmt, ...), 4, 5);
|
|
145
172
|
rb_warning_category_t rb_warning_category_from_name(VALUE category);
|
|
146
173
|
bool rb_warning_category_enabled_p(rb_warning_category_t category);
|
|
147
174
|
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
|
|
@@ -158,6 +185,7 @@ NORETURN(static inline void rb_key_err_raise(VALUE mesg, VALUE recv, VALUE name)
|
|
|
158
185
|
static inline void Check_Type(VALUE v, enum ruby_value_type t);
|
|
159
186
|
static inline bool rb_typeddata_is_instance_of_inline(VALUE obj, const rb_data_type_t *data_type);
|
|
160
187
|
#define rb_typeddata_is_instance_of rb_typeddata_is_instance_of_inline
|
|
188
|
+
void rb_bug_without_die(const char *fmt, ...);
|
|
161
189
|
|
|
162
190
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
163
191
|
/* error.c (export) */
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
#include "ruby/internal/config.h" /* for HAVE_LONG_LONG */
|
|
12
12
|
#include <limits.h> /* for CHAR_BIT */
|
|
13
|
+
#include "internal/bits.h" /* for MUL_OVERFLOW_FIXNUM_P */
|
|
13
14
|
#include "internal/compilers.h" /* for __has_builtin */
|
|
14
15
|
#include "ruby/internal/stdbool.h" /* for bool */
|
|
15
16
|
#include "ruby/intern.h" /* for rb_big_mul */
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
#include "ruby/ruby.h" /* for rb_event_flag_t */
|
|
17
17
|
#include "vm_core.h" /* for GET_EC() */
|
|
18
18
|
|
|
19
|
-
#ifndef
|
|
20
|
-
# define
|
|
19
|
+
#ifndef USE_MODULAR_GC
|
|
20
|
+
# define USE_MODULAR_GC 0
|
|
21
21
|
#endif
|
|
22
22
|
|
|
23
23
|
#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
|
|
@@ -163,12 +163,6 @@ struct rb_objspace; /* in vm_core.h */
|
|
|
163
163
|
RB_OBJ_WRITE(old, _slot, young); \
|
|
164
164
|
} while (0)
|
|
165
165
|
|
|
166
|
-
// We use SIZE_POOL_COUNT number of shape IDs for transitions out of different size pools
|
|
167
|
-
// The next available shape ID will be the SPECIAL_CONST_SHAPE_ID
|
|
168
|
-
#ifndef SIZE_POOL_COUNT
|
|
169
|
-
# define SIZE_POOL_COUNT 5
|
|
170
|
-
#endif
|
|
171
|
-
|
|
172
166
|
/* Used in places that could malloc during, which can cause the GC to run. We
|
|
173
167
|
* need to temporarily disable the GC to allow the malloc to happen.
|
|
174
168
|
* Allocating memory during GC is a bad idea, so use this only when absolutely
|
|
@@ -180,25 +174,14 @@ struct rb_objspace; /* in vm_core.h */
|
|
|
180
174
|
#define DURING_GC_COULD_MALLOC_REGION_END() \
|
|
181
175
|
if (_already_disabled == Qfalse) rb_gc_enable()
|
|
182
176
|
|
|
183
|
-
typedef struct ractor_newobj_size_pool_cache {
|
|
184
|
-
struct RVALUE *freelist;
|
|
185
|
-
struct heap_page *using_page;
|
|
186
|
-
} rb_ractor_newobj_size_pool_cache_t;
|
|
187
|
-
|
|
188
|
-
typedef struct ractor_newobj_cache {
|
|
189
|
-
size_t incremental_mark_step_allocated_slots;
|
|
190
|
-
rb_ractor_newobj_size_pool_cache_t size_pool_caches[SIZE_POOL_COUNT];
|
|
191
|
-
} rb_ractor_newobj_cache_t;
|
|
192
|
-
|
|
193
177
|
/* gc.c */
|
|
194
|
-
extern int ruby_disable_gc;
|
|
195
178
|
RUBY_ATTR_MALLOC void *ruby_mimmalloc(size_t size);
|
|
196
179
|
RUBY_ATTR_MALLOC void *ruby_mimcalloc(size_t num, size_t size);
|
|
197
180
|
void ruby_mimfree(void *ptr);
|
|
198
181
|
void rb_gc_prepare_heap(void);
|
|
199
182
|
void rb_objspace_set_event_hook(const rb_event_flag_t event);
|
|
200
|
-
VALUE rb_objspace_gc_enable(
|
|
201
|
-
VALUE rb_objspace_gc_disable(
|
|
183
|
+
VALUE rb_objspace_gc_enable(void *objspace);
|
|
184
|
+
VALUE rb_objspace_gc_disable(void *objspace);
|
|
202
185
|
void ruby_gc_set_params(void);
|
|
203
186
|
void rb_gc_copy_attributes(VALUE dest, VALUE obj);
|
|
204
187
|
size_t rb_size_mul_or_raise(size_t, size_t, VALUE); /* used in compile.c */
|
|
@@ -212,12 +195,13 @@ RUBY_ATTR_MALLOC void *rb_xcalloc_mul_add_mul(size_t, size_t, size_t, size_t);
|
|
|
212
195
|
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));
|
|
213
196
|
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));
|
|
214
197
|
static inline void ruby_sized_xfree_inlined(void *ptr, size_t size);
|
|
215
|
-
|
|
198
|
+
|
|
199
|
+
void *rb_gc_ractor_cache_alloc(rb_ractor_t *ractor);
|
|
200
|
+
void rb_gc_ractor_cache_free(void *cache);
|
|
201
|
+
|
|
216
202
|
bool rb_gc_size_allocatable_p(size_t size);
|
|
217
|
-
size_t *
|
|
218
|
-
size_t
|
|
219
|
-
int rb_objspace_garbage_object_p(VALUE obj);
|
|
220
|
-
bool rb_gc_is_ptr_to_obj(const void *ptr);
|
|
203
|
+
size_t *rb_gc_heap_sizes(void);
|
|
204
|
+
size_t rb_gc_heap_id_for_size(size_t size);
|
|
221
205
|
|
|
222
206
|
void rb_gc_mark_and_move(VALUE *ptr);
|
|
223
207
|
|
|
@@ -228,6 +212,9 @@ void rb_gc_ref_update_table_values_only(st_table *tbl);
|
|
|
228
212
|
|
|
229
213
|
void rb_gc_initial_stress_set(VALUE flag);
|
|
230
214
|
|
|
215
|
+
void rb_gc_before_fork(void);
|
|
216
|
+
void rb_gc_after_fork(rb_pid_t pid);
|
|
217
|
+
|
|
231
218
|
#define rb_gc_mark_and_move_ptr(ptr) do { \
|
|
232
219
|
VALUE _obj = (VALUE)*(ptr); \
|
|
233
220
|
rb_gc_mark_and_move(&_obj); \
|
|
@@ -238,8 +225,9 @@ RUBY_SYMBOL_EXPORT_BEGIN
|
|
|
238
225
|
/* exports for objspace module */
|
|
239
226
|
void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
|
|
240
227
|
void rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *data);
|
|
241
|
-
int rb_objspace_markable_object_p(VALUE obj);
|
|
242
228
|
int rb_objspace_internal_object_p(VALUE obj);
|
|
229
|
+
int rb_objspace_garbage_object_p(VALUE obj);
|
|
230
|
+
bool rb_gc_pointer_to_heap_p(VALUE obj);
|
|
243
231
|
|
|
244
232
|
void rb_objspace_each_objects(
|
|
245
233
|
int (*callback)(void *start, void *end, size_t stride, void *data),
|
|
@@ -249,13 +237,13 @@ size_t rb_gc_obj_slot_size(VALUE obj);
|
|
|
249
237
|
|
|
250
238
|
VALUE rb_gc_disable_no_rest(void);
|
|
251
239
|
|
|
240
|
+
#define RB_GC_MAX_NAME_LEN 20
|
|
252
241
|
|
|
253
242
|
/* gc.c (export) */
|
|
254
243
|
const char *rb_objspace_data_type_name(VALUE obj);
|
|
255
244
|
VALUE rb_wb_protected_newobj_of(struct rb_execution_context_struct *, VALUE, VALUE, size_t);
|
|
256
245
|
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE, size_t);
|
|
257
246
|
size_t rb_obj_memsize_of(VALUE);
|
|
258
|
-
void rb_gc_verify_internal_consistency(void);
|
|
259
247
|
size_t rb_obj_gc_flags(VALUE, ID[], size_t);
|
|
260
248
|
void rb_gc_mark_values(long n, const VALUE *values);
|
|
261
249
|
void rb_gc_mark_vm_stack_values(long n, const VALUE *values);
|
|
@@ -263,11 +251,19 @@ void rb_gc_update_values(long n, VALUE *values);
|
|
|
263
251
|
void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
|
|
264
252
|
void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
|
|
265
253
|
void ruby_sized_xfree(void *x, size_t size);
|
|
254
|
+
|
|
255
|
+
const char *rb_gc_active_gc_name(void);
|
|
256
|
+
int rb_gc_modular_gc_loaded_p(void);
|
|
257
|
+
|
|
258
|
+
#if USE_MODULAR_GC
|
|
259
|
+
void ruby_load_modular_gc_from_argv(int argc, char **argv);
|
|
260
|
+
#endif
|
|
266
261
|
RUBY_SYMBOL_EXPORT_END
|
|
267
262
|
|
|
268
263
|
int rb_ec_stack_check(struct rb_execution_context_struct *ec);
|
|
269
264
|
void rb_gc_writebarrier_remember(VALUE obj);
|
|
270
265
|
const char *rb_obj_info(VALUE obj);
|
|
266
|
+
void ruby_annotate_mmap(const void *addr, unsigned long size, const char *name);
|
|
271
267
|
|
|
272
268
|
#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
|
|
273
269
|
|
|
@@ -88,6 +88,7 @@ int rb_hash_stlike_foreach_with_replace(VALUE hash, st_foreach_check_callback_fu
|
|
|
88
88
|
int rb_hash_stlike_update(VALUE hash, st_data_t key, st_update_callback_func *func, st_data_t arg);
|
|
89
89
|
VALUE rb_ident_hash_new_with_size(st_index_t size);
|
|
90
90
|
void rb_hash_free(VALUE hash);
|
|
91
|
+
RUBY_EXTERN VALUE rb_cHash_empty_frozen;
|
|
91
92
|
|
|
92
93
|
static inline unsigned RHASH_AR_TABLE_SIZE_RAW(VALUE h);
|
|
93
94
|
static inline VALUE RHASH_IFNONE(VALUE h);
|
|
@@ -79,7 +79,12 @@ struct vm_ifunc_argc {
|
|
|
79
79
|
#endif
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
/*! IFUNC (Internal FUNCtion)
|
|
82
|
+
/*! IFUNC (Internal FUNCtion)
|
|
83
|
+
*
|
|
84
|
+
* Bookkeeping for converting a C function and some closed-over data into a
|
|
85
|
+
* block passable to methods. Like Ruby Proc, but not directly accessible at
|
|
86
|
+
* Ruby level since this is an imemo. See rb_block_call() and friends.
|
|
87
|
+
*/
|
|
83
88
|
struct vm_ifunc {
|
|
84
89
|
VALUE flags;
|
|
85
90
|
VALUE *svar_lep;
|
|
@@ -87,6 +92,7 @@ struct vm_ifunc {
|
|
|
87
92
|
const void *data;
|
|
88
93
|
struct vm_ifunc_argc argc;
|
|
89
94
|
};
|
|
95
|
+
#define IFUNC_YIELD_OPTIMIZABLE IMEMO_FL_USER0
|
|
90
96
|
|
|
91
97
|
struct rb_imemo_tmpbuf_struct {
|
|
92
98
|
VALUE flags;
|
|
@@ -15,7 +15,7 @@ struct rb_io;
|
|
|
15
15
|
|
|
16
16
|
#include "ruby/io.h" /* for rb_io_t */
|
|
17
17
|
|
|
18
|
-
#define IO_WITHOUT_GVL(func, arg)
|
|
18
|
+
#define IO_WITHOUT_GVL(func, arg) rb_nogvl(func, arg, RUBY_UBF_IO, 0, RB_NOGVL_OFFLOAD_SAFE)
|
|
19
19
|
#define IO_WITHOUT_GVL_INT(func, arg) (int)(VALUE)IO_WITHOUT_GVL(func, arg)
|
|
20
20
|
|
|
21
21
|
/** Ruby's IO, metadata and buffers. */
|
|
@@ -135,6 +135,9 @@ RUBY_SYMBOL_EXPORT_BEGIN
|
|
|
135
135
|
void rb_maygvl_fd_fix_cloexec(int fd);
|
|
136
136
|
int rb_gc_for_fd(int err);
|
|
137
137
|
void rb_write_error_str(VALUE mesg);
|
|
138
|
+
|
|
139
|
+
VALUE rb_io_blocking_region_wait(struct rb_io *io, rb_blocking_function_t *function, void *argument, enum rb_io_event events);
|
|
140
|
+
VALUE rb_io_blocking_region(struct rb_io *io, rb_blocking_function_t *function, void *argument);
|
|
138
141
|
RUBY_SYMBOL_EXPORT_END
|
|
139
142
|
|
|
140
143
|
#endif /* INTERNAL_IO_H */
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
#include "rubyparser.h"
|
|
13
13
|
#include "internal/static_assert.h"
|
|
14
14
|
|
|
15
|
+
// The default parser to use for Ruby code.
|
|
16
|
+
typedef enum {
|
|
17
|
+
RB_DEFAULT_PARSER_PARSE_Y,
|
|
18
|
+
RB_DEFAULT_PARSER_PRISM,
|
|
19
|
+
} ruby_default_parser_enum;
|
|
20
|
+
|
|
21
|
+
ruby_default_parser_enum rb_ruby_default_parser(void);
|
|
22
|
+
void rb_ruby_default_parser_set(ruby_default_parser_enum parser);
|
|
23
|
+
|
|
24
|
+
#define rb_ruby_prism_p() (rb_ruby_default_parser() == RB_DEFAULT_PARSER_PRISM)
|
|
25
|
+
|
|
15
26
|
#ifdef UNIVERSAL_PARSER
|
|
16
27
|
#define rb_encoding const void
|
|
17
28
|
#endif
|
|
@@ -55,7 +66,7 @@ void rb_ruby_parser_set_script_lines(rb_parser_t *p);
|
|
|
55
66
|
void rb_ruby_parser_error_tolerant(rb_parser_t *p);
|
|
56
67
|
void rb_ruby_parser_keep_tokens(rb_parser_t *p);
|
|
57
68
|
typedef rb_parser_string_t*(rb_parser_lex_gets_func)(struct parser_params*, rb_parser_input_data, int);
|
|
58
|
-
rb_ast_t *rb_parser_compile(rb_parser_t *p, rb_parser_lex_gets_func *gets,
|
|
69
|
+
rb_ast_t *rb_parser_compile(rb_parser_t *p, rb_parser_lex_gets_func *gets, VALUE fname, rb_parser_input_data input, int line);
|
|
59
70
|
|
|
60
71
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
61
72
|
|
|
@@ -63,12 +74,14 @@ rb_encoding *rb_ruby_parser_encoding(rb_parser_t *p);
|
|
|
63
74
|
int rb_ruby_parser_end_seen_p(rb_parser_t *p);
|
|
64
75
|
int rb_ruby_parser_set_yydebug(rb_parser_t *p, int flag);
|
|
65
76
|
rb_parser_string_t *rb_str_to_parser_string(rb_parser_t *p, VALUE str);
|
|
77
|
+
void rb_parser_string_free(rb_parser_t *p, rb_parser_string_t *str);
|
|
66
78
|
|
|
67
79
|
int rb_parser_dvar_defined_ref(struct parser_params*, ID, ID**);
|
|
68
80
|
ID rb_parser_internal_id(struct parser_params*);
|
|
69
81
|
int rb_parser_reg_fragment_check(struct parser_params*, rb_parser_string_t*, int);
|
|
70
|
-
int rb_reg_named_capture_assign_iter_impl(struct parser_params *p, const char *s, long len, rb_encoding *enc, NODE **succ_block, const rb_code_location_t *loc);
|
|
82
|
+
int rb_reg_named_capture_assign_iter_impl(struct parser_params *p, const char *s, long len, rb_encoding *enc, NODE **succ_block, const rb_code_location_t *loc, rb_parser_assignable_func assignable);
|
|
71
83
|
int rb_parser_local_defined(struct parser_params *p, ID id, const struct rb_iseq_struct *iseq);
|
|
84
|
+
NODE *rb_parser_assignable(struct parser_params *p, ID id, NODE *val, const YYLTYPE *loc);
|
|
72
85
|
|
|
73
86
|
RUBY_SYMBOL_EXPORT_END
|
|
74
87
|
|
|
@@ -97,7 +110,7 @@ VALUE rb_ruby_parser_ruby_sourcefile_string(rb_parser_t *p);
|
|
|
97
110
|
int rb_ruby_parser_ruby_sourceline(rb_parser_t *p);
|
|
98
111
|
int rb_ruby_parser_lex_state(rb_parser_t *p);
|
|
99
112
|
void rb_ruby_ripper_parse0(rb_parser_t *p);
|
|
100
|
-
int rb_ruby_ripper_dedent_string(rb_parser_t *p,
|
|
113
|
+
int rb_ruby_ripper_dedent_string(rb_parser_t *p, rb_parser_string_t *string, int width);
|
|
101
114
|
int rb_ruby_ripper_initialized_p(rb_parser_t *p);
|
|
102
115
|
void rb_ruby_ripper_parser_initialize(rb_parser_t *p);
|
|
103
116
|
long rb_ruby_ripper_column(rb_parser_t *p);
|
|
@@ -23,6 +23,7 @@ VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additi
|
|
|
23
23
|
VALUE rb_callable_receiver(VALUE);
|
|
24
24
|
|
|
25
25
|
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
|
|
26
|
+
VALUE rb_func_proc_dup(VALUE src_obj);
|
|
26
27
|
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc);
|
|
27
28
|
VALUE rb_iseq_location(const struct rb_iseq_struct *iseq);
|
|
28
29
|
VALUE rb_sym_to_proc(VALUE sym);
|
data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/sanitizers.h
RENAMED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
#endif
|
|
17
17
|
|
|
18
18
|
#ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
|
|
19
|
-
# if __has_feature(address_sanitizer)
|
|
19
|
+
# if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
|
|
20
20
|
# define RUBY_ASAN_ENABLED
|
|
21
21
|
# include <sanitizer/asan_interface.h>
|
|
22
22
|
# endif
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
#elif defined(RUBY_ASAN_ENABLED)
|
|
40
40
|
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
|
41
41
|
__attribute__((__no_sanitize__("address"), __noinline__)) x
|
|
42
|
+
#elif defined(RUBY_MSAN_ENABLED)
|
|
43
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
|
44
|
+
__attribute__((__no_sanitize__("memory"), __noinline__)) x
|
|
42
45
|
#elif defined(NO_SANITIZE_ADDRESS)
|
|
43
46
|
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
|
44
47
|
NO_SANITIZE_ADDRESS(NOINLINE(x))
|
|
@@ -54,10 +57,11 @@
|
|
|
54
57
|
# include "internal/warnings.h"
|
|
55
58
|
# undef NO_SANITIZE
|
|
56
59
|
# define NO_SANITIZE(x, y) \
|
|
57
|
-
COMPILER_WARNING_PUSH
|
|
58
|
-
COMPILER_WARNING_IGNORED(-Wattributes)
|
|
60
|
+
COMPILER_WARNING_PUSH \
|
|
61
|
+
COMPILER_WARNING_IGNORED(-Wattributes) \
|
|
59
62
|
__attribute__((__no_sanitize__(x))) y; \
|
|
60
|
-
COMPILER_WARNING_POP
|
|
63
|
+
COMPILER_WARNING_POP \
|
|
64
|
+
y
|
|
61
65
|
#endif
|
|
62
66
|
|
|
63
67
|
#ifndef NO_SANITIZE
|
|
@@ -115,26 +119,22 @@ asan_poison_memory_region(const volatile void *ptr, size_t size)
|
|
|
115
119
|
__asan_poison_memory_region(ptr, size);
|
|
116
120
|
}
|
|
117
121
|
|
|
118
|
-
/**
|
|
119
|
-
* This is a variant of asan_poison_memory_region that takes a VALUE.
|
|
120
|
-
*
|
|
121
|
-
* @param[in] obj target object.
|
|
122
|
-
*/
|
|
123
|
-
static inline void
|
|
124
|
-
asan_poison_object(VALUE obj)
|
|
125
|
-
{
|
|
126
|
-
MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
|
|
127
|
-
asan_poison_memory_region(ptr, SIZEOF_VALUE);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
122
|
#ifdef RUBY_ASAN_ENABLED
|
|
131
123
|
#define asan_poison_object_if(ptr, obj) do { \
|
|
132
|
-
if (ptr)
|
|
124
|
+
if (ptr) rb_asan_poison_object(obj); \
|
|
133
125
|
} while (0)
|
|
134
126
|
#else
|
|
135
127
|
#define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj))
|
|
136
128
|
#endif
|
|
137
129
|
|
|
130
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
131
|
+
/**
|
|
132
|
+
* This is a variant of asan_poison_memory_region that takes a VALUE.
|
|
133
|
+
*
|
|
134
|
+
* @param[in] obj target object.
|
|
135
|
+
*/
|
|
136
|
+
void rb_asan_poison_object(VALUE obj);
|
|
137
|
+
|
|
138
138
|
/**
|
|
139
139
|
* This function predicates if the given object is fully addressable or not.
|
|
140
140
|
*
|
|
@@ -142,12 +142,17 @@ asan_poison_object(VALUE obj)
|
|
|
142
142
|
* @retval 0 the given object is fully addressable.
|
|
143
143
|
* @retval otherwise pointer to first such byte who is poisoned.
|
|
144
144
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
void *rb_asan_poisoned_object_p(VALUE obj);
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* This is a variant of asan_unpoison_memory_region that takes a VALUE.
|
|
149
|
+
*
|
|
150
|
+
* @param[in] obj target object.
|
|
151
|
+
* @param[in] malloc_p if the memory region is like a malloc's return value or not.
|
|
152
|
+
*/
|
|
153
|
+
void rb_asan_unpoison_object(VALUE obj, bool newobj_p);
|
|
154
|
+
|
|
155
|
+
RUBY_SYMBOL_EXPORT_END
|
|
151
156
|
|
|
152
157
|
/**
|
|
153
158
|
* This function asserts that a (formally poisoned) memory region from ptr to
|
|
@@ -176,24 +181,11 @@ asan_unpoison_memory_region(const volatile void *ptr, size_t size, bool malloc_p
|
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
183
|
|
|
179
|
-
/**
|
|
180
|
-
* This is a variant of asan_unpoison_memory_region that takes a VALUE.
|
|
181
|
-
*
|
|
182
|
-
* @param[in] obj target object.
|
|
183
|
-
* @param[in] malloc_p if the memory region is like a malloc's return value or not.
|
|
184
|
-
*/
|
|
185
|
-
static inline void
|
|
186
|
-
asan_unpoison_object(VALUE obj, bool newobj_p)
|
|
187
|
-
{
|
|
188
|
-
MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
|
|
189
|
-
asan_unpoison_memory_region(ptr, SIZEOF_VALUE, newobj_p);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
184
|
static inline void *
|
|
193
185
|
asan_unpoison_object_temporary(VALUE obj)
|
|
194
186
|
{
|
|
195
|
-
void *ptr =
|
|
196
|
-
|
|
187
|
+
void *ptr = rb_asan_poisoned_object_p(obj);
|
|
188
|
+
rb_asan_unpoison_object(obj, false);
|
|
197
189
|
return ptr;
|
|
198
190
|
}
|
|
199
191
|
|
|
@@ -201,11 +193,40 @@ static inline void *
|
|
|
201
193
|
asan_poison_object_restore(VALUE obj, void *ptr)
|
|
202
194
|
{
|
|
203
195
|
if (ptr) {
|
|
204
|
-
|
|
196
|
+
rb_asan_poison_object(obj);
|
|
197
|
+
}
|
|
198
|
+
return NULL;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
#define asan_unpoisoning_object(obj) \
|
|
202
|
+
for (void *poisoned = asan_unpoison_object_temporary(obj), \
|
|
203
|
+
*unpoisoning = &poisoned; /* flag to loop just once */ \
|
|
204
|
+
unpoisoning; \
|
|
205
|
+
unpoisoning = asan_poison_object_restore(obj, poisoned))
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
static inline void *
|
|
209
|
+
asan_unpoison_memory_region_temporary(void *ptr, size_t len)
|
|
210
|
+
{
|
|
211
|
+
void *poisoned_ptr = __asan_region_is_poisoned(ptr, len);
|
|
212
|
+
asan_unpoison_memory_region(ptr, len, false);
|
|
213
|
+
return poisoned_ptr;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
static inline void *
|
|
217
|
+
asan_poison_memory_region_restore(void *ptr, size_t len, void *poisoned_ptr)
|
|
218
|
+
{
|
|
219
|
+
if (poisoned_ptr) {
|
|
220
|
+
asan_poison_memory_region(ptr, len);
|
|
205
221
|
}
|
|
206
222
|
return NULL;
|
|
207
223
|
}
|
|
208
224
|
|
|
225
|
+
#define asan_unpoisoning_memory_region(ptr, len) \
|
|
226
|
+
for (void *poisoned = asan_unpoison_memory_region_temporary(ptr, len), \
|
|
227
|
+
*unpoisoning = &poisoned; /* flag to loop just once */ \
|
|
228
|
+
unpoisoning; \
|
|
229
|
+
unpoisoning = asan_poison_memory_region_restore(ptr, len, poisoned))
|
|
209
230
|
|
|
210
231
|
/**
|
|
211
232
|
* Checks if the given pointer is on an ASAN fake stack. If so, it returns the
|