debase-ruby_core_source 3.3.5 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -17,7 +17,7 @@ enum vm_call_flag_bits {
|
|
17
17
|
VM_CALL_ARGS_BLOCKARG_bit, // m(&block)
|
18
18
|
VM_CALL_FCALL_bit, // m(args) # receiver is self
|
19
19
|
VM_CALL_VCALL_bit, // m # method call that looks like a local variable
|
20
|
-
VM_CALL_ARGS_SIMPLE_bit, // (ci->flag & (SPLAT|BLOCKARG)) &&
|
20
|
+
VM_CALL_ARGS_SIMPLE_bit, // !(ci->flag & (SPLAT|BLOCKARG|KWARG|KW_SPLAT|FORWARDING)) && !has_block_iseq
|
21
21
|
VM_CALL_KWARG_bit, // has kwarg
|
22
22
|
VM_CALL_KW_SPLAT_bit, // m(**opts)
|
23
23
|
VM_CALL_TAILCALL_bit, // located at tail position
|
@@ -26,6 +26,7 @@ enum vm_call_flag_bits {
|
|
26
26
|
VM_CALL_OPT_SEND_bit, // internal flag
|
27
27
|
VM_CALL_KW_SPLAT_MUT_bit, // kw splat hash can be modified (to avoid allocating a new one)
|
28
28
|
VM_CALL_ARGS_SPLAT_MUT_bit, // args splat can be modified (to avoid allocating a new one)
|
29
|
+
VM_CALL_FORWARDING_bit, // m(...)
|
29
30
|
VM_CALL__END
|
30
31
|
};
|
31
32
|
|
@@ -42,6 +43,7 @@ enum vm_call_flag_bits {
|
|
42
43
|
#define VM_CALL_OPT_SEND (0x01 << VM_CALL_OPT_SEND_bit)
|
43
44
|
#define VM_CALL_KW_SPLAT_MUT (0x01 << VM_CALL_KW_SPLAT_MUT_bit)
|
44
45
|
#define VM_CALL_ARGS_SPLAT_MUT (0x01 << VM_CALL_ARGS_SPLAT_MUT_bit)
|
46
|
+
#define VM_CALL_FORWARDING (0x01 << VM_CALL_FORWARDING_bit)
|
45
47
|
|
46
48
|
struct rb_callinfo_kwarg {
|
47
49
|
int keyword_len;
|
@@ -240,6 +242,21 @@ vm_ci_new_runtime_(ID mid, unsigned int flag, unsigned int argc, const struct rb
|
|
240
242
|
|
241
243
|
#define VM_CALLINFO_NOT_UNDER_GC IMEMO_FL_USER0
|
242
244
|
|
245
|
+
static inline bool
|
246
|
+
vm_ci_markable(const struct rb_callinfo *ci)
|
247
|
+
{
|
248
|
+
if (! ci) {
|
249
|
+
return false; /* or true? This is Qfalse... */
|
250
|
+
}
|
251
|
+
else if (vm_ci_packed_p(ci)) {
|
252
|
+
return true;
|
253
|
+
}
|
254
|
+
else {
|
255
|
+
VM_ASSERT(IMEMO_TYPE_P(ci, imemo_callinfo));
|
256
|
+
return ! FL_ANY_RAW((VALUE)ci, VM_CALLINFO_NOT_UNDER_GC);
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
243
260
|
#define VM_CI_ON_STACK(mid_, flags_, argc_, kwarg_) \
|
244
261
|
(struct rb_callinfo) { \
|
245
262
|
.flags = T_IMEMO | \
|
@@ -318,6 +335,8 @@ vm_cc_new(VALUE klass,
|
|
318
335
|
*((struct rb_callable_method_entry_struct **)&cc->cme_) = (struct rb_callable_method_entry_struct *)cme;
|
319
336
|
*((vm_call_handler *)&cc->call_) = call;
|
320
337
|
|
338
|
+
VM_ASSERT(RB_TYPE_P(klass, T_CLASS) || RB_TYPE_P(klass, T_ICLASS));
|
339
|
+
|
321
340
|
switch (type) {
|
322
341
|
case cc_type_normal:
|
323
342
|
break;
|
@@ -329,7 +348,10 @@ vm_cc_new(VALUE klass,
|
|
329
348
|
break;
|
330
349
|
}
|
331
350
|
|
332
|
-
|
351
|
+
if (cme->def->type == VM_METHOD_TYPE_ATTRSET || cme->def->type == VM_METHOD_TYPE_IVAR) {
|
352
|
+
vm_cc_attr_index_initialize(cc, INVALID_SHAPE_ID);
|
353
|
+
}
|
354
|
+
|
333
355
|
RB_DEBUG_COUNTER_INC(cc_new);
|
334
356
|
return cc;
|
335
357
|
}
|
@@ -56,7 +56,8 @@
|
|
56
56
|
#define RVALUE_SIZE (sizeof(struct RBasic) + sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX]))
|
57
57
|
|
58
58
|
#if VM_CHECK_MODE > 0
|
59
|
-
#define VM_ASSERT(
|
59
|
+
#define VM_ASSERT(expr, ...) \
|
60
|
+
RUBY_ASSERT_MESG_WHEN(VM_CHECK_MODE > 0, expr, #expr RBIMPL_VA_OPT_ARGS(__VA_ARGS__))
|
60
61
|
#define VM_UNREACHABLE(func) rb_bug(#func ": unreachable")
|
61
62
|
#define RUBY_ASSERT_CRITICAL_SECTION
|
62
63
|
#define RUBY_DEBUG_THREAD_SCHEDULE() rb_thread_schedule()
|
@@ -69,7 +70,30 @@
|
|
69
70
|
#define RUBY_ASSERT_MUTEX_OWNED(mutex) VM_ASSERT(rb_mutex_owned_p(mutex))
|
70
71
|
|
71
72
|
#if defined(RUBY_ASSERT_CRITICAL_SECTION)
|
72
|
-
|
73
|
+
/*
|
74
|
+
# Critical Section Assertions
|
75
|
+
|
76
|
+
These assertions are used to ensure that context switching does not occur between two points in the code. In theory,
|
77
|
+
such code should already be protected by a mutex, but these assertions are used to ensure that the mutex is held.
|
78
|
+
|
79
|
+
The specific case where it can be useful is where a mutex is held further up the call stack, and the code in question
|
80
|
+
may not directly hold the mutex. In this case, the critical section assertions can be used to ensure that the mutex is
|
81
|
+
held by someone else.
|
82
|
+
|
83
|
+
These assertions are only enabled when RUBY_ASSERT_CRITICAL_SECTION is defined, which is only defined if VM_CHECK_MODE
|
84
|
+
is set.
|
85
|
+
|
86
|
+
## Example Usage
|
87
|
+
|
88
|
+
```c
|
89
|
+
RUBY_ASSERT_CRITICAL_SECTION_ENTER();
|
90
|
+
// ... some code which does not invoke rb_vm_check_ints() ...
|
91
|
+
RUBY_ASSERT_CRITICAL_SECTION_LEAVE();
|
92
|
+
```
|
93
|
+
|
94
|
+
If `rb_vm_check_ints()` is called between the `RUBY_ASSERT_CRITICAL_SECTION_ENTER()` and
|
95
|
+
`RUBY_ASSERT_CRITICAL_SECTION_LEAVE()`, a failed assertion will result.
|
96
|
+
*/
|
73
97
|
extern int ruby_assert_critical_section_entered;
|
74
98
|
#define RUBY_ASSERT_CRITICAL_SECTION_ENTER() do{ruby_assert_critical_section_entered += 1;}while(false)
|
75
99
|
#define RUBY_ASSERT_CRITICAL_SECTION_LEAVE() do{VM_ASSERT(ruby_assert_critical_section_entered > 0);ruby_assert_critical_section_entered -= 1;}while(false)
|
@@ -105,15 +129,6 @@ extern int ruby_assert_critical_section_entered;
|
|
105
129
|
#include "vm_opts.h"
|
106
130
|
|
107
131
|
#include "ruby/thread_native.h"
|
108
|
-
|
109
|
-
#if USE_SHARED_GC
|
110
|
-
typedef struct gc_function_map {
|
111
|
-
void *(*objspace_alloc)(void);
|
112
|
-
} rb_gc_function_map_t;
|
113
|
-
|
114
|
-
#define rb_gc_functions (&GET_VM()->gc_functions_map)
|
115
|
-
#endif
|
116
|
-
|
117
132
|
/*
|
118
133
|
* implementation selector of get_insn_info algorithm
|
119
134
|
* 0: linear search
|
@@ -238,6 +253,8 @@ union ic_serial_entry {
|
|
238
253
|
VALUE data[2];
|
239
254
|
};
|
240
255
|
|
256
|
+
#define IMEMO_CONST_CACHE_SHAREABLE IMEMO_FL_USER0
|
257
|
+
|
241
258
|
// imemo_constcache
|
242
259
|
struct iseq_inline_constant_cache_entry {
|
243
260
|
VALUE flags;
|
@@ -378,6 +395,8 @@ enum rb_builtin_attr {
|
|
378
395
|
BUILTIN_ATTR_SINGLE_NOARG_LEAF = 0x02,
|
379
396
|
// This attribute signals JIT to duplicate the iseq for each block iseq so that its `yield` will be monomorphic.
|
380
397
|
BUILTIN_ATTR_INLINE_BLOCK = 0x04,
|
398
|
+
// The iseq acts like a C method in backtraces.
|
399
|
+
BUILTIN_ATTR_C_TRACE = 0x08,
|
381
400
|
};
|
382
401
|
|
383
402
|
typedef VALUE (*rb_jit_func_t)(struct rb_execution_context_struct *, struct rb_control_frame_struct *);
|
@@ -427,6 +446,7 @@ struct rb_iseq_constant_body {
|
|
427
446
|
unsigned int anon_rest: 1;
|
428
447
|
unsigned int anon_kwrest: 1;
|
429
448
|
unsigned int use_block: 1;
|
449
|
+
unsigned int forwardable: 1;
|
430
450
|
} flags;
|
431
451
|
|
432
452
|
unsigned int size;
|
@@ -586,6 +606,12 @@ rb_iseq_check(const rb_iseq_t *iseq)
|
|
586
606
|
return iseq;
|
587
607
|
}
|
588
608
|
|
609
|
+
static inline bool
|
610
|
+
rb_iseq_attr_p(const rb_iseq_t *iseq, enum rb_builtin_attr attr)
|
611
|
+
{
|
612
|
+
return (ISEQ_BODY(iseq)->builtin_attrs & attr) == attr;
|
613
|
+
}
|
614
|
+
|
589
615
|
static inline const rb_iseq_t *
|
590
616
|
def_iseq_ptr(rb_method_definition_t *def)
|
591
617
|
{
|
@@ -616,10 +642,9 @@ typedef struct rb_at_exit_list {
|
|
616
642
|
struct rb_at_exit_list *next;
|
617
643
|
} rb_at_exit_list;
|
618
644
|
|
619
|
-
|
620
|
-
|
621
|
-
void
|
622
|
-
void rb_objspace_call_finalizer(struct rb_objspace *);
|
645
|
+
void *rb_objspace_alloc(void);
|
646
|
+
void rb_objspace_free(void *objspace);
|
647
|
+
void rb_objspace_call_finalizer(void);
|
623
648
|
|
624
649
|
typedef struct rb_hook_list_struct {
|
625
650
|
struct rb_event_hook_struct *hooks;
|
@@ -743,9 +768,6 @@ typedef struct rb_vm_struct {
|
|
743
768
|
VALUE cmd[RUBY_NSIG];
|
744
769
|
} trap_list;
|
745
770
|
|
746
|
-
/* relation table of ensure - rollback for callcc */
|
747
|
-
struct st_table *ensure_rollback_table;
|
748
|
-
|
749
771
|
/* postponed_job (async-signal-safe, and thread-safe) */
|
750
772
|
struct rb_postponed_job_queue *postponed_job_queue;
|
751
773
|
|
@@ -759,10 +781,13 @@ typedef struct rb_vm_struct {
|
|
759
781
|
VALUE coverages, me2counter;
|
760
782
|
int coverage_mode;
|
761
783
|
|
762
|
-
struct
|
763
|
-
|
764
|
-
|
765
|
-
|
784
|
+
struct {
|
785
|
+
struct rb_objspace *objspace;
|
786
|
+
struct gc_mark_func_data_struct {
|
787
|
+
void *data;
|
788
|
+
void (*mark_func)(VALUE v, void *data);
|
789
|
+
} *mark_func_data;
|
790
|
+
} gc;
|
766
791
|
|
767
792
|
rb_at_exit_list *at_exit;
|
768
793
|
|
@@ -774,13 +799,13 @@ typedef struct rb_vm_struct {
|
|
774
799
|
struct rb_id_table *negative_cme_table;
|
775
800
|
st_table *overloaded_cme_table; // cme -> overloaded_cme
|
776
801
|
st_table *unused_block_warning_table;
|
777
|
-
bool unused_block_warning_strict;
|
778
802
|
|
779
803
|
// This id table contains a mapping from ID to ICs. It does this with ID
|
780
804
|
// keys and nested st_tables as values. The nested tables have ICs as keys
|
781
805
|
// and Qtrue as values. It is used when inline constant caches need to be
|
782
806
|
// invalidated or ISEQs are being freed.
|
783
807
|
struct rb_id_table *constant_cache;
|
808
|
+
ID inserting_constant_cache_id;
|
784
809
|
|
785
810
|
#ifndef VM_GLOBAL_CC_CACHE_TABLE_SIZE
|
786
811
|
#define VM_GLOBAL_CC_CACHE_TABLE_SIZE 1023
|
@@ -986,17 +1011,6 @@ struct rb_unblock_callback {
|
|
986
1011
|
|
987
1012
|
struct rb_mutex_struct;
|
988
1013
|
|
989
|
-
typedef struct rb_ensure_entry {
|
990
|
-
VALUE marker;
|
991
|
-
VALUE (*e_proc)(VALUE);
|
992
|
-
VALUE data2;
|
993
|
-
} rb_ensure_entry_t;
|
994
|
-
|
995
|
-
typedef struct rb_ensure_list {
|
996
|
-
struct rb_ensure_list *next;
|
997
|
-
struct rb_ensure_entry entry;
|
998
|
-
} rb_ensure_list_t;
|
999
|
-
|
1000
1014
|
typedef struct rb_fiber_struct rb_fiber_t;
|
1001
1015
|
|
1002
1016
|
struct rb_waiting_list {
|
@@ -1035,9 +1049,6 @@ struct rb_execution_context_struct {
|
|
1035
1049
|
const VALUE *root_lep;
|
1036
1050
|
VALUE root_svar;
|
1037
1051
|
|
1038
|
-
/* ensure & callcc */
|
1039
|
-
rb_ensure_list_t *ensure_list;
|
1040
|
-
|
1041
1052
|
/* trace information */
|
1042
1053
|
struct rb_trace_arg_struct *trace_arg;
|
1043
1054
|
|
@@ -1146,6 +1157,7 @@ typedef struct rb_thread_struct {
|
|
1146
1157
|
struct rb_unblock_callback unblock;
|
1147
1158
|
VALUE locking_mutex;
|
1148
1159
|
struct rb_mutex_struct *keeping_mutexes;
|
1160
|
+
struct ccan_list_head interrupt_exec_tasks;
|
1149
1161
|
|
1150
1162
|
struct rb_waiting_list *join_list;
|
1151
1163
|
|
@@ -1213,7 +1225,7 @@ rb_iseq_t *rb_iseq_new (const VALUE ast_value, VALUE name, VALUE path, V
|
|
1213
1225
|
rb_iseq_t *rb_iseq_new_top (const VALUE ast_value, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
|
1214
1226
|
rb_iseq_t *rb_iseq_new_main (const VALUE ast_value, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt);
|
1215
1227
|
rb_iseq_t *rb_iseq_new_eval (const VALUE ast_value, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth);
|
1216
|
-
rb_iseq_t *rb_iseq_new_with_opt(
|
1228
|
+
rb_iseq_t *rb_iseq_new_with_opt( VALUE ast_value, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
1217
1229
|
enum rb_iseq_type, const rb_compile_option_t*,
|
1218
1230
|
VALUE script_lines);
|
1219
1231
|
|
@@ -1296,6 +1308,15 @@ enum vm_check_match_type {
|
|
1296
1308
|
#define VM_CHECKMATCH_TYPE_MASK 0x03
|
1297
1309
|
#define VM_CHECKMATCH_ARRAY 0x04
|
1298
1310
|
|
1311
|
+
enum vm_opt_newarray_send_type {
|
1312
|
+
VM_OPT_NEWARRAY_SEND_MAX = 1,
|
1313
|
+
VM_OPT_NEWARRAY_SEND_MIN = 2,
|
1314
|
+
VM_OPT_NEWARRAY_SEND_HASH = 3,
|
1315
|
+
VM_OPT_NEWARRAY_SEND_PACK = 4,
|
1316
|
+
VM_OPT_NEWARRAY_SEND_PACK_BUFFER = 5,
|
1317
|
+
VM_OPT_NEWARRAY_SEND_INCLUDE_P = 6,
|
1318
|
+
};
|
1319
|
+
|
1299
1320
|
enum vm_special_object_type {
|
1300
1321
|
VM_SPECIAL_OBJECT_VMCORE = 1,
|
1301
1322
|
VM_SPECIAL_OBJECT_CBASE,
|
@@ -1501,22 +1522,13 @@ VM_ENV_ESCAPED_P(const VALUE *ep)
|
|
1501
1522
|
return VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) ? 1 : 0;
|
1502
1523
|
}
|
1503
1524
|
|
1504
|
-
#if VM_CHECK_MODE > 0
|
1505
|
-
static inline int
|
1506
|
-
vm_assert_env(VALUE obj)
|
1507
|
-
{
|
1508
|
-
VM_ASSERT(imemo_type_p(obj, imemo_env));
|
1509
|
-
return 1;
|
1510
|
-
}
|
1511
|
-
#endif
|
1512
|
-
|
1513
1525
|
RBIMPL_ATTR_NONNULL((1))
|
1514
1526
|
static inline VALUE
|
1515
1527
|
VM_ENV_ENVVAL(const VALUE *ep)
|
1516
1528
|
{
|
1517
1529
|
VALUE envval = ep[VM_ENV_DATA_INDEX_ENV];
|
1518
1530
|
VM_ASSERT(VM_ENV_ESCAPED_P(ep));
|
1519
|
-
VM_ASSERT(
|
1531
|
+
VM_ASSERT(envval == Qundef || imemo_type_p(envval, imemo_env));
|
1520
1532
|
return envval;
|
1521
1533
|
}
|
1522
1534
|
|
@@ -1959,6 +1971,8 @@ rb_ec_vm_ptr(const rb_execution_context_t *ec)
|
|
1959
1971
|
}
|
1960
1972
|
}
|
1961
1973
|
|
1974
|
+
NOINLINE(struct rb_execution_context_struct *rb_current_ec_noinline(void));
|
1975
|
+
|
1962
1976
|
static inline rb_execution_context_t *
|
1963
1977
|
rb_current_execution_context(bool expect_ec)
|
1964
1978
|
{
|
@@ -66,6 +66,11 @@ typedef enum call_type {
|
|
66
66
|
CALL_FCALL_KW
|
67
67
|
} call_type;
|
68
68
|
|
69
|
+
struct rb_forwarding_call_data {
|
70
|
+
struct rb_call_data cd;
|
71
|
+
CALL_INFO caller_ci;
|
72
|
+
};
|
73
|
+
|
69
74
|
#if VM_COLLECT_USAGE_DETAILS
|
70
75
|
enum vm_regan_regtype {
|
71
76
|
VM_REGAN_PC = 0,
|
@@ -258,8 +263,8 @@ THROW_DATA_CONSUMED_SET(struct vm_throw_data *obj)
|
|
258
263
|
static inline bool
|
259
264
|
vm_call_cacheable(const struct rb_callinfo *ci, const struct rb_callcache *cc)
|
260
265
|
{
|
261
|
-
return (vm_ci_flag(ci) & VM_CALL_FCALL) ||
|
262
|
-
METHOD_ENTRY_VISI(vm_cc_cme(cc)) != METHOD_VISI_PROTECTED;
|
266
|
+
return !(vm_ci_flag(ci) & VM_CALL_FORWARDING) && ((vm_ci_flag(ci) & VM_CALL_FCALL) ||
|
267
|
+
METHOD_ENTRY_VISI(vm_cc_cme(cc)) != METHOD_VISI_PROTECTED);
|
263
268
|
}
|
264
269
|
/* If this returns true, an optimized function returned by `vm_call_iseq_setup_func`
|
265
270
|
can be used as a fastpath. */
|
@@ -21,9 +21,9 @@ void rb_vm_lock_body(LOCATION_ARGS);
|
|
21
21
|
void rb_vm_unlock_body(LOCATION_ARGS);
|
22
22
|
|
23
23
|
struct rb_ractor_struct;
|
24
|
-
void rb_vm_lock_enter_body_cr(struct rb_ractor_struct *cr, unsigned int *lev APPEND_LOCATION_ARGS);
|
25
|
-
void rb_vm_lock_enter_body_nb(unsigned int *lev APPEND_LOCATION_ARGS);
|
26
|
-
void rb_vm_lock_enter_body(unsigned int *lev APPEND_LOCATION_ARGS);
|
24
|
+
NOINLINE(void rb_vm_lock_enter_body_cr(struct rb_ractor_struct *cr, unsigned int *lev APPEND_LOCATION_ARGS));
|
25
|
+
NOINLINE(void rb_vm_lock_enter_body_nb(unsigned int *lev APPEND_LOCATION_ARGS));
|
26
|
+
NOINLINE(void rb_vm_lock_enter_body(unsigned int *lev APPEND_LOCATION_ARGS));
|
27
27
|
void rb_vm_lock_leave_body(unsigned int *lev APPEND_LOCATION_ARGS);
|
28
28
|
void rb_vm_barrier(void);
|
29
29
|
|
@@ -64,7 +64,6 @@ static const void *const insns_address_table[] = {
|
|
64
64
|
LABEL_PTR(toregexp),
|
65
65
|
LABEL_PTR(intern),
|
66
66
|
LABEL_PTR(newarray),
|
67
|
-
LABEL_PTR(newarraykwsplat),
|
68
67
|
LABEL_PTR(pushtoarraykwsplat),
|
69
68
|
LABEL_PTR(duparray),
|
70
69
|
LABEL_PTR(duphash),
|
@@ -93,13 +92,18 @@ static const void *const insns_address_table[] = {
|
|
93
92
|
LABEL_PTR(definemethod),
|
94
93
|
LABEL_PTR(definesmethod),
|
95
94
|
LABEL_PTR(send),
|
95
|
+
LABEL_PTR(sendforward),
|
96
96
|
LABEL_PTR(opt_send_without_block),
|
97
97
|
LABEL_PTR(objtostring),
|
98
|
+
LABEL_PTR(opt_ary_freeze),
|
99
|
+
LABEL_PTR(opt_hash_freeze),
|
98
100
|
LABEL_PTR(opt_str_freeze),
|
99
101
|
LABEL_PTR(opt_nil_p),
|
100
102
|
LABEL_PTR(opt_str_uminus),
|
103
|
+
LABEL_PTR(opt_duparray_send),
|
101
104
|
LABEL_PTR(opt_newarray_send),
|
102
105
|
LABEL_PTR(invokesuper),
|
106
|
+
LABEL_PTR(invokesuperforward),
|
103
107
|
LABEL_PTR(invokeblock),
|
104
108
|
LABEL_PTR(leave),
|
105
109
|
LABEL_PTR(throw),
|
@@ -170,7 +174,6 @@ static const void *const insns_address_table[] = {
|
|
170
174
|
LABEL_PTR(trace_toregexp),
|
171
175
|
LABEL_PTR(trace_intern),
|
172
176
|
LABEL_PTR(trace_newarray),
|
173
|
-
LABEL_PTR(trace_newarraykwsplat),
|
174
177
|
LABEL_PTR(trace_pushtoarraykwsplat),
|
175
178
|
LABEL_PTR(trace_duparray),
|
176
179
|
LABEL_PTR(trace_duphash),
|
@@ -199,13 +202,18 @@ static const void *const insns_address_table[] = {
|
|
199
202
|
LABEL_PTR(trace_definemethod),
|
200
203
|
LABEL_PTR(trace_definesmethod),
|
201
204
|
LABEL_PTR(trace_send),
|
205
|
+
LABEL_PTR(trace_sendforward),
|
202
206
|
LABEL_PTR(trace_opt_send_without_block),
|
203
207
|
LABEL_PTR(trace_objtostring),
|
208
|
+
LABEL_PTR(trace_opt_ary_freeze),
|
209
|
+
LABEL_PTR(trace_opt_hash_freeze),
|
204
210
|
LABEL_PTR(trace_opt_str_freeze),
|
205
211
|
LABEL_PTR(trace_opt_nil_p),
|
206
212
|
LABEL_PTR(trace_opt_str_uminus),
|
213
|
+
LABEL_PTR(trace_opt_duparray_send),
|
207
214
|
LABEL_PTR(trace_opt_newarray_send),
|
208
215
|
LABEL_PTR(trace_invokesuper),
|
216
|
+
LABEL_PTR(trace_invokesuperforward),
|
209
217
|
LABEL_PTR(trace_invokeblock),
|
210
218
|
LABEL_PTR(trace_leave),
|
211
219
|
LABEL_PTR(trace_throw),
|
@@ -37,6 +37,7 @@ void rb_yjit_collect_binding_alloc(void);
|
|
37
37
|
void rb_yjit_collect_binding_set(void);
|
38
38
|
void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception);
|
39
39
|
void rb_yjit_init(bool yjit_enabled);
|
40
|
+
void rb_yjit_free_at_exit();
|
40
41
|
void rb_yjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
|
41
42
|
void rb_yjit_constant_state_changed(ID id);
|
42
43
|
void rb_yjit_iseq_mark(void *payload);
|
@@ -3,6 +3,8 @@ require 'rbconfig'
|
|
3
3
|
|
4
4
|
module Debase
|
5
5
|
module RubyCoreSource
|
6
|
+
MOCK_RUBY_VERSION_KEY = "MOCK_RUBY_VERSION"
|
7
|
+
|
6
8
|
REVISION_MAP = {
|
7
9
|
# Add pre-release version here since they do not have patchlevel to refer to.
|
8
10
|
# Revision can be found at `revision.h` of ruby sources.
|
@@ -54,7 +56,7 @@ module Debase
|
|
54
56
|
expected_directory
|
55
57
|
else
|
56
58
|
# Fallback to an older version.
|
57
|
-
ruby_version = Gem::Version.new(RUBY_VERSION)
|
59
|
+
ruby_version = Gem::Version.new(ENV[MOCK_RUBY_VERSION_KEY] || RUBY_VERSION)
|
58
60
|
path, = Dir.glob(prefix + 'ruby-*').
|
59
61
|
select { |d| File.directory?(d) }.
|
60
62
|
map { |d| [d, ruby_source_dir_version(d)] }.
|
@@ -68,7 +70,7 @@ module Debase
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def self.ruby_source_dir_version(dir)
|
71
|
-
match = /ruby-([0-9\.]+)-((p|rc|preview)[0-9]+)\z/.match(dir)
|
73
|
+
match = /ruby-([0-9\.]+)-((p|rc|preview)-?[0-9]+)\z/.match(dir)
|
72
74
|
Gem::Version.new("#{match[1]}.#{match[2]}")
|
73
75
|
end
|
74
76
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
DIR_NAME = File.dirname(__FILE__)
|
4
|
+
$:.unshift File.join(DIR_NAME, "..", "lib")
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'debase/ruby_core_source'
|
8
|
+
|
9
|
+
class DeduceSourceDirTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_deduce_source_dir
|
12
|
+
version_to_answer = {
|
13
|
+
"3.4.1" => "ruby-3.4.0-p-1",
|
14
|
+
"3.4.0" => "ruby-3.4.0-p-1",
|
15
|
+
"3.3.6" => "ruby-3.3.5-p100",
|
16
|
+
"3.3.5" => "ruby-3.3.5-p100",
|
17
|
+
"3.3.4" => "ruby-3.3.0-p0",
|
18
|
+
"3.3.3" => "ruby-3.3.0-p0",
|
19
|
+
"3.2.6" => "ruby-3.2.0-p0",
|
20
|
+
"3.1.6" => "ruby-3.1.0-p0",
|
21
|
+
"3.0.7" => "ruby-3.0.0-p0",
|
22
|
+
}
|
23
|
+
|
24
|
+
version_to_answer.each do |version, answer|
|
25
|
+
ENV[Debase::RubyCoreSource::MOCK_RUBY_VERSION_KEY] = version
|
26
|
+
result = Debase::RubyCoreSource.deduce_packaged_source_dir(version)
|
27
|
+
deduced_source_dir_name = result.split(File::SEPARATOR).last
|
28
|
+
assert_equal(answer, deduced_source_dir_name)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|