debase-ruby_core_source 4.0.0.preview2 → 4.0.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/CHANGELOG.md +5 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/id.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/insns.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/insns_info.inc +234 -218
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/basic_operators.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/bignum.h +21 -10
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/bits.h +14 -17
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/box.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/class.h +3 -2
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/cont.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/eval.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/gc.h +7 -5
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/numeric.h +48 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/thread.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/time.h +2 -5
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/vm.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/iseq.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/method.h +7 -2
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/parse.h +5 -3
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/parser_bits.h +108 -25
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/ast.h +38 -17
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/extension.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/options.h +4 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/prism.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/version.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ractor_core.h +25 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/regint.h +1 -16
- data/lib/debase/ruby_core_source/ruby-4.0.0-p0/revision.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ruby_atomic.h +7 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/rubyparser.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/shape.h +30 -10
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/thread_pthread.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/version.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm.inc +115 -91
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_callinfo.h +19 -6
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_core.h +68 -12
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_exec.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_sync.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vmtc.inc +2 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +147 -147
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/revision.h +0 -5
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/builtin.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/darray.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/debug_counter.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/eval_intern.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/array.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/cmdlineopt.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/compar.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/compilers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/complex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/concurrent_set.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/dir.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/enc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/encoding.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/enum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/enumerator.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/error.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/file.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/fixnum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/hash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/imemo.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/inits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/io.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/load.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/loadpath.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/math.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/missing.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/object.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/parse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/proc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/process.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/ractor.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/random.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/range.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/rational.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/re.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/ruby_parser.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/sanitizers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/serial.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/set_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/signal.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/st.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/static_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/string.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/struct.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/transcode.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/util.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/variable.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal/warnings.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/internal.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/node.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/parser_node.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/parser_st.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/parser_value.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/defines.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/diagnostic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/encoding.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/node.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/pack.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/parser.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/prettyprint.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/regexp.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/static_literals.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_buffer.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_char.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_constant_pool.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_integer.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_memchr.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_newline_list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_string.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_strncasecmp.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism/util/pm_strpbrk.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/prism_compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/regenc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/ruby_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/thread_none.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/variable.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_call_iseq_optimized.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_debug.h +4 -4
- /data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_insnhelper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/vm_opts.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/yjit.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-4.0.0-preview2 → ruby-4.0.0-p0}/zjit.h +0 -0
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
#include <stdint.h> /* for uintptr_t */
|
|
31
31
|
#include "internal/compilers.h" /* for MSC_VERSION_SINCE */
|
|
32
32
|
|
|
33
|
-
#
|
|
33
|
+
#ifdef _MSC_VER
|
|
34
34
|
# include <stdlib.h> /* for _byteswap_uint64 */
|
|
35
35
|
#endif
|
|
36
36
|
|
|
37
37
|
#if defined(HAVE_X86INTRIN_H)
|
|
38
38
|
# include <x86intrin.h> /* for _lzcnt_u64 */
|
|
39
|
-
#elif
|
|
39
|
+
#elif defined(_MSC_VER)
|
|
40
40
|
# include <intrin.h> /* for the following intrinsics */
|
|
41
41
|
#endif
|
|
42
42
|
|
|
@@ -50,16 +50,13 @@
|
|
|
50
50
|
# pragma intrinsic(__lzcnt64)
|
|
51
51
|
#endif
|
|
52
52
|
|
|
53
|
-
#if
|
|
53
|
+
#if defined(_MSC_VER)
|
|
54
54
|
# pragma intrinsic(_rotl)
|
|
55
55
|
# pragma intrinsic(_rotr)
|
|
56
56
|
# ifdef _WIN64
|
|
57
57
|
# pragma intrinsic(_rotl64)
|
|
58
58
|
# pragma intrinsic(_rotr64)
|
|
59
59
|
# endif
|
|
60
|
-
#endif
|
|
61
|
-
|
|
62
|
-
#if MSC_VERSION_SINCE(1400)
|
|
63
60
|
# pragma intrinsic(_BitScanForward)
|
|
64
61
|
# pragma intrinsic(_BitScanReverse)
|
|
65
62
|
# ifdef _WIN64
|
|
@@ -90,6 +87,7 @@
|
|
|
90
87
|
|
|
91
88
|
#define UNSIGNED_INTEGER_MAX(T) ((T)~(T)0)
|
|
92
89
|
|
|
90
|
+
#ifndef MUL_OVERFLOW_SIGNED_INTEGER_P
|
|
93
91
|
#if __has_builtin(__builtin_mul_overflow_p)
|
|
94
92
|
# define MUL_OVERFLOW_P(a, b) \
|
|
95
93
|
__builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
|
|
@@ -118,15 +116,100 @@
|
|
|
118
116
|
MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
|
119
117
|
#endif
|
|
120
118
|
|
|
121
|
-
#
|
|
119
|
+
#if defined(MUL_OVERFLOW_P) && defined(USE___BUILTIN_MUL_OVERFLOW_LONG_LONG)
|
|
122
120
|
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
|
|
121
|
+
#else
|
|
122
|
+
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
|
123
|
+
#endif
|
|
124
|
+
|
|
125
|
+
#ifdef MUL_OVERFLOW_P
|
|
123
126
|
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
|
|
124
127
|
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b)
|
|
125
128
|
#else
|
|
126
|
-
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
|
127
129
|
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
|
128
130
|
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
|
129
131
|
#endif
|
|
132
|
+
#endif
|
|
133
|
+
|
|
134
|
+
#ifndef ADD_OVERFLOW_SIGNED_INTEGER_P
|
|
135
|
+
#if __has_builtin(__builtin_add_overflow_p)
|
|
136
|
+
# define ADD_OVERFLOW_P(a, b) \
|
|
137
|
+
__builtin_add_overflow_p((a), (b), (__typeof__(a * b))0)
|
|
138
|
+
#elif __has_builtin(__builtin_add_overflow)
|
|
139
|
+
# define ADD_OVERFLOW_P(a, b) \
|
|
140
|
+
__extension__ ({ __typeof__(a) c; __builtin_add_overflow((a), (b), &c); })
|
|
141
|
+
#endif
|
|
142
|
+
|
|
143
|
+
#define ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
|
|
144
|
+
(a) > 0 ? (b) > (max) - (a) : (b) < (min) - (a))
|
|
145
|
+
|
|
146
|
+
#if __has_builtin(__builtin_add_overflow_p)
|
|
147
|
+
/* __builtin_add_overflow_p can take bitfield */
|
|
148
|
+
/* and GCC permits bitfields for integers other than int */
|
|
149
|
+
# define ADD_OVERFLOW_FIXNUM_P(a, b) \
|
|
150
|
+
__extension__ ({ \
|
|
151
|
+
struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
|
|
152
|
+
__builtin_add_overflow_p((a), (b), c.fixnum); \
|
|
153
|
+
})
|
|
154
|
+
#else
|
|
155
|
+
# define ADD_OVERFLOW_FIXNUM_P(a, b) \
|
|
156
|
+
ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
|
157
|
+
#endif
|
|
158
|
+
|
|
159
|
+
#if defined(ADD_OVERFLOW_P) && defined(USE___BUILTIN_ADD_OVERFLOW_LONG_LONG)
|
|
160
|
+
# define ADD_OVERFLOW_LONG_LONG_P(a, b) ADD_OVERFLOW_P(a, b)
|
|
161
|
+
#else
|
|
162
|
+
# define ADD_OVERFLOW_LONG_LONG_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
|
163
|
+
#endif
|
|
164
|
+
|
|
165
|
+
#ifdef ADD_OVERFLOW_P
|
|
166
|
+
# define ADD_OVERFLOW_LONG_P(a, b) ADD_OVERFLOW_P(a, b)
|
|
167
|
+
# define ADD_OVERFLOW_INT_P(a, b) ADD_OVERFLOW_P(a, b)
|
|
168
|
+
#else
|
|
169
|
+
# define ADD_OVERFLOW_LONG_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
|
170
|
+
# define ADD_OVERFLOW_INT_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
|
171
|
+
#endif
|
|
172
|
+
#endif
|
|
173
|
+
|
|
174
|
+
#ifndef SUB_OVERFLOW_SIGNED_INTEGER_P
|
|
175
|
+
#if __has_builtin(__builtin_sub_overflow_p)
|
|
176
|
+
# define SUB_OVERFLOW_P(a, b) \
|
|
177
|
+
__builtin_sub_overflow_p((a), (b), (__typeof__(a * b))0)
|
|
178
|
+
#elif __has_builtin(__builtin_sub_overflow)
|
|
179
|
+
# define SUB_OVERFLOW_P(a, b) \
|
|
180
|
+
__extension__ ({ __typeof__(a) c; __builtin_sub_overflow((a), (b), &c); })
|
|
181
|
+
#endif
|
|
182
|
+
|
|
183
|
+
#define SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
|
|
184
|
+
(b) > 0 ? (a) < (min) + (b) : (a) > (max) + (b))
|
|
185
|
+
|
|
186
|
+
#if __has_builtin(__builtin_sub_overflow_p)
|
|
187
|
+
/* __builtin_sub_overflow_p can take bitfield */
|
|
188
|
+
/* and GCC permits bitfields for integers other than int */
|
|
189
|
+
# define SUB_OVERFLOW_FIXNUM_P(a, b) \
|
|
190
|
+
__extension__ ({ \
|
|
191
|
+
struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
|
|
192
|
+
__builtin_sub_overflow_p((a), (b), c.fixnum); \
|
|
193
|
+
})
|
|
194
|
+
#else
|
|
195
|
+
# define SUB_OVERFLOW_FIXNUM_P(a, b) \
|
|
196
|
+
SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
|
197
|
+
#endif
|
|
198
|
+
|
|
199
|
+
#if defined(SUB_OVERFLOW_P) && defined(USE___BUILTIN_SUB_OVERFLOW_LONG_LONG)
|
|
200
|
+
# define SUB_OVERFLOW_LONG_LONG_P(a, b) SUB_OVERFLOW_P(a, b)
|
|
201
|
+
#else
|
|
202
|
+
# define SUB_OVERFLOW_LONG_LONG_P(a, b) SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
|
203
|
+
#endif
|
|
204
|
+
|
|
205
|
+
#ifdef SUB_OVERFLOW_P
|
|
206
|
+
# define SUB_OVERFLOW_LONG_P(a, b) SUB_OVERFLOW_P(a, b)
|
|
207
|
+
# define SUB_OVERFLOW_INT_P(a, b) SUB_OVERFLOW_P(a, b)
|
|
208
|
+
#else
|
|
209
|
+
# define SUB_OVERFLOW_LONG_P(a, b) SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
|
210
|
+
# define SUB_OVERFLOW_INT_P(a, b) SUB_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
|
211
|
+
#endif
|
|
212
|
+
#endif
|
|
130
213
|
|
|
131
214
|
#ifdef HAVE_UINT128_T
|
|
132
215
|
# define bit_length(x) \
|
|
@@ -180,7 +263,7 @@ ruby_swap16(uint16_t x)
|
|
|
180
263
|
#if __has_builtin(__builtin_bswap16)
|
|
181
264
|
return __builtin_bswap16(x);
|
|
182
265
|
|
|
183
|
-
#elif
|
|
266
|
+
#elif defined(_MSC_VER)
|
|
184
267
|
return _byteswap_ushort(x);
|
|
185
268
|
|
|
186
269
|
#else
|
|
@@ -195,7 +278,7 @@ ruby_swap32(uint32_t x)
|
|
|
195
278
|
#if __has_builtin(__builtin_bswap32)
|
|
196
279
|
return __builtin_bswap32(x);
|
|
197
280
|
|
|
198
|
-
#elif
|
|
281
|
+
#elif defined(_MSC_VER)
|
|
199
282
|
return _byteswap_ulong(x);
|
|
200
283
|
|
|
201
284
|
#else
|
|
@@ -212,7 +295,7 @@ ruby_swap64(uint64_t x)
|
|
|
212
295
|
#if __has_builtin(__builtin_bswap64)
|
|
213
296
|
return __builtin_bswap64(x);
|
|
214
297
|
|
|
215
|
-
#elif
|
|
298
|
+
#elif defined(_MSC_VER)
|
|
216
299
|
return _byteswap_uint64(x);
|
|
217
300
|
|
|
218
301
|
#else
|
|
@@ -237,7 +320,7 @@ nlz_int32(uint32_t x)
|
|
|
237
320
|
#elif defined(__x86_64__) && defined(__LZCNT__)
|
|
238
321
|
return (unsigned int)_lzcnt_u32(x);
|
|
239
322
|
|
|
240
|
-
#elif
|
|
323
|
+
#elif defined(_MSC_VER) /* &&! defined(__AVX2__) */
|
|
241
324
|
unsigned long r;
|
|
242
325
|
return _BitScanReverse(&r, x) ? (31 - (int)r) : 32;
|
|
243
326
|
|
|
@@ -266,7 +349,7 @@ nlz_int64(uint64_t x)
|
|
|
266
349
|
#elif defined(__x86_64__) && defined(__LZCNT__)
|
|
267
350
|
return (unsigned int)_lzcnt_u64(x);
|
|
268
351
|
|
|
269
|
-
#elif defined(_WIN64) &&
|
|
352
|
+
#elif defined(_WIN64) && defined(_MSC_VER) /* &&! defined(__AVX2__) */
|
|
270
353
|
unsigned long r;
|
|
271
354
|
return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64;
|
|
272
355
|
|
|
@@ -394,9 +477,9 @@ rb_popcount32(uint32_t x)
|
|
|
394
477
|
#else
|
|
395
478
|
x = (x & 0x55555555) + (x >> 1 & 0x55555555);
|
|
396
479
|
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
|
|
397
|
-
x = (x &
|
|
398
|
-
x = (x &
|
|
399
|
-
x = (x &
|
|
480
|
+
x = (x & 0x07070707) + (x >> 4 & 0x07070707);
|
|
481
|
+
x = (x & 0x000f000f) + (x >> 8 & 0x000f000f);
|
|
482
|
+
x = (x & 0x0000001f) + (x >>16 & 0x0000001f);
|
|
400
483
|
return (unsigned int)x;
|
|
401
484
|
|
|
402
485
|
#endif
|
|
@@ -424,9 +507,9 @@ rb_popcount64(uint64_t x)
|
|
|
424
507
|
x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
|
|
425
508
|
x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
|
|
426
509
|
x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
|
|
427
|
-
x = (x &
|
|
428
|
-
x = (x &
|
|
429
|
-
x = (x &
|
|
510
|
+
x = (x & 0x000f000f000f000f) + (x >> 8 & 0x000f000f000f000f);
|
|
511
|
+
x = (x & 0x0000001f0000001f) + (x >>16 & 0x0000001f0000001f);
|
|
512
|
+
x = (x & 0x000000000000003f) + (x >>32 & 0x000000000000003f);
|
|
430
513
|
return (unsigned int)x;
|
|
431
514
|
|
|
432
515
|
#endif
|
|
@@ -452,7 +535,7 @@ ntz_int32(uint32_t x)
|
|
|
452
535
|
#if defined(__x86_64__) && defined(__BMI__)
|
|
453
536
|
return (unsigned)_tzcnt_u32(x);
|
|
454
537
|
|
|
455
|
-
#elif
|
|
538
|
+
#elif defined(_MSC_VER)
|
|
456
539
|
/* :FIXME: Is there any way to issue TZCNT instead of BSF, apart from using
|
|
457
540
|
* assembly? Because issuing LZCNT seems possible (see nlz.h). */
|
|
458
541
|
unsigned long r;
|
|
@@ -474,7 +557,7 @@ ntz_int64(uint64_t x)
|
|
|
474
557
|
#if defined(__x86_64__) && defined(__BMI__)
|
|
475
558
|
return (unsigned)_tzcnt_u64(x);
|
|
476
559
|
|
|
477
|
-
#elif defined(_WIN64) &&
|
|
560
|
+
#elif defined(_WIN64) && defined(_MSC_VER)
|
|
478
561
|
unsigned long r;
|
|
479
562
|
return _BitScanForward64(&r, x) ? (int)r : 64;
|
|
480
563
|
|
|
@@ -522,10 +605,10 @@ RUBY_BIT_ROTL(VALUE v, int n)
|
|
|
522
605
|
#elif __has_builtin(__builtin_rotateleft64) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
523
606
|
return __builtin_rotateleft64(v, n);
|
|
524
607
|
|
|
525
|
-
#elif
|
|
608
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
|
526
609
|
return _rotl(v, n);
|
|
527
610
|
|
|
528
|
-
#elif
|
|
611
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
529
612
|
return _rotl64(v, n);
|
|
530
613
|
|
|
531
614
|
#elif defined(_lrotl) && (SIZEOF_VALUE == SIZEOF_LONG)
|
|
@@ -546,10 +629,10 @@ RUBY_BIT_ROTR(VALUE v, int n)
|
|
|
546
629
|
#elif __has_builtin(__builtin_rotateright64) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
547
630
|
return __builtin_rotateright64(v, n);
|
|
548
631
|
|
|
549
|
-
#elif
|
|
632
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
|
550
633
|
return _rotr(v, n);
|
|
551
634
|
|
|
552
|
-
#elif
|
|
635
|
+
#elif defined(_MSC_VER) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
|
553
636
|
return _rotr64(v, n);
|
|
554
637
|
|
|
555
638
|
#elif defined(_lrotr) && (SIZEOF_VALUE == SIZEOF_LONG)
|
|
@@ -1050,22 +1050,6 @@ typedef uint16_t pm_node_flags_t;
|
|
|
1050
1050
|
static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = 0x1;
|
|
1051
1051
|
static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = 0x2;
|
|
1052
1052
|
|
|
1053
|
-
/**
|
|
1054
|
-
* Cast the type to an enum to allow the compiler to provide exhaustiveness
|
|
1055
|
-
* checking.
|
|
1056
|
-
*/
|
|
1057
|
-
#define PM_NODE_TYPE(node) ((enum pm_node_type) (node)->type)
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Return true if the type of the given node matches the given type.
|
|
1061
|
-
*/
|
|
1062
|
-
#define PM_NODE_TYPE_P(node, type) (PM_NODE_TYPE(node) == (type))
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* Return true if the given flag is set on the given node.
|
|
1066
|
-
*/
|
|
1067
|
-
#define PM_NODE_FLAG_P(node, flag) ((((pm_node_t *)(node))->flags & (flag)) != 0)
|
|
1068
|
-
|
|
1069
1053
|
/**
|
|
1070
1054
|
* This is the base structure that represents a node in the syntax tree. It is
|
|
1071
1055
|
* embedded into every node type.
|
|
@@ -1096,6 +1080,32 @@ typedef struct pm_node {
|
|
|
1096
1080
|
pm_location_t location;
|
|
1097
1081
|
} pm_node_t;
|
|
1098
1082
|
|
|
1083
|
+
/**
|
|
1084
|
+
* Cast the given node to the base pm_node_t type.
|
|
1085
|
+
*/
|
|
1086
|
+
#define PM_NODE_UPCAST(node_) ((pm_node_t *) (node_))
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Cast the type to an enum to allow the compiler to provide exhaustiveness
|
|
1090
|
+
* checking.
|
|
1091
|
+
*/
|
|
1092
|
+
#define PM_NODE_TYPE(node_) ((enum pm_node_type) (node_)->type)
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Return true if the type of the given node matches the given type.
|
|
1096
|
+
*/
|
|
1097
|
+
#define PM_NODE_TYPE_P(node_, type_) (PM_NODE_TYPE(node_) == (type_))
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Return the flags associated with the given node.
|
|
1101
|
+
*/
|
|
1102
|
+
#define PM_NODE_FLAGS(node_) (PM_NODE_UPCAST(node_)->flags)
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Return true if the given flag is set on the given node.
|
|
1106
|
+
*/
|
|
1107
|
+
#define PM_NODE_FLAG_P(node_, flag_) ((PM_NODE_FLAGS(node_) & (flag_)) != 0)
|
|
1108
|
+
|
|
1099
1109
|
/**
|
|
1100
1110
|
* AliasGlobalVariableNode
|
|
1101
1111
|
*
|
|
@@ -4097,11 +4107,16 @@ typedef struct pm_forwarding_parameter_node {
|
|
|
4097
4107
|
/**
|
|
4098
4108
|
* ForwardingSuperNode
|
|
4099
4109
|
*
|
|
4100
|
-
* Represents the use of the `super` keyword without parentheses or arguments.
|
|
4110
|
+
* Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
|
|
4101
4111
|
*
|
|
4102
4112
|
* super
|
|
4103
4113
|
* ^^^^^
|
|
4104
4114
|
*
|
|
4115
|
+
* super { 123 }
|
|
4116
|
+
* ^^^^^^^^^^^^^
|
|
4117
|
+
*
|
|
4118
|
+
* If it has any other arguments, it would be a `SuperNode` instead.
|
|
4119
|
+
*
|
|
4105
4120
|
* Type: ::PM_FORWARDING_SUPER_NODE
|
|
4106
4121
|
*
|
|
4107
4122
|
* @extends pm_node_t
|
|
@@ -4113,6 +4128,8 @@ typedef struct pm_forwarding_super_node {
|
|
|
4113
4128
|
|
|
4114
4129
|
/**
|
|
4115
4130
|
* ForwardingSuperNode#block
|
|
4131
|
+
*
|
|
4132
|
+
* All other arguments are forwarded as normal, except the original block is replaced with the new block.
|
|
4116
4133
|
*/
|
|
4117
4134
|
struct pm_block_node *block;
|
|
4118
4135
|
} pm_forwarding_super_node_t;
|
|
@@ -7552,6 +7569,8 @@ typedef struct pm_string_node {
|
|
|
7552
7569
|
* super foo, bar
|
|
7553
7570
|
* ^^^^^^^^^^^^^^
|
|
7554
7571
|
*
|
|
7572
|
+
* If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
|
|
7573
|
+
*
|
|
7555
7574
|
* Type: ::PM_SUPER_NODE
|
|
7556
7575
|
*
|
|
7557
7576
|
* @extends pm_node_t
|
|
@@ -7573,6 +7592,8 @@ typedef struct pm_super_node {
|
|
|
7573
7592
|
|
|
7574
7593
|
/**
|
|
7575
7594
|
* SuperNode#arguments
|
|
7595
|
+
*
|
|
7596
|
+
* Can be only `nil` when there are empty parentheses, like `super()`.
|
|
7576
7597
|
*/
|
|
7577
7598
|
struct pm_arguments_node *arguments;
|
|
7578
7599
|
|
|
@@ -97,8 +97,11 @@ typedef enum {
|
|
|
97
97
|
/** The vendored version of prism in CRuby 4.0.x. */
|
|
98
98
|
PM_OPTIONS_VERSION_CRUBY_4_0 = 3,
|
|
99
99
|
|
|
100
|
+
/** The vendored version of prism in CRuby 4.1.x. */
|
|
101
|
+
PM_OPTIONS_VERSION_CRUBY_4_1 = 4,
|
|
102
|
+
|
|
100
103
|
/** The current version of prism. */
|
|
101
|
-
PM_OPTIONS_VERSION_LATEST =
|
|
104
|
+
PM_OPTIONS_VERSION_LATEST = PM_OPTIONS_VERSION_CRUBY_4_1
|
|
102
105
|
} pm_options_version_t;
|
|
103
106
|
|
|
104
107
|
/**
|
|
@@ -314,7 +314,7 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint
|
|
|
314
314
|
* dependencies. It is currently being integrated into
|
|
315
315
|
* [CRuby](https://github.com/ruby/ruby),
|
|
316
316
|
* [JRuby](https://github.com/jruby/jruby),
|
|
317
|
-
* [TruffleRuby](https://github.com/
|
|
317
|
+
* [TruffleRuby](https://github.com/truffleruby/truffleruby),
|
|
318
318
|
* [Sorbet](https://github.com/sorbet/sorbet), and
|
|
319
319
|
* [Syntax Tree](https://github.com/ruby-syntax-tree/syntax_tree).
|
|
320
320
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* The minor version of the Prism library as an int.
|
|
16
16
|
*/
|
|
17
|
-
#define PRISM_VERSION_MINOR
|
|
17
|
+
#define PRISM_VERSION_MINOR 7
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* The patch version of the Prism library as an int.
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
/**
|
|
25
25
|
* The version of the Prism library as a constant string.
|
|
26
26
|
*/
|
|
27
|
-
#define PRISM_VERSION "1.
|
|
27
|
+
#define PRISM_VERSION "1.7.0"
|
|
28
28
|
|
|
29
29
|
#endif
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
#define RACTOR_CHECK_MODE (VM_CHECK_MODE || RUBY_DEBUG) && (SIZEOF_UINT64_T == SIZEOF_VALUE)
|
|
10
10
|
#endif
|
|
11
11
|
|
|
12
|
+
// experimental flag because it is not sure it is the common pattern
|
|
13
|
+
#define RUBY_TYPED_FROZEN_SHAREABLE_NO_REC RUBY_FL_FINALIZE
|
|
14
|
+
|
|
12
15
|
struct rb_ractor_sync {
|
|
13
16
|
// ractor lock
|
|
14
17
|
rb_nativethread_lock_t lock;
|
|
@@ -88,6 +91,8 @@ struct rb_ractor_struct {
|
|
|
88
91
|
|
|
89
92
|
// ractor local data
|
|
90
93
|
|
|
94
|
+
rb_serial_t next_ec_serial;
|
|
95
|
+
|
|
91
96
|
st_table *local_storage;
|
|
92
97
|
struct rb_id_table *idkey_local_storage;
|
|
93
98
|
VALUE local_storage_store_lock;
|
|
@@ -139,6 +144,7 @@ VALUE rb_ractor_require(VALUE feature, bool silent);
|
|
|
139
144
|
VALUE rb_ractor_autoload_load(VALUE space, ID id);
|
|
140
145
|
|
|
141
146
|
VALUE rb_ractor_ensure_shareable(VALUE obj, VALUE name);
|
|
147
|
+
st_table *rb_ractor_targeted_hooks(rb_ractor_t *cr);
|
|
142
148
|
|
|
143
149
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
144
150
|
void rb_ractor_finish_marking(void);
|
|
@@ -245,6 +251,25 @@ rb_ractor_id(const rb_ractor_t *r)
|
|
|
245
251
|
return r->pub.id;
|
|
246
252
|
}
|
|
247
253
|
|
|
254
|
+
static inline void
|
|
255
|
+
rb_ractor_targeted_hooks_incr(rb_ractor_t *cr)
|
|
256
|
+
{
|
|
257
|
+
cr->pub.targeted_hooks_cnt++;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
static inline void
|
|
261
|
+
rb_ractor_targeted_hooks_decr(rb_ractor_t *cr)
|
|
262
|
+
{
|
|
263
|
+
RUBY_ASSERT(cr->pub.targeted_hooks_cnt > 0);
|
|
264
|
+
cr->pub.targeted_hooks_cnt--;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
static inline unsigned int
|
|
268
|
+
rb_ractor_targeted_hooks_cnt(rb_ractor_t *cr)
|
|
269
|
+
{
|
|
270
|
+
return cr->pub.targeted_hooks_cnt;
|
|
271
|
+
}
|
|
272
|
+
|
|
248
273
|
#if RACTOR_CHECK_MODE > 0
|
|
249
274
|
# define RACTOR_BELONGING_ID(obj) (*(uint32_t *)(((uintptr_t)(obj)) + rb_gc_obj_slot_size(obj)))
|
|
250
275
|
|
|
@@ -215,9 +215,7 @@
|
|
|
215
215
|
#define xmemcpy memcpy
|
|
216
216
|
#define xmemmove memmove
|
|
217
217
|
|
|
218
|
-
#if
|
|
219
|
-
|| (!defined(RUBY_MSVCRT_VERSION) && defined(_WIN32))) \
|
|
220
|
-
&& !defined(__GNUC__)
|
|
218
|
+
#if defined(_WIN32) && !defined(__GNUC__)
|
|
221
219
|
# define xalloca _alloca
|
|
222
220
|
# define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args)
|
|
223
221
|
# define xsnprintf sprintf_s
|
|
@@ -266,19 +264,6 @@
|
|
|
266
264
|
# include <stdio.h>
|
|
267
265
|
#endif
|
|
268
266
|
|
|
269
|
-
#ifdef _WIN32
|
|
270
|
-
# if defined(_MSC_VER) && (_MSC_VER < 1300)
|
|
271
|
-
# ifndef _INTPTR_T_DEFINED
|
|
272
|
-
# define _INTPTR_T_DEFINED
|
|
273
|
-
typedef int intptr_t;
|
|
274
|
-
# endif
|
|
275
|
-
# ifndef _UINTPTR_T_DEFINED
|
|
276
|
-
# define _UINTPTR_T_DEFINED
|
|
277
|
-
typedef unsigned int uintptr_t;
|
|
278
|
-
# endif
|
|
279
|
-
# endif
|
|
280
|
-
#endif /* _WIN32 */
|
|
281
|
-
|
|
282
267
|
#ifndef PRIdPTR
|
|
283
268
|
# ifdef _WIN64
|
|
284
269
|
# define PRIdPTR "I64d"
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
#define INTERNAL_ATOMIC_H
|
|
3
3
|
|
|
4
4
|
#include "ruby/atomic.h"
|
|
5
|
+
#ifdef HAVE_STDATOMIC_H
|
|
6
|
+
# include <stdatomic.h>
|
|
7
|
+
#endif
|
|
5
8
|
|
|
6
9
|
#define RUBY_ATOMIC_VALUE_LOAD(x) rbimpl_atomic_value_load(&(x), RBIMPL_ATOMIC_SEQ_CST)
|
|
7
10
|
|
|
@@ -43,6 +46,8 @@ rbimpl_atomic_u64_load_relaxed(const volatile rbimpl_atomic_uint64_t *value)
|
|
|
43
46
|
uint64_t val = *value;
|
|
44
47
|
return atomic_cas_64(value, val, val);
|
|
45
48
|
#else
|
|
49
|
+
// TODO: stdatomic
|
|
50
|
+
|
|
46
51
|
return *value;
|
|
47
52
|
#endif
|
|
48
53
|
}
|
|
@@ -58,6 +63,8 @@ rbimpl_atomic_u64_set_relaxed(volatile rbimpl_atomic_uint64_t *address, uint64_t
|
|
|
58
63
|
#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx))
|
|
59
64
|
atomic_swap_64(address, value);
|
|
60
65
|
#else
|
|
66
|
+
// TODO: stdatomic
|
|
67
|
+
|
|
61
68
|
*address = value;
|
|
62
69
|
#endif
|
|
63
70
|
}
|
|
@@ -163,10 +163,8 @@ bool rb_shape_verify_consistency(VALUE obj, shape_id_t shape_id);
|
|
|
163
163
|
#endif
|
|
164
164
|
|
|
165
165
|
static inline void
|
|
166
|
-
|
|
166
|
+
RBASIC_SET_SHAPE_ID_NO_CHECKS(VALUE obj, shape_id_t shape_id)
|
|
167
167
|
{
|
|
168
|
-
RUBY_ASSERT(!RB_SPECIAL_CONST_P(obj));
|
|
169
|
-
RUBY_ASSERT(!RB_TYPE_P(obj, T_IMEMO) || IMEMO_TYPE_P(obj, imemo_fields));
|
|
170
168
|
#if RBASIC_SHAPE_ID_FIELD
|
|
171
169
|
RBASIC(obj)->shape_id = (VALUE)shape_id;
|
|
172
170
|
#else
|
|
@@ -174,6 +172,16 @@ RBASIC_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
|
|
|
174
172
|
RBASIC(obj)->flags &= SHAPE_FLAG_MASK;
|
|
175
173
|
RBASIC(obj)->flags |= ((VALUE)(shape_id) << SHAPE_FLAG_SHIFT);
|
|
176
174
|
#endif
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static inline void
|
|
178
|
+
RBASIC_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
|
|
179
|
+
{
|
|
180
|
+
RUBY_ASSERT(!RB_SPECIAL_CONST_P(obj));
|
|
181
|
+
RUBY_ASSERT(!RB_TYPE_P(obj, T_IMEMO) || IMEMO_TYPE_P(obj, imemo_fields));
|
|
182
|
+
|
|
183
|
+
RBASIC_SET_SHAPE_ID_NO_CHECKS(obj, shape_id);
|
|
184
|
+
|
|
177
185
|
RUBY_ASSERT(rb_shape_verify_consistency(obj, shape_id));
|
|
178
186
|
}
|
|
179
187
|
|
|
@@ -217,7 +225,7 @@ shape_id_t rb_shape_transition_frozen(VALUE obj);
|
|
|
217
225
|
shape_id_t rb_shape_transition_complex(VALUE obj);
|
|
218
226
|
shape_id_t rb_shape_transition_remove_ivar(VALUE obj, ID id, shape_id_t *removed_shape_id);
|
|
219
227
|
shape_id_t rb_shape_transition_add_ivar(VALUE obj, ID id);
|
|
220
|
-
shape_id_t rb_shape_transition_add_ivar_no_warnings(VALUE
|
|
228
|
+
shape_id_t rb_shape_transition_add_ivar_no_warnings(VALUE klass, shape_id_t original_shape_id, ID id);
|
|
221
229
|
shape_id_t rb_shape_transition_object_id(VALUE obj);
|
|
222
230
|
shape_id_t rb_shape_transition_heap(VALUE obj, size_t heap_index);
|
|
223
231
|
shape_id_t rb_shape_object_id(shape_id_t original_shape_id);
|
|
@@ -367,23 +375,35 @@ ROBJECT_SET_FIELDS_HASH(VALUE obj, const st_table *tbl)
|
|
|
367
375
|
ROBJECT(obj)->as.heap.fields = (VALUE *)tbl;
|
|
368
376
|
}
|
|
369
377
|
|
|
378
|
+
static inline uint32_t
|
|
379
|
+
ROBJECT_FIELDS_COUNT_COMPLEX(VALUE obj)
|
|
380
|
+
{
|
|
381
|
+
return (uint32_t)rb_st_table_size(ROBJECT_FIELDS_HASH(obj));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
static inline uint32_t
|
|
385
|
+
ROBJECT_FIELDS_COUNT_NOT_COMPLEX(VALUE obj)
|
|
386
|
+
{
|
|
387
|
+
RBIMPL_ASSERT_TYPE(obj, RUBY_T_OBJECT);
|
|
388
|
+
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
|
389
|
+
return RSHAPE(RBASIC_SHAPE_ID(obj))->next_field_index;
|
|
390
|
+
}
|
|
391
|
+
|
|
370
392
|
static inline uint32_t
|
|
371
393
|
ROBJECT_FIELDS_COUNT(VALUE obj)
|
|
372
394
|
{
|
|
373
395
|
if (rb_shape_obj_too_complex_p(obj)) {
|
|
374
|
-
return (
|
|
396
|
+
return ROBJECT_FIELDS_COUNT_COMPLEX(obj);
|
|
375
397
|
}
|
|
376
398
|
else {
|
|
377
|
-
|
|
378
|
-
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));
|
|
379
|
-
return RSHAPE(RBASIC_SHAPE_ID(obj))->next_field_index;
|
|
399
|
+
return ROBJECT_FIELDS_COUNT_NOT_COMPLEX(obj);
|
|
380
400
|
}
|
|
381
401
|
}
|
|
382
402
|
|
|
383
403
|
static inline uint32_t
|
|
384
404
|
RBASIC_FIELDS_COUNT(VALUE obj)
|
|
385
405
|
{
|
|
386
|
-
return RSHAPE(
|
|
406
|
+
return RSHAPE(RBASIC_SHAPE_ID(obj))->next_field_index;
|
|
387
407
|
}
|
|
388
408
|
|
|
389
409
|
static inline bool
|
|
@@ -417,7 +437,7 @@ rb_shape_obj_has_fields(VALUE obj)
|
|
|
417
437
|
}
|
|
418
438
|
|
|
419
439
|
static inline bool
|
|
420
|
-
|
|
440
|
+
rb_obj_gen_fields_p(VALUE obj)
|
|
421
441
|
{
|
|
422
442
|
switch (TYPE(obj)) {
|
|
423
443
|
case T_NONE:
|
|
@@ -39,6 +39,7 @@ struct rb_thread_sched_waiting {
|
|
|
39
39
|
#else
|
|
40
40
|
uint64_t timeout;
|
|
41
41
|
#endif
|
|
42
|
+
uint32_t event_serial;
|
|
42
43
|
int fd; // -1 for timeout only
|
|
43
44
|
int result;
|
|
44
45
|
} data;
|
|
@@ -47,7 +48,7 @@ struct rb_thread_sched_waiting {
|
|
|
47
48
|
struct ccan_list_node node;
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
// per-
|
|
51
|
+
// per-Thread scheduler helper data
|
|
51
52
|
struct rb_thread_sched_item {
|
|
52
53
|
struct {
|
|
53
54
|
struct ccan_list_node ubf;
|
|
@@ -69,6 +70,7 @@ struct rb_thread_sched_item {
|
|
|
69
70
|
} node;
|
|
70
71
|
|
|
71
72
|
struct rb_thread_sched_waiting waiting_reason;
|
|
73
|
+
uint32_t event_serial;
|
|
72
74
|
|
|
73
75
|
bool finished;
|
|
74
76
|
bool malloc_stack;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
|
12
12
|
#define RUBY_VERSION_TEENY 0
|
|
13
13
|
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
|
14
|
-
#define RUBY_PATCHLEVEL
|
|
14
|
+
#define RUBY_PATCHLEVEL 0
|
|
15
15
|
|
|
16
16
|
#include "ruby/version.h"
|
|
17
17
|
#include "ruby/internal/abi.h"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
# ifdef RUBY_PATCHLEVEL_NAME
|
|
59
59
|
# define RUBY_PATCHLEVEL_STR STRINGIZE(RUBY_PATCHLEVEL_NAME)
|
|
60
60
|
# else
|
|
61
|
-
# define RUBY_PATCHLEVEL_STR "
|
|
61
|
+
# define RUBY_PATCHLEVEL_STR "dev"
|
|
62
62
|
# endif
|
|
63
63
|
#elif defined RUBY_ABI_VERSION
|
|
64
64
|
# error RUBY_ABI_VERSION is defined in non-development branch
|