summaryrefslogtreecommitdiff
path: root/spec/ruby/command_line/dash_upper_k_spec.rb
blob: a060eab79347f32c582f573a7636702f3b08d42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require_relative '../spec_helper'

describe 'The -K command line option' do
  before :each do
    @test_string = "print [__ENCODING__&.name, Encoding.default_external&.name, Encoding.default_internal&.name].inspect"
  end

  describe 'sets __ENCODING__ and Encoding.default_external' do
    it "to Encoding::BINARY with -Ka" do
      ruby_exe(@test_string, options: '-Ka').should ==
        [Encoding::BINARY.name, Encoding::BINARY.name, nil].inspect
    end

    it "to Encoding::BINARY with -KA" do
      ruby_exe(@test_string, options: '-KA').should ==
        [Encoding::BINARY.name, Encoding::BINARY.name, nil].inspect
    end

    it "to Encoding::BINARY with -Kn" do
      ruby_exe(@test_string, options: '-Kn').should ==
        [Encoding::BINARY.name, Encoding::BINARY.name, nil].inspect
    end

    it "to Encoding::BINARY with -KN" do
      ruby_exe(@test_string, options: '-KN').should ==
        [Encoding::BINARY.name, Encoding::BINARY.name, nil].inspect
    end

    it "to Encoding::EUC_JP with -Ke" do
      ruby_exe(@test_string, options: '-Ke').should ==
        [Encoding::EUC_JP.name, Encoding::EUC_JP.name, nil].inspect
    end

    it "to Encoding::EUC_JP with -KE" do
      ruby_exe(@test_string, options: '-KE').should ==
        [Encoding::EUC_JP.name, Encoding::EUC_JP.name, nil].inspect
    end

    it "to Encoding::UTF_8 with -Ku" do
      ruby_exe(@test_string, options: '-Ku').should ==
        [Encoding::UTF_8.name, Encoding::UTF_8.name, nil].inspect
    end

    it "to Encoding::UTF_8 with -KU" do
      ruby_exe(@test_string, options: '-KU').should ==
        [Encoding::UTF_8.name, Encoding::UTF_8.name, nil].inspect
    end

    it "to Encoding::Windows_31J with -Ks" do
      ruby_exe(@test_string, options: '-Ks').should ==
        [Encoding::Windows_31J.name, Encoding::Windows_31J.name, nil].inspect
    end

    it "to Encoding::Windows_31J with -KS" do
      ruby_exe(@test_string, options: '-KS').should ==
        [Encoding::Windows_31J.name, Encoding::Windows_31J.name, nil].inspect
    end
  end

  it "ignores unknown codes" do
    locale = Encoding.find('locale')
    ruby_exe(@test_string, options: '-KZ').should ==
      [Encoding::UTF_8.name, locale.name, nil].inspect
  end
end
84761fb113fd77'>.github/actions/setup/macos/action.yml19
-rw-r--r--.github/actions/slack/action.yml16
-rw-r--r--.github/auto_request_review.yml19
-rw-r--r--.github/dependabot.yml4
-rw-r--r--.github/labeler.yml6
-rw-r--r--.github/workflows/annocheck.yml12
-rw-r--r--.github/workflows/auto_request_review.yml3
-rw-r--r--.github/workflows/auto_review_pr.yml33
-rw-r--r--.github/workflows/baseruby.yml13
-rw-r--r--.github/workflows/bundled_gems.yml97
-rw-r--r--.github/workflows/check_dependencies.yml31
-rw-r--r--.github/workflows/check_misc.yml126
-rw-r--r--.github/workflows/codeql-analysis.yml23
-rw-r--r--.github/workflows/compilers.yml544
-rw-r--r--.github/workflows/cygwin.yml71
-rw-r--r--.github/workflows/default_gems_list.yml99
-rw-r--r--.github/workflows/dependabot_automerge.yml18
-rw-r--r--.github/workflows/labeler.yml12
-rw-r--r--.github/workflows/macos.yml66
-rw-r--r--.github/workflows/mingw.yml173
-rw-r--r--.github/workflows/modgc.yml176
-rw-r--r--.github/workflows/parse_y.yml100
-rw-r--r--.github/workflows/post_push.yml85
-rw-r--r--.github/workflows/pr-playground.yml2
-rw-r--r--.github/workflows/prism.yml114
-rw-r--r--.github/workflows/publish.yml107
-rw-r--r--.github/workflows/release.yml18
-rw-r--r--.github/workflows/rjit-bindgen.yml86
-rw-r--r--.github/workflows/rjit.yml114
-rw-r--r--.github/workflows/rust-warnings.yml60
-rw-r--r--.github/workflows/scorecards.yml46
-rw-r--r--.github/workflows/spec_guards.yml19
-rw-r--r--.github/workflows/sync_default_gems.yml77
-rw-r--r--.github/workflows/ubuntu.yml150
-rw-r--r--.github/workflows/wasm.yml28
-rw-r--r--.github/workflows/windows.yml209
-rw-r--r--.github/workflows/wsl.yml70
-rw-r--r--.github/workflows/yjit-macos.yml72
-rw-r--r--.github/workflows/yjit-ubuntu.yml91
-rw-r--r--.github/workflows/zjit-macos.yml214
-rw-r--r--.github/workflows/zjit-ubuntu.yml267
-rw-r--r--.gitignore13
-rw-r--r--.rdoc_options32
-rw-r--r--.travis.yml153
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--COPYING2
-rw-r--r--COPYING.ja2
-rw-r--r--Cargo.lock193
-rw-r--r--Cargo.toml60
-rw-r--r--LEGAL263
-rw-r--r--NEWS.md175
-rw-r--r--README.ja.md11
-rw-r--r--README.md5
-rw-r--r--addr2line.c526
-rw-r--r--array.c3281
-rw-r--r--array.rb321
-rw-r--r--ast.c387
-rw-r--r--ast.rb62
-rwxr-xr-xautogen.sh21
-rw-r--r--benchmark/README.md3
-rw-r--r--benchmark/app_aobench.rb4
-rw-r--r--benchmark/app_fib.rb2
-rw-r--r--benchmark/class_superclass.yml23
-rw-r--r--benchmark/file_join.yml7
-rw-r--r--benchmark/hash_new.yml16
-rw-r--r--benchmark/io_close.yml13
-rw-r--r--benchmark/io_close_contended.yml21
-rw-r--r--benchmark/lib/benchmark_driver/runner/ractor.rb2
-rw-r--r--benchmark/module_eqq.yml7
-rw-r--r--benchmark/nilclass.yml10
-rw-r--r--benchmark/object_allocate.yml1
-rw-r--r--benchmark/object_class.yml40
-rw-r--r--benchmark/object_id.yml4
-rw-r--r--benchmark/ractor_string_fstring.yml18
-rw-r--r--benchmark/scan.yaml16
-rw-r--r--benchmark/search.yaml16
-rw-r--r--benchmark/set.yml261
-rw-r--r--benchmark/string_casecmp.yml2
-rw-r--r--benchmark/string_concat.yml4
-rw-r--r--benchmark/string_fstring.yml16
-rw-r--r--benchmark/string_gsub.yml43
-rw-r--r--benchmark/struct_accessor.yml12
-rw-r--r--benchmark/time_now.yml1
-rw-r--r--benchmark/time_strftime.yml7
-rw-r--r--benchmark/time_xmlschema.yml27
-rw-r--r--benchmark/vm_ivar_get.yml67
-rw-r--r--benchmark/vm_ivar_set_on_instance.yml63
-rw-r--r--bignum.c171
-rwxr-xr-xbootstraptest/runner.rb169
-rw-r--r--bootstraptest/test_autoload.rb12
-rw-r--r--bootstraptest/test_eval.rb2
-rw-r--r--bootstraptest/test_fiber.rb5
-rw-r--r--bootstraptest/test_fork.rb27
-rw-r--r--bootstraptest/test_gc.rb2
-rw-r--r--bootstraptest/test_insns.rb60
-rw-r--r--bootstraptest/test_io.rb4
-rw-r--r--bootstraptest/test_literal.rb8
-rw-r--r--bootstraptest/test_load.rb14
-rw-r--r--bootstraptest/test_method.rb258
-rw-r--r--bootstraptest/test_ractor.rb1714
-rw-r--r--bootstraptest/test_rjit.rb58
-rw-r--r--bootstraptest/test_syntax.rb4
-rw-r--r--bootstraptest/test_thread.rb13
-rw-r--r--bootstraptest/test_yjit.rb718
-rw-r--r--bootstraptest/test_yjit_rust_port.rb8
-rw-r--r--box.c1220
-rw-r--r--builtin.c24
-rw-r--r--builtin.h8
-rw-r--r--class.c1105
-rw-r--r--common.mk19864
-rw-r--r--compar.c43
-rw-r--r--compile.c1599
-rw-r--r--complex.c286
-rw-r--r--concurrent_set.c513
-rw-r--r--configure.ac617
-rw-r--r--cont.c514
-rw-r--r--coroutine/amd64/Context.S42
-rw-r--r--coroutine/amd64/Context.h2
-rw-r--r--coroutine/arm32/Context.S7
-rw-r--r--coroutine/arm32/Context.h2
-rw-r--r--coroutine/arm64/Context.S96
-rw-r--r--coroutine/arm64/Context.asm81
-rw-r--r--coroutine/arm64/Context.h26
-rw-r--r--coroutine/loongarch64/Context.S5
-rw-r--r--coroutine/loongarch64/Context.h2
-rw-r--r--coroutine/ppc/Context.S5
-rw-r--r--coroutine/ppc64/Context.S5
-rw-r--r--coroutine/ppc64le/Context.S21
-rw-r--r--coroutine/ppc64le/Context.h2
-rw-r--r--coroutine/riscv64/Context.S5
-rw-r--r--coroutine/riscv64/Context.h2
-rw-r--r--coroutine/win32/Context.h3
-rw-r--r--coroutine/win64/Context.h3
-rw-r--r--coroutine/x86/Context.S5
-rw-r--r--coroutine/x86/Context.h2
-rw-r--r--cygwin/GNUmakefile.in18
-rw-r--r--darray.h133
-rw-r--r--debug.c23
-rw-r--r--debug_counter.h8
-rw-r--r--defs/gmake.mk140
-rw-r--r--defs/id.def9
-rw-r--r--defs/jit.mk96
-rw-r--r--depend20573
-rw-r--r--dir.c263
-rw-r--r--dir.rb28
-rw-r--r--dln.c97
-rw-r--r--dln.h3
-rw-r--r--dmydln.c20
-rw-r--r--doc/.document13
-rw-r--r--doc/ChangeLog/ChangeLog-1.9.32
-rw-r--r--doc/ChangeLog/ChangeLog-2.0.02
-rw-r--r--doc/ChangeLog/ChangeLog-2.1.04
-rw-r--r--doc/ChangeLog/ChangeLog-2.3.08
-rw-r--r--doc/ChangeLog/ChangeLog-2.4.04
-rw-r--r--doc/NEWS/NEWS-3.0.0.md6
-rw-r--r--doc/NEWS/NEWS-3.1.0.md4
-rw-r--r--doc/NEWS/NEWS-3.2.0.md4
-rw-r--r--doc/NEWS/NEWS-3.4.0.md962
-rw-r--r--doc/NEWS/NEWS-4.0.0.md802
-rw-r--r--doc/_regexp.rdoc104
-rw-r--r--doc/_timezones.rdoc51
-rw-r--r--doc/case_mapping.rdoc116
-rw-r--r--doc/character_selectors.rdoc97
-rw-r--r--doc/command_injection.rdoc37
-rw-r--r--doc/command_line/environment.md173
-rw-r--r--doc/contributing.md12
-rw-r--r--doc/contributing/bug_triaging.rdoc (renamed from doc/bug_triaging.rdoc)0
-rw-r--r--doc/contributing/building_ruby.md139
-rw-r--r--doc/contributing/concurrency_guide.md154
-rw-r--r--doc/contributing/contributing.md35
-rw-r--r--doc/contributing/documentation_guide.md240
-rw-r--r--doc/contributing/dtrace_probes.rdoc (renamed from doc/dtrace_probes.rdoc)0
-rw-r--r--doc/contributing/glossary.md15
-rw-r--r--doc/contributing/making_changes_to_stdlibs.md14
-rw-r--r--doc/contributing/memory_view.md (renamed from doc/memory_view.md)0
-rw-r--r--doc/contributing/reporting_issues.md37
-rw-r--r--doc/contributing/testing_ruby.md109
-rw-r--r--doc/contributing/vm_stack_and_frames.md163
-rw-r--r--doc/date/calendars.rdoc62
-rw-r--r--doc/distribution.md47
-rw-r--r--doc/distribution/distribution.md48
-rw-r--r--doc/distribution/windows.md304
-rw-r--r--doc/encodings.rdoc481
-rw-r--r--doc/examples/files.rdoc8
-rw-r--r--doc/exceptions.md362
-rw-r--r--doc/extension.ja.rdoc2
-rw-r--r--doc/extension.rdoc4
-rw-r--r--doc/fiber.md232
-rw-r--r--doc/float.rb128
-rw-r--r--doc/format_specifications.rdoc348
-rw-r--r--doc/forwardable.rd.ja2
-rw-r--r--doc/globals.rdoc422
-rw-r--r--doc/index.md65
-rw-r--r--doc/irb/indexes.md189
-rw-r--r--doc/irb/irb-tools.rd.ja184
-rw-r--r--doc/irb/irb.rd.ja425
-rw-r--r--doc/jit/yjit.md544
-rw-r--r--doc/jit/zjit.md397
-rw-r--r--doc/language/box.md361
-rw-r--r--doc/language/bsearch.rdoc (renamed from doc/bsearch.rdoc)0
-rw-r--r--doc/language/calendars.rdoc62
-rw-r--r--doc/language/case_mapping.rdoc106
-rw-r--r--doc/language/character_selectors.rdoc100
-rw-r--r--doc/language/dig_methods.rdoc (renamed from doc/dig_methods.rdoc)0
-rw-r--r--doc/language/encodings.rdoc482
-rw-r--r--doc/language/exceptions.md521
-rw-r--r--doc/language/fiber.md290
-rw-r--r--doc/language/format_specifications.rdoc354
-rw-r--r--doc/language/globals.md610
-rw-r--r--doc/language/hash_inclusion.rdoc31
-rw-r--r--doc/language/implicit_conversion.rdoc (renamed from doc/implicit_conversion.rdoc)0
-rw-r--r--doc/language/marshal.rdoc318
-rw-r--r--doc/language/option_dump.md265
-rw-r--r--doc/language/options.md688
-rw-r--r--doc/language/packed_data.rdoc722
-rw-r--r--doc/language/ractor.md797
-rw-r--r--doc/language/regexp/methods.rdoc (renamed from doc/regexp/methods.rdoc)0
-rw-r--r--doc/language/regexp/unicode_properties.rdoc718
-rw-r--r--doc/language/signals.rdoc106
-rw-r--r--doc/language/strftime_formatting.rdoc525
-rw-r--r--doc/maintainers.md540
-rw-r--r--doc/marshal.rdoc313
-rw-r--r--doc/matchdata/begin.rdoc12
-rw-r--r--doc/matchdata/bytebegin.rdoc30
-rw-r--r--doc/matchdata/byteend.rdoc30
-rw-r--r--doc/matchdata/end.rdoc12
-rw-r--r--doc/matchdata/offset.rdoc12
-rw-r--r--doc/math/math.rdoc2
-rw-r--r--doc/optparse/argument_converters.rdoc2
-rw-r--r--doc/optparse/option_params.rdoc39
-rw-r--r--doc/optparse/ruby/matched_values.rb6
-rw-r--r--doc/optparse/tutorial.rdoc32
-rw-r--r--doc/packed_data.rdoc589
-rw-r--r--doc/ractor.md952
-rw-r--r--doc/rdoc/markup_reference.rb1287
-rw-r--r--doc/regexp/unicode_properties.rdoc678
-rw-r--r--doc/reline/face.md111
-rw-r--r--doc/rjit/rjit.md45
-rw-r--r--doc/ruby/option_dump.md297
-rw-r--r--doc/ruby/options.md723
-rw-r--r--doc/security.rdoc139
-rw-r--r--doc/security/command_injection.rdoc15
-rw-r--r--doc/security/security.rdoc127
-rw-r--r--doc/signals.rdoc106
-rw-r--r--doc/standard_library.md225
-rw-r--r--doc/standard_library.rdoc132
-rw-r--r--doc/strftime_formatting.rdoc527
-rw-r--r--doc/string.rb421
-rw-r--r--doc/string/aref.rdoc96
-rw-r--r--doc/string/aset.rdoc179
-rw-r--r--doc/string/b.rdoc2
-rw-r--r--doc/string/bytes.rdoc5
-rw-r--r--doc/string/bytesize.rdoc17
-rw-r--r--doc/string/byteslice.rdoc54
-rw-r--r--doc/string/bytesplice.rdoc66
-rw-r--r--doc/string/capitalize.rdoc26
-rw-r--r--doc/string/center.rdoc21
-rw-r--r--doc/string/chars.rdoc4
-rw-r--r--doc/string/chomp.rdoc8
-rw-r--r--doc/string/chop.rdoc7
-rw-r--r--doc/string/chr.rdoc7
-rw-r--r--doc/string/codepoints.rdoc4
-rw-r--r--doc/string/concat.rdoc11
-rw-r--r--doc/string/count.rdoc74
-rw-r--r--doc/string/delete.rdoc75
-rw-r--r--doc/string/delete_prefix.rdoc11
-rw-r--r--doc/string/delete_suffix.rdoc10
-rw-r--r--doc/string/downcase.rdoc20
-rw-r--r--doc/string/dump.rdoc89
-rw-r--r--doc/string/each_byte.rdoc22
-rw-r--r--doc/string/each_char.rdoc26
-rw-r--r--doc/string/each_codepoint.rdoc28
-rw-r--r--doc/string/each_grapheme_cluster.rdoc19
-rw-r--r--doc/string/each_line.rdoc24
-rw-r--r--doc/string/encode.rdoc5
-rw-r--r--doc/string/end_with_p.rdoc16
-rw-r--r--doc/string/eql_p.rdoc18
-rw-r--r--doc/string/force_encoding.rdoc15
-rw-r--r--doc/string/getbyte.rdoc23
-rw-r--r--doc/string/grapheme_clusters.rdoc15
-rw-r--r--doc/string/hash.rdoc19
-rw-r--r--doc/string/index.rdoc30
-rw-r--r--doc/string/insert.rdoc15
-rw-r--r--doc/string/inspect.rdoc38
-rw-r--r--doc/string/intern.rdoc8
-rw-r--r--doc/string/length.rdoc7
-rw-r--r--doc/string/ljust.rdoc15
-rw-r--r--doc/string/new.rdoc44
-rw-r--r--doc/string/ord.rdoc3
-rw-r--r--doc/string/partition.rdoc51
-rw-r--r--doc/string/rindex.rdoc51
-rw-r--r--doc/string/rjust.rdoc9
-rw-r--r--doc/string/rpartition.rdoc55
-rw-r--r--doc/string/scan.rdoc35
-rw-r--r--doc/string/scrub.rdoc27
-rw-r--r--doc/string/split.rdoc131
-rw-r--r--doc/string/squeeze.rdoc33
-rw-r--r--doc/string/start_with_p.rdoc12
-rw-r--r--doc/string/sub.rdoc33
-rw-r--r--doc/string/succ.rdoc52
-rw-r--r--doc/string/sum.rdoc5
-rw-r--r--doc/string/swapcase.rdoc31
-rw-r--r--doc/string/unicode_normalize.rdoc28
-rw-r--r--doc/string/upcase.rdoc27
-rw-r--r--doc/string/upto.rdoc38
-rw-r--r--doc/string/valid_encoding_p.rdoc8
-rw-r--r--doc/stringio/each_byte.rdoc34
-rw-r--r--doc/stringio/each_char.rdoc34
-rw-r--r--doc/stringio/each_codepoint.rdoc36
-rw-r--r--doc/stringio/each_line.md189
-rw-r--r--doc/stringio/getbyte.rdoc31
-rw-r--r--doc/stringio/getc.rdoc34
-rw-r--r--doc/stringio/gets.rdoc99
-rw-r--r--doc/stringio/pread.rdoc65
-rw-r--r--doc/stringio/putc.rdoc82
-rw-r--r--doc/stringio/read.rdoc83
-rw-r--r--doc/stringio/size.rdoc5
-rw-r--r--doc/stringio/stringio.md700
-rw-r--r--doc/strscan/helper_methods.md12
-rw-r--r--doc/strscan/methods/get_byte.md4
-rw-r--r--doc/strscan/methods/get_charpos.md2
-rw-r--r--doc/strscan/methods/get_pos.md2
-rw-r--r--doc/strscan/methods/getch.md6
-rw-r--r--doc/strscan/methods/scan.md4
-rw-r--r--doc/strscan/methods/scan_until.md4
-rw-r--r--doc/strscan/methods/set_pos.md4
-rw-r--r--doc/strscan/methods/skip.md2
-rw-r--r--doc/strscan/methods/skip_until.md4
-rw-r--r--doc/strscan/methods/terminate.md2
-rw-r--r--doc/strscan/strscan.md69
-rw-r--r--doc/syntax.rdoc5
-rw-r--r--doc/syntax/assignment.rdoc4
-rw-r--r--doc/syntax/calling_methods.rdoc97
-rw-r--r--doc/syntax/comments.rdoc2
-rw-r--r--doc/syntax/control_expressions.rdoc2
-rw-r--r--doc/syntax/exceptions.rdoc2
-rw-r--r--doc/syntax/keywords.rdoc (renamed from doc/keywords.rdoc)0
-rw-r--r--doc/syntax/layout.rdoc118
-rw-r--r--doc/syntax/literals.rdoc96
-rw-r--r--doc/syntax/methods.rdoc1
-rw-r--r--doc/syntax/pattern_matching.rdoc8
-rw-r--r--doc/syntax/refinements.rdoc5
-rw-r--r--doc/windows.md234
-rw-r--r--doc/yjit/yjit.md517
-rw-r--r--doc/yjit/yjit_hacking.md75
-rw-r--r--enc/Makefile.in5
-rw-r--r--enc/ascii.c4
-rw-r--r--enc/big5.c12
-rw-r--r--enc/cp949.c4
-rw-r--r--enc/depend73
-rw-r--r--enc/emacs_mule.c4
-rw-r--r--enc/euc_jp.c4
-rw-r--r--enc/euc_kr.c8
-rw-r--r--enc/euc_tw.c4
-rw-r--r--enc/gb18030.c4
-rw-r--r--enc/gbk.c4
-rw-r--r--enc/iso_8859_1.c6
-rw-r--r--enc/iso_8859_10.c6
-rw-r--r--enc/iso_8859_11.c4
-rw-r--r--enc/iso_8859_13.c6
-rw-r--r--enc/iso_8859_14.c6
-rw-r--r--enc/iso_8859_15.c6
-rw-r--r--enc/iso_8859_16.c6
-rw-r--r--enc/iso_8859_2.c6
-rw-r--r--enc/iso_8859_3.c6
-rw-r--r--enc/iso_8859_4.c6
-rw-r--r--enc/iso_8859_5.c6
-rw-r--r--enc/iso_8859_6.c4
-rw-r--r--enc/iso_8859_7.c6
-rw-r--r--enc/iso_8859_8.c4
-rw-r--r--enc/iso_8859_9.c6
-rw-r--r--enc/jis/props.h.blt17
-rw-r--r--enc/koi8_r.c4
-rw-r--r--enc/koi8_u.c4
-rw-r--r--enc/shift_jis.c4
-rw-r--r--enc/trans/ibm864-tbl.rb126
-rw-r--r--enc/trans/iso2022.trans148
-rw-r--r--enc/trans/single_byte.trans1
-rw-r--r--enc/unicode.c12
-rw-r--r--enc/unicode/15.0.0/casefold.h7629
-rw-r--r--enc/unicode/15.0.0/name2ctype.h45690
-rw-r--r--enc/unicode/17.0.0/casefold.h8013
-rw-r--r--enc/unicode/17.0.0/name2ctype.h49725
-rw-r--r--enc/us_ascii.c4
-rw-r--r--enc/utf_16be.c4
-rw-r--r--enc/utf_16le.c4
-rw-r--r--enc/utf_32be.c4
-rw-r--r--enc/utf_32le.c4
-rw-r--r--enc/utf_8.c4
-rw-r--r--enc/windows_1250.c6
-rw-r--r--enc/windows_1251.c6
-rw-r--r--enc/windows_1252.c6
-rw-r--r--enc/windows_1253.c6
-rw-r--r--enc/windows_1254.c6
-rw-r--r--enc/windows_1257.c6
-rw-r--r--enc/windows_31j.c4
-rw-r--r--encoding.c423
-rw-r--r--enum.c276
-rw-r--r--enumerator.c596
-rw-r--r--error.c769
-rw-r--r--eval.c439
-rw-r--r--eval_intern.h7
-rw-r--r--eval_jump.c28
-rw-r--r--ext/-test-/RUBY_ALIGNOF/depend1
-rw-r--r--ext/-test-/abi/depend3
-rw-r--r--ext/-test-/arith_seq/beg_len_step/depend1
-rw-r--r--ext/-test-/arith_seq/extract/depend1
-rw-r--r--ext/-test-/array/concat/depend1
-rw-r--r--ext/-test-/array/resize/depend1
-rw-r--r--ext/-test-/asan/asan.c24
-rw-r--r--ext/-test-/asan/extconf.rb2
-rw-r--r--ext/-test-/bignum/depend19
-rw-r--r--ext/-test-/box/yay1/extconf.rb1
-rw-r--r--ext/-test-/box/yay1/yay1.c28
-rw-r--r--ext/-test-/box/yay1/yay1.def3
-rw-r--r--ext/-test-/box/yay1/yay1.h4
-rw-r--r--ext/-test-/box/yay2/extconf.rb1
-rw-r--r--ext/-test-/box/yay2/yay2.c28
-rw-r--r--ext/-test-/box/yay2/yay2.def3
-rw-r--r--ext/-test-/box/yay2/yay2.h4
-rw-r--r--ext/-test-/bug-14834/bug-14384.c39
-rw-r--r--ext/-test-/bug-14834/bug-14834.c39
-rw-r--r--ext/-test-/bug-14834/depend321
-rw-r--r--ext/-test-/bug-3571/depend1
-rw-r--r--ext/-test-/bug-5832/depend1
-rw-r--r--ext/-test-/bug_reporter/depend1
-rw-r--r--ext/-test-/class/depend2
-rw-r--r--ext/-test-/class/init.c1
-rw-r--r--ext/-test-/cxxanyargs/cxxanyargs.cpp26
-rw-r--r--ext/-test-/debug/depend3
-rw-r--r--ext/-test-/dln/empty/depend1
-rw-r--r--ext/-test-/econv/append.c2
-rw-r--r--ext/-test-/econv/depend336
-rw-r--r--ext/-test-/ensure_and_callcc/depend163
-rw-r--r--ext/-test-/ensure_and_callcc/ensure_and_callcc.c58
-rw-r--r--ext/-test-/ensure_and_callcc/extconf.rb5
-rw-r--r--ext/-test-/enumerator_kw/depend1
-rw-r--r--ext/-test-/eval/depend162
-rw-r--r--ext/-test-/exception/depend4
-rw-r--r--ext/-test-/fatal/depend3
-rw-r--r--ext/-test-/fatal/invalid.c6
-rw-r--r--ext/-test-/file/depend4
-rw-r--r--ext/-test-/float/depend2
-rw-r--r--ext/-test-/funcall/depend1
-rw-r--r--ext/-test-/gvl/call_without_gvl/depend1
-rw-r--r--ext/-test-/hash/depend2
-rw-r--r--ext/-test-/integer/depend3
-rw-r--r--ext/-test-/iseq_load/depend1
-rw-r--r--ext/-test-/iter/depend3
-rw-r--r--ext/-test-/load/dot.dot/depend1
-rw-r--r--ext/-test-/load/protect/depend1
-rw-r--r--ext/-test-/load/resolve_symbol_resolver/depend163
-rw-r--r--ext/-test-/load/resolve_symbol_resolver/resolve_symbol_resolver.c7
-rw-r--r--ext/-test-/load/resolve_symbol_target/depend164
-rw-r--r--ext/-test-/load/resolve_symbol_target/resolve_symbol_target.def4
-rw-r--r--ext/-test-/load/stringify_symbols/depend164
-rw-r--r--ext/-test-/load/stringify_target/depend164
-rw-r--r--ext/-test-/load/stringify_target/stringify_target.def4
-rw-r--r--ext/-test-/marshal/compat/depend1
-rw-r--r--ext/-test-/marshal/internal_ivar/depend1
-rw-r--r--ext/-test-/marshal/internal_ivar/internal_ivar.c15
-rw-r--r--ext/-test-/marshal/usr/depend1
-rw-r--r--ext/-test-/memory_status/depend1
-rw-r--r--ext/-test-/memory_view/depend1
-rw-r--r--ext/-test-/method/depend2
-rw-r--r--ext/-test-/notimplement/depend1
-rw-r--r--ext/-test-/num2int/depend1
-rw-r--r--ext/-test-/path_to_class/depend1
-rw-r--r--ext/-test-/popen_deadlock/depend1
-rw-r--r--ext/-test-/postponed_job/depend1
-rw-r--r--ext/-test-/printf/depend1
-rw-r--r--ext/-test-/proc/depend3
-rw-r--r--ext/-test-/public_header_warnings/extconf.rb9
-rw-r--r--ext/-test-/random/depend3
-rw-r--r--ext/-test-/random/loop.c11
-rw-r--r--ext/-test-/rational/depend1
-rw-r--r--ext/-test-/rb_call_super_kw/depend1
-rw-r--r--ext/-test-/recursion/depend1
-rw-r--r--ext/-test-/regexp/depend2
-rw-r--r--ext/-test-/sanitizers/depend162
-rw-r--r--ext/-test-/sanitizers/extconf.rb2
-rw-r--r--ext/-test-/sanitizers/sanitizers.c36
-rw-r--r--ext/-test-/scan_args/depend1
-rw-r--r--ext/-test-/scheduler/extconf.rb2
-rw-r--r--ext/-test-/scheduler/scheduler.c92
-rw-r--r--ext/-test-/st/foreach/depend1
-rw-r--r--ext/-test-/st/numhash/depend1
-rw-r--r--ext/-test-/st/update/depend1
-rw-r--r--ext/-test-/stack/depend179
-rw-r--r--ext/-test-/stack/extconf.rb3
-rw-r--r--ext/-test-/stack/stack.c35
-rw-r--r--ext/-test-/string/depend20
-rw-r--r--ext/-test-/string/fstring.c6
-rw-r--r--ext/-test-/string/set_len.c8
-rw-r--r--ext/-test-/struct/depend5
-rw-r--r--ext/-test-/symbol/depend2
-rw-r--r--ext/-test-/thread/id/depend163
-rw-r--r--ext/-test-/thread/instrumentation/depend1
-rw-r--r--ext/-test-/thread/instrumentation/instrumentation.c4
-rw-r--r--ext/-test-/thread/lock_native_thread/depend163
-rw-r--r--ext/-test-/thread_fd/depend161
-rw-r--r--ext/-test-/thread_fd/extconf.rb2
-rw-r--r--ext/-test-/thread_fd/thread_fd.c30
-rw-r--r--ext/-test-/time/depend3
-rw-r--r--ext/-test-/time/leap_second.c15
-rw-r--r--ext/-test-/tracepoint/depend2
-rw-r--r--ext/-test-/tracepoint/gc_hook.c26
-rw-r--r--ext/-test-/tracepoint/tracepoint.c10
-rw-r--r--ext/-test-/typeddata/depend1
-rw-r--r--ext/-test-/vm/depend1
-rw-r--r--ext/-test-/wait/depend1
-rw-r--r--ext/-test-/win32/dln/extconf.rb1
-rw-r--r--ext/.document3
-rw-r--r--ext/cgi/escape/depend1
-rw-r--r--ext/cgi/escape/escape.c30
-rw-r--r--ext/continuation/depend1
-rw-r--r--ext/coverage/coverage.c9
-rw-r--r--ext/coverage/depend3
-rw-r--r--ext/coverage/lib/coverage.rb5
-rw-r--r--ext/date/date.gemspec6
-rw-r--r--ext/date/date_core.c532
-rw-r--r--ext/date/date_parse.c3
-rw-r--r--ext/date/date_strptime.c6
-rw-r--r--ext/date/depend4
-rw-r--r--ext/date/extconf.rb1
-rw-r--r--ext/date/lib/date.rb2
-rw-r--r--ext/date/prereq.mk2
-rw-r--r--ext/date/zonetab.h1250
-rw-r--r--ext/date/zonetab.list7
-rw-r--r--ext/digest/bubblebabble/depend1
-rw-r--r--ext/digest/defs.h22
-rw-r--r--ext/digest/depend1
-rw-r--r--ext/digest/digest.c42
-rw-r--r--ext/digest/digest.h37
-rw-r--r--ext/digest/digest_conf.rb18
-rw-r--r--ext/digest/lib/digest/version.rb3
-rw-r--r--ext/digest/md5/depend2
-rw-r--r--ext/digest/md5/md5cc.h12
-rw-r--r--ext/digest/md5/md5init.c1
-rw-r--r--ext/digest/rmd160/depend2
-rw-r--r--ext/digest/sha1/depend2
-rw-r--r--ext/digest/sha1/sha1.c8
-rw-r--r--ext/digest/sha1/sha1cc.h8
-rw-r--r--ext/digest/sha2/depend2
-rw-r--r--ext/digest/sha2/sha2cc.h39
-rw-r--r--ext/digest/test.sh30
-rw-r--r--ext/erb/escape/escape.c41
-rw-r--r--ext/erb/escape/extconf.rb1
-rw-r--r--ext/etc/depend1
-rw-r--r--ext/etc/etc.c70
-rw-r--r--ext/etc/etc.gemspec5
-rw-r--r--ext/etc/extconf.rb48
-rwxr-xr-xext/extmk.rb61
-rw-r--r--ext/fcntl/depend1
-rw-r--r--ext/fcntl/fcntl.c48
-rw-r--r--ext/fcntl/fcntl.gemspec2
-rw-r--r--ext/fiddle/closure.c458
-rw-r--r--ext/fiddle/closure.h8
-rw-r--r--ext/fiddle/conversions.c383
-rw-r--r--ext/fiddle/conversions.h55
-rw-r--r--ext/fiddle/depend1396
-rw-r--r--ext/fiddle/extconf.rb256
-rw-r--r--ext/fiddle/fiddle.c712
-rw-r--r--ext/fiddle/fiddle.gemspec60
-rw-r--r--ext/fiddle/fiddle.h240
-rw-r--r--ext/fiddle/function.c496
-rw-r--r--ext/fiddle/function.h8
-rw-r--r--ext/fiddle/handle.c591
-rw-r--r--ext/fiddle/lib/fiddle.rb103
-rw-r--r--ext/fiddle/lib/fiddle/closure.rb74
-rw-r--r--ext/fiddle/lib/fiddle/cparser.rb278
-rw-r--r--ext/fiddle/lib/fiddle/function.rb29
-rw-r--r--ext/fiddle/lib/fiddle/import.rb322
-rw-r--r--ext/fiddle/lib/fiddle/pack.rb149
-rw-r--r--ext/fiddle/lib/fiddle/struct.rb539
-rw-r--r--ext/fiddle/lib/fiddle/types.rb73
-rw-r--r--ext/fiddle/lib/fiddle/value.rb120
-rw-r--r--ext/fiddle/lib/fiddle/version.rb3
-rw-r--r--ext/fiddle/memory_view.c321
-rw-r--r--ext/fiddle/pinned.c123
-rw-r--r--ext/fiddle/pointer.c887
-rw-r--r--ext/fiddle/win32/fficonfig.h29
-rw-r--r--ext/fiddle/win32/libffi-3.2.1-mswin.patch191
-rwxr-xr-xext/fiddle/win32/libffi-config.rb48
-rw-r--r--ext/fiddle/win32/libffi.mk.tmpl96
-rw-r--r--ext/io/console/console.c244
-rw-r--r--ext/io/console/depend4
-rw-r--r--ext/io/console/extconf.rb30
-rw-r--r--ext/io/console/io-console.gemspec3
-rw-r--r--ext/io/console/win32_vk.inc325
-rw-r--r--ext/io/console/win32_vk.list2
-rw-r--r--ext/io/nonblock/depend1
-rw-r--r--ext/io/nonblock/extconf.rb2
-rw-r--r--ext/io/nonblock/io-nonblock.gemspec4
-rw-r--r--ext/io/nonblock/nonblock.c4
-rw-r--r--ext/io/wait/depend2
-rw-r--r--ext/io/wait/extconf.rb23
-rw-r--r--ext/io/wait/io-wait.gemspec23
-rw-r--r--ext/io/wait/wait.c418
-rw-r--r--ext/json/fbuffer/fbuffer.h278
-rw-r--r--ext/json/generator/depend8
-rw-r--r--ext/json/generator/extconf.rb7
-rw-r--r--ext/json/generator/generator.c2347
-rw-r--r--ext/json/generator/generator.h172
-rw-r--r--ext/json/json.gemspec94
-rw-r--r--ext/json/json.h101
-rw-r--r--ext/json/lib/json.rb104
-rw-r--r--ext/json/lib/json/add/bigdecimal.rb4
-rw-r--r--ext/json/lib/json/add/complex.rb2
-rw-r--r--ext/json/lib/json/add/core.rb3
-rw-r--r--ext/json/lib/json/add/date.rb2
-rw-r--r--ext/json/lib/json/add/date_time.rb2
-rw-r--r--ext/json/lib/json/add/exception.rb2
-rw-r--r--ext/json/lib/json/add/ostruct.rb2
-rw-r--r--ext/json/lib/json/add/range.rb2
-rw-r--r--ext/json/lib/json/add/rational.rb2
-rw-r--r--ext/json/lib/json/add/regexp.rb2
-rw-r--r--ext/json/lib/json/add/string.rb35
-rw-r--r--ext/json/lib/json/add/struct.rb2
-rw-r--r--ext/json/lib/json/add/symbol.rb12
-rw-r--r--ext/json/lib/json/add/time.rb13
-rw-r--r--ext/json/lib/json/common.rb942
-rw-r--r--ext/json/lib/json/ext.rb40
-rw-r--r--ext/json/lib/json/ext/generator/state.rb103
-rw-r--r--ext/json/lib/json/generic_object.rb10
-rw-r--r--ext/json/lib/json/version.rb10
-rw-r--r--ext/json/parser/depend8
-rw-r--r--ext/json/parser/extconf.rb34
-rw-r--r--ext/json/parser/parser.c3373
-rw-r--r--ext/json/parser/parser.h91
-rw-r--r--ext/json/parser/parser.rl967
-rw-r--r--ext/json/parser/prereq.mk13
-rw-r--r--ext/json/simd/conf.rb24
-rw-r--r--ext/json/simd/simd.h218
-rw-r--r--ext/json/vendor/fpconv.c480
-rw-r--r--ext/json/vendor/jeaiii-ltoa.h267
-rw-r--r--ext/json/vendor/ryu.h819
-rw-r--r--ext/monitor/depend1
-rw-r--r--ext/monitor/lib/monitor.rb10
-rw-r--r--ext/monitor/monitor.c156
-rw-r--r--ext/objspace/depend13
-rw-r--r--ext/objspace/object_tracing.c47
-rw-r--r--ext/objspace/objspace.c179
-rw-r--r--ext/objspace/objspace_dump.c213
-rw-r--r--ext/openssl/History.md249
-rw-r--r--ext/openssl/depend65
-rw-r--r--ext/openssl/extconf.rb97
-rw-r--r--ext/openssl/lib/openssl.rb16
-rw-r--r--ext/openssl/lib/openssl/bn.rb2
-rw-r--r--ext/openssl/lib/openssl/buffering.rb62
-rw-r--r--ext/openssl/lib/openssl/cipher.rb2
-rw-r--r--ext/openssl/lib/openssl/digest.rb4
-rw-r--r--ext/openssl/lib/openssl/marshal.rb2
-rw-r--r--ext/openssl/lib/openssl/pkey.rb120
-rw-r--r--ext/openssl/lib/openssl/ssl.rb97
-rw-r--r--ext/openssl/lib/openssl/version.rb3
-rw-r--r--ext/openssl/lib/openssl/x509.rb21
-rw-r--r--ext/openssl/openssl.gemspec7
-rw-r--r--ext/openssl/openssl_missing.c40
-rw-r--r--ext/openssl/openssl_missing.h208
-rw-r--r--ext/openssl/ossl.c597
-rw-r--r--ext/openssl/ossl.h45
-rw-r--r--ext/openssl/ossl_asn1.c901
-rw-r--r--ext/openssl/ossl_asn1.h36
-rw-r--r--ext/openssl/ossl_bio.c8
-rw-r--r--ext/openssl/ossl_bio.h2
-rw-r--r--ext/openssl/ossl_bn.c597
-rw-r--r--ext/openssl/ossl_bn.h3
-rw-r--r--ext/openssl/ossl_cipher.c477
-rw-r--r--ext/openssl/ossl_cipher.h16
-rw-r--r--ext/openssl/ossl_config.c26
-rw-r--r--ext/openssl/ossl_config.h2
-rw-r--r--ext/openssl/ossl_digest.c143
-rw-r--r--ext/openssl/ossl_digest.h15
-rw-r--r--ext/openssl/ossl_engine.c148
-rw-r--r--ext/openssl/ossl_engine.h5
-rw-r--r--ext/openssl/ossl_hmac.c72
-rw-r--r--ext/openssl/ossl_hmac.h5
-rw-r--r--ext/openssl/ossl_kdf.c95
-rw-r--r--ext/openssl/ossl_ns_spki.c80
-rw-r--r--ext/openssl/ossl_ns_spki.h6
-rw-r--r--ext/openssl/ossl_ocsp.c471
-rw-r--r--ext/openssl/ossl_ocsp.h9
-rw-r--r--ext/openssl/ossl_pkcs12.c97
-rw-r--r--ext/openssl/ossl_pkcs12.h5
-rw-r--r--ext/openssl/ossl_pkcs7.c395
-rw-r--r--ext/openssl/ossl_pkcs7.h24
-rw-r--r--ext/openssl/ossl_pkey.c343
-rw-r--r--ext/openssl/ossl_pkey.h211
-rw-r--r--ext/openssl/ossl_pkey_dh.c101
-rw-r--r--ext/openssl/ossl_pkey_dsa.c71
-rw-r--r--ext/openssl/ossl_pkey_ec.c426
-rw-r--r--ext/openssl/ossl_pkey_rsa.c161
-rw-r--r--ext/openssl/ossl_provider.c9
-rw-r--r--ext/openssl/ossl_rand.c27
-rw-r--r--ext/openssl/ossl_rand.h5
-rw-r--r--ext/openssl/ossl_ssl.c947
-rw-r--r--ext/openssl/ossl_ssl.h18
-rw-r--r--ext/openssl/ossl_ssl_session.c190
-rw-r--r--ext/openssl/ossl_ts.c226
-rw-r--r--ext/openssl/ossl_ts.h2
-rw-r--r--ext/openssl/ossl_x509.c39
-rw-r--r--ext/openssl/ossl_x509.h21
-rw-r--r--ext/openssl/ossl_x509attr.c138
-rw-r--r--ext/openssl/ossl_x509cert.c196
-rw-r--r--ext/openssl/ossl_x509crl.c169
-rw-r--r--ext/openssl/ossl_x509ext.c117
-rw-r--r--ext/openssl/ossl_x509name.c157
-rw-r--r--ext/openssl/ossl_x509req.c119
-rw-r--r--ext/openssl/ossl_x509revoked.c72
-rw-r--r--ext/openssl/ossl_x509store.c113
-rw-r--r--ext/pathname/depend174
-rw-r--r--ext/pathname/extconf.rb3
-rw-r--r--ext/pathname/lib/pathname.rb605
-rw-r--r--ext/pathname/pathname.c1668
-rw-r--r--ext/pathname/pathname.gemspec32
-rw-r--r--ext/psych/depend5
-rw-r--r--ext/psych/extconf.rb7
-rw-r--r--ext/psych/lib/psych.rb59
-rw-r--r--ext/psych/lib/psych/class_loader.rb1
-rw-r--r--ext/psych/lib/psych/core_ext.rb21
-rw-r--r--ext/psych/lib/psych/nodes/node.rb7
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb22
-rw-r--r--ext/psych/lib/psych/versions.rb4
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb57
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb53
-rw-r--r--ext/psych/psych.c3
-rw-r--r--ext/psych/psych.gemspec2
-rw-r--r--ext/psych/psych_emitter.c276
-rw-r--r--ext/psych/psych_parser.c525
-rw-r--r--ext/psych/psych_to_ruby.c5
-rw-r--r--ext/psych/psych_yaml_tree.c1
-rw-r--r--ext/pty/depend2
-rw-r--r--ext/pty/pty.c39
-rw-r--r--ext/rbconfig/sizeof/depend2
-rw-r--r--ext/ripper/depend12
-rw-r--r--ext/ripper/eventids2.c1
-rw-r--r--ext/ripper/lib/ripper/lexer.rb11
-rw-r--r--ext/ripper/ripper_init.c.tmpl16
-rw-r--r--ext/ripper/tools/generate.rb6
-rw-r--r--ext/socket/ancdata.c10
-rw-r--r--ext/socket/basicsocket.c6
-rw-r--r--ext/socket/depend75
-rw-r--r--ext/socket/extconf.rb1
-rw-r--r--ext/socket/getaddrinfo.c7
-rw-r--r--ext/socket/getnameinfo.c18
-rw-r--r--ext/socket/ifaddr.c2
-rw-r--r--ext/socket/init.c58
-rw-r--r--ext/socket/ipsocket.c1325
-rw-r--r--ext/socket/lib/socket.rb819
-rw-r--r--ext/socket/raddrinfo.c295
-rw-r--r--ext/socket/rubysocket.h60
-rw-r--r--ext/socket/socket.c98
-rw-r--r--ext/socket/sockssocket.c7
-rw-r--r--ext/socket/tcpserver.c2
-rw-r--r--ext/socket/tcpsocket.c47
-rw-r--r--ext/socket/udpsocket.c57
-rw-r--r--ext/socket/unixsocket.c43
-rw-r--r--ext/stringio/depend2
-rw-r--r--ext/stringio/extconf.rb2
-rw-r--r--ext/stringio/stringio.c349
-rw-r--r--ext/stringio/stringio.gemspec2
-rw-r--r--ext/strscan/depend1
-rw-r--r--ext/strscan/extconf.rb5
-rw-r--r--ext/strscan/lib/strscan/strscan.rb25
-rw-r--r--ext/strscan/strscan.c423
-rw-r--r--ext/strscan/strscan.gemspec9
-rw-r--r--ext/win32/lib/win32/registry.rb302
-rw-r--r--ext/win32/lib/win32/resolv.rb113
-rw-r--r--ext/win32/lib/win32/sspi.rb338
-rw-r--r--ext/win32/resolv/extconf.rb6
-rw-r--r--ext/win32/resolv/resolv.c211
-rw-r--r--ext/win32/win32-registry.gemspec29
-rw-r--r--ext/win32ole/.document1
-rw-r--r--ext/win32ole/depend12
-rw-r--r--ext/win32ole/extconf.rb45
-rw-r--r--ext/win32ole/lib/win32ole.rb32
-rw-r--r--ext/win32ole/lib/win32ole/property.rb29
-rw-r--r--ext/win32ole/win32ole.c4142
-rw-r--r--ext/win32ole/win32ole.gemspec35
-rw-r--r--ext/win32ole/win32ole.h155
-rw-r--r--ext/win32ole/win32ole_error.c96
-rw-r--r--ext/win32ole/win32ole_error.h9
-rw-r--r--ext/win32ole/win32ole_event.c1279
-rw-r--r--ext/win32ole/win32ole_event.h6
-rw-r--r--ext/win32ole/win32ole_method.c954
-rw-r--r--ext/win32ole/win32ole_method.h16
-rw-r--r--ext/win32ole/win32ole_param.c440
-rw-r--r--ext/win32ole/win32ole_param.h8
-rw-r--r--ext/win32ole/win32ole_record.c608
-rw-r--r--ext/win32ole/win32ole_record.h10
-rw-r--r--ext/win32ole/win32ole_type.c922
-rw-r--r--ext/win32ole/win32ole_type.h8
-rw-r--r--ext/win32ole/win32ole_typelib.c848
-rw-r--r--ext/win32ole/win32ole_typelib.h11
-rw-r--r--ext/win32ole/win32ole_variable.c385
-rw-r--r--ext/win32ole/win32ole_variable.h8
-rw-r--r--ext/win32ole/win32ole_variant.c737
-rw-r--r--ext/win32ole/win32ole_variant.h9
-rw-r--r--ext/win32ole/win32ole_variant_m.c153
-rw-r--r--ext/win32ole/win32ole_variant_m.h7
-rw-r--r--ext/zlib/depend1
-rw-r--r--ext/zlib/zlib.c362
-rw-r--r--file.c853
-rw-r--r--gc.c13891
-rw-r--r--gc.rb717
-rw-r--r--gc/README.md37
-rw-r--r--gc/default/default.c9602
-rw-r--r--gc/default/extconf.rb5
-rw-r--r--gc/extconf_base.rb14
-rw-r--r--gc/gc.h265
-rw-r--r--gc/gc_impl.h126
-rw-r--r--gc/mmtk/.gitignore1
-rw-r--r--gc/mmtk/Cargo.lock1108
-rw-r--r--gc/mmtk/Cargo.toml42
-rw-r--r--gc/mmtk/cbindgen.toml36
-rw-r--r--gc/mmtk/depend18
-rw-r--r--gc/mmtk/extconf.rb24
-rw-r--r--gc/mmtk/mmtk.c1554
-rw-r--r--gc/mmtk/mmtk.h172
-rw-r--r--gc/mmtk/src/abi.rs336
-rw-r--r--gc/mmtk/src/active_plan.rs56
-rw-r--r--gc/mmtk/src/api.rs486
-rw-r--r--gc/mmtk/src/binding.rs129
-rw-r--r--gc/mmtk/src/collection.rs109
-rw-r--r--gc/mmtk/src/heap/mod.rs4
-rw-r--r--gc/mmtk/src/heap/ruby_heap_trigger.rs105
-rw-r--r--gc/mmtk/src/lib.rs161
-rw-r--r--gc/mmtk/src/object_model.rs124
-rw-r--r--gc/mmtk/src/pinning_registry.rs187
-rw-r--r--gc/mmtk/src/reference_glue.rs26
-rw-r--r--gc/mmtk/src/scanning.rs291
-rw-r--r--gc/mmtk/src/utils.rs161
-rw-r--r--gc/mmtk/src/weak_proc.rs318
-rw-r--r--gem_prelude.rb1
-rw-r--r--gems/bundled_gems68
-rw-r--r--gems/lib/rake/extensiontask.rb2
-rw-r--r--goruby.c10
-rw-r--r--hash.c2126
-rw-r--r--hash.rb40
-rw-r--r--id_table.c122
-rw-r--r--id_table.h15
-rw-r--r--imemo.c412
-rw-r--r--include/ruby/assert.h12
-rw-r--r--include/ruby/atomic.h452
-rw-r--r--include/ruby/backward.h6
-rw-r--r--include/ruby/backward/2/rmodule.h2
-rw-r--r--include/ruby/backward/cxxanyargs.hpp29
-rw-r--r--include/ruby/debug.h64
-rw-r--r--include/ruby/fiber/scheduler.h107
-rw-r--r--include/ruby/intern.h1
-rw-r--r--include/ruby/internal/abi.h2
-rw-r--r--include/ruby/internal/anyargs.h22
-rw-r--r--include/ruby/internal/arithmetic/int.h2
-rw-r--r--include/ruby/internal/arithmetic/intptr_t.h12
-rw-r--r--include/ruby/internal/attr/deprecated.h9
-rw-r--r--include/ruby/internal/attr/forceinline.h2
-rw-r--r--include/ruby/internal/attr/noexcept.h2
-rw-r--r--include/ruby/internal/attr/nonstring.h40
-rw-r--r--include/ruby/internal/attr/restrict.h2
-rw-r--r--include/ruby/internal/compiler_is/msvc.h13
-rw-r--r--include/ruby/internal/config.h2
-rw-r--r--include/ruby/internal/core/rarray.h4
-rw-r--r--include/ruby/internal/core/rbasic.h16
-rw-r--r--include/ruby/internal/core/rclass.h2
-rw-r--r--include/ruby/internal/core/rdata.h18
-rw-r--r--include/ruby/internal/core/robject.h40
-rw-r--r--include/ruby/internal/core/rstring.h57
-rw-r--r--include/ruby/internal/core/rstruct.h12
-rw-r--r--include/ruby/internal/core/rtypeddata.h264
-rw-r--r--include/ruby/internal/ctype.h4
-rw-r--r--include/ruby/internal/encoding/coderange.h2
-rw-r--r--include/ruby/internal/encoding/string.h6
-rw-r--r--include/ruby/internal/error.h11
-rw-r--r--include/ruby/internal/eval.h15
-rw-r--r--include/ruby/internal/fl_type.h226
-rw-r--r--include/ruby/internal/gc.h5
-rw-r--r--include/ruby/internal/globals.h2
-rw-r--r--include/ruby/internal/has/builtin.h4
-rw-r--r--include/ruby/internal/intern/array.h8
-rw-r--r--include/ruby/internal/intern/complex.h4
-rw-r--r--include/ruby/internal/intern/cont.h11
-rw-r--r--include/ruby/internal/intern/enumerator.h12
-rw-r--r--include/ruby/internal/intern/error.h20
-rw-r--r--include/ruby/internal/intern/file.h3
-rw-r--r--include/ruby/internal/intern/hash.h14
-rw-r--r--include/ruby/internal/intern/io.h2
-rw-r--r--include/ruby/internal/intern/object.h3
-rw-r--r--include/ruby/internal/intern/proc.h12
-rw-r--r--include/ruby/internal/intern/select.h2
-rw-r--r--include/ruby/internal/intern/select/win32.h4
-rw-r--r--include/ruby/internal/intern/set.h111
-rw-r--r--include/ruby/internal/intern/string.h31
-rw-r--r--include/ruby/internal/intern/thread.h8
-rw-r--r--include/ruby/internal/intern/vm.h7
-rw-r--r--include/ruby/internal/iterator.h45
-rw-r--r--include/ruby/internal/memory.h141
-rw-r--r--include/ruby/internal/newobj.h38
-rw-r--r--include/ruby/internal/scan_args.h2
-rw-r--r--include/ruby/internal/special_consts.h4
-rw-r--r--include/ruby/internal/static_assert.h5
-rw-r--r--include/ruby/internal/stdbool.h16
-rw-r--r--include/ruby/internal/symbol.h75
-rw-r--r--include/ruby/internal/value_type.h11
-rw-r--r--include/ruby/internal/warning_push.h2
-rw-r--r--include/ruby/internal/xmalloc.h104
-rw-r--r--include/ruby/io.h310
-rw-r--r--include/ruby/onigmo.h13
-rw-r--r--include/ruby/ractor.h16
-rw-r--r--include/ruby/random.h2
-rw-r--r--include/ruby/ruby.h15
-rw-r--r--include/ruby/thread.h20
-rw-r--r--include/ruby/version.h4
-rw-r--r--include/ruby/win32.h51
-rw-r--r--inits.c20
-rw-r--r--insns.def252
-rw-r--r--internal.h3
-rw-r--r--internal/array.h3
-rw-r--r--internal/basic_operators.h2
-rw-r--r--internal/bignum.h32
-rw-r--r--internal/bits.h113
-rw-r--r--internal/box.h83
-rw-r--r--internal/class.h713
-rw-r--r--internal/cmdlineopt.h7
-rw-r--r--internal/concurrent_set.h21
-rw-r--r--internal/cont.h1
-rw-r--r--internal/encoding.h5
-rw-r--r--internal/error.h42
-rw-r--r--internal/eval.h10
-rw-r--r--internal/fixnum.h1
-rw-r--r--internal/gc.h101
-rw-r--r--internal/hash.h3
-rw-r--r--internal/imemo.h138
-rw-r--r--internal/inits.h4
-rw-r--r--internal/io.h37
-rw-r--r--internal/load.h2
-rw-r--r--internal/numeric.h49
-rw-r--r--internal/object.h2
-rw-r--r--internal/parse.h20
-rw-r--r--internal/proc.h2
-rw-r--r--internal/ractor.h4
-rw-r--r--internal/range.h6
-rw-r--r--internal/re.h9
-rw-r--r--internal/sanitizers.h127
-rw-r--r--internal/set_table.h70
-rw-r--r--internal/signal.h1
-rw-r--r--internal/st.h2
-rw-r--r--internal/string.h71
-rw-r--r--internal/struct.h77
-rw-r--r--internal/symbol.h7
-rw-r--r--internal/thread.h53
-rw-r--r--internal/time.h4
-rw-r--r--internal/variable.h24
-rw-r--r--internal/vm.h17
-rw-r--r--io.c759
-rw-r--r--io_buffer.c349
-rw-r--r--iseq.c679
-rw-r--r--iseq.h24
-rw-r--r--jit.c799
-rw-r--r--jit/Cargo.toml6
-rw-r--r--jit/src/lib.rs38
-rw-r--r--jit_hook.rb12
-rw-r--r--jit_undef.rb4
-rw-r--r--kernel.rb86
-rw-r--r--lex.c.blt85
-rw-r--r--lib/English.gemspec11
-rw-r--r--lib/English.rb50
-rw-r--r--lib/benchmark.gemspec30
-rw-r--r--lib/benchmark.rb584
-rw-r--r--lib/bundled_gems.rb243
-rw-r--r--lib/bundler.rb190
-rw-r--r--lib/bundler/build_metadata.rb18
-rw-r--r--lib/bundler/bundler.gemspec10
-rw-r--r--lib/bundler/capistrano.rb20
-rw-r--r--lib/bundler/checksum.rb40
-rw-r--r--lib/bundler/cli.rb385
-rw-r--r--lib/bundler/cli/add.rb14
-rw-r--r--lib/bundler/cli/cache.rb13
-rw-r--r--lib/bundler/cli/check.rb6
-rw-r--r--lib/bundler/cli/common.rb25
-rw-r--r--lib/bundler/cli/config.rb3
-rw-r--r--lib/bundler/cli/console.rb23
-rw-r--r--lib/bundler/cli/doctor.rb178
-rw-r--r--lib/bundler/cli/doctor/diagnose.rb167
-rw-r--r--lib/bundler/cli/doctor/ssl.rb249
-rw-r--r--lib/bundler/cli/exec.rb32
-rw-r--r--lib/bundler/cli/fund.rb2
-rw-r--r--lib/bundler/cli/gem.rb158
-rw-r--r--lib/bundler/cli/info.rb12
-rw-r--r--lib/bundler/cli/inject.rb60
-rw-r--r--lib/bundler/cli/install.rb112
-rw-r--r--lib/bundler/cli/issue.rb8
-rw-r--r--lib/bundler/cli/list.rb35
-rw-r--r--lib/bundler/cli/lock.rb44
-rw-r--r--lib/bundler/cli/outdated.rb46
-rw-r--r--lib/bundler/cli/plugin.rb6
-rw-r--r--lib/bundler/cli/pristine.rb6
-rw-r--r--lib/bundler/cli/show.rb12
-rw-r--r--lib/bundler/cli/update.rb10
-rw-r--r--lib/bundler/cli/viz.rb31
-rw-r--r--lib/bundler/compact_index_client.rb9
-rw-r--r--lib/bundler/compact_index_client/cache.rb2
-rw-r--r--lib/bundler/compact_index_client/gem_parser.rb32
-rw-r--r--lib/bundler/compact_index_client/parser.rb73
-rw-r--r--lib/bundler/compact_index_client/updater.rb3
-rw-r--r--lib/bundler/current_ruby.rb72
-rw-r--r--lib/bundler/definition.rb888
-rw-r--r--lib/bundler/dependency.rb141
-rw-r--r--lib/bundler/deployment.rb65
-rw-r--r--lib/bundler/digest.rb2
-rw-r--r--lib/bundler/dsl.rb269
-rw-r--r--lib/bundler/endpoint_specification.rb33
-rw-r--r--lib/bundler/env.rb2
-rw-r--r--lib/bundler/environment_preserver.rb1
-rw-r--r--lib/bundler/errors.rb57
-rw-r--r--lib/bundler/feature_flag.rb45
-rw-r--r--lib/bundler/fetcher.rb85
-rw-r--r--lib/bundler/fetcher/compact_index.rb4
-rw-r--r--lib/bundler/fetcher/dependency.rb3
-rw-r--r--lib/bundler/fetcher/downloader.rb40
-rw-r--r--lib/bundler/fetcher/gem_remote_fetcher.rb6
-rw-r--r--lib/bundler/force_platform.rb2
-rw-r--r--lib/bundler/friendly_errors.rb9
-rw-r--r--lib/bundler/gem_helpers.rb127
-rw-r--r--lib/bundler/gem_version_promoter.rb2
-rw-r--r--lib/bundler/graph.rb152
-rw-r--r--lib/bundler/index.rb16
-rw-r--r--lib/bundler/injector.rb27
-rw-r--r--lib/bundler/inline.rb67
-rw-r--r--lib/bundler/installer.rb77
-rw-r--r--lib/bundler/installer/gem_installer.rb17
-rw-r--r--lib/bundler/installer/parallel_installer.rb5
-rw-r--r--lib/bundler/installer/standalone.rb7
-rw-r--r--lib/bundler/lazy_specification.rb197
-rw-r--r--lib/bundler/lockfile_generator.rb4
-rw-r--r--lib/bundler/lockfile_parser.rb35
-rw-r--r--lib/bundler/man/bundle-add.171
-rw-r--r--lib/bundler/man/bundle-add.1.ronn75
-rw-r--r--lib/bundler/man/bundle-binstubs.118
-rw-r--r--lib/bundler/man/bundle-binstubs.1.ronn15
-rw-r--r--lib/bundler/man/bundle-cache.126
-rw-r--r--lib/bundler/man/bundle-cache.1.ronn24
-rw-r--r--lib/bundler/man/bundle-check.113
-rw-r--r--lib/bundler/man/bundle-check.1.ronn7
-rw-r--r--lib/bundler/man/bundle-clean.16
-rw-r--r--lib/bundler/man/bundle-config.1339
-rw-r--r--lib/bundler/man/bundle-config.1.ronn230
-rw-r--r--lib/bundler/man/bundle-console.110
-rw-r--r--lib/bundler/man/bundle-console.1.ronn9
-rw-r--r--lib/bundler/man/bundle-doctor.153
-rw-r--r--lib/bundler/man/bundle-doctor.1.ronn54
-rw-r--r--lib/bundler/man/bundle-env.19
-rw-r--r--lib/bundler/man/bundle-env.1.ronn10
-rw-r--r--lib/bundler/man/bundle-exec.116
-rw-r--r--lib/bundler/man/bundle-exec.1.ronn11
-rw-r--r--lib/bundler/man/bundle-fund.122
-rw-r--r--lib/bundler/man/bundle-fund.1.ronn25
-rw-r--r--lib/bundler/man/bundle-gem.194
-rw-r--r--lib/bundler/man/bundle-gem.1.ronn47
-rw-r--r--lib/bundler/man/bundle-help.16
-rw-r--r--lib/bundler/man/bundle-info.111
-rw-r--r--lib/bundler/man/bundle-info.1.ronn8
-rw-r--r--lib/bundler/man/bundle-init.110
-rw-r--r--lib/bundler/man/bundle-init.1.ronn5
-rw-r--r--lib/bundler/man/bundle-inject.123
-rw-r--r--lib/bundler/man/bundle-inject.1.ronn24
-rw-r--r--lib/bundler/man/bundle-install.188
-rw-r--r--lib/bundler/man/bundle-install.1.ronn149
-rw-r--r--lib/bundler/man/bundle-issue.145
-rw-r--r--lib/bundler/man/bundle-issue.1.ronn37
-rw-r--r--lib/bundler/man/bundle-licenses.19
-rw-r--r--lib/bundler/man/bundle-licenses.1.ronn10
-rw-r--r--lib/bundler/man/bundle-list.111
-rw-r--r--lib/bundler/man/bundle-list.1.ronn10
-rw-r--r--lib/bundler/man/bundle-lock.131
-rw-r--r--lib/bundler/man/bundle-lock.1.ronn29
-rw-r--r--lib/bundler/man/bundle-open.18
-rw-r--r--lib/bundler/man/bundle-open.1.ronn3
-rw-r--r--lib/bundler/man/bundle-outdated.117
-rw-r--r--lib/bundler/man/bundle-outdated.1.ronn12
-rw-r--r--lib/bundler/man/bundle-platform.16
-rw-r--r--lib/bundler/man/bundle-plugin.152
-rw-r--r--lib/bundler/man/bundle-plugin.1.ronn51
-rw-r--r--lib/bundler/man/bundle-pristine.16
-rw-r--r--lib/bundler/man/bundle-pristine.1.ronn2
-rw-r--r--lib/bundler/man/bundle-remove.114
-rw-r--r--lib/bundler/man/bundle-remove.1.ronn11
-rw-r--r--lib/bundler/man/bundle-show.16
-rw-r--r--lib/bundler/man/bundle-update.128
-rw-r--r--lib/bundler/man/bundle-update.1.ronn26
-rw-r--r--lib/bundler/man/bundle-version.16
-rw-r--r--lib/bundler/man/bundle-viz.130
-rw-r--r--lib/bundler/man/bundle-viz.1.ronn32
-rw-r--r--lib/bundler/man/bundle.115
-rw-r--r--lib/bundler/man/bundle.1.ronn9
-rw-r--r--lib/bundler/man/gemfile.539
-rw-r--r--lib/bundler/man/gemfile.5.ronn34
-rw-r--r--lib/bundler/man/index.txt6
-rw-r--r--lib/bundler/match_metadata.rb13
-rw-r--r--lib/bundler/match_platform.rb43
-rw-r--r--lib/bundler/materialization.rb59
-rw-r--r--lib/bundler/plugin.rb25
-rw-r--r--lib/bundler/plugin/api/source.rb5
-rw-r--r--lib/bundler/plugin/index.rb6
-rw-r--r--lib/bundler/plugin/installer.rb12
-rw-r--r--lib/bundler/plugin/installer/path.rb8
-rw-r--r--lib/bundler/plugin/source_list.rb2
-rw-r--r--lib/bundler/process_lock.rb24
-rw-r--r--lib/bundler/remote_specification.rb7
-rw-r--r--lib/bundler/resolver.rb126
-rw-r--r--lib/bundler/resolver/base.rb17
-rw-r--r--lib/bundler/resolver/candidate.rb43
-rw-r--r--lib/bundler/resolver/package.rb24
-rw-r--r--lib/bundler/resolver/spec_group.rb49
-rw-r--r--lib/bundler/resolver/strategy.rb40
-rw-r--r--lib/bundler/retry.rb2
-rw-r--r--lib/bundler/ruby_dsl.rb20
-rw-r--r--lib/bundler/ruby_version.rb12
-rw-r--r--lib/bundler/rubygems_ext.rb417
-rw-r--r--lib/bundler/rubygems_gem_installer.rb51
-rw-r--r--lib/bundler/rubygems_integration.rb119
-rw-r--r--lib/bundler/runtime.rb75
-rw-r--r--lib/bundler/self_manager.rb64
-rw-r--r--lib/bundler/settings.rb51
-rw-r--r--lib/bundler/settings/validator.rb23
-rw-r--r--lib/bundler/setup.rb3
-rw-r--r--lib/bundler/shared_helpers.rb81
-rw-r--r--lib/bundler/similarity_detector.rb63
-rw-r--r--lib/bundler/source.rb4
-rw-r--r--lib/bundler/source/gemspec.rb5
-rw-r--r--lib/bundler/source/git.rb155
-rw-r--r--lib/bundler/source/git/git_proxy.rb37
-rw-r--r--lib/bundler/source/metadata.rb5
-rw-r--r--lib/bundler/source/path.rb44
-rw-r--r--lib/bundler/source/rubygems.rb86
-rw-r--r--lib/bundler/source/rubygems/remote.rb14
-rw-r--r--lib/bundler/source_list.rb91
-rw-r--r--lib/bundler/source_map.rb7
-rw-r--r--lib/bundler/spec_set.rb280
-rw-r--r--lib/bundler/stub_specification.rb31
-rw-r--r--lib/bundler/templates/Executable11
-rw-r--r--lib/bundler/templates/Executable.bundler109
-rw-r--r--lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt136
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt4
-rw-r--r--lib/bundler/templates/newgem/README.md.tt10
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt5
-rw-r--r--lib/bundler/templates/newgem/circleci/config.yml.tt12
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt2
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt11
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/go.mod.tt5
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt2
-rw-r--r--lib/bundler/templates/newgem/ext/newgem/newgem.go.tt31
-rw-r--r--lib/bundler/templates/newgem/github/workflows/main.yml.tt38
-rw-r--r--lib/bundler/templates/newgem/gitlab-ci.yml.tt9
-rw-r--r--lib/bundler/templates/newgem/lib/newgem.rb.tt2
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt22
-rw-r--r--lib/bundler/ui/shell.rb46
-rw-r--r--lib/bundler/ui/silent.rb13
-rw-r--r--lib/bundler/uri_credentials_filter.rb2
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool.rb70
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb117
-rw-r--r--lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb2
-rw-r--r--lib/bundler/vendor/fileutils/.document1
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils.rb135
-rw-r--r--lib/bundler/vendor/net-http-persistent/.document1
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb152
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb3
-rw-r--r--lib/bundler/vendor/pub_grub/.document1
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb28
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb42
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb28
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb46
-rw-r--r--lib/bundler/vendor/securerandom/lib/securerandom.rb102
-rw-r--r--lib/bundler/vendor/thor/.document1
-rw-r--r--lib/bundler/vendor/thor/lib/thor.rb13
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb56
-rw-r--r--lib/bundler/vendor/thor/lib/thor/group.rb11
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/argument.rb5
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/option.rb4
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/options.rb5
-rw-r--r--lib/bundler/vendor/thor/lib/thor/runner.rb4
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/basic.rb28
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/html.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb26
-rw-r--r--lib/bundler/vendor/thor/lib/thor/util.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/version.rb2
-rw-r--r--lib/bundler/vendor/tsort/.document1
-rw-r--r--lib/bundler/vendor/uri/.document1
-rw-r--r--lib/bundler/vendor/uri/lib/uri.rb18
-rw-r--r--lib/bundler/vendor/uri/lib/uri/common.rb123
-rw-r--r--lib/bundler/vendor/uri/lib/uri/file.rb8
-rw-r--r--lib/bundler/vendor/uri/lib/uri/ftp.rb2
-rw-r--r--lib/bundler/vendor/uri/lib/uri/generic.rb114
-rw-r--r--lib/bundler/vendor/uri/lib/uri/http.rb16
-rw-r--r--lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb42
-rw-r--r--lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb29
-rw-r--r--lib/bundler/vendor/uri/lib/uri/version.rb4
-rw-r--r--lib/bundler/vendored_net_http.rb23
-rw-r--r--lib/bundler/vendored_securerandom.rb12
-rw-r--r--lib/bundler/version.rb12
-rw-r--r--lib/bundler/vlad.rb15
-rw-r--r--lib/bundler/worker.rb2
-rw-r--r--lib/bundler/yaml_serializer.rb2
-rw-r--r--lib/cgi.rb300
-rw-r--r--lib/cgi/cgi.gemspec42
-rw-r--r--lib/cgi/cookie.rb209
-rw-r--r--lib/cgi/core.rb900
-rw-r--r--lib/cgi/escape.rb232
-rw-r--r--lib/cgi/html.rb1035
-rw-r--r--lib/cgi/session.rb562
-rw-r--r--lib/cgi/session/pstore.rb88
-rw-r--r--lib/cgi/util.rb261
-rw-r--r--lib/delegate.gemspec2
-rw-r--r--lib/delegate.rb45
-rw-r--r--lib/did_you_mean.rb24
-rw-r--r--lib/did_you_mean/version.rb2
-rw-r--r--lib/erb.gemspec38
-rw-r--r--lib/erb.rb1271
-rw-r--r--lib/erb/compiler.rb25
-rw-r--r--lib/erb/def_method.rb2
-rw-r--r--lib/erb/erb.gemspec37
-rw-r--r--lib/erb/util.rb68
-rw-r--r--lib/erb/version.rb4
-rw-r--r--lib/error_highlight/base.rb241
-rw-r--r--lib/error_highlight/core_ext.rb35
-rw-r--r--lib/error_highlight/error_highlight.gemspec2
-rw-r--r--lib/error_highlight/formatter.rb63
-rw-r--r--lib/error_highlight/version.rb2
-rw-r--r--lib/fileutils.gemspec2
-rw-r--r--lib/fileutils.rb109
-rw-r--r--lib/find.rb1
-rw-r--r--lib/forwardable.rb51
-rw-r--r--lib/forwardable/forwardable.gemspec2
-rw-r--r--lib/forwardable/impl.rb17
-rw-r--r--lib/ipaddr.gemspec4
-rw-r--r--lib/ipaddr.rb60
-rw-r--r--lib/irb.rb1608
-rw-r--r--lib/irb/.document1
-rw-r--r--lib/irb/cmd/nop.rb4
-rw-r--r--lib/irb/color.rb262
-rw-r--r--lib/irb/color_printer.rb55
-rw-r--r--lib/irb/command.rb23
-rw-r--r--lib/irb/command/backtrace.rb17
-rw-r--r--lib/irb/command/base.rb62
-rw-r--r--lib/irb/command/break.rb17
-rw-r--r--lib/irb/command/catch.rb17
-rw-r--r--lib/irb/command/chws.rb40
-rw-r--r--lib/irb/command/context.rb16
-rw-r--r--lib/irb/command/continue.rb17
-rw-r--r--lib/irb/command/debug.rb71
-rw-r--r--lib/irb/command/delete.rb17
-rw-r--r--lib/irb/command/disable_irb.rb19
-rw-r--r--lib/irb/command/edit.rb63
-rw-r--r--lib/irb/command/exit.rb18
-rw-r--r--lib/irb/command/finish.rb17
-rw-r--r--lib/irb/command/force_exit.rb18
-rw-r--r--lib/irb/command/help.rb83
-rw-r--r--lib/irb/command/history.rb45
-rw-r--r--lib/irb/command/info.rb17
-rw-r--r--lib/irb/command/internal_helpers.rb27
-rw-r--r--lib/irb/command/irb_info.rb33
-rw-r--r--lib/irb/command/load.rb91
-rw-r--r--lib/irb/command/ls.rb155
-rw-r--r--lib/irb/command/measure.rb49
-rw-r--r--lib/irb/command/next.rb17
-rw-r--r--lib/irb/command/pushws.rb65
-rw-r--r--lib/irb/command/show_doc.rb51
-rw-r--r--lib/irb/command/show_source.rb74
-rw-r--r--lib/irb/command/step.rb17
-rw-r--r--lib/irb/command/subirb.rb123
-rw-r--r--lib/irb/command/whereami.rb23
-rw-r--r--lib/irb/completion.rb477
-rw-r--r--lib/irb/context.rb674
-rw-r--r--lib/irb/debug.rb130
-rw-r--r--lib/irb/debug/ui.rb103
-rw-r--r--lib/irb/default_commands.rb265
-rw-r--r--lib/irb/easter-egg.rb148
-rw-r--r--lib/irb/ext/change-ws.rb37
-rw-r--r--lib/irb/ext/eval_history.rb149
-rw-r--r--lib/irb/ext/loader.rb127
-rw-r--r--lib/irb/ext/multi-irb.rb258
-rw-r--r--lib/irb/ext/tracer.rb39
-rw-r--r--lib/irb/ext/use-loader.rb67
-rw-r--r--lib/irb/ext/workspaces.rb36
-rw-r--r--lib/irb/frame.rb80
-rw-r--r--lib/irb/help.rb28
-rw-r--r--lib/irb/helper_method.rb29
-rw-r--r--lib/irb/helper_method/base.rb16
-rw-r--r--lib/irb/helper_method/conf.rb11
-rw-r--r--lib/irb/history.rb87
-rw-r--r--lib/irb/init.rb538
-rw-r--r--lib/irb/input-method.rb514
-rw-r--r--lib/irb/inspector.rb130
-rw-r--r--lib/irb/irb.gemspec46
-rw-r--r--lib/irb/lc/error.rb52
-rw-r--r--lib/irb/lc/help-message55
-rw-r--r--lib/irb/lc/ja/error.rb53
-rw-r--r--lib/irb/lc/ja/help-message58
-rw-r--r--lib/irb/locale.rb153
-rw-r--r--lib/irb/nesting_parser.rb237
-rw-r--r--lib/irb/notifier.rb230
-rw-r--r--lib/irb/output-method.rb80
-rw-r--r--lib/irb/pager.rb91
-rw-r--r--lib/irb/ruby-lex.rb474
-rw-r--r--lib/irb/ruby_logo.aa80
-rw-r--r--lib/irb/source_finder.rb139
-rw-r--r--lib/irb/statement.rb80
-rw-r--r--lib/irb/version.rb11
-rw-r--r--lib/irb/workspace.rb189
-rw-r--r--lib/irb/ws-for-case-2.rb9
-rw-r--r--lib/irb/xmp.rb164
-rw-r--r--lib/logger.rb747
-rw-r--r--lib/logger/errors.rb9
-rw-r--r--lib/logger/formatter.rb36
-rw-r--r--lib/logger/log_device.rb207
-rw-r--r--lib/logger/logger.gemspec22
-rw-r--r--lib/logger/period.rb47
-rw-r--r--lib/logger/severity.rb38
-rw-r--r--lib/logger/version.rb5
-rw-r--r--lib/mkmf.rb56
-rw-r--r--lib/net/http.rb217
-rw-r--r--lib/net/http/backward.rb40
-rw-r--r--lib/net/http/exceptions.rb3
-rw-r--r--lib/net/http/generic_request.rb45
-rw-r--r--lib/net/http/header.rb12
-rw-r--r--lib/net/http/net-http.gemspec10
-rw-r--r--lib/net/http/requests.rb16
-rw-r--r--lib/net/http/response.rb3
-rw-r--r--lib/net/http/responses.rb72
-rw-r--r--lib/net/net-protocol.gemspec5
-rw-r--r--lib/net/protocol.rb15
-rw-r--r--lib/open-uri.rb73
-rw-r--r--lib/open3/version.rb1
-rw-r--r--lib/optparse.rb188
-rw-r--r--lib/optparse/optparse.gemspec13
-rw-r--r--lib/ostruct.gemspec24
-rw-r--r--lib/ostruct.rb489
-rw-r--r--lib/pathname.rb74
-rw-r--r--lib/pp.gemspec3
-rw-r--r--lib/pp.rb158
-rw-r--r--lib/prettyprint.rb1
-rw-r--r--lib/prism.rb40
-rw-r--r--lib/prism/desugar_compiler.rb186
-rw-r--r--lib/prism/ffi.rb188
-rw-r--r--lib/prism/lex_compat.rb108
-rw-r--r--lib/prism/lex_ripper.rb64
-rw-r--r--lib/prism/node_ext.rb88
-rw-r--r--lib/prism/pack.rb2
-rw-r--r--lib/prism/parse_result.rb241
-rw-r--r--lib/prism/parse_result/comments.rb1
-rw-r--r--lib/prism/parse_result/errors.rb66
-rw-r--r--lib/prism/parse_result/newlines.rb57
-rw-r--r--lib/prism/pattern.rb1
-rw-r--r--lib/prism/polyfill/append_as_bytes.rb15
-rw-r--r--lib/prism/polyfill/scan_byte.rb14
-rw-r--r--lib/prism/polyfill/warn.rb36
-rw-r--r--lib/prism/prism.gemspec26
-rw-r--r--lib/prism/relocation.rb505
-rw-r--r--lib/prism/string_query.rb31
-rw-r--r--lib/prism/translation.rb9
-rw-r--r--lib/prism/translation/parser.rb79
-rw-r--r--lib/prism/translation/parser/builder.rb62
-rw-r--r--lib/prism/translation/parser/compiler.rb476
-rw-r--r--lib/prism/translation/parser/lexer.rb520
-rw-r--r--lib/prism/translation/parser/rubocop.rb73
-rw-r--r--lib/prism/translation/parser33.rb12
-rw-r--r--lib/prism/translation/parser34.rb12
-rw-r--r--lib/prism/translation/parser_current.rb26
-rw-r--r--lib/prism/translation/parser_versions.rb36
-rw-r--r--lib/prism/translation/ripper.rb111
-rw-r--r--lib/prism/translation/ripper/filter.rb53
-rw-r--r--lib/prism/translation/ripper/lexer.rb128
-rw-r--r--lib/prism/translation/ripper/sexp.rb1
-rw-r--r--lib/prism/translation/ruby_parser.rb450
-rw-r--r--lib/pstore.gemspec32
-rw-r--r--lib/pstore.rb731
-rw-r--r--lib/random/formatter.rb9
-rw-r--r--lib/rdoc.rb213
-rw-r--r--lib/rdoc/.document2
-rw-r--r--lib/rdoc/alias.rb111
-rw-r--r--lib/rdoc/anon_class.rb10
-rw-r--r--lib/rdoc/any_method.rb379
-rw-r--r--lib/rdoc/attr.rb175
-rw-r--r--lib/rdoc/class_module.rb801
-rw-r--r--lib/rdoc/code_object.rb421
-rw-r--r--lib/rdoc/code_objects.rb5
-rw-r--r--lib/rdoc/comment.rb229
-rw-r--r--lib/rdoc/constant.rb186
-rw-r--r--lib/rdoc/context.rb1264
-rw-r--r--lib/rdoc/context/section.rb233
-rw-r--r--lib/rdoc/cross_reference.rb228
-rw-r--r--lib/rdoc/encoding.rb120
-rw-r--r--lib/rdoc/erb_partial.rb18
-rw-r--r--lib/rdoc/erbio.rb37
-rw-r--r--lib/rdoc/extend.rb9
-rw-r--r--lib/rdoc/generator.rb51
-rw-r--r--lib/rdoc/generator/darkfish.rb786
-rw-r--r--lib/rdoc/generator/json_index.rb300
-rw-r--r--lib/rdoc/generator/markup.rb159
-rw-r--r--lib/rdoc/generator/pot.rb99
-rw-r--r--lib/rdoc/generator/pot/message_extractor.rb68
-rw-r--r--lib/rdoc/generator/pot/po.rb84
-rw-r--r--lib/rdoc/generator/pot/po_entry.rb141
-rw-r--r--lib/rdoc/generator/ri.rb30
-rw-r--r--lib/rdoc/generator/template/darkfish/.document0
-rw-r--r--lib/rdoc/generator/template/darkfish/_footer.rhtml5
-rw-r--r--lib/rdoc/generator/template/darkfish/_head.rhtml20
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml19
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml33
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml15
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml12
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml11
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml32
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml11
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml14
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml11
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml39
-rw-r--r--lib/rdoc/generator/template/darkfish/class.rhtml180
-rw-r--r--lib/rdoc/generator/template/darkfish/css/fonts.css167
-rw-r--r--lib/rdoc/generator/template/darkfish/css/rdoc.css687
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttfbin94668 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttfbin94196 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttfbin96184 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttfbin95316 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttfbin138268 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttfbin138680 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/add.pngbin733 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/arrow_up.pngbin372 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/brick.pngbin452 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/brick_link.pngbin764 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/bug.pngbin774 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/bullet_black.pngbin211 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.pngbin207 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.pngbin209 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/date.pngbin626 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/delete.pngbin715 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/find.pngbin659 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/loadingAnimation.gifbin5886 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/macFFBgHack.pngbin207 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/package.pngbin853 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/page_green.pngbin621 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/page_white_text.pngbin342 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/page_white_width.pngbin309 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/plugin.pngbin591 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/ruby.pngbin592 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/tag_blue.pngbin1880 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/tag_green.pngbin613 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/transparent.pngbin97 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/wrench.pngbin610 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/wrench_orange.pngbin584 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/images/zoom.pngbin692 -> 0 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/index.rhtml22
-rw-r--r--lib/rdoc/generator/template/darkfish/js/darkfish.js97
-rw-r--r--lib/rdoc/generator/template/darkfish/js/search.js110
-rw-r--r--lib/rdoc/generator/template/darkfish/page.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_root.rhtml62
-rw-r--r--lib/rdoc/generator/template/darkfish/table_of_contents.rhtml59
-rw-r--r--lib/rdoc/generator/template/json_index/.document1
-rw-r--r--lib/rdoc/generator/template/json_index/js/navigation.js105
-rw-r--r--lib/rdoc/generator/template/json_index/js/searcher.js229
-rw-r--r--lib/rdoc/ghost_method.rb6
-rw-r--r--lib/rdoc/i18n.rb10
-rw-r--r--lib/rdoc/i18n/locale.rb102
-rw-r--r--lib/rdoc/i18n/text.rb126
-rw-r--r--lib/rdoc/include.rb9
-rw-r--r--lib/rdoc/known_classes.rb74
-rw-r--r--lib/rdoc/markdown.rb16783
-rw-r--r--lib/rdoc/markdown/entities.rb2131
-rw-r--r--lib/rdoc/markdown/literals.rb454
-rw-r--r--lib/rdoc/markup.rb235
-rw-r--r--lib/rdoc/markup/attr_changer.rb22
-rw-r--r--lib/rdoc/markup/attr_span.rb35
-rw-r--r--lib/rdoc/markup/attribute_manager.rb405
-rw-r--r--lib/rdoc/markup/attributes.rb70
-rw-r--r--lib/rdoc/markup/blank_line.rb27
-rw-r--r--lib/rdoc/markup/block_quote.rb14
-rw-r--r--lib/rdoc/markup/document.rb164
-rw-r--r--lib/rdoc/markup/formatter.rb265
-rw-r--r--lib/rdoc/markup/hard_break.rb31
-rw-r--r--lib/rdoc/markup/heading.rb78
-rw-r--r--lib/rdoc/markup/include.rb42
-rw-r--r--lib/rdoc/markup/indented_paragraph.rb47
-rw-r--r--lib/rdoc/markup/list.rb101
-rw-r--r--lib/rdoc/markup/list_item.rb99
-rw-r--r--lib/rdoc/markup/paragraph.rb28
-rw-r--r--lib/rdoc/markup/parser.rb585
-rw-r--r--lib/rdoc/markup/pre_process.rb298
-rw-r--r--lib/rdoc/markup/raw.rb69
-rw-r--r--lib/rdoc/markup/regexp_handling.rb40
-rw-r--r--lib/rdoc/markup/rule.rb20
-rw-r--r--lib/rdoc/markup/table.rb56
-rw-r--r--lib/rdoc/markup/to_ansi.rb93
-rw-r--r--lib/rdoc/markup/to_bs.rb102
-rw-r--r--lib/rdoc/markup/to_html.rb452
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb175
-rw-r--r--lib/rdoc/markup/to_html_snippet.rb287
-rw-r--r--lib/rdoc/markup/to_joined_paragraph.rb46
-rw-r--r--lib/rdoc/markup/to_label.rb74
-rw-r--r--lib/rdoc/markup/to_markdown.rb191
-rw-r--r--lib/rdoc/markup/to_rdoc.rb352
-rw-r--r--lib/rdoc/markup/to_table_of_contents.rb88
-rw-r--r--lib/rdoc/markup/to_test.rb69
-rw-r--r--lib/rdoc/markup/to_tt_only.rb120
-rw-r--r--lib/rdoc/markup/verbatim.rb83
-rw-r--r--lib/rdoc/meta_method.rb6
-rw-r--r--lib/rdoc/method_attr.rb418
-rw-r--r--lib/rdoc/mixin.rb120
-rw-r--r--lib/rdoc/normal_class.rb92
-rw-r--r--lib/rdoc/normal_module.rb73
-rw-r--r--lib/rdoc/options.rb1331
-rw-r--r--lib/rdoc/parser.rb296
-rw-r--r--lib/rdoc/parser/c.rb1236
-rw-r--r--lib/rdoc/parser/changelog.rb349
-rw-r--r--lib/rdoc/parser/markdown.rb22
-rw-r--r--lib/rdoc/parser/rd.rb22
-rw-r--r--lib/rdoc/parser/ripper_state_lex.rb600
-rw-r--r--lib/rdoc/parser/ruby.rb2372
-rw-r--r--lib/rdoc/parser/ruby_tools.rb165
-rw-r--r--lib/rdoc/parser/simple.rb61
-rw-r--r--lib/rdoc/parser/text.rb11
-rw-r--r--lib/rdoc/rd.rb99
-rw-r--r--lib/rdoc/rd/block_parser.rb1710
-rw-r--r--lib/rdoc/rd/inline.rb71
-rw-r--r--lib/rdoc/rd/inline_parser.rb1858
-rw-r--r--lib/rdoc/rdoc.gemspec237
-rw-r--r--lib/rdoc/rdoc.rb563
-rw-r--r--lib/rdoc/require.rb51
-rw-r--r--lib/rdoc/ri.rb20
-rw-r--r--lib/rdoc/ri/driver.rb1517
-rw-r--r--lib/rdoc/ri/formatter.rb6
-rw-r--r--lib/rdoc/ri/paths.rb171
-rw-r--r--lib/rdoc/ri/store.rb6
-rw-r--r--lib/rdoc/ri/task.rb71
-rw-r--r--lib/rdoc/rubygems_hook.rb248
-rw-r--r--lib/rdoc/servlet.rb451
-rw-r--r--lib/rdoc/single_class.rb30
-rw-r--r--lib/rdoc/stats.rb461
-rw-r--r--lib/rdoc/stats/normal.rb58
-rw-r--r--lib/rdoc/stats/quiet.rb59
-rw-r--r--lib/rdoc/stats/verbose.rb44
-rw-r--r--lib/rdoc/store.rb989
-rw-r--r--lib/rdoc/task.rb355
-rw-r--r--lib/rdoc/text.rb322
-rw-r--r--lib/rdoc/token_stream.rb118
-rw-r--r--lib/rdoc/tom_doc.rb263
-rw-r--r--lib/rdoc/top_level.rb291
-rw-r--r--lib/rdoc/version.rb10
-rw-r--r--lib/readline.gemspec33
-rw-r--r--lib/readline.rb7
-rw-r--r--lib/reline.rb516
-rw-r--r--lib/reline/config.rb382
-rw-r--r--lib/reline/face.rb199
-rw-r--r--lib/reline/history.rb76
-rw-r--r--lib/reline/io.rb41
-rw-r--r--lib/reline/io/ansi.rb360
-rw-r--r--lib/reline/io/dumb.rb106
-rw-r--r--lib/reline/io/windows.rb503
-rw-r--r--lib/reline/key_actor.rb8
-rw-r--r--lib/reline/key_actor/base.rb31
-rw-r--r--lib/reline/key_actor/composite.rb17
-rw-r--r--lib/reline/key_actor/emacs.rb517
-rw-r--r--lib/reline/key_actor/vi_command.rb518
-rw-r--r--lib/reline/key_actor/vi_insert.rb517
-rw-r--r--lib/reline/key_stroke.rb109
-rw-r--r--lib/reline/kill_ring.rb125
-rw-r--r--lib/reline/line_editor.rb2557
-rw-r--r--lib/reline/reline.gemspec30
-rw-r--r--lib/reline/terminfo.rb153
-rw-r--r--lib/reline/unicode.rb696
-rw-r--r--lib/reline/unicode/east_asian_width.rb1196
-rw-r--r--lib/reline/version.rb3
-rw-r--r--lib/resolv.gemspec6
-rw-r--r--lib/resolv.rb195
-rw-r--r--lib/ruby_vm/rjit/.document1
-rw-r--r--lib/ruby_vm/rjit/assembler.rb1140
-rw-r--r--lib/ruby_vm/rjit/block.rb11
-rw-r--r--lib/ruby_vm/rjit/branch_stub.rb24
-rw-r--r--lib/ruby_vm/rjit/c_pointer.rb394
-rw-r--r--lib/ruby_vm/rjit/c_type.rb99
-rw-r--r--lib/ruby_vm/rjit/code_block.rb91
-rw-r--r--lib/ruby_vm/rjit/compiler.rb518
-rw-r--r--lib/ruby_vm/rjit/context.rb377
-rw-r--r--lib/ruby_vm/rjit/entry_stub.rb7
-rw-r--r--lib/ruby_vm/rjit/exit_compiler.rb164
-rw-r--r--lib/ruby_vm/rjit/hooks.rb36
-rw-r--r--lib/ruby_vm/rjit/insn_compiler.rb6002
-rw-r--r--lib/ruby_vm/rjit/invariants.rb155
-rw-r--r--lib/ruby_vm/rjit/jit_state.rb65
-rw-r--r--lib/ruby_vm/rjit/stats.rb191
-rw-r--r--lib/ruby_vm/rjit/type.rb221
-rw-r--r--lib/rubygems.rb246
-rw-r--r--lib/rubygems/basic_specification.rb59
-rw-r--r--lib/rubygems/bundler_version_finder.rb43
-rw-r--r--lib/rubygems/command.rb5
-rw-r--r--lib/rubygems/command_manager.rb15
-rw-r--r--lib/rubygems/commands/build_command.rb7
-rw-r--r--lib/rubygems/commands/cert_command.rb2
-rw-r--r--lib/rubygems/commands/cleanup_command.rb16
-rw-r--r--lib/rubygems/commands/contents_command.rb27
-rw-r--r--lib/rubygems/commands/environment_command.rb5
-rw-r--r--lib/rubygems/commands/exec_command.rb29
-rw-r--r--lib/rubygems/commands/fetch_command.rb14
-rw-r--r--lib/rubygems/commands/install_command.rb10
-rw-r--r--lib/rubygems/commands/pristine_command.rb31
-rw-r--r--lib/rubygems/commands/push_command.rb37
-rw-r--r--lib/rubygems/commands/query_command.rb43
-rw-r--r--lib/rubygems/commands/rdoc_command.rb4
-rw-r--r--lib/rubygems/commands/rebuild_command.rb1
-rw-r--r--lib/rubygems/commands/setup_command.rb39
-rw-r--r--lib/rubygems/commands/sources_command.rb140
-rw-r--r--lib/rubygems/commands/uninstall_command.rb11
-rw-r--r--lib/rubygems/commands/update_command.rb10
-rw-r--r--lib/rubygems/compatibility.rb41
-rw-r--r--lib/rubygems/config_file.rb23
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb7
-rw-r--r--lib/rubygems/core_ext/kernel_warn.rb8
-rw-r--r--lib/rubygems/defaults.rb4
-rw-r--r--lib/rubygems/dependency.rb12
-rw-r--r--lib/rubygems/dependency_installer.rb79
-rw-r--r--lib/rubygems/dependency_list.rb3
-rw-r--r--lib/rubygems/deprecate.rb146
-rw-r--r--lib/rubygems/doctor.rb2
-rw-r--r--lib/rubygems/errors.rb5
-rw-r--r--lib/rubygems/exceptions.rb25
-rw-r--r--lib/rubygems/ext/builder.rb50
-rw-r--r--lib/rubygems/ext/cargo_builder.rb22
-rw-r--r--lib/rubygems/ext/cmake_builder.rb106
-rw-r--r--lib/rubygems/ext/configure_builder.rb9
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb17
-rw-r--r--lib/rubygems/ext/rake_builder.rb11
-rw-r--r--lib/rubygems/gem_runner.rb10
-rw-r--r--lib/rubygems/gemcutter_utilities.rb17
-rw-r--r--lib/rubygems/gemcutter_utilities/webauthn_listener.rb13
-rw-r--r--lib/rubygems/install_default_message.rb13
-rw-r--r--lib/rubygems/install_update_options.rb17
-rw-r--r--lib/rubygems/installer.rb244
-rw-r--r--lib/rubygems/local_remote_options.rb4
-rw-r--r--lib/rubygems/name_tuple.rb8
-rw-r--r--lib/rubygems/package.rb33
-rw-r--r--lib/rubygems/package/tar_header.rb19
-rw-r--r--lib/rubygems/package/tar_reader.rb2
-rw-r--r--lib/rubygems/package/tar_reader/entry.rb6
-rw-r--r--lib/rubygems/package/tar_writer.rb9
-rw-r--r--lib/rubygems/platform.rb234
-rw-r--r--lib/rubygems/psych_tree.rb2
-rw-r--r--lib/rubygems/query_utils.rb4
-rw-r--r--lib/rubygems/rdoc.rb19
-rw-r--r--lib/rubygems/remote_fetcher.rb23
-rw-r--r--lib/rubygems/request/connection_pools.rb7
-rw-r--r--lib/rubygems/request/http_pool.rb15
-rw-r--r--lib/rubygems/request_set.rb9
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb2
-rw-r--r--lib/rubygems/request_set/lockfile.rb2
-rw-r--r--lib/rubygems/requirement.rb23
-rw-r--r--lib/rubygems/resolver.rb11
-rw-r--r--lib/rubygems/resolver/activation_request.rb2
-rw-r--r--lib/rubygems/resolver/api_set.rb19
-rw-r--r--lib/rubygems/resolver/api_set/gem_parser.rb7
-rw-r--r--lib/rubygems/resolver/best_set.rb30
-rw-r--r--lib/rubygems/resolver/composed_set.rb6
-rw-r--r--lib/rubygems/resolver/conflict.rb2
-rw-r--r--lib/rubygems/resolver/git_set.rb1
-rw-r--r--lib/rubygems/resolver/index_set.rb4
-rw-r--r--lib/rubygems/resolver/source_set.rb2
-rw-r--r--lib/rubygems/s3_uri_signer.rb69
-rw-r--r--lib/rubygems/safe_marshal/reader.rb45
-rw-r--r--lib/rubygems/safe_marshal/visitors/to_ruby.rb45
-rw-r--r--lib/rubygems/security/policy.rb2
-rw-r--r--lib/rubygems/security/signer.rb2
-rw-r--r--lib/rubygems/shellwords.rb3
-rw-r--r--lib/rubygems/source.rb72
-rw-r--r--lib/rubygems/source/git.rb35
-rw-r--r--lib/rubygems/source/installed.rb4
-rw-r--r--lib/rubygems/source/local.rb12
-rw-r--r--lib/rubygems/source/specific_file.rb8
-rw-r--r--lib/rubygems/source_list.rb36
-rw-r--r--lib/rubygems/spec_fetcher.rb70
-rw-r--r--lib/rubygems/specification.rb222
-rw-r--r--lib/rubygems/specification_policy.rb56
-rw-r--r--lib/rubygems/specification_record.rb4
-rw-r--r--lib/rubygems/ssl_certs/rubygems.org/GlobalSign.pem (renamed from lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem)0
-rw-r--r--lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA.pem21
-rw-r--r--lib/rubygems/stub_specification.rb21
-rw-r--r--lib/rubygems/target_rbconfig.rb50
-rw-r--r--lib/rubygems/text.rb2
-rw-r--r--lib/rubygems/uninstaller.rb42
-rw-r--r--lib/rubygems/uri.rb2
-rw-r--r--lib/rubygems/uri_formatter.rb3
-rw-r--r--lib/rubygems/user_interaction.rb15
-rw-r--r--lib/rubygems/util.rb22
-rw-r--r--lib/rubygems/util/atomic_file_writer.rb76
-rw-r--r--lib/rubygems/util/licenses.rb51
-rw-r--r--lib/rubygems/util/list.rb40
-rw-r--r--lib/rubygems/validator.rb2
-rw-r--r--lib/rubygems/vendor/.document (renamed from lib/bundler/vendor/connection_pool/.document)0
-rw-r--r--lib/rubygems/vendor/molinillo/.document1
-rw-r--r--lib/rubygems/vendor/net-http/.document1
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http.rb296
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/backward.rb40
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/exceptions.rb3
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb45
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/header.rb14
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/requests.rb21
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/response.rb3
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/http/responses.rb72
-rw-r--r--lib/rubygems/vendor/net-http/lib/net/https.rb2
-rw-r--r--lib/rubygems/vendor/net-protocol/.document1
-rw-r--r--lib/rubygems/vendor/optparse/.document1
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse.rb307
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/ac.rb16
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/kwargs.rb11
-rw-r--r--lib/rubygems/vendor/optparse/lib/optparse/version.rb9
-rw-r--r--lib/rubygems/vendor/resolv/.document1
-rw-r--r--lib/rubygems/vendor/resolv/lib/resolv.rb159
-rw-r--r--lib/rubygems/vendor/securerandom/lib/securerandom.rb102
-rw-r--r--lib/rubygems/vendor/timeout/.document1
-rw-r--r--lib/rubygems/vendor/timeout/lib/timeout.rb22
-rw-r--r--lib/rubygems/vendor/tsort/.document1
-rw-r--r--lib/rubygems/vendor/uri/.document1
-rw-r--r--lib/rubygems/vendor/uri/lib/uri.rb18
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/common.rb129
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/file.rb8
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/ftp.rb2
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/generic.rb114
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/http.rb16
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb42
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb29
-rw-r--r--lib/rubygems/vendor/uri/lib/uri/version.rb4
-rw-r--r--lib/rubygems/vendored_securerandom.rb3
-rw-r--r--lib/rubygems/version.rb63
-rw-r--r--lib/rubygems/win_platform.rb31
-rw-r--r--lib/rubygems/yaml_serializer.rb2
-rw-r--r--lib/securerandom.gemspec3
-rw-r--r--lib/securerandom.rb8
-rw-r--r--lib/set.rb852
-rw-r--r--lib/set/set.gemspec30
-rw-r--r--lib/set/sorted_set.rb6
-rw-r--r--lib/set/subclass_compatible.rb347
-rw-r--r--lib/shellwords.gemspec7
-rw-r--r--lib/shellwords.rb32
-rw-r--r--lib/singleton.rb108
-rw-r--r--lib/syntax_suggest/api.rb7
-rw-r--r--lib/syntax_suggest/capture_code_context.rb2
-rw-r--r--lib/syntax_suggest/clean_document.rb2
-rw-r--r--lib/syntax_suggest/code_frontier.rb2
-rw-r--r--lib/syntax_suggest/core_ext.rb18
-rw-r--r--lib/syntax_suggest/lex_value.rb2
-rw-r--r--lib/syntax_suggest/mini_stringio.rb30
-rw-r--r--lib/syntax_suggest/version.rb2
-rw-r--r--lib/tempfile.rb98
-rw-r--r--lib/time.gemspec1
-rw-r--r--lib/time.rb85
-rw-r--r--lib/timeout.rb257
-rw-r--r--lib/tmpdir.gemspec2
-rw-r--r--lib/tmpdir.rb34
-rw-r--r--lib/tsort.gemspec29
-rw-r--r--lib/tsort.rb455
-rw-r--r--lib/unicode_normalize/normalize.rb30
-rw-r--r--lib/unicode_normalize/tables.rb186
-rw-r--r--lib/uri/common.rb123
-rw-r--r--lib/uri/file.rb8
-rw-r--r--lib/uri/generic.rb98
-rw-r--r--lib/uri/http.rb12
-rw-r--r--lib/uri/rfc2396_parser.rb42
-rw-r--r--lib/uri/rfc3986_parser.rb29
-rw-r--r--lib/uri/uri.gemspec5
-rw-r--r--lib/uri/version.rb4
-rw-r--r--lib/weakref.gemspec2
-rw-r--r--lib/weakref.rb5
-rw-r--r--lib/yaml.rb3
-rw-r--r--lib/yaml/dbm.rb31
-rw-r--r--lib/yaml/store.rb12
-rwxr-xr-xlibexec/erb50
-rwxr-xr-xlibexec/irb9
-rwxr-xr-xlibexec/rdoc43
-rwxr-xr-xlibexec/ri12
-rwxr-xr-xlibexec/syntax_suggest2
-rw-r--r--load.c529
-rw-r--r--main.c22
-rw-r--r--man/index.txt25
-rw-r--r--man/irb.1257
-rw-r--r--man/ri.1247
-rw-r--r--man/ruby.128
-rw-r--r--marshal.c202
-rw-r--r--math.c74
-rw-r--r--memory_view.c24
-rw-r--r--method.h29
-rw-r--r--mini_builtin.c108
-rw-r--r--miniinit.c45
-rw-r--r--misc/.vscode/settings.json8
-rwxr-xr-xmisc/expand_tabs.rb34
-rw-r--r--[-rwxr-xr-x]misc/lldb_cruby.py24
-rw-r--r--misc/lldb_rb/commands/heap_page_command.py5
-rw-r--r--misc/lldb_rb/commands/print_flags_command.py6
-rw-r--r--misc/lldb_rb/lldb_interface.py11
-rw-r--r--misc/lldb_rb/rb_heap_structs.py19
-rw-r--r--misc/lldb_rb/utils.py36
-rw-r--r--misc/ruby-style.el15
-rw-r--r--misc/tsan_suppressions.txt109
-rw-r--r--missing/dtoa.c314
-rw-r--r--nilclass.rb38
-rw-r--r--node.c19
-rw-r--r--node.h17
-rw-r--r--node_dump.c187
-rw-r--r--numeric.c1021
-rw-r--r--numeric.rb64
-rw-r--r--object.c674
-rw-r--r--pack.c176
-rw-r--r--pack.rb24
-rw-r--r--parse.y3083
-rw-r--r--parser_bits.h133
-rw-r--r--parser_st.c3
-rw-r--r--pathname.c117
-rw-r--r--pathname_builtin.rb1172
-rw-r--r--prelude.rb28
-rw-r--r--prism/config.yml1335
-rw-r--r--prism/defines.h68
-rw-r--r--prism/encoding.c239
-rw-r--r--prism/extension.c569
-rw-r--r--prism/extension.h10
-rw-r--r--prism/options.c144
-rw-r--r--prism/options.h195
-rw-r--r--prism/parser.h77
-rw-r--r--prism/prism.c7051
-rw-r--r--prism/prism.h106
-rw-r--r--prism/regexp.c84
-rw-r--r--prism/regexp.h7
-rw-r--r--prism/srcs.mk150
-rw-r--r--prism/srcs.mk.in48
-rw-r--r--prism/static_literals.c2
-rw-r--r--prism/templates/ext/prism/api_node.c.erb110
-rw-r--r--prism/templates/include/prism/ast.h.erb81
-rw-r--r--prism/templates/lib/prism/compiler.rb.erb6
-rw-r--r--prism/templates/lib/prism/dispatcher.rb.erb16
-rw-r--r--prism/templates/lib/prism/dot_visitor.rb.erb11
-rw-r--r--prism/templates/lib/prism/dsl.rb.erb126
-rw-r--r--prism/templates/lib/prism/inspect_visitor.rb.erb13
-rw-r--r--prism/templates/lib/prism/node.rb.erb302
-rw-r--r--prism/templates/lib/prism/reflection.rb.erb7
-rw-r--r--prism/templates/lib/prism/serialize.rb.erb618
-rw-r--r--prism/templates/lib/prism/visitor.rb.erb8
-rw-r--r--prism/templates/src/diagnostic.c.erb36
-rw-r--r--prism/templates/src/node.c.erb19
-rw-r--r--prism/templates/src/prettyprint.c.erb13
-rw-r--r--prism/templates/src/serialize.c.erb12
-rwxr-xr-xprism/templates/template.rb97
-rw-r--r--prism/util/pm_buffer.c40
-rw-r--r--prism/util/pm_buffer.h18
-rw-r--r--prism/util/pm_char.c2
-rw-r--r--prism/util/pm_constant_pool.c10
-rw-r--r--prism/util/pm_integer.c28
-rw-r--r--prism/util/pm_integer.h16
-rw-r--r--prism/util/pm_list.h6
-rw-r--r--prism/util/pm_newline_list.c29
-rw-r--r--prism/util/pm_newline_list.h11
-rw-r--r--prism/util/pm_string.c213
-rw-r--r--prism/util/pm_string.h46
-rw-r--r--prism/util/pm_strncasecmp.c14
-rw-r--r--prism/version.h6
-rw-r--r--prism_compile.c7237
-rw-r--r--prism_compile.h34
-rw-r--r--proc.c699
-rw-r--r--process.c444
-rw-r--r--ractor.c2564
-rw-r--r--ractor.rb973
-rw-r--r--ractor_core.h204
-rw-r--r--ractor_sync.c1516
-rw-r--r--random.c253
-rw-r--r--range.c506
-rw-r--r--rational.c185
-rw-r--r--re.c229
-rw-r--r--regcomp.c2423
-rw-r--r--regenc.c103
-rw-r--r--regenc.h17
-rw-r--r--regerror.c103
-rw-r--r--regexec.c3098
-rw-r--r--regint.h26
-rw-r--r--regparse.c2748
-rw-r--r--regparse.h6
-rw-r--r--rjit.c501
-rw-r--r--rjit.h101
-rw-r--r--rjit.rb41
-rw-r--r--rjit_c.c543
-rw-r--r--rjit_c.h165
-rw-r--r--rjit_c.rb1670
-rw-r--r--ruby-runner.c9
-rw-r--r--ruby.c350
-rw-r--r--ruby.rs4
-rw-r--r--ruby_atomic.h50
-rw-r--r--ruby_parser.c38
-rw-r--r--rubyparser.h193
-rw-r--r--sample/drb/README.ja.rdoc59
-rw-r--r--sample/drb/README.rdoc56
-rw-r--r--sample/drb/acl.rb15
-rw-r--r--sample/drb/darray.rb12
-rw-r--r--sample/drb/darrayc.rb47
-rw-r--r--sample/drb/dbiff.rb51
-rw-r--r--sample/drb/dcdbiff.rb43
-rw-r--r--sample/drb/dchatc.rb41
-rw-r--r--sample/drb/dchats.rb69
-rw-r--r--sample/drb/dhasen.rb41
-rw-r--r--sample/drb/dhasenc.rb14
-rw-r--r--sample/drb/dlogc.rb16
-rw-r--r--sample/drb/dlogd.rb38
-rw-r--r--sample/drb/dqin.rb13
-rw-r--r--sample/drb/dqlib.rb14
-rw-r--r--sample/drb/dqout.rb14
-rw-r--r--sample/drb/dqueue.rb11
-rw-r--r--sample/drb/drbc.rb45
-rw-r--r--sample/drb/drbch.rb48
-rw-r--r--sample/drb/drbm.rb60
-rw-r--r--sample/drb/drbmc.rb22
-rw-r--r--sample/drb/drbs-acl.rb51
-rw-r--r--sample/drb/drbs.rb64
-rw-r--r--sample/drb/drbssl_c.rb19
-rw-r--r--sample/drb/drbssl_s.rb31
-rw-r--r--sample/drb/extserv_test.rb80
-rw-r--r--sample/drb/gw_ct.rb29
-rw-r--r--sample/drb/gw_cu.rb28
-rw-r--r--sample/drb/gw_s.rb10
-rw-r--r--sample/drb/holderc.rb22
-rw-r--r--sample/drb/holders.rb63
-rw-r--r--sample/drb/http0.rb77
-rw-r--r--sample/drb/http0serv.rb120
-rw-r--r--sample/drb/name.rb117
-rw-r--r--sample/drb/namec.rb36
-rw-r--r--sample/drb/old_tuplespace.rb212
-rw-r--r--sample/drb/rinda_ts.rb7
-rw-r--r--sample/drb/rindac.rb17
-rw-r--r--sample/drb/rindas.rb18
-rw-r--r--sample/drb/ring_echo.rb29
-rw-r--r--sample/drb/ring_inspect.rb30
-rw-r--r--sample/drb/ring_place.rb25
-rw-r--r--sample/drb/simpletuple.rb89
-rw-r--r--sample/drb/speedc.rb21
-rw-r--r--sample/drb/speeds.rb31
-rw-r--r--sample/openssl/c_rehash.rb2
-rw-r--r--sample/prism/find_calls.rb (renamed from sample/find_calls.rb)0
-rw-r--r--sample/prism/find_comments.rb (renamed from sample/find_comments.rb)0
-rw-r--r--sample/prism/locate_nodes.rb (renamed from sample/locate_nodes.rb)0
-rw-r--r--sample/prism/make_tags.rb302
-rw-r--r--sample/prism/multiplex_constants.rb138
-rw-r--r--sample/prism/relocate_constants.rb43
-rw-r--r--sample/prism/visit_nodes.rb (renamed from sample/visit_nodes.rb)0
-rw-r--r--sample/trick2025/01-omoikane/authors.markdown5
-rw-r--r--sample/trick2025/01-omoikane/bf.rb81
-rw-r--r--sample/trick2025/01-omoikane/entry.rb32
-rw-r--r--sample/trick2025/01-omoikane/remarks.markdown71
-rw-r--r--sample/trick2025/01-omoikane/sample_input.txt35
-rw-r--r--sample/trick2025/01-omoikane/spoiler_rot13.txt470
-rw-r--r--sample/trick2025/02-mame/authors.markdown3
-rw-r--r--sample/trick2025/02-mame/entry.rb34
-rw-r--r--sample/trick2025/02-mame/remarks.markdown141
-rw-r--r--sample/trick2025/02-mame/sample.orig.rb8
-rw-r--r--sample/trick2025/02-mame/test.patch16
-rw-r--r--sample/trick2025/03-tompng/authors.markdown3
-rw-r--r--sample/trick2025/03-tompng/entry.rb74
-rw-r--r--sample/trick2025/03-tompng/remarks.markdown146
-rw-r--r--sample/trick2025/04-tompng/authors.markdown3
-rw-r--r--sample/trick2025/04-tompng/entry.rb36
-rw-r--r--sample/trick2025/04-tompng/remarks.markdown43
-rw-r--r--sample/trick2025/05-tompng/authors.markdown3
-rw-r--r--sample/trick2025/05-tompng/entry.rb118
-rw-r--r--sample/trick2025/05-tompng/remarks.markdown106
-rw-r--r--sample/trick2025/README.md16
-rw-r--r--sample/win32ole/excel1.rb37
-rw-r--r--sample/win32ole/excel2.rb31
-rw-r--r--sample/win32ole/excel3.rb21
-rw-r--r--sample/win32ole/ie.rb12
-rw-r--r--sample/win32ole/ieconst.rb33
-rw-r--r--sample/win32ole/ienavi.rb41
-rw-r--r--sample/win32ole/ienavi2.rb41
-rw-r--r--sample/win32ole/oledirs.rb24
-rw-r--r--sample/win32ole/olegen.rb348
-rw-r--r--sample/win32ole/xml.rb7307
-rw-r--r--scheduler.c594
-rw-r--r--set.c2293
-rw-r--r--shape.c1387
-rw-r--r--shape.h472
-rw-r--r--signal.c126
-rw-r--r--siphash.c3
-rwxr-xr-xspec/bin/bundle6
-rwxr-xr-xspec/bin/parallel_rspec7
-rwxr-xr-xspec/bin/rspec6
-rw-r--r--spec/bundled_gems.mspec10
-rw-r--r--spec/bundled_gems_spec.rb427
-rw-r--r--spec/bundler/bundler/build_metadata_spec.rb23
-rw-r--r--spec/bundler/bundler/bundler_spec.rb68
-rw-r--r--spec/bundler/bundler/cli_common_spec.rb22
-rw-r--r--spec/bundler/bundler/cli_spec.rb88
-rw-r--r--spec/bundler/bundler/compact_index_client/parser_spec.rb178
-rw-r--r--spec/bundler/bundler/compact_index_client/updater_spec.rb17
-rw-r--r--spec/bundler/bundler/current_ruby_spec.rb157
-rw-r--r--spec/bundler/bundler/definition_spec.rb70
-rw-r--r--spec/bundler/bundler/dependency_spec.rb134
-rw-r--r--spec/bundler/bundler/dsl_spec.rb45
-rw-r--r--spec/bundler/bundler/endpoint_specification_spec.rb2
-rw-r--r--spec/bundler/bundler/env_spec.rb26
-rw-r--r--spec/bundler/bundler/fetcher/dependency_spec.rb2
-rw-r--r--spec/bundler/bundler/fetcher/downloader_spec.rb85
-rw-r--r--spec/bundler/bundler/fetcher/gem_remote_fetcher_spec.rb60
-rw-r--r--spec/bundler/bundler/fetcher/index_spec.rb24
-rw-r--r--spec/bundler/bundler/friendly_errors_spec.rb31
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb2
-rw-r--r--spec/bundler/bundler/gem_version_promoter_spec.rb10
-rw-r--r--spec/bundler/bundler/installer/gem_installer_spec.rb15
-rw-r--r--spec/bundler/bundler/lockfile_parser_spec.rb8
-rw-r--r--spec/bundler/bundler/plugin/events_spec.rb12
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb10
-rw-r--r--spec/bundler/bundler/plugin/installer_spec.rb9
-rw-r--r--spec/bundler/bundler/plugin_spec.rb31
-rw-r--r--spec/bundler/bundler/resolver/candidate_spec.rb19
-rw-r--r--spec/bundler/bundler/retry_spec.rb4
-rw-r--r--spec/bundler/bundler/ruby_dsl_spec.rb50
-rw-r--r--spec/bundler/bundler/ruby_version_spec.rb10
-rw-r--r--spec/bundler/bundler/rubygems_integration_spec.rb53
-rw-r--r--spec/bundler/bundler/settings_spec.rb40
-rw-r--r--spec/bundler/bundler/shared_helpers_spec.rb51
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb135
-rw-r--r--spec/bundler/bundler/source/git_spec.rb50
-rw-r--r--spec/bundler/bundler/source/rubygems/remote_spec.rb8
-rw-r--r--spec/bundler/bundler/source/rubygems_spec.rb18
-rw-r--r--spec/bundler/bundler/source_list_spec.rb26
-rw-r--r--spec/bundler/bundler/source_spec.rb6
-rw-r--r--spec/bundler/bundler/specifications/foo.gemspec2
-rw-r--r--spec/bundler/bundler/stub_specification_spec.rb20
-rw-r--r--spec/bundler/bundler/ui/shell_spec.rb54
-rw-r--r--spec/bundler/bundler/uri_credentials_filter_spec.rb10
-rw-r--r--spec/bundler/bundler/uri_normalizer_spec.rb25
-rw-r--r--spec/bundler/bundler/yaml_serializer_spec.rb4
-rw-r--r--spec/bundler/cache/cache_path_spec.rb12
-rw-r--r--spec/bundler/cache/gems_spec.rb237
-rw-r--r--spec/bundler/cache/git_spec.rb289
-rw-r--r--spec/bundler/cache/path_spec.rb70
-rw-r--r--spec/bundler/cache/platform_spec.rb16
-rw-r--r--spec/bundler/commands/add_spec.rb190
-rw-r--r--spec/bundler/commands/binstubs_spec.rb391
-rw-r--r--spec/bundler/commands/cache_spec.rb362
-rw-r--r--spec/bundler/commands/check_spec.rb321
-rw-r--r--spec/bundler/commands/clean_spec.rb318
-rw-r--r--spec/bundler/commands/config_spec.rb51
-rw-r--r--spec/bundler/commands/console_spec.rb217
-rw-r--r--spec/bundler/commands/doctor_spec.rb78
-rw-r--r--spec/bundler/commands/exec_spec.rb568
-rw-r--r--spec/bundler/commands/fund_spec.rb50
-rw-r--r--spec/bundler/commands/help_spec.rb5
-rw-r--r--spec/bundler/commands/info_spec.rb46
-rw-r--r--spec/bundler/commands/init_spec.rb12
-rw-r--r--spec/bundler/commands/inject_spec.rb117
-rw-r--r--spec/bundler/commands/install_spec.rb1178
-rw-r--r--spec/bundler/commands/issue_spec.rb2
-rw-r--r--spec/bundler/commands/licenses_spec.rb4
-rw-r--r--spec/bundler/commands/list_spec.rb164
-rw-r--r--spec/bundler/commands/lock_spec.rb1747
-rw-r--r--spec/bundler/commands/newgem_spec.rb1774
-rw-r--r--spec/bundler/commands/open_spec.rb14
-rw-r--r--spec/bundler/commands/outdated_spec.rb247
-rw-r--r--spec/bundler/commands/platform_spec.rb415
-rw-r--r--spec/bundler/commands/post_bundle_message_spec.rb208
-rw-r--r--spec/bundler/commands/pristine_spec.rb70
-rw-r--r--spec/bundler/commands/remove_spec.rb354
-rw-r--r--spec/bundler/commands/show_spec.rb71
-rw-r--r--spec/bundler/commands/ssl_spec.rb373
-rw-r--r--spec/bundler/commands/update_spec.rb928
-rw-r--r--spec/bundler/commands/version_spec.rb50
-rw-r--r--spec/bundler/commands/viz_spec.rb144
-rw-r--r--spec/bundler/install/allow_offline_install_spec.rb34
-rw-r--r--spec/bundler/install/binstubs_spec.rb20
-rw-r--r--spec/bundler/install/bundler_spec.rb48
-rw-r--r--spec/bundler/install/deploy_spec.rb245
-rw-r--r--spec/bundler/install/failure_spec.rb4
-rw-r--r--spec/bundler/install/force_spec.rb71
-rw-r--r--spec/bundler/install/gemfile/eval_gemfile_spec.rb32
-rw-r--r--spec/bundler/install/gemfile/force_ruby_platform_spec.rb72
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb249
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb526
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb144
-rw-r--r--spec/bundler/install/gemfile/install_if_spec.rb24
-rw-r--r--spec/bundler/install/gemfile/lockfile_spec.rb33
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb259
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb481
-rw-r--r--spec/bundler/install/gemfile/ruby_spec.rb72
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb1376
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb901
-rw-r--r--spec/bundler/install/gemfile_spec.rb118
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb408
-rw-r--r--spec/bundler/install/gems/dependency_api_fallback_spec.rb19
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb287
-rw-r--r--spec/bundler/install/gems/env_spec.rb36
-rw-r--r--spec/bundler/install/gems/flex_spec.rb220
-rw-r--r--spec/bundler/install/gems/fund_spec.rb28
-rw-r--r--spec/bundler/install/gems/gemfile_source_header_spec.rb24
-rw-r--r--spec/bundler/install/gems/mirror_probe_spec.rb68
-rw-r--r--spec/bundler/install/gems/mirror_spec.rb22
-rw-r--r--spec/bundler/install/gems/native_extensions_spec.rb18
-rw-r--r--spec/bundler/install/gems/post_install_spec.rb44
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb266
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb168
-rw-r--r--spec/bundler/install/gems/win32_spec.rb10
-rw-r--r--spec/bundler/install/gemspecs_spec.rb50
-rw-r--r--spec/bundler/install/git_spec.rb140
-rw-r--r--spec/bundler/install/global_cache_spec.rb180
-rw-r--r--spec/bundler/install/path_spec.rb114
-rw-r--r--spec/bundler/install/prereleases_spec.rb18
-rw-r--r--spec/bundler/install/process_lock_spec.rb14
-rw-r--r--spec/bundler/install/redownload_spec.rb91
-rw-r--r--spec/bundler/install/security_policy_spec.rb8
-rw-r--r--spec/bundler/install/yanked_spec.rb153
-rw-r--r--spec/bundler/lock/git_spec.rb120
-rw-r--r--spec/bundler/lock/lockfile_spec.rb1433
-rw-r--r--spec/bundler/other/cli_dispatch_spec.rb6
-rw-r--r--spec/bundler/other/cli_man_pages_spec.rb100
-rw-r--r--spec/bundler/other/ext_spec.rb47
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb588
-rw-r--r--spec/bundler/plugins/command_spec.rb10
-rw-r--r--spec/bundler/plugins/hook_spec.rb54
-rw-r--r--spec/bundler/plugins/install_spec.rb83
-rw-r--r--spec/bundler/plugins/list_spec.rb4
-rw-r--r--spec/bundler/plugins/source/example_spec.rb54
-rw-r--r--spec/bundler/plugins/source_spec.rb16
-rw-r--r--spec/bundler/plugins/uninstall_spec.rb8
-rw-r--r--spec/bundler/quality_spec.rb31
-rw-r--r--spec/bundler/realworld/dependency_api_spec.rb46
-rw-r--r--spec/bundler/realworld/edgecases_spec.rb312
-rw-r--r--spec/bundler/realworld/ffi_spec.rb4
-rw-r--r--spec/bundler/realworld/fixtures/tapioca/Gemfile5
-rw-r--r--spec/bundler/realworld/fixtures/tapioca/Gemfile.lock49
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile4
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile.lock35
-rw-r--r--spec/bundler/realworld/gemfile_source_header_spec.rb53
-rw-r--r--spec/bundler/realworld/mirror_probe_spec.rb131
-rw-r--r--spec/bundler/realworld/slow_perf_spec.rb111
-rw-r--r--spec/bundler/resolver/basic_spec.rb100
-rw-r--r--spec/bundler/resolver/platform_spec.rb62
-rw-r--r--spec/bundler/runtime/env_helpers_spec.rb236
-rw-r--r--spec/bundler/runtime/executable_spec.rb116
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb76
-rw-r--r--spec/bundler/runtime/inline_spec.rb290
-rw-r--r--spec/bundler/runtime/load_spec.rb28
-rw-r--r--spec/bundler/runtime/platform_spec.rb147
-rw-r--r--spec/bundler/runtime/require_spec.rb119
-rw-r--r--spec/bundler/runtime/requiring_spec.rb8
-rw-r--r--spec/bundler/runtime/self_management_spec.rb168
-rw-r--r--spec/bundler/runtime/setup_spec.rb486
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb298
-rw-r--r--spec/bundler/spec_helper.rb48
-rw-r--r--spec/bundler/support/artifice/compact_index_creds_diff_host.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_etag_match.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_mirror_down.rb21
-rw-r--r--spec/bundler/support/artifice/compact_index_no_checksums.rb16
-rw-r--r--spec/bundler/support/artifice/endpoint_500.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_creds_diff_host.rb2
-rw-r--r--spec/bundler/support/artifice/fail.rb2
-rw-r--r--spec/bundler/support/artifice/helpers/compact_index.rb13
-rw-r--r--spec/bundler/support/artifice/helpers/endpoint.rb9
-rw-r--r--spec/bundler/support/artifice/helpers/rack_request.rb2
-rw-r--r--spec/bundler/support/artifice/vcr.rb2
-rw-r--r--spec/bundler/support/artifice/windows.rb2
-rw-r--r--spec/bundler/support/build_metadata.rb12
-rw-r--r--spec/bundler/support/builders.rb213
-rwxr-xr-xspec/bundler/support/bundle6
-rw-r--r--spec/bundler/support/bundle.rb6
-rw-r--r--spec/bundler/support/checksums.rb18
-rw-r--r--spec/bundler/support/command_execution.rb3
-rw-r--r--spec/bundler/support/env.rb6
-rw-r--r--spec/bundler/support/filters.rb18
-rw-r--r--spec/bundler/support/hax.rb51
-rw-r--r--spec/bundler/support/helpers.rb292
-rw-r--r--spec/bundler/support/indexes.rb17
-rw-r--r--spec/bundler/support/matchers.rb14
-rw-r--r--spec/bundler/support/path.rb126
-rw-r--r--spec/bundler/support/platforms.rb70
-rw-r--r--spec/bundler/support/rubygems_ext.rb106
-rw-r--r--spec/bundler/support/setup.rb9
-rw-r--r--spec/bundler/support/silent_logger.rb10
-rw-r--r--spec/bundler/support/subprocess.rb13
-rw-r--r--spec/bundler/support/the_bundle.rb16
-rw-r--r--spec/bundler/support/vendored_net_http.rb23
-rw-r--r--spec/bundler/support/windows_tag_group.rb191
-rw-r--r--spec/bundler/update/force_spec.rb30
-rw-r--r--spec/bundler/update/gemfile_spec.rb14
-rw-r--r--spec/bundler/update/gems/fund_spec.rb4
-rw-r--r--spec/bundler/update/gems/post_install_spec.rb20
-rw-r--r--spec/bundler/update/git_spec.rb86
-rw-r--r--spec/bundler/update/path_spec.rb2
-rw-r--r--spec/bundler/update/redownload_spec.rb44
-rw-r--r--spec/default.mspec39
-rw-r--r--spec/mmtk.mspec12
-rw-r--r--[-rwxr-xr-x]spec/mspec/lib/mspec/commands/mkspec.rb2
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-ci.rb5
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-run.rb8
-rw-r--r--spec/mspec/lib/mspec/commands/mspec-tag.rb2
-rw-r--r--[-rwxr-xr-x]spec/mspec/lib/mspec/commands/mspec.rb2
-rw-r--r--spec/mspec/lib/mspec/guards/platform.rb24
-rw-r--r--spec/mspec/lib/mspec/helpers/numeric.rb26
-rw-r--r--spec/mspec/lib/mspec/helpers/tmp.rb15
-rw-r--r--spec/mspec/lib/mspec/runner/actions/leakchecker.rb6
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/launchable.rb88
-rw-r--r--spec/mspec/lib/mspec/runner/formatters/multi.rb2
-rw-r--r--spec/mspec/lib/mspec/utils/name_map.rb13
-rw-r--r--spec/mspec/lib/mspec/utils/options.rb17
-rw-r--r--spec/mspec/lib/mspec/utils/script.rb8
-rw-r--r--spec/mspec/spec/commands/mspec_ci_spec.rb5
-rw-r--r--spec/mspec/spec/commands/mspec_run_spec.rb5
-rw-r--r--spec/mspec/spec/guards/platform_spec.rb38
-rw-r--r--spec/mspec/spec/utils/fixtures/this_file_raises.rb1
-rw-r--r--spec/mspec/spec/utils/fixtures/this_file_raises2.rb1
-rw-r--r--spec/mspec/spec/utils/name_map_spec.rb12
-rwxr-xr-x[-rw-r--r--]spec/mspec/tool/remove_old_guards.rb19
-rw-r--r--spec/mspec/tool/sync/sync-rubyspec.rb35
-rw-r--r--spec/ruby/.mspec.constants1
-rw-r--r--spec/ruby/.rubocop.yml21
-rw-r--r--spec/ruby/.rubocop_todo.yml45
-rw-r--r--spec/ruby/CONTRIBUTING.md14
-rw-r--r--spec/ruby/README.md12
-rwxr-xr-xspec/ruby/bin/rubocop12
-rwxr-xr-xspec/ruby/command_line/dash_0_spec.rb13
-rw-r--r--spec/ruby/command_line/dash_upper_u_spec.rb24
-rw-r--r--spec/ruby/command_line/dash_v_spec.rb3
-rw-r--r--spec/ruby/command_line/feature_spec.rb2
-rw-r--r--spec/ruby/command_line/fixtures/debug_info.rb1
-rw-r--r--spec/ruby/command_line/frozen_strings_spec.rb37
-rw-r--r--spec/ruby/command_line/rubyopt_spec.rb6
-rw-r--r--spec/ruby/core/array/drop_spec.rb2
-rw-r--r--spec/ruby/core/array/each_spec.rb2
-rw-r--r--spec/ruby/core/array/fetch_values_spec.rb55
-rw-r--r--spec/ruby/core/array/fixtures/classes.rb744
-rw-r--r--spec/ruby/core/array/intersect_spec.rb92
-rw-r--r--spec/ruby/core/array/pack/a_spec.rb6
-rw-r--r--spec/ruby/core/array/pack/at_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/b_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/buffer_spec.rb10
-rw-r--r--spec/ruby/core/array/pack/c_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/comment_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/h_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/l_spec.rb16
-rw-r--r--spec/ruby/core/array/pack/m_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/shared/basic.rb27
-rw-r--r--spec/ruby/core/array/pack/shared/float.rb2
-rw-r--r--spec/ruby/core/array/pack/shared/integer.rb6
-rw-r--r--spec/ruby/core/array/pack/shared/string.rb2
-rw-r--r--spec/ruby/core/array/pack/u_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/w_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/x_spec.rb2
-rw-r--r--spec/ruby/core/array/pack/z_spec.rb4
-rw-r--r--spec/ruby/core/array/plus_spec.rb2
-rw-r--r--spec/ruby/core/array/sample_spec.rb7
-rw-r--r--spec/ruby/core/array/shared/slice.rb184
-rw-r--r--spec/ruby/core/array/shared/unshift.rb2
-rw-r--r--spec/ruby/core/array/shuffle_spec.rb13
-rw-r--r--spec/ruby/core/array/to_h_spec.rb6
-rw-r--r--spec/ruby/core/basicobject/equal_spec.rb6
-rw-r--r--spec/ruby/core/basicobject/instance_eval_spec.rb19
-rw-r--r--spec/ruby/core/basicobject/instance_exec_spec.rb20
-rw-r--r--spec/ruby/core/basicobject/singleton_method_added_spec.rb2
-rw-r--r--spec/ruby/core/binding/fixtures/irb.rb3
-rw-r--r--spec/ruby/core/binding/shared/clone.rb2
-rw-r--r--spec/ruby/core/builtin_constants/builtin_constants_spec.rb102
-rw-r--r--spec/ruby/core/class/attached_object_spec.rb40
-rw-r--r--spec/ruby/core/class/dup_spec.rb2
-rw-r--r--spec/ruby/core/class/inherited_spec.rb17
-rw-r--r--spec/ruby/core/class/new_spec.rb2
-rw-r--r--spec/ruby/core/class/subclasses_spec.rb126
-rw-r--r--spec/ruby/core/comparable/clamp_spec.rb149
-rw-r--r--spec/ruby/core/comparable/fixtures/classes.rb1
-rw-r--r--spec/ruby/core/complex/equal_value_spec.rb2
-rw-r--r--spec/ruby/core/complex/polar_spec.rb24
-rw-r--r--spec/ruby/core/complex/shared/rect.rb12
-rw-r--r--spec/ruby/core/data/constants_spec.rb20
-rw-r--r--spec/ruby/core/data/deconstruct_keys_spec.rb130
-rw-r--r--spec/ruby/core/data/deconstruct_spec.rb8
-rw-r--r--spec/ruby/core/data/define_spec.rb48
-rw-r--r--spec/ruby/core/data/eql_spec.rb63
-rw-r--r--spec/ruby/core/data/equal_value_spec.rb63
-rw-r--r--spec/ruby/core/data/fixtures/classes.rb31
-rw-r--r--spec/ruby/core/data/hash_spec.rb25
-rw-r--r--spec/ruby/core/data/initialize_spec.rb145
-rw-r--r--spec/ruby/core/data/inspect_spec.rb6
-rw-r--r--spec/ruby/core/data/members_spec.rb21
-rw-r--r--spec/ruby/core/data/shared/inspect.rb62
-rw-r--r--spec/ruby/core/data/to_h_spec.rb63
-rw-r--r--spec/ruby/core/data/to_s_spec.rb6
-rw-r--r--spec/ruby/core/data/with_spec.rb66
-rw-r--r--spec/ruby/core/dir/chdir_spec.rb122
-rw-r--r--spec/ruby/core/dir/close_spec.rb42
-rw-r--r--spec/ruby/core/dir/exist_spec.rb8
-rw-r--r--spec/ruby/core/dir/fchdir_spec.rb39
-rw-r--r--spec/ruby/core/dir/fixtures/common.rb10
-rw-r--r--spec/ruby/core/dir/for_fd_spec.rb79
-rw-r--r--spec/ruby/core/dir/glob_spec.rb81
-rw-r--r--spec/ruby/core/dir/home_spec.rb46
-rw-r--r--spec/ruby/core/dir/shared/delete.rb18
-rw-r--r--spec/ruby/core/dir/shared/exist.rb1
-rw-r--r--spec/ruby/core/dir/shared/glob.rb65
-rw-r--r--spec/ruby/core/encoding/compatible_spec.rb385
-rw-r--r--spec/ruby/core/encoding/converter/convert_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/finish_spec.rb4
-rw-r--r--spec/ruby/core/encoding/converter/last_error_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/new_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/primitive_convert_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/primitive_errinfo_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/putback_spec.rb2
-rw-r--r--spec/ruby/core/encoding/converter/search_convpath_spec.rb6
-rw-r--r--spec/ruby/core/encoding/find_spec.rb2
-rw-r--r--spec/ruby/core/encoding/fixtures/classes.rb2
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/error_bytes_spec.rb2
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/incomplete_input_spec.rb2
-rw-r--r--spec/ruby/core/encoding/invalid_byte_sequence_error/readagain_bytes_spec.rb2
-rw-r--r--spec/ruby/core/encoding/replicate_spec.rb4
-rw-r--r--spec/ruby/core/enumerable/collect_concat_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/collect_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/compact_spec.rb10
-rw-r--r--spec/ruby/core/enumerable/detect_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/each_cons_spec.rb6
-rw-r--r--spec/ruby/core/enumerable/each_slice_spec.rb6
-rw-r--r--spec/ruby/core/enumerable/entries_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/filter_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/find_all_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/find_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/fixtures/classes.rb7
-rw-r--r--spec/ruby/core/enumerable/flat_map_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/map_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/select_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/shared/inject.rb47
-rw-r--r--spec/ruby/core/enumerable/tally_spec.rb112
-rw-r--r--spec/ruby/core/enumerable/to_a_spec.rb2
-rw-r--r--spec/ruby/core/enumerable/to_h_spec.rb8
-rw-r--r--spec/ruby/core/enumerable/to_set_spec.rb33
-rw-r--r--spec/ruby/core/enumerator/each_with_index_spec.rb8
-rw-r--r--spec/ruby/core/enumerator/each_with_object_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/enum_for_spec.rb2
-rw-r--r--spec/ruby/core/enumerator/fixtures/classes.rb (renamed from spec/ruby/fixtures/enumerator/classes.rb)0
-rw-r--r--spec/ruby/core/enumerator/lazy/compact_spec.rb18
-rw-r--r--spec/ruby/core/enumerator/lazy/lazy_spec.rb9
-rw-r--r--spec/ruby/core/enumerator/product/each_spec.rb108
-rw-r--r--spec/ruby/core/enumerator/product/initialize_copy_spec.rb74
-rw-r--r--spec/ruby/core/enumerator/product/initialize_spec.rb44
-rw-r--r--spec/ruby/core/enumerator/product/inspect_spec.rb28
-rw-r--r--spec/ruby/core/enumerator/product/rewind_spec.rb90
-rw-r--r--spec/ruby/core/enumerator/product/size_spec.rb102
-rw-r--r--spec/ruby/core/enumerator/product_spec.rb138
-rw-r--r--spec/ruby/core/enumerator/shared/enum_for.rb (renamed from spec/ruby/shared/enumerator/enum_for.rb)0
-rw-r--r--spec/ruby/core/enumerator/shared/with_index.rb33
-rw-r--r--spec/ruby/core/enumerator/shared/with_object.rb42
-rw-r--r--spec/ruby/core/enumerator/to_enum_spec.rb4
-rw-r--r--spec/ruby/core/enumerator/with_index_spec.rb19
-rw-r--r--spec/ruby/core/enumerator/with_object_spec.rb2
-rw-r--r--spec/ruby/core/env/clone_spec.rb10
-rw-r--r--spec/ruby/core/env/dup_spec.rb10
-rw-r--r--spec/ruby/core/env/element_reference_spec.rb2
-rw-r--r--spec/ruby/core/env/fetch_spec.rb2
-rw-r--r--spec/ruby/core/env/inspect_spec.rb2
-rw-r--r--spec/ruby/core/env/length_spec.rb2
-rw-r--r--spec/ruby/core/env/shared/update.rb10
-rw-r--r--spec/ruby/core/env/size_spec.rb2
-rw-r--r--spec/ruby/core/env/to_h_spec.rb12
-rw-r--r--spec/ruby/core/exception/detailed_message_spec.rb65
-rw-r--r--spec/ruby/core/exception/errno_spec.rb2
-rw-r--r--spec/ruby/core/exception/fixtures/common.rb3
-rw-r--r--spec/ruby/core/exception/frozen_error_spec.rb16
-rw-r--r--spec/ruby/core/exception/full_message_spec.rb96
-rw-r--r--spec/ruby/core/exception/no_method_error_spec.rb204
-rw-r--r--spec/ruby/core/exception/set_backtrace_spec.rb71
-rw-r--r--spec/ruby/core/exception/shared/set_backtrace.rb64
-rw-r--r--spec/ruby/core/exception/syntax_error_spec.rb36
-rw-r--r--spec/ruby/core/exception/system_call_error_spec.rb32
-rw-r--r--spec/ruby/core/fiber/alive_spec.rb44
-rw-r--r--spec/ruby/core/fiber/blocking_spec.rb22
-rw-r--r--spec/ruby/core/fiber/current_spec.rb50
-rw-r--r--spec/ruby/core/fiber/fixtures/classes.rb16
-rw-r--r--spec/ruby/core/fiber/fixtures/scheduler.rb35
-rw-r--r--spec/ruby/core/fiber/inspect_spec.rb1
-rw-r--r--spec/ruby/core/fiber/raise_spec.rb4
-rw-r--r--spec/ruby/core/fiber/resume_spec.rb15
-rw-r--r--spec/ruby/core/fiber/scheduler_spec.rb8
-rw-r--r--spec/ruby/core/fiber/set_scheduler_spec.rb8
-rw-r--r--spec/ruby/core/fiber/shared/resume.rb58
-rw-r--r--spec/ruby/core/fiber/shared/scheduler.rb51
-rw-r--r--spec/ruby/core/fiber/storage_spec.rb247
-rw-r--r--spec/ruby/core/fiber/transfer_spec.rb84
-rw-r--r--spec/ruby/core/file/birthtime_spec.rb62
-rw-r--r--spec/ruby/core/file/chown_spec.rb16
-rw-r--r--spec/ruby/core/file/constants/constants_spec.rb2
-rw-r--r--spec/ruby/core/file/dirname_spec.rb80
-rw-r--r--spec/ruby/core/file/empty_spec.rb6
-rw-r--r--spec/ruby/core/file/exist_spec.rb8
-rw-r--r--spec/ruby/core/file/flock_spec.rb32
-rw-r--r--spec/ruby/core/file/lchmod_spec.rb2
-rw-r--r--spec/ruby/core/file/path_spec.rb41
-rw-r--r--spec/ruby/core/file/setuid_spec.rb4
-rw-r--r--spec/ruby/core/file/shared/path.rb12
-rw-r--r--spec/ruby/core/file/shared/update_time.rb2
-rw-r--r--spec/ruby/core/file/socket_spec.rb32
-rw-r--r--spec/ruby/core/file/stat/birthtime_spec.rb34
-rw-r--r--spec/ruby/core/file/stat/rdev_major_spec.rb13
-rw-r--r--spec/ruby/core/file/stat/rdev_minor_spec.rb13
-rw-r--r--spec/ruby/core/file/zero_spec.rb6
-rw-r--r--spec/ruby/core/filetest/exist_spec.rb8
-rw-r--r--spec/ruby/core/filetest/socket_spec.rb4
-rw-r--r--spec/ruby/core/filetest/zero_spec.rb6
-rw-r--r--spec/ruby/core/float/ceil_spec.rb5
-rw-r--r--spec/ruby/core/float/comparison_spec.rb4
-rw-r--r--spec/ruby/core/float/floor_spec.rb5
-rw-r--r--spec/ruby/core/float/round_spec.rb9
-rw-r--r--spec/ruby/core/gc/config_spec.rb83
-rw-r--r--spec/ruby/core/gc/measure_total_time_spec.rb24
-rw-r--r--spec/ruby/core/gc/total_time_spec.rb18
-rw-r--r--spec/ruby/core/hash/compact_spec.rb2
-rw-r--r--spec/ruby/core/hash/constructor_spec.rb11
-rw-r--r--spec/ruby/core/hash/element_reference_spec.rb2
-rw-r--r--spec/ruby/core/hash/except_spec.rb28
-rw-r--r--spec/ruby/core/hash/hash_spec.rb10
-rw-r--r--spec/ruby/core/hash/invert_spec.rb21
-rw-r--r--spec/ruby/core/hash/merge_spec.rb23
-rw-r--r--spec/ruby/core/hash/new_spec.rb20
-rw-r--r--spec/ruby/core/hash/reject_spec.rb21
-rw-r--r--spec/ruby/core/hash/replace_spec.rb76
-rw-r--r--spec/ruby/core/hash/shared/replace.rb51
-rw-r--r--spec/ruby/core/hash/shared/select.rb21
-rw-r--r--spec/ruby/core/hash/shared/store.rb6
-rw-r--r--spec/ruby/core/hash/shared/to_s.rb52
-rw-r--r--spec/ruby/core/hash/shift_spec.rb41
-rw-r--r--spec/ruby/core/hash/slice_spec.rb21
-rw-r--r--spec/ruby/core/hash/to_h_spec.rb38
-rw-r--r--spec/ruby/core/hash/transform_keys_spec.rb45
-rw-r--r--spec/ruby/core/hash/transform_values_spec.rb21
-rw-r--r--spec/ruby/core/integer/ceil_spec.rb5
-rw-r--r--spec/ruby/core/integer/ceildiv_spec.rb26
-rw-r--r--spec/ruby/core/integer/chr_spec.rb18
-rw-r--r--spec/ruby/core/integer/constants_spec.rb36
-rw-r--r--spec/ruby/core/integer/divide_spec.rb37
-rw-r--r--spec/ruby/core/integer/floor_spec.rb12
-rw-r--r--spec/ruby/core/integer/left_shift_spec.rb6
-rw-r--r--spec/ruby/core/integer/minus_spec.rb17
-rw-r--r--spec/ruby/core/integer/plus_spec.rb17
-rw-r--r--spec/ruby/core/integer/pow_spec.rb8
-rw-r--r--spec/ruby/core/integer/remainder_spec.rb4
-rw-r--r--spec/ruby/core/integer/right_shift_spec.rb6
-rw-r--r--spec/ruby/core/integer/round_spec.rb6
-rw-r--r--spec/ruby/core/integer/shared/exponent.rb40
-rw-r--r--spec/ruby/core/integer/shared/integer_ceil_precision.rb43
-rw-r--r--spec/ruby/core/integer/shared/integer_floor_precision.rb43
-rw-r--r--spec/ruby/core/integer/shared/modulo.rb46
-rw-r--r--spec/ruby/core/integer/size_spec.rb4
-rw-r--r--spec/ruby/core/integer/try_convert_spec.rb76
-rw-r--r--spec/ruby/core/io/autoclose_spec.rb77
-rw-r--r--spec/ruby/core/io/binread_spec.rb2
-rw-r--r--spec/ruby/core/io/buffer/empty_spec.rb29
-rw-r--r--spec/ruby/core/io/buffer/external_spec.rb108
-rw-r--r--spec/ruby/core/io/buffer/free_spec.rb104
-rw-r--r--spec/ruby/core/io/buffer/initialize_spec.rb103
-rw-r--r--spec/ruby/core/io/buffer/internal_spec.rb108
-rw-r--r--spec/ruby/core/io/buffer/locked_spec.rb75
-rw-r--r--spec/ruby/core/io/buffer/mapped_spec.rb108
-rw-r--r--spec/ruby/core/io/buffer/null_spec.rb29
-rw-r--r--spec/ruby/core/io/buffer/private_spec.rb111
-rw-r--r--spec/ruby/core/io/buffer/readonly_spec.rb143
-rw-r--r--spec/ruby/core/io/buffer/resize_spec.rb155
-rw-r--r--spec/ruby/core/io/buffer/shared/null_and_empty.rb59
-rw-r--r--spec/ruby/core/io/buffer/shared_spec.rb117
-rw-r--r--spec/ruby/core/io/buffer/transfer_spec.rb118
-rw-r--r--spec/ruby/core/io/buffer/valid_spec.rb110
-rw-r--r--spec/ruby/core/io/dup_spec.rb30
-rw-r--r--spec/ruby/core/io/external_encoding_spec.rb10
-rw-r--r--spec/ruby/core/io/foreach_spec.rb46
-rw-r--r--spec/ruby/core/io/internal_encoding_spec.rb10
-rw-r--r--spec/ruby/core/io/path_spec.rb14
-rw-r--r--spec/ruby/core/io/popen_spec.rb16
-rw-r--r--spec/ruby/core/io/pread_spec.rb6
-rw-r--r--spec/ruby/core/io/puts_spec.rb2
-rw-r--r--spec/ruby/core/io/read_spec.rb112
-rw-r--r--spec/ruby/core/io/readlines_spec.rb62
-rw-r--r--spec/ruby/core/io/readpartial_spec.rb17
-rw-r--r--spec/ruby/core/io/set_encoding_by_bom_spec.rb8
-rw-r--r--spec/ruby/core/io/shared/each.rb18
-rw-r--r--spec/ruby/core/io/shared/gets_ascii.rb2
-rw-r--r--spec/ruby/core/io/shared/new.rb23
-rw-r--r--spec/ruby/core/io/sysread_spec.rb6
-rw-r--r--spec/ruby/core/io/write_nonblock_spec.rb2
-rw-r--r--spec/ruby/core/io/write_spec.rb2
-rw-r--r--spec/ruby/core/kernel/Float_spec.rb154
-rw-r--r--spec/ruby/core/kernel/Rational_spec.rb234
-rw-r--r--spec/ruby/core/kernel/autoload_spec.rb5
-rw-r--r--spec/ruby/core/kernel/block_given_spec.rb5
-rw-r--r--spec/ruby/core/kernel/caller_locations_spec.rb14
-rw-r--r--spec/ruby/core/kernel/caller_spec.rb57
-rw-r--r--spec/ruby/core/kernel/eval_spec.rb105
-rw-r--r--spec/ruby/core/kernel/extend_spec.rb12
-rw-r--r--spec/ruby/core/kernel/fixtures/classes.rb54
-rw-r--r--spec/ruby/core/kernel/format_spec.rb32
-rw-r--r--spec/ruby/core/kernel/inspect_spec.rb59
-rw-r--r--spec/ruby/core/kernel/is_a_spec.rb2
-rw-r--r--spec/ruby/core/kernel/kind_of_spec.rb2
-rw-r--r--spec/ruby/core/kernel/match_spec.rb27
-rw-r--r--spec/ruby/core/kernel/not_match_spec.rb14
-rw-r--r--spec/ruby/core/kernel/open_spec.rb96
-rw-r--r--spec/ruby/core/kernel/raise_spec.rb237
-rw-r--r--spec/ruby/core/kernel/require_spec.rb16
-rw-r--r--spec/ruby/core/kernel/select_spec.rb4
-rw-r--r--spec/ruby/core/kernel/shared/load.rb48
-rw-r--r--spec/ruby/core/kernel/shared/require.rb34
-rw-r--r--spec/ruby/core/kernel/shared/sprintf.rb36
-rw-r--r--spec/ruby/core/kernel/singleton_method_spec.rb46
-rw-r--r--spec/ruby/core/kernel/sleep_spec.rb48
-rw-r--r--spec/ruby/core/kernel/sprintf_spec.rb36
-rw-r--r--spec/ruby/core/kernel/taint_spec.rb23
-rw-r--r--spec/ruby/core/kernel/tainted_spec.rb25
-rw-r--r--spec/ruby/core/kernel/trust_spec.rb24
-rw-r--r--spec/ruby/core/kernel/untaint_spec.rb24
-rw-r--r--spec/ruby/core/kernel/untrust_spec.rb23
-rw-r--r--spec/ruby/core/kernel/untrusted_spec.rb24
-rw-r--r--spec/ruby/core/kernel/warn_spec.rb6
-rw-r--r--spec/ruby/core/main/private_spec.rb12
-rw-r--r--spec/ruby/core/main/public_spec.rb12
-rw-r--r--spec/ruby/core/main/using_spec.rb10
-rw-r--r--spec/ruby/core/marshal/dump_spec.rb282
-rw-r--r--spec/ruby/core/marshal/fixtures/marshal_data.rb75
-rw-r--r--spec/ruby/core/marshal/fixtures/marshal_multibyte_data.rb12
-rw-r--r--spec/ruby/core/marshal/shared/load.rb516
-rw-r--r--spec/ruby/core/matchdata/bytebegin_spec.rb132
-rw-r--r--spec/ruby/core/matchdata/byteend_spec.rb104
-rw-r--r--spec/ruby/core/matchdata/byteoffset_spec.rb132
-rw-r--r--spec/ruby/core/matchdata/deconstruct_keys_spec.rb86
-rw-r--r--spec/ruby/core/matchdata/deconstruct_spec.rb4
-rw-r--r--spec/ruby/core/matchdata/element_reference_spec.rb5
-rw-r--r--spec/ruby/core/matchdata/match_length_spec.rb46
-rw-r--r--spec/ruby/core/matchdata/match_spec.rb46
-rw-r--r--spec/ruby/core/matchdata/offset_spec.rb106
-rw-r--r--spec/ruby/core/math/atanh_spec.rb4
-rw-r--r--spec/ruby/core/math/expm1_spec.rb37
-rw-r--r--spec/ruby/core/math/fixtures/common.rb (renamed from spec/ruby/fixtures/math/common.rb)0
-rw-r--r--spec/ruby/core/math/lgamma_spec.rb11
-rw-r--r--spec/ruby/core/math/log1p_spec.rb49
-rw-r--r--spec/ruby/core/math/shared/atanh.rb (renamed from spec/ruby/shared/math/atanh.rb)0
-rw-r--r--spec/ruby/core/method/owner_spec.rb6
-rw-r--r--spec/ruby/core/method/parameters_spec.rb53
-rw-r--r--spec/ruby/core/method/private_spec.rb25
-rw-r--r--spec/ruby/core/method/protected_spec.rb25
-rw-r--r--spec/ruby/core/method/public_spec.rb25
-rw-r--r--spec/ruby/core/method/shared/dup.rb2
-rw-r--r--spec/ruby/core/method/source_location_spec.rb16
-rw-r--r--spec/ruby/core/method/unbind_spec.rb12
-rw-r--r--spec/ruby/core/module/ancestors_spec.rb26
-rw-r--r--spec/ruby/core/module/autoload_spec.rb161
-rw-r--r--spec/ruby/core/module/const_added_spec.rb272
-rw-r--r--spec/ruby/core/module/const_defined_spec.rb2
-rw-r--r--spec/ruby/core/module/const_get_spec.rb24
-rw-r--r--spec/ruby/core/module/const_set_spec.rb13
-rw-r--r--spec/ruby/core/module/const_source_location_spec.rb34
-rw-r--r--spec/ruby/core/module/define_method_spec.rb3
-rw-r--r--spec/ruby/core/module/deprecate_constant_spec.rb9
-rw-r--r--spec/ruby/core/module/fixtures/classes.rb2
-rw-r--r--spec/ruby/core/module/fixtures/const_added.rb4
-rw-r--r--spec/ruby/core/module/fixtures/name.rb3
-rw-r--r--spec/ruby/core/module/fixtures/set_temporary_name.rb4
-rw-r--r--spec/ruby/core/module/include_spec.rb69
-rw-r--r--spec/ruby/core/module/instance_method_spec.rb5
-rw-r--r--spec/ruby/core/module/module_function_spec.rb37
-rw-r--r--spec/ruby/core/module/name_spec.rb53
-rw-r--r--spec/ruby/core/module/new_spec.rb4
-rw-r--r--spec/ruby/core/module/prepend_spec.rb85
-rw-r--r--spec/ruby/core/module/private_spec.rb26
-rw-r--r--spec/ruby/core/module/protected_spec.rb26
-rw-r--r--spec/ruby/core/module/public_spec.rb26
-rw-r--r--spec/ruby/core/module/refine_spec.rb339
-rw-r--r--spec/ruby/core/module/refinements_spec.rb56
-rw-r--r--spec/ruby/core/module/remove_const_spec.rb2
-rw-r--r--spec/ruby/core/module/ruby2_keywords_spec.rb171
-rw-r--r--spec/ruby/core/module/set_temporary_name_spec.rb85
-rw-r--r--spec/ruby/core/module/to_s_spec.rb2
-rw-r--r--spec/ruby/core/module/undefined_instance_methods_spec.rb32
-rw-r--r--spec/ruby/core/module/used_refinements_spec.rb110
-rw-r--r--spec/ruby/core/numeric/shared/imag.rb6
-rw-r--r--spec/ruby/core/numeric/shared/rect.rb26
-rw-r--r--spec/ruby/core/objectspace/_id2ref_spec.rb87
-rw-r--r--spec/ruby/core/objectspace/add_finalizer_spec.rb5
-rw-r--r--spec/ruby/core/objectspace/call_finalizer_spec.rb5
-rw-r--r--spec/ruby/core/objectspace/define_finalizer_spec.rb55
-rw-r--r--spec/ruby/core/objectspace/finalizers_spec.rb5
-rw-r--r--spec/ruby/core/objectspace/remove_finalizer_spec.rb5
-rw-r--r--spec/ruby/core/objectspace/undefine_finalizer_spec.rb30
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/clear_spec.rb27
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/delete_spec.rb13
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/element_reference_spec.rb83
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/element_set_spec.rb59
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/fixtures/classes.rb5
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/getkey_spec.rb14
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/inspect_spec.rb4
-rw-r--r--spec/ruby/core/objectspace/weakkeymap/key_spec.rb11
-rw-r--r--spec/ruby/core/proc/clone_spec.rb15
-rw-r--r--spec/ruby/core/proc/curry_spec.rb9
-rw-r--r--spec/ruby/core/proc/dup_spec.rb15
-rw-r--r--spec/ruby/core/proc/element_reference_spec.rb2
-rw-r--r--spec/ruby/core/proc/fixtures/common.rb23
-rw-r--r--spec/ruby/core/proc/parameters_spec.rb78
-rw-r--r--spec/ruby/core/proc/ruby2_keywords_spec.rb14
-rw-r--r--spec/ruby/core/proc/shared/dup.rb10
-rw-r--r--spec/ruby/core/proc/source_location_spec.rb51
-rw-r--r--spec/ruby/core/process/_fork_spec.rb30
-rw-r--r--spec/ruby/core/process/constants_spec.rb116
-rw-r--r--spec/ruby/core/process/daemon_spec.rb3
-rw-r--r--spec/ruby/core/process/fixtures/clocks.rb2
-rw-r--r--spec/ruby/core/process/gid_spec.rb4
-rw-r--r--spec/ruby/core/process/setrlimit_spec.rb28
-rw-r--r--spec/ruby/core/process/status/bit_and_spec.rb37
-rw-r--r--spec/ruby/core/process/status/right_shift_spec.rb36
-rw-r--r--spec/ruby/core/process/tms/cstime_spec.rb17
-rw-r--r--spec/ruby/core/process/tms/cutime_spec.rb17
-rw-r--r--spec/ruby/core/process/tms/stime_spec.rb17
-rw-r--r--spec/ruby/core/process/tms/utime_spec.rb17
-rw-r--r--spec/ruby/core/queue/deq_spec.rb4
-rw-r--r--spec/ruby/core/queue/freeze_spec.rb6
-rw-r--r--spec/ruby/core/queue/initialize_spec.rb64
-rw-r--r--spec/ruby/core/queue/pop_spec.rb4
-rw-r--r--spec/ruby/core/queue/shift_spec.rb4
-rw-r--r--spec/ruby/core/random/bytes_spec.rb2
-rw-r--r--spec/ruby/core/random/default_spec.rb32
-rw-r--r--spec/ruby/core/random/new_spec.rb2
-rw-r--r--spec/ruby/core/range/case_compare_spec.rb2
-rw-r--r--spec/ruby/core/range/cover_spec.rb2
-rw-r--r--spec/ruby/core/range/each_spec.rb35
-rw-r--r--spec/ruby/core/range/include_spec.rb2
-rw-r--r--spec/ruby/core/range/last_spec.rb6
-rw-r--r--spec/ruby/core/range/max_spec.rb20
-rw-r--r--spec/ruby/core/range/member_spec.rb2
-rw-r--r--spec/ruby/core/range/overlap_spec.rb89
-rw-r--r--spec/ruby/core/range/reverse_each_spec.rb103
-rw-r--r--spec/ruby/core/range/shared/cover.rb2
-rw-r--r--spec/ruby/core/range/shared/cover_and_include.rb17
-rw-r--r--spec/ruby/core/range/shared/include.rb2
-rw-r--r--spec/ruby/core/range/size_spec.rb11
-rw-r--r--spec/ruby/core/range/step_spec.rb383
-rw-r--r--spec/ruby/core/range/to_set_spec.rb55
-rw-r--r--spec/ruby/core/rational/abs_spec.rb2
-rw-r--r--spec/ruby/core/rational/ceil_spec.rb43
-rw-r--r--spec/ruby/core/rational/comparison_spec.rb84
-rw-r--r--spec/ruby/core/rational/denominator_spec.rb12
-rw-r--r--spec/ruby/core/rational/div_spec.rb46
-rw-r--r--spec/ruby/core/rational/divide_spec.rb66
-rw-r--r--spec/ruby/core/rational/divmod_spec.rb36
-rw-r--r--spec/ruby/core/rational/equal_value_spec.rb31
-rw-r--r--spec/ruby/core/rational/exponent_spec.rb234
-rw-r--r--spec/ruby/core/rational/fdiv_spec.rb3
-rw-r--r--spec/ruby/core/rational/fixtures/rational.rb (renamed from spec/ruby/fixtures/rational.rb)0
-rw-r--r--spec/ruby/core/rational/floor_spec.rb43
-rw-r--r--spec/ruby/core/rational/hash_spec.rb7
-rw-r--r--spec/ruby/core/rational/inspect_spec.rb12
-rw-r--r--spec/ruby/core/rational/magnitude_spec.rb2
-rw-r--r--spec/ruby/core/rational/minus_spec.rb2
-rw-r--r--spec/ruby/core/rational/modulo_spec.rb41
-rw-r--r--spec/ruby/core/rational/multiply_spec.rb57
-rw-r--r--spec/ruby/core/rational/numerator_spec.rb8
-rw-r--r--spec/ruby/core/rational/plus_spec.rb43
-rw-r--r--spec/ruby/core/rational/quo_spec.rb23
-rw-r--r--spec/ruby/core/rational/remainder_spec.rb3
-rw-r--r--spec/ruby/core/rational/round_spec.rb104
-rw-r--r--spec/ruby/core/rational/shared/abs.rb11
-rw-r--r--spec/ruby/core/rational/shared/arithmetic_exception_in_coerce.rb11
-rw-r--r--spec/ruby/core/rational/to_f_spec.rb14
-rw-r--r--spec/ruby/core/rational/to_i_spec.rb10
-rw-r--r--spec/ruby/core/rational/to_r_spec.rb9
-rw-r--r--spec/ruby/core/rational/to_s_spec.rb12
-rw-r--r--spec/ruby/core/rational/truncate_spec.rb69
-rw-r--r--spec/ruby/core/refinement/append_features_spec.rb24
-rw-r--r--spec/ruby/core/refinement/extend_object_spec.rb28
-rw-r--r--spec/ruby/core/refinement/import_methods_spec.rb354
-rw-r--r--spec/ruby/core/refinement/include_spec.rb26
-rw-r--r--spec/ruby/core/refinement/prepend_features_spec.rb24
-rw-r--r--spec/ruby/core/refinement/prepend_spec.rb26
-rw-r--r--spec/ruby/core/refinement/refined_class_spec.rb29
-rw-r--r--spec/ruby/core/refinement/shared/target.rb13
-rw-r--r--spec/ruby/core/refinement/target_spec.rb8
-rw-r--r--spec/ruby/core/regexp/compile_spec.rb2
-rw-r--r--spec/ruby/core/regexp/linear_time_spec.rb42
-rw-r--r--spec/ruby/core/regexp/new_spec.rb2
-rw-r--r--spec/ruby/core/regexp/shared/new.rb426
-rw-r--r--spec/ruby/core/regexp/shared/quote.rb6
-rw-r--r--spec/ruby/core/regexp/timeout_spec.rb48
-rw-r--r--spec/ruby/core/set/add_spec.rb34
-rw-r--r--spec/ruby/core/set/append_spec.rb6
-rw-r--r--spec/ruby/core/set/case_compare_spec.rb11
-rw-r--r--spec/ruby/core/set/case_equality_spec.rb6
-rw-r--r--spec/ruby/core/set/classify_spec.rb26
-rw-r--r--spec/ruby/core/set/clear_spec.rb16
-rw-r--r--spec/ruby/core/set/collect_spec.rb6
-rw-r--r--spec/ruby/core/set/compare_by_identity_spec.rb153
-rw-r--r--spec/ruby/core/set/comparison_spec.rb26
-rw-r--r--spec/ruby/core/set/constructor_spec.rb14
-rw-r--r--spec/ruby/core/set/delete_if_spec.rb37
-rw-r--r--spec/ruby/core/set/delete_spec.rb36
-rw-r--r--spec/ruby/core/set/difference_spec.rb6
-rw-r--r--spec/ruby/core/set/disjoint_spec.rb22
-rw-r--r--spec/ruby/core/set/divide_spec.rb68
-rw-r--r--spec/ruby/core/set/each_spec.rb26
-rw-r--r--spec/ruby/core/set/empty_spec.rb9
-rw-r--r--spec/ruby/core/set/enumerable/to_set_spec.rb12
-rw-r--r--spec/ruby/core/set/eql_spec.rb14
-rw-r--r--spec/ruby/core/set/equal_value_spec.rb34
-rw-r--r--spec/ruby/core/set/exclusion_spec.rb17
-rw-r--r--spec/ruby/core/set/filter_spec.rb (renamed from spec/ruby/library/set/filter_spec.rb)0
-rw-r--r--spec/ruby/core/set/fixtures/set_like.rb30
-rw-r--r--spec/ruby/core/set/flatten_merge_spec.rb24
-rw-r--r--spec/ruby/core/set/flatten_spec.rb59
-rw-r--r--spec/ruby/core/set/hash_spec.rb19
-rw-r--r--spec/ruby/core/set/include_spec.rb6
-rw-r--r--spec/ruby/core/set/initialize_clone_spec.rb15
-rw-r--r--spec/ruby/core/set/initialize_spec.rb72
-rw-r--r--spec/ruby/core/set/inspect_spec.rb6
-rw-r--r--spec/ruby/core/set/intersect_spec.rb22
-rw-r--r--spec/ruby/core/set/intersection_spec.rb10
-rw-r--r--spec/ruby/core/set/join_spec.rb30
-rw-r--r--spec/ruby/core/set/keep_if_spec.rb37
-rw-r--r--spec/ruby/core/set/length_spec.rb6
-rw-r--r--spec/ruby/core/set/map_spec.rb6
-rw-r--r--spec/ruby/core/set/member_spec.rb6
-rw-r--r--spec/ruby/core/set/merge_spec.rb37
-rw-r--r--spec/ruby/core/set/minus_spec.rb6
-rw-r--r--spec/ruby/core/set/plus_spec.rb6
-rw-r--r--spec/ruby/core/set/pretty_print_cycle_spec.rb14
-rw-r--r--spec/ruby/core/set/proper_subset_spec.rb45
-rw-r--r--spec/ruby/core/set/proper_superset_spec.rb42
-rw-r--r--spec/ruby/core/set/reject_spec.rb41
-rw-r--r--spec/ruby/core/set/replace_spec.rb24
-rw-r--r--spec/ruby/core/set/select_spec.rb (renamed from spec/ruby/library/set/select_spec.rb)0
-rw-r--r--spec/ruby/core/set/set_spec.rb10
-rw-r--r--spec/ruby/core/set/shared/add.rb (renamed from spec/ruby/library/set/shared/add.rb)0
-rw-r--r--spec/ruby/core/set/shared/collect.rb (renamed from spec/ruby/library/set/shared/collect.rb)0
-rw-r--r--spec/ruby/core/set/shared/difference.rb (renamed from spec/ruby/library/set/shared/difference.rb)0
-rw-r--r--spec/ruby/core/set/shared/include.rb (renamed from spec/ruby/library/set/shared/include.rb)0
-rw-r--r--spec/ruby/core/set/shared/inspect.rb45
-rw-r--r--spec/ruby/core/set/shared/intersection.rb (renamed from spec/ruby/library/set/shared/intersection.rb)0
-rw-r--r--spec/ruby/core/set/shared/length.rb (renamed from spec/ruby/library/set/shared/length.rb)0
-rw-r--r--spec/ruby/core/set/shared/select.rb41
-rw-r--r--spec/ruby/core/set/shared/union.rb (renamed from spec/ruby/library/set/shared/union.rb)0
-rw-r--r--spec/ruby/core/set/size_spec.rb6
-rw-r--r--spec/ruby/core/set/sortedset/sortedset_spec.rb13
-rw-r--r--spec/ruby/core/set/subset_spec.rb45
-rw-r--r--spec/ruby/core/set/subtract_spec.rb16
-rw-r--r--spec/ruby/core/set/superset_spec.rb42
-rw-r--r--spec/ruby/core/set/to_a_spec.rb7
-rw-r--r--spec/ruby/core/set/to_s_spec.rb11
-rw-r--r--spec/ruby/core/set/union_spec.rb10
-rw-r--r--spec/ruby/core/sizedqueue/append_spec.rb4
-rw-r--r--spec/ruby/core/sizedqueue/deq_spec.rb4
-rw-r--r--spec/ruby/core/sizedqueue/enq_spec.rb4
-rw-r--r--spec/ruby/core/sizedqueue/freeze_spec.rb6
-rw-r--r--spec/ruby/core/sizedqueue/pop_spec.rb4
-rw-r--r--spec/ruby/core/sizedqueue/push_spec.rb4
-rw-r--r--spec/ruby/core/sizedqueue/shift_spec.rb4
-rw-r--r--spec/ruby/core/string/append_as_bytes_spec.rb58
-rw-r--r--spec/ruby/core/string/byteindex_spec.rb470
-rw-r--r--spec/ruby/core/string/byterindex_spec.rb568
-rw-r--r--spec/ruby/core/string/byteslice_spec.rb4
-rw-r--r--spec/ruby/core/string/bytesplice_spec.rb308
-rw-r--r--spec/ruby/core/string/chilled_string_spec.rb174
-rw-r--r--spec/ruby/core/string/codepoints_spec.rb2
-rw-r--r--spec/ruby/core/string/count_spec.rb2
-rw-r--r--spec/ruby/core/string/dedup_spec.rb4
-rw-r--r--spec/ruby/core/string/encode_spec.rb16
-rw-r--r--spec/ruby/core/string/lstrip_spec.rb14
-rw-r--r--spec/ruby/core/string/modulo_spec.rb20
-rw-r--r--spec/ruby/core/string/rindex_spec.rb4
-rw-r--r--spec/ruby/core/string/rstrip_spec.rb28
-rw-r--r--spec/ruby/core/string/scan_spec.rb20
-rw-r--r--spec/ruby/core/string/shared/codepoints.rb2
-rw-r--r--spec/ruby/core/string/shared/dedup.rb5
-rw-r--r--spec/ruby/core/string/shared/each_codepoint_without_block.rb2
-rw-r--r--spec/ruby/core/string/shared/encode.rb184
-rw-r--r--spec/ruby/core/string/shared/eql.rb2
-rw-r--r--spec/ruby/core/string/shared/slice.rb17
-rw-r--r--spec/ruby/core/string/shared/succ.rb2
-rw-r--r--spec/ruby/core/string/squeeze_spec.rb2
-rw-r--r--spec/ruby/core/string/sub_spec.rb16
-rw-r--r--spec/ruby/core/string/swapcase_spec.rb6
-rw-r--r--spec/ruby/core/string/to_c_spec.rb36
-rw-r--r--spec/ruby/core/string/to_f_spec.rb106
-rw-r--r--spec/ruby/core/string/to_i_spec.rb2
-rw-r--r--spec/ruby/core/string/to_r_spec.rb4
-rw-r--r--spec/ruby/core/string/unpack/a_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/at_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/b_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/c_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/comment_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/h_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/l_spec.rb16
-rw-r--r--spec/ruby/core/string/unpack/m_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/shared/basic.rb16
-rw-r--r--spec/ruby/core/string/unpack/shared/float.rb2
-rw-r--r--spec/ruby/core/string/unpack/shared/integer.rb2
-rw-r--r--spec/ruby/core/string/unpack/u_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/w_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/x_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack/z_spec.rb2
-rw-r--r--spec/ruby/core/string/unpack1_spec.rb47
-rw-r--r--spec/ruby/core/string/unpack_spec.rb32
-rw-r--r--spec/ruby/core/string/uplus_spec.rb44
-rw-r--r--spec/ruby/core/struct/constants_spec.rb16
-rw-r--r--spec/ruby/core/struct/deconstruct_keys_spec.rb54
-rw-r--r--spec/ruby/core/struct/element_set_spec.rb7
-rw-r--r--spec/ruby/core/struct/fixtures/classes.rb2
-rw-r--r--spec/ruby/core/struct/initialize_spec.rb20
-rw-r--r--spec/ruby/core/struct/keyword_init_spec.rb61
-rw-r--r--spec/ruby/core/struct/members_spec.rb12
-rw-r--r--spec/ruby/core/struct/new_spec.rb72
-rw-r--r--spec/ruby/core/struct/struct_spec.rb7
-rw-r--r--spec/ruby/core/struct/to_h_spec.rb12
-rw-r--r--spec/ruby/core/symbol/inspect_spec.rb15
-rw-r--r--spec/ruby/core/symbol/shared/id2name.rb14
-rw-r--r--spec/ruby/core/symbol/shared/slice.rb2
-rw-r--r--spec/ruby/core/symbol/to_proc_spec.rb44
-rw-r--r--spec/ruby/core/thread/abort_on_exception_spec.rb2
-rw-r--r--spec/ruby/core/thread/backtrace/limit_spec.rb18
-rw-r--r--spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb17
-rw-r--r--spec/ruby/core/thread/each_caller_location_spec.rb70
-rw-r--r--spec/ruby/core/thread/element_reference_spec.rb11
-rw-r--r--spec/ruby/core/thread/element_set_spec.rb25
-rw-r--r--spec/ruby/core/thread/fixtures/classes.rb25
-rw-r--r--spec/ruby/core/thread/group_spec.rb15
-rw-r--r--spec/ruby/core/thread/key_spec.rb7
-rw-r--r--spec/ruby/core/thread/native_thread_id_spec.rb52
-rw-r--r--spec/ruby/core/thread/raise_spec.rb3
-rw-r--r--spec/ruby/core/thread/thread_variable_get_spec.rb39
-rw-r--r--spec/ruby/core/thread/thread_variable_set_spec.rb42
-rw-r--r--spec/ruby/core/thread/thread_variable_spec.rb43
-rw-r--r--spec/ruby/core/thread/thread_variables_spec.rb22
-rw-r--r--spec/ruby/core/time/_dump_spec.rb2
-rw-r--r--spec/ruby/core/time/_load_spec.rb2
-rw-r--r--spec/ruby/core/time/at_spec.rb36
-rw-r--r--spec/ruby/core/time/comparison_spec.rb26
-rw-r--r--spec/ruby/core/time/deconstruct_keys_spec.rb80
-rw-r--r--spec/ruby/core/time/getlocal_spec.rb39
-rw-r--r--spec/ruby/core/time/iso8601_spec.rb6
-rw-r--r--spec/ruby/core/time/localtime_spec.rb51
-rw-r--r--spec/ruby/core/time/minus_spec.rb2
-rw-r--r--spec/ruby/core/time/new_spec.rb579
-rw-r--r--spec/ruby/core/time/now_spec.rb184
-rw-r--r--spec/ruby/core/time/shared/gmtime.rb9
-rw-r--r--spec/ruby/core/time/shared/time_params.rb4
-rw-r--r--spec/ruby/core/time/shared/xmlschema.rb31
-rw-r--r--spec/ruby/core/time/strftime_spec.rb62
-rw-r--r--spec/ruby/core/time/utc_spec.rb26
-rw-r--r--spec/ruby/core/time/xmlschema_spec.rb6
-rw-r--r--spec/ruby/core/time/yday_spec.rb13
-rw-r--r--spec/ruby/core/time/zone_spec.rb22
-rw-r--r--spec/ruby/core/tracepoint/allow_reentry_spec.rb44
-rw-r--r--spec/ruby/core/tracepoint/enable_spec.rb55
-rw-r--r--spec/ruby/core/tracepoint/inspect_spec.rb13
-rw-r--r--spec/ruby/core/tracepoint/raised_exception_spec.rb18
-rw-r--r--spec/ruby/core/unboundmethod/equal_value_spec.rb39
-rw-r--r--spec/ruby/core/unboundmethod/owner_spec.rb6
-rw-r--r--spec/ruby/core/unboundmethod/private_spec.rb25
-rw-r--r--spec/ruby/core/unboundmethod/protected_spec.rb25
-rw-r--r--spec/ruby/core/unboundmethod/public_spec.rb25
-rw-r--r--spec/ruby/core/unboundmethod/shared/dup.rb2
-rw-r--r--spec/ruby/core/unboundmethod/shared/to_s.rb15
-rw-r--r--spec/ruby/core/unboundmethod/source_location_spec.rb18
-rw-r--r--spec/ruby/core/warning/categories_spec.rb12
-rw-r--r--spec/ruby/core/warning/warn_spec.rb52
-rw-r--r--spec/ruby/default.mspec5
-rw-r--r--spec/ruby/fixtures/constants.rb2
-rw-r--r--spec/ruby/fixtures/io.rb12
-rw-r--r--spec/ruby/language/assignments_spec.rb355
-rw-r--r--spec/ruby/language/block_spec.rb236
-rw-r--r--spec/ruby/language/case_spec.rb2
-rw-r--r--spec/ruby/language/class_spec.rb44
-rw-r--r--spec/ruby/language/constants_spec.rb113
-rw-r--r--spec/ruby/language/def_spec.rb29
-rw-r--r--spec/ruby/language/defined_spec.rb4
-rw-r--r--spec/ruby/language/delegation_spec.rb109
-rw-r--r--spec/ruby/language/ensure_spec.rb6
-rw-r--r--spec/ruby/language/fixtures/class_with_class_variable.rb9
-rw-r--r--spec/ruby/language/fixtures/defined.rb6
-rw-r--r--spec/ruby/language/fixtures/delegation.rb4
-rw-r--r--spec/ruby/language/fixtures/module.rb9
-rw-r--r--spec/ruby/language/fixtures/private.rb26
-rw-r--r--spec/ruby/language/fixtures/send.rb16
-rw-r--r--spec/ruby/language/for_spec.rb103
-rw-r--r--spec/ruby/language/hash_spec.rb130
-rw-r--r--spec/ruby/language/heredoc_spec.rb10
-rw-r--r--spec/ruby/language/it_parameter_spec.rb66
-rw-r--r--spec/ruby/language/keyword_arguments_spec.rb80
-rw-r--r--spec/ruby/language/magic_comment_spec.rb3
-rw-r--r--spec/ruby/language/method_spec.rb249
-rw-r--r--spec/ruby/language/module_spec.rb51
-rw-r--r--spec/ruby/language/numbered_parameters_spec.rb15
-rw-r--r--spec/ruby/language/optional_assignments_spec.rb2
-rw-r--r--spec/ruby/language/pattern_matching_spec.rb1527
-rw-r--r--spec/ruby/language/precedence_spec.rb16
-rw-r--r--spec/ruby/language/predefined_spec.rb311
-rw-r--r--spec/ruby/language/private_spec.rb2
-rw-r--r--spec/ruby/language/proc_spec.rb2
-rw-r--r--spec/ruby/language/regexp/anchors_spec.rb8
-rw-r--r--spec/ruby/language/regexp/character_classes_spec.rb13
-rw-r--r--spec/ruby/language/regexp/encoding_spec.rb8
-rw-r--r--spec/ruby/language/regexp/escapes_spec.rb2
-rw-r--r--spec/ruby/language/regexp/grouping_spec.rb2
-rw-r--r--spec/ruby/language/regexp_spec.rb4
-rw-r--r--spec/ruby/language/rescue_spec.rb26
-rw-r--r--spec/ruby/language/reserved_keywords.rb149
-rw-r--r--spec/ruby/language/send_spec.rb18
-rw-r--r--spec/ruby/language/string_spec.rb14
-rw-r--r--spec/ruby/language/super_spec.rb2
-rw-r--r--spec/ruby/language/undef_spec.rb2
-rw-r--r--spec/ruby/language/variables_spec.rb108
-rw-r--r--spec/ruby/library/bigdecimal/BigDecimal_spec.rb56
-rw-r--r--spec/ruby/library/bigdecimal/add_spec.rb8
-rw-r--r--spec/ruby/library/bigdecimal/core_spec.rb7
-rw-r--r--spec/ruby/library/bigdecimal/divmod_spec.rb80
-rw-r--r--spec/ruby/library/bigdecimal/fix_spec.rb28
-rw-r--r--spec/ruby/library/bigdecimal/mult_spec.rb8
-rw-r--r--spec/ruby/library/bigdecimal/precs_spec.rb55
-rw-r--r--spec/ruby/library/bigdecimal/remainder_spec.rb8
-rw-r--r--spec/ruby/library/bigdecimal/round_spec.rb12
-rw-r--r--spec/ruby/library/bigdecimal/shared/modulo.rb14
-rw-r--r--spec/ruby/library/bigdecimal/shared/power.rb4
-rw-r--r--spec/ruby/library/bigdecimal/shared/quo.rb1
-rw-r--r--spec/ruby/library/bigdecimal/split_spec.rb20
-rw-r--r--spec/ruby/library/bigdecimal/sqrt_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/sub_spec.rb8
-rw-r--r--spec/ruby/library/bigdecimal/to_i_spec.rb2
-rw-r--r--spec/ruby/library/bigdecimal/truncate_spec.rb10
-rw-r--r--spec/ruby/library/cgi/cookie/domain_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/expires_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/initialize_spec.rb235
-rw-r--r--spec/ruby/library/cgi/cookie/name_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/parse_spec.rb41
-rw-r--r--spec/ruby/library/cgi/cookie/path_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/secure_spec.rb99
-rw-r--r--spec/ruby/library/cgi/cookie/to_s_spec.rb51
-rw-r--r--spec/ruby/library/cgi/cookie/value_spec.rb121
-rw-r--r--spec/ruby/library/cgi/escapeElement_spec.rb8
-rw-r--r--spec/ruby/library/cgi/escapeHTML_spec.rb6
-rw-r--r--spec/ruby/library/cgi/escapeURIComponent_spec.rb105
-rw-r--r--spec/ruby/library/cgi/escape_spec.rb6
-rw-r--r--spec/ruby/library/cgi/htmlextension/a_spec.rb73
-rw-r--r--spec/ruby/library/cgi/htmlextension/base_spec.rb47
-rw-r--r--spec/ruby/library/cgi/htmlextension/blockquote_spec.rb47
-rw-r--r--spec/ruby/library/cgi/htmlextension/br_spec.rb31
-rw-r--r--spec/ruby/library/cgi/htmlextension/caption_spec.rb47
-rw-r--r--spec/ruby/library/cgi/htmlextension/checkbox_group_spec.rb121
-rw-r--r--spec/ruby/library/cgi/htmlextension/checkbox_spec.rb113
-rw-r--r--spec/ruby/library/cgi/htmlextension/doctype_spec.rb41
-rw-r--r--spec/ruby/library/cgi/htmlextension/file_field_spec.rb105
-rw-r--r--spec/ruby/library/cgi/htmlextension/form_spec.rb85
-rw-r--r--spec/ruby/library/cgi/htmlextension/frame_spec.rb21
-rw-r--r--spec/ruby/library/cgi/htmlextension/frameset_spec.rb21
-rw-r--r--spec/ruby/library/cgi/htmlextension/hidden_spec.rb87
-rw-r--r--spec/ruby/library/cgi/htmlextension/html_spec.rb99
-rw-r--r--spec/ruby/library/cgi/htmlextension/image_button_spec.rb101
-rw-r--r--spec/ruby/library/cgi/htmlextension/img_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/multipart_form_spec.rb93
-rw-r--r--spec/ruby/library/cgi/htmlextension/password_field_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/popup_menu_spec.rb13
-rw-r--r--spec/ruby/library/cgi/htmlextension/radio_button_spec.rb113
-rw-r--r--spec/ruby/library/cgi/htmlextension/radio_group_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/reset_spec.rb83
-rw-r--r--spec/ruby/library/cgi/htmlextension/scrolling_list_spec.rb13
-rw-r--r--spec/ruby/library/cgi/htmlextension/submit_spec.rb83
-rw-r--r--spec/ruby/library/cgi/htmlextension/text_field_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/textarea_spec.rb107
-rw-r--r--spec/ruby/library/cgi/http_header_spec.rb11
-rw-r--r--spec/ruby/library/cgi/initialize_spec.rb209
-rw-r--r--spec/ruby/library/cgi/out_spec.rb97
-rw-r--r--spec/ruby/library/cgi/parse_spec.rb37
-rw-r--r--spec/ruby/library/cgi/pretty_spec.rb19
-rw-r--r--spec/ruby/library/cgi/print_spec.rb39
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_charset_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_encoding_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_language_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/auth_type_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/cache_control_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/content_length_spec.rb39
-rw-r--r--spec/ruby/library/cgi/queryextension/content_type_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/cookies_spec.rb15
-rw-r--r--spec/ruby/library/cgi/queryextension/element_reference_spec.rb41
-rw-r--r--spec/ruby/library/cgi/queryextension/from_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/gateway_interface_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/has_key_spec.rb11
-rw-r--r--spec/ruby/library/cgi/queryextension/host_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/include_spec.rb11
-rw-r--r--spec/ruby/library/cgi/queryextension/key_spec.rb11
-rw-r--r--spec/ruby/library/cgi/queryextension/keys_spec.rb29
-rw-r--r--spec/ruby/library/cgi/queryextension/multipart_spec.rb47
-rw-r--r--spec/ruby/library/cgi/queryextension/negotiate_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/params_spec.rb55
-rw-r--r--spec/ruby/library/cgi/queryextension/path_info_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/path_translated_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/pragma_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/query_string_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/raw_cookie2_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/raw_cookie_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/referer_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_addr_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_host_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_ident_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_user_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/request_method_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/script_name_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/server_name_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/server_port_spec.rb39
-rw-r--r--spec/ruby/library/cgi/queryextension/server_protocol_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/server_software_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/user_agent_spec.rb33
-rw-r--r--spec/ruby/library/cgi/rfc1123_date_spec.rb15
-rw-r--r--spec/ruby/library/cgi/unescapeElement_spec.rb8
-rw-r--r--spec/ruby/library/cgi/unescapeHTML_spec.rb6
-rw-r--r--spec/ruby/library/cgi/unescapeURIComponent_spec.rb128
-rw-r--r--spec/ruby/library/cgi/unescape_spec.rb8
-rw-r--r--spec/ruby/library/coverage/fixtures/code_with_begin.rb3
-rw-r--r--spec/ruby/library/coverage/result_spec.rb134
-rw-r--r--spec/ruby/library/coverage/start_spec.rb128
-rw-r--r--spec/ruby/library/coverage/supported_spec.rb42
-rw-r--r--spec/ruby/library/date/accessor_spec.rb2
-rw-r--r--spec/ruby/library/date/deconstruct_keys_spec.rb74
-rw-r--r--spec/ruby/library/date/mon_spec.rb3
-rw-r--r--spec/ruby/library/date/month_spec.rb6
-rw-r--r--spec/ruby/library/date/shared/month.rb6
-rw-r--r--spec/ruby/library/date/strftime_spec.rb16
-rw-r--r--spec/ruby/library/date/yday_spec.rb3
-rw-r--r--spec/ruby/library/datetime/deconstruct_keys_spec.rb78
-rw-r--r--spec/ruby/library/datetime/strftime_spec.rb16
-rw-r--r--spec/ruby/library/datetime/time/to_datetime_spec.rb20
-rw-r--r--spec/ruby/library/datetime/to_time_spec.rb20
-rw-r--r--spec/ruby/library/datetime/yday_spec.rb7
-rw-r--r--spec/ruby/library/digest/md5/append_spec.rb2
-rw-r--r--spec/ruby/library/digest/md5/shared/constants.rb2
-rw-r--r--spec/ruby/library/digest/sha1/shared/constants.rb2
-rw-r--r--spec/ruby/library/digest/sha256/append_spec.rb2
-rw-r--r--spec/ruby/library/digest/sha256/shared/constants.rb2
-rw-r--r--spec/ruby/library/digest/sha384/append_spec.rb2
-rw-r--r--spec/ruby/library/digest/sha384/shared/constants.rb2
-rw-r--r--spec/ruby/library/digest/sha512/append_spec.rb2
-rw-r--r--spec/ruby/library/digest/sha512/shared/constants.rb2
-rw-r--r--spec/ruby/library/erb/def_class_spec.rb2
-rw-r--r--spec/ruby/library/erb/def_module_spec.rb3
-rw-r--r--spec/ruby/library/erb/defmethod/def_erb_method_spec.rb2
-rw-r--r--spec/ruby/library/erb/new_spec.rb6
-rw-r--r--spec/ruby/library/fiber/alive_spec.rb46
-rw-r--r--spec/ruby/library/fiber/current_spec.rb58
-rw-r--r--spec/ruby/library/fiber/resume_spec.rb18
-rw-r--r--spec/ruby/library/fiber/transfer_spec.rb86
-rw-r--r--spec/ruby/library/find/fixtures/common.rb14
-rw-r--r--spec/ruby/library/io-wait/fixtures/classes.rb12
-rw-r--r--spec/ruby/library/io-wait/wait_readable_spec.rb23
-rw-r--r--spec/ruby/library/io-wait/wait_spec.rb113
-rw-r--r--spec/ruby/library/io-wait/wait_writable_spec.rb25
-rw-r--r--spec/ruby/library/ipaddr/new_spec.rb46
-rw-r--r--spec/ruby/library/irb/fixtures/irb.rb3
-rw-r--r--spec/ruby/library/irb/irb_spec.rb (renamed from spec/ruby/core/binding/irb_spec.rb)0
-rw-r--r--spec/ruby/library/logger/logger/new_spec.rb28
-rw-r--r--spec/ruby/library/matrix/exponent_spec.rb18
-rw-r--r--spec/ruby/library/net-ftp/connect_spec.rb8
-rw-r--r--spec/ruby/library/net-ftp/fixtures/server.rb2
-rw-r--r--spec/ruby/library/net-ftp/shared/puttextfile.rb12
-rw-r--r--spec/ruby/library/net-http/HTTPServerException_spec.rb4
-rw-r--r--spec/ruby/library/net-http/http/post_spec.rb8
-rw-r--r--spec/ruby/library/net-http/http/send_request_spec.rb2
-rw-r--r--spec/ruby/library/net-http/httpgenericrequest/exec_spec.rb54
-rw-r--r--spec/ruby/library/objectspace/memsize_of_spec.rb2
-rw-r--r--spec/ruby/library/objectspace/trace_object_allocations_spec.rb32
-rw-r--r--spec/ruby/library/objectspace/trace_spec.rb20
-rw-r--r--spec/ruby/library/openssl/digest/initialize_spec.rb16
-rw-r--r--spec/ruby/library/openssl/kdf/pbkdf2_hmac_spec.rb20
-rw-r--r--spec/ruby/library/openssl/kdf/scrypt_spec.rb3
-rw-r--r--spec/ruby/library/openssl/shared/constants.rb2
-rw-r--r--spec/ruby/library/pathname/glob_spec.rb8
-rw-r--r--spec/ruby/library/pp/pp_spec.rb2
-rw-r--r--spec/ruby/library/random/formatter/alphanumeric_spec.rb56
-rw-r--r--spec/ruby/library/rbconfig/rbconfig_spec.rb62
-rw-r--r--spec/ruby/library/rbconfig/unicode_emoji_version_spec.rb18
-rw-r--r--spec/ruby/library/rbconfig/unicode_version_spec.rb18
-rw-r--r--spec/ruby/library/rubygems/gem/bin_path_spec.rb1
-rw-r--r--spec/ruby/library/securerandom/random_number_spec.rb34
-rw-r--r--spec/ruby/library/set/add_spec.rb27
-rw-r--r--spec/ruby/library/set/append_spec.rb7
-rw-r--r--spec/ruby/library/set/case_compare_spec.rb12
-rw-r--r--spec/ruby/library/set/case_equality_spec.rb7
-rw-r--r--spec/ruby/library/set/classify_spec.rb27
-rw-r--r--spec/ruby/library/set/clear_spec.rb17
-rw-r--r--spec/ruby/library/set/collect_spec.rb7
-rw-r--r--spec/ruby/library/set/compare_by_identity_spec.rb143
-rw-r--r--spec/ruby/library/set/comparison_spec.rb27
-rw-r--r--spec/ruby/library/set/constructor_spec.rb15
-rw-r--r--spec/ruby/library/set/delete_if_spec.rb38
-rw-r--r--spec/ruby/library/set/delete_spec.rb37
-rw-r--r--spec/ruby/library/set/difference_spec.rb7
-rw-r--r--spec/ruby/library/set/disjoint_spec.rb23
-rw-r--r--spec/ruby/library/set/divide_spec.rb59
-rw-r--r--spec/ruby/library/set/each_spec.rb27
-rw-r--r--spec/ruby/library/set/empty_spec.rb10
-rw-r--r--spec/ruby/library/set/enumerable/to_set_spec.rb13
-rw-r--r--spec/ruby/library/set/eql_spec.rb15
-rw-r--r--spec/ruby/library/set/equal_value_spec.rb33
-rw-r--r--spec/ruby/library/set/exclusion_spec.rb18
-rw-r--r--spec/ruby/library/set/fixtures/set_like.rb31
-rw-r--r--spec/ruby/library/set/flatten_merge_spec.rb23
-rw-r--r--spec/ruby/library/set/flatten_spec.rb56
-rw-r--r--spec/ruby/library/set/hash_spec.rb13
-rw-r--r--spec/ruby/library/set/include_spec.rb7
-rw-r--r--spec/ruby/library/set/initialize_clone_spec.rb16
-rw-r--r--spec/ruby/library/set/initialize_spec.rb73
-rw-r--r--spec/ruby/library/set/inspect_spec.rb7
-rw-r--r--spec/ruby/library/set/intersect_spec.rb23
-rw-r--r--spec/ruby/library/set/intersection_spec.rb11
-rw-r--r--spec/ruby/library/set/join_spec.rb29
-rw-r--r--spec/ruby/library/set/keep_if_spec.rb38
-rw-r--r--spec/ruby/library/set/length_spec.rb7
-rw-r--r--spec/ruby/library/set/map_spec.rb7
-rw-r--r--spec/ruby/library/set/member_spec.rb7
-rw-r--r--spec/ruby/library/set/merge_spec.rb19
-rw-r--r--spec/ruby/library/set/minus_spec.rb7
-rw-r--r--spec/ruby/library/set/plus_spec.rb7
-rw-r--r--spec/ruby/library/set/pretty_print_cycle_spec.rb10
-rw-r--r--spec/ruby/library/set/pretty_print_spec.rb19
-rw-r--r--spec/ruby/library/set/proper_subset_spec.rb44
-rw-r--r--spec/ruby/library/set/proper_superset_spec.rb41
-rw-r--r--spec/ruby/library/set/reject_spec.rb42
-rw-r--r--spec/ruby/library/set/replace_spec.rb17
-rw-r--r--spec/ruby/library/set/set_spec.rb12
-rw-r--r--spec/ruby/library/set/shared/inspect.rb25
-rw-r--r--spec/ruby/library/set/shared/select.rb42
-rw-r--r--spec/ruby/library/set/size_spec.rb7
-rw-r--r--spec/ruby/library/set/sortedset/sortedset_spec.rb12
-rw-r--r--spec/ruby/library/set/subset_spec.rb44
-rw-r--r--spec/ruby/library/set/subtract_spec.rb17
-rw-r--r--spec/ruby/library/set/superset_spec.rb41
-rw-r--r--spec/ruby/library/set/to_a_spec.rb8
-rw-r--r--spec/ruby/library/set/to_s_spec.rb12
-rw-r--r--spec/ruby/library/set/union_spec.rb11
-rw-r--r--spec/ruby/library/socket/addrinfo/afamily_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/family_addrinfo_spec.rb48
-rw-r--r--spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/getnameinfo_spec.rb20
-rw-r--r--spec/ruby/library/socket/addrinfo/initialize_spec.rb66
-rw-r--r--spec/ruby/library/socket/addrinfo/inspect_sockaddr_spec.rb18
-rw-r--r--spec/ruby/library/socket/addrinfo/inspect_spec.rb26
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_address_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_port_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ip_unpack_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv4_loopback_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv4_multicast_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv4_private_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv4_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv6_loopback_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv6_multicast_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv6_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/ipv6_to_ipv4_spec.rb2
-rw-r--r--spec/ruby/library/socket/addrinfo/marshal_dump_spec.rb56
-rw-r--r--spec/ruby/library/socket/addrinfo/marshal_load_spec.rb20
-rw-r--r--spec/ruby/library/socket/addrinfo/pfamily_spec.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/protocol_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/shared/to_sockaddr.rb16
-rw-r--r--spec/ruby/library/socket/addrinfo/socktype_spec.rb14
-rw-r--r--spec/ruby/library/socket/addrinfo/udp_spec.rb6
-rw-r--r--spec/ruby/library/socket/addrinfo/unix_path_spec.rb46
-rw-r--r--spec/ruby/library/socket/addrinfo/unix_spec.rb46
-rw-r--r--spec/ruby/library/socket/ancillarydata/initialize_spec.rb2
-rw-r--r--spec/ruby/library/socket/ancillarydata/unix_rights_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/connect_address_spec.rb80
-rw-r--r--spec/ruby/library/socket/basicsocket/getpeereid_spec.rb2
-rw-r--r--spec/ruby/library/socket/basicsocket/recv_nonblock_spec.rb71
-rw-r--r--spec/ruby/library/socket/basicsocket/recv_spec.rb132
-rw-r--r--spec/ruby/library/socket/basicsocket/recvmsg_nonblock_spec.rb76
-rw-r--r--spec/ruby/library/socket/basicsocket/recvmsg_spec.rb84
-rw-r--r--spec/ruby/library/socket/basicsocket/send_spec.rb84
-rw-r--r--spec/ruby/library/socket/basicsocket/setsockopt_spec.rb26
-rw-r--r--spec/ruby/library/socket/constants/constants_spec.rb2
-rw-r--r--spec/ruby/library/socket/ipsocket/getaddress_spec.rb5
-rw-r--r--spec/ruby/library/socket/ipsocket/recvfrom_spec.rb82
-rw-r--r--spec/ruby/library/socket/shared/address.rb86
-rw-r--r--spec/ruby/library/socket/shared/pack_sockaddr.rb61
-rw-r--r--spec/ruby/library/socket/socket/bind_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/connect_nonblock_spec.rb58
-rw-r--r--spec/ruby/library/socket/socket/connect_spec.rb22
-rw-r--r--spec/ruby/library/socket/socket/getaddrinfo_spec.rb20
-rw-r--r--spec/ruby/library/socket/socket/gethostbyaddr_spec.rb7
-rw-r--r--spec/ruby/library/socket/socket/gethostbyname_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/gethostname_spec.rb12
-rw-r--r--spec/ruby/library/socket/socket/getifaddrs_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/getnameinfo_spec.rb18
-rw-r--r--spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb80
-rw-r--r--spec/ruby/library/socket/socket/recvfrom_spec.rb87
-rw-r--r--spec/ruby/library/socket/socket/udp_server_loop_spec.rb4
-rw-r--r--spec/ruby/library/socket/socket/unix_server_loop_spec.rb76
-rw-r--r--spec/ruby/library/socket/socket/unix_server_socket_spec.rb56
-rw-r--r--spec/ruby/library/socket/socket/unix_spec.rb56
-rw-r--r--spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb16
-rw-r--r--spec/ruby/library/socket/socket/unpack_sockaddr_un_spec.rb34
-rw-r--r--spec/ruby/library/socket/spec_helper.rb1
-rw-r--r--spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb4
-rw-r--r--spec/ruby/library/socket/tcpsocket/shared/new.rb48
-rw-r--r--spec/ruby/library/socket/unixserver/accept_nonblock_spec.rb114
-rw-r--r--spec/ruby/library/socket/unixserver/accept_spec.rb166
-rw-r--r--spec/ruby/library/socket/unixserver/for_fd_spec.rb28
-rw-r--r--spec/ruby/library/socket/unixserver/initialize_spec.rb36
-rw-r--r--spec/ruby/library/socket/unixserver/listen_spec.rb24
-rw-r--r--spec/ruby/library/socket/unixserver/new_spec.rb14
-rw-r--r--spec/ruby/library/socket/unixserver/open_spec.rb30
-rw-r--r--spec/ruby/library/socket/unixserver/sysaccept_spec.rb64
-rw-r--r--spec/ruby/library/socket/unixsocket/addr_spec.rb48
-rw-r--r--spec/ruby/library/socket/unixsocket/initialize_spec.rb60
-rw-r--r--spec/ruby/library/socket/unixsocket/inspect_spec.rb20
-rw-r--r--spec/ruby/library/socket/unixsocket/local_address_spec.rb132
-rw-r--r--spec/ruby/library/socket/unixsocket/new_spec.rb14
-rw-r--r--spec/ruby/library/socket/unixsocket/open_spec.rb34
-rw-r--r--spec/ruby/library/socket/unixsocket/pair_spec.rb40
-rw-r--r--spec/ruby/library/socket/unixsocket/partially_closable_spec.rb30
-rw-r--r--spec/ruby/library/socket/unixsocket/path_spec.rb34
-rw-r--r--spec/ruby/library/socket/unixsocket/peeraddr_spec.rb38
-rw-r--r--spec/ruby/library/socket/unixsocket/recv_io_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixsocket/recvfrom_spec.rb152
-rw-r--r--spec/ruby/library/socket/unixsocket/remote_address_spec.rb60
-rw-r--r--spec/ruby/library/socket/unixsocket/send_io_spec.rb2
-rw-r--r--spec/ruby/library/socket/unixsocket/shared/pair.rb47
-rw-r--r--spec/ruby/library/socket/unixsocket/socketpair_spec.rb46
-rw-r--r--spec/ruby/library/stringio/each_line_spec.rb4
-rw-r--r--spec/ruby/library/stringio/each_spec.rb4
-rw-r--r--spec/ruby/library/stringio/fileno_spec.rb3
-rw-r--r--spec/ruby/library/stringio/fixtures/classes.rb4
-rw-r--r--spec/ruby/library/stringio/gets_spec.rb263
-rw-r--r--spec/ruby/library/stringio/initialize_spec.rb22
-rw-r--r--spec/ruby/library/stringio/readline_spec.rb160
-rw-r--r--spec/ruby/library/stringio/readpartial_spec.rb38
-rw-r--r--spec/ruby/library/stringio/set_encoding_by_bom_spec.rb237
-rw-r--r--spec/ruby/library/stringio/shared/each.rb78
-rw-r--r--spec/ruby/library/stringio/shared/gets.rb249
-rw-r--r--spec/ruby/library/stringio/shared/read.rb4
-rw-r--r--spec/ruby/library/stringio/shared/sysread.rb2
-rw-r--r--spec/ruby/library/stringio/shared/write.rb2
-rw-r--r--spec/ruby/library/stringio/sysread_spec.rb5
-rw-r--r--spec/ruby/library/stringscanner/captures_spec.rb36
-rw-r--r--spec/ruby/library/stringscanner/charpos_spec.rb18
-rw-r--r--spec/ruby/library/stringscanner/check_spec.rb68
-rw-r--r--spec/ruby/library/stringscanner/check_until_spec.rb122
-rw-r--r--spec/ruby/library/stringscanner/clear_spec.rb18
-rw-r--r--spec/ruby/library/stringscanner/element_reference_spec.rb9
-rw-r--r--spec/ruby/library/stringscanner/empty_spec.rb18
-rw-r--r--spec/ruby/library/stringscanner/eos_spec.rb17
-rw-r--r--spec/ruby/library/stringscanner/exist_spec.rb101
-rw-r--r--spec/ruby/library/stringscanner/fixed_anchor_spec.rb17
-rw-r--r--spec/ruby/library/stringscanner/get_byte_spec.rb81
-rw-r--r--spec/ruby/library/stringscanner/getbyte_spec.rb21
-rw-r--r--spec/ruby/library/stringscanner/getch_spec.rb56
-rw-r--r--spec/ruby/library/stringscanner/initialize_spec.rb5
-rw-r--r--spec/ruby/library/stringscanner/match_spec.rb23
-rw-r--r--spec/ruby/library/stringscanner/must_C_version_spec.rb2
-rw-r--r--spec/ruby/library/stringscanner/named_captures_spec.rb30
-rw-r--r--spec/ruby/library/stringscanner/peek_byte_spec.rb35
-rw-r--r--spec/ruby/library/stringscanner/peek_spec.rb39
-rw-r--r--spec/ruby/library/stringscanner/peep_spec.rb18
-rw-r--r--spec/ruby/library/stringscanner/rest_size_spec.rb18
-rw-r--r--spec/ruby/library/stringscanner/restsize_spec.rb18
-rw-r--r--spec/ruby/library/stringscanner/scan_byte_spec.rb98
-rw-r--r--spec/ruby/library/stringscanner/scan_full_spec.rb14
-rw-r--r--spec/ruby/library/stringscanner/scan_integer_spec.rb157
-rw-r--r--spec/ruby/library/stringscanner/scan_spec.rb14
-rw-r--r--spec/ruby/library/stringscanner/scan_until_spec.rb122
-rw-r--r--spec/ruby/library/stringscanner/search_full_spec.rb107
-rw-r--r--spec/ruby/library/stringscanner/shared/eos.rb17
-rw-r--r--spec/ruby/library/stringscanner/shared/get_byte.rb29
-rw-r--r--spec/ruby/library/stringscanner/shared/peek.rb39
-rw-r--r--spec/ruby/library/stringscanner/shared/pos.rb7
-rw-r--r--spec/ruby/library/stringscanner/shared/rest_size.rb18
-rw-r--r--spec/ruby/library/stringscanner/shared/terminate.rb8
-rw-r--r--spec/ruby/library/stringscanner/skip_spec.rb14
-rw-r--r--spec/ruby/library/stringscanner/skip_until_spec.rb118
-rw-r--r--spec/ruby/library/stringscanner/terminate_spec.rb8
-rw-r--r--spec/ruby/library/stringscanner/unscan_spec.rb6
-rw-r--r--spec/ruby/library/stringscanner/values_at_spec.rb68
-rw-r--r--spec/ruby/library/syslog/constants_spec.rb2
-rw-r--r--spec/ruby/library/syslog/log_spec.rb2
-rw-r--r--spec/ruby/library/syslog/shared/log.rb2
-rw-r--r--spec/ruby/library/tempfile/callback_spec.rb6
-rw-r--r--spec/ruby/library/tempfile/create_spec.rb176
-rw-r--r--spec/ruby/library/time/iso8601_spec.rb4
-rw-r--r--spec/ruby/library/time/shared/rfc2822.rb24
-rw-r--r--spec/ruby/library/time/shared/xmlschema.rb52
-rw-r--r--spec/ruby/library/time/xmlschema_spec.rb2
-rw-r--r--spec/ruby/library/timeout/timeout_spec.rb8
-rw-r--r--spec/ruby/library/uri/generic/host_spec.rb8
-rw-r--r--spec/ruby/library/uri/generic/to_s_spec.rb8
-rw-r--r--spec/ruby/library/uri/set_component_spec.rb40
-rw-r--r--spec/ruby/library/uri/shared/parse.rb13
-rw-r--r--spec/ruby/library/win32ole/fixtures/classes.rb17
-rw-r--r--spec/ruby/library/win32ole/win32ole/locale_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/new_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole/shared/ole_method.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_event/new_spec.rb14
-rw-r--r--spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb12
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb10
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/event_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb10
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/name_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/new_spec.rb22
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/params_spec.rb14
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/shared/name.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_method/visible_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/default_spec.rb12
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/input_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/name_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/optional_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/retval_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/shared/name.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/guid_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/name_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/new_spec.rb32
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/progid_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/progids_spec.rb6
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/shared/name.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb8
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/variables_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/visible_spec.rb4
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/shared/name.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/value_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb2
-rw-r--r--spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb2
-rw-r--r--spec/ruby/library/yaml/dump_spec.rb6
-rw-r--r--spec/ruby/library/yaml/shared/load.rb6
-rw-r--r--spec/ruby/library/yaml/to_yaml_spec.rb2
-rw-r--r--spec/ruby/library/zlib/gzipreader/each_char_spec.rb51
-rw-r--r--spec/ruby/library/zlib/inflate/set_dictionary_spec.rb2
-rw-r--r--spec/ruby/optional/capi/array_spec.rb48
-rw-r--r--spec/ruby/optional/capi/bignum_spec.rb26
-rw-r--r--spec/ruby/optional/capi/binding_spec.rb18
-rw-r--r--spec/ruby/optional/capi/class_spec.rb2
-rw-r--r--spec/ruby/optional/capi/debug_spec.rb7
-rw-r--r--spec/ruby/optional/capi/digest_spec.rb103
-rw-r--r--spec/ruby/optional/capi/encoding_spec.rb24
-rw-r--r--spec/ruby/optional/capi/exception_spec.rb20
-rw-r--r--spec/ruby/optional/capi/ext/array_spec.c8
-rw-r--r--spec/ruby/optional/capi/ext/class_spec.c4
-rw-r--r--spec/ruby/optional/capi/ext/constants_spec.c6
-rw-r--r--spec/ruby/optional/capi/ext/digest_spec.c168
-rw-r--r--spec/ruby/optional/capi/ext/exception_spec.c8
-rw-r--r--spec/ruby/optional/capi/ext/fiber_spec.c5
-rw-r--r--spec/ruby/optional/capi/ext/finalizer_spec.c25
-rw-r--r--spec/ruby/optional/capi/ext/hash_spec.c19
-rw-r--r--spec/ruby/optional/capi/ext/io_spec.c55
-rw-r--r--spec/ruby/optional/capi/ext/kernel_spec.c62
-rw-r--r--spec/ruby/optional/capi/ext/mutex_spec.c23
-rw-r--r--spec/ruby/optional/capi/ext/object_spec.c49
-rw-r--r--spec/ruby/optional/capi/ext/range_spec.c48
-rw-r--r--spec/ruby/optional/capi/ext/rbasic_spec.c10
-rw-r--r--spec/ruby/optional/capi/ext/rubyspec.h39
-rw-r--r--spec/ruby/optional/capi/ext/set_spec.c65
-rw-r--r--spec/ruby/optional/capi/ext/string_spec.c26
-rw-r--r--spec/ruby/optional/capi/ext/struct_spec.c33
-rw-r--r--spec/ruby/optional/capi/ext/thread_spec.c10
-rw-r--r--spec/ruby/optional/capi/fiber_spec.rb53
-rw-r--r--spec/ruby/optional/capi/finalizer_spec.rb40
-rw-r--r--spec/ruby/optional/capi/fixnum_spec.rb4
-rw-r--r--spec/ruby/optional/capi/globals_spec.rb13
-rw-r--r--spec/ruby/optional/capi/hash_spec.rb75
-rw-r--r--spec/ruby/optional/capi/integer_spec.rb2
-rw-r--r--spec/ruby/optional/capi/io_spec.rb329
-rw-r--r--spec/ruby/optional/capi/kernel_spec.rb225
-rw-r--r--spec/ruby/optional/capi/module_spec.rb6
-rw-r--r--spec/ruby/optional/capi/mutex_spec.rb13
-rw-r--r--spec/ruby/optional/capi/numeric_spec.rb8
-rw-r--r--spec/ruby/optional/capi/object_spec.rb12
-rw-r--r--spec/ruby/optional/capi/range_spec.rb144
-rw-r--r--spec/ruby/optional/capi/regexp_spec.rb4
-rw-r--r--spec/ruby/optional/capi/set_spec.rb96
-rw-r--r--spec/ruby/optional/capi/shared/rbasic.rb1
-rw-r--r--spec/ruby/optional/capi/spec_helper.rb17
-rw-r--r--spec/ruby/optional/capi/string_spec.rb145
-rw-r--r--spec/ruby/optional/capi/struct_spec.rb105
-rw-r--r--spec/ruby/optional/capi/thread_spec.rb8
-rw-r--r--spec/ruby/optional/capi/util_spec.rb2
-rw-r--r--spec/ruby/optional/thread_safety/fixtures/classes.rb39
-rw-r--r--spec/ruby/optional/thread_safety/hash_spec.rb210
-rw-r--r--spec/ruby/security/cve_2020_10663_spec.rb64
-rw-r--r--spec/ruby/security/cve_2024_49761_spec.rb7
-rw-r--r--spec/ruby/shared/enumerator/with_index.rb33
-rw-r--r--spec/ruby/shared/enumerator/with_object.rb42
-rw-r--r--spec/ruby/shared/fiber/resume.rb58
-rw-r--r--spec/ruby/shared/file/size.rb2
-rw-r--r--spec/ruby/shared/file/socket.rb32
-rw-r--r--spec/ruby/shared/file/sticky.rb2
-rw-r--r--spec/ruby/shared/io/putc.rb2
-rw-r--r--spec/ruby/shared/kernel/raise.rb348
-rw-r--r--spec/ruby/shared/process/fork.rb10
-rw-r--r--spec/ruby/shared/queue/deque.rb118
-rw-r--r--spec/ruby/shared/queue/freeze.rb18
-rw-r--r--spec/ruby/shared/rational/Rational.rb150
-rw-r--r--spec/ruby/shared/rational/abs.rb11
-rw-r--r--spec/ruby/shared/rational/arithmetic_exception_in_coerce.rb11
-rw-r--r--spec/ruby/shared/rational/ceil.rb45
-rw-r--r--spec/ruby/shared/rational/comparison.rb95
-rw-r--r--spec/ruby/shared/rational/denominator.rb14
-rw-r--r--spec/ruby/shared/rational/div.rb54
-rw-r--r--spec/ruby/shared/rational/divide.rb71
-rw-r--r--spec/ruby/shared/rational/divmod.rb42
-rw-r--r--spec/ruby/shared/rational/equal_value.rb39
-rw-r--r--spec/ruby/shared/rational/exponent.rb196
-rw-r--r--spec/ruby/shared/rational/fdiv.rb5
-rw-r--r--spec/ruby/shared/rational/floor.rb45
-rw-r--r--spec/ruby/shared/rational/hash.rb9
-rw-r--r--spec/ruby/shared/rational/inspect.rb14
-rw-r--r--spec/ruby/shared/rational/modulo.rb43
-rw-r--r--spec/ruby/shared/rational/multiply.rb62
-rw-r--r--spec/ruby/shared/rational/numerator.rb10
-rw-r--r--spec/ruby/shared/rational/plus.rb48
-rw-r--r--spec/ruby/shared/rational/remainder.rb5
-rw-r--r--spec/ruby/shared/rational/round.rb106
-rw-r--r--spec/ruby/shared/rational/to_f.rb16
-rw-r--r--spec/ruby/shared/rational/to_i.rb12
-rw-r--r--spec/ruby/shared/rational/to_r.rb11
-rw-r--r--spec/ruby/shared/rational/to_s.rb14
-rw-r--r--spec/ruby/shared/rational/truncate.rb71
-rw-r--r--spec/ruby/shared/sizedqueue/enque.rb152
-rw-r--r--spec/ruby/shared/string/end_with.rb4
-rw-r--r--spec/ruby/shared/string/times.rb4
-rw-r--r--spec/ruby/shared/time/yday.rb18
-rw-r--r--spec/syntax_suggest/integration/syntax_suggest_spec.rb4
-rw-r--r--spec/syntax_suggest/spec_helper.rb5
-rw-r--r--spec/syntax_suggest/unit/mini_stringio_spec.rb25
-rw-r--r--sprintf.c22
-rw-r--r--st.c927
-rw-r--r--strftime.c10
-rw-r--r--string.c3107
-rw-r--r--string.rb552
-rw-r--r--struct.c155
-rw-r--r--symbol.c1018
-rw-r--r--symbol.h18
-rw-r--r--symbol.rb14
-rw-r--r--template/GNUmakefile.in3
-rw-r--r--template/Makefile.in128
-rw-r--r--template/builtin_binary.inc.tmpl30
-rw-r--r--template/builtin_binary.rbbin.tmpl35
-rw-r--r--template/configure-ext.mk.tmpl4
-rw-r--r--template/exts.mk.tmpl49
-rw-r--r--template/fake.rb.in29
-rw-r--r--template/id.c.tmpl3
-rw-r--r--template/id.h.tmpl8
-rw-r--r--template/limits.c.tmpl19
-rw-r--r--template/prelude.c.tmpl131
-rw-r--r--template/ruby-runner.h.in2
-rw-r--r--template/sizes.c.tmpl21
-rw-r--r--template/unicode_norm_gen.tmpl37
-rw-r--r--test/-ext-/box/test_load_ext.rb97
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb12
-rw-r--r--test/-ext-/debug/test_debug.rb67
-rw-r--r--test/-ext-/debug/test_profile_frames.rb3
-rw-r--r--test/-ext-/gvl/test_last_thread.rb3
-rw-r--r--test/-ext-/marshal/test_internal_ivar.rb10
-rw-r--r--test/-ext-/required.rb10
-rw-r--r--test/-ext-/scheduler/test_interrupt_with_scheduler.rb54
-rw-r--r--test/-ext-/stack/test_stack_overflow.rb55
-rw-r--r--test/-ext-/string/test_capacity.rb4
-rw-r--r--test/-ext-/string/test_interned_str.rb5
-rw-r--r--test/-ext-/string/test_set_len.rb18
-rw-r--r--test/-ext-/symbol/test_type.rb16
-rw-r--r--test/-ext-/test_abi.rb12
-rw-r--r--test/-ext-/test_ensure_and_callcc.rb40
-rw-r--r--test/-ext-/thread/test_instrumentation_api.rb6
-rw-r--r--test/-ext-/thread/test_lock_native_thread.rb4
-rw-r--r--test/-ext-/thread_fd/test_thread_fd_close.rb24
-rw-r--r--test/-ext-/tracepoint/test_tracepoint.rb20
-rw-r--r--test/.excludes-mmtk/TestArgf.rb1
-rw-r--r--test/.excludes-mmtk/TestEtc.rb1
-rw-r--r--test/.excludes-mmtk/TestGc.rb26
-rw-r--r--test/.excludes-mmtk/TestObjSpace.rb4
-rw-r--r--test/.excludes-mmtk/TestObjectSpace.rb1
-rw-r--r--test/.excludes-mmtk/TestProcess.rb4
-rw-r--r--test/.excludes-mmtk/TestTracepointObj.rb1
-rw-r--r--test/.excludes-prism/TestM17N.rb1
-rw-r--r--test/.excludes-prism/TestMixedUnicodeEscape.rb1
-rw-r--r--test/.excludes-prism/TestRubyLiteral.rb1
-rw-r--r--test/.excludes-zjit/TestResolvDNS.rb1
-rw-r--r--test/.excludes/JSONGenericObjectTest.rb4
-rw-r--r--test/.excludes/TestPatternMatching.rb1
-rw-r--r--test/.excludes/URI/TestMailTo.rb1
-rw-r--r--test/.excludes/_appveyor/TestArray.rb7
-rw-r--r--test/benchmark/test_benchmark.rb167
-rw-r--r--test/cgi/test_cgi_cookie.rb211
-rw-r--r--test/cgi/test_cgi_core.rb307
-rw-r--r--test/cgi/test_cgi_escape.rb325
-rw-r--r--test/cgi/test_cgi_header.rb192
-rw-r--r--test/cgi/test_cgi_modruby.rb149
-rw-r--r--test/cgi/test_cgi_multipart.rb385
-rw-r--r--test/cgi/test_cgi_session.rb169
-rw-r--r--test/cgi/test_cgi_tag_helper.rb355
-rw-r--r--test/cgi/test_cgi_util.rb312
-rw-r--r--test/cgi/testdata/file1.html10
-rw-r--r--test/cgi/testdata/large.pngbin156414 -> 0 bytes-rw-r--r--test/cgi/testdata/small.pngbin82 -> 0 bytes-rw-r--r--test/coverage/test_coverage.rb53
-rw-r--r--test/date/test_date.rb4
-rw-r--r--test/date/test_date_conv.rb15
-rw-r--r--test/date/test_date_parse.rb29
-rw-r--r--test/date/test_date_ractor.rb2
-rw-r--r--test/date/test_date_strftime.rb9
-rw-r--r--test/date/test_switch_hitter.rb5
-rw-r--r--test/did_you_mean/spell_checking/test_method_name_check.rb4
-rw-r--r--test/did_you_mean/spell_checking/test_require_path_check.rb6
-rw-r--r--test/did_you_mean/test_ractor_compatibility.rb12
-rw-r--r--test/digest/test_ractor.rb6
-rw-r--r--test/dtrace/helper.rb6
-rw-r--r--test/erb/test_erb.rb80
-rw-r--r--test/error_highlight/test_error_highlight.rb464
-rw-r--r--test/etc/test_etc.rb79
-rw-r--r--test/fiber/scheduler.rb178
-rw-r--r--test/fiber/test_io.rb51
-rw-r--r--test/fiber/test_io_buffer.rb3
-rw-r--r--test/fiber/test_io_close.rb107
-rw-r--r--test/fiber/test_process.rb4
-rw-r--r--test/fiber/test_ractor.rb2
-rw-r--r--test/fiber/test_scheduler.rb201
-rw-r--r--test/fiber/test_sleep.rb4
-rw-r--r--test/fiber/test_thread.rb41
-rw-r--r--test/fiddle/helper.rb184
-rw-r--r--test/fiddle/test_c_struct_builder.rb69
-rw-r--r--test/fiddle/test_c_struct_entry.rb171
-rw-r--r--test/fiddle/test_c_union_entity.rb36
-rw-r--r--test/fiddle/test_closure.rb153
-rw-r--r--test/fiddle/test_cparser.rb414
-rw-r--r--test/fiddle/test_fiddle.rb58
-rw-r--r--test/fiddle/test_func.rb166
-rw-r--r--test/fiddle/test_function.rb239
-rw-r--r--test/fiddle/test_handle.rb218
-rw-r--r--test/fiddle/test_import.rb490
-rw-r--r--test/fiddle/test_memory_view.rb143
-rw-r--r--test/fiddle/test_pack.rb37
-rw-r--r--test/fiddle/test_pinned.rb28
-rw-r--r--test/fiddle/test_pointer.rb306
-rw-r--r--test/fileutils/test_fileutils.rb111
-rw-r--r--test/io/console/test_io_console.rb53
-rw-r--r--test/io/console/test_ractor.rb42
-rw-r--r--test/io/wait/test_io_wait.rb36
-rw-r--r--test/io/wait/test_io_wait_uncommon.rb15
-rw-r--r--test/io/wait/test_ractor.rb6
-rw-r--r--test/irb/command/test_custom_command.rb149
-rw-r--r--test/irb/command/test_disable_irb.rb28
-rw-r--r--test/irb/command/test_force_exit.rb51
-rw-r--r--test/irb/command/test_help.rb75
-rw-r--r--test/irb/command/test_multi_irb_commands.rb50
-rw-r--r--test/irb/command/test_show_source.rb397
-rw-r--r--test/irb/helper.rb221
-rw-r--r--test/irb/test_color.rb274
-rw-r--r--test/irb/test_color_printer.rb69
-rw-r--r--test/irb/test_command.rb971
-rw-r--r--test/irb/test_completion.rb311
-rw-r--r--test/irb/test_context.rb729
-rw-r--r--test/irb/test_debugger_integration.rb496
-rw-r--r--test/irb/test_eval_history.rb69
-rw-r--r--test/irb/test_evaluation.rb44
-rw-r--r--test/irb/test_helper_method.rb134
-rw-r--r--test/irb/test_history.rb491
-rw-r--r--test/irb/test_init.rb386
-rw-r--r--test/irb/test_input_method.rb173
-rw-r--r--test/irb/test_irb.rb917
-rw-r--r--test/irb/test_locale.rb118
-rw-r--r--test/irb/test_nesting_parser.rb341
-rw-r--r--test/irb/test_option.rb13
-rw-r--r--test/irb/test_raise_exception.rb74
-rw-r--r--test/irb/test_ruby_lex.rb242
-rw-r--r--test/irb/test_tracer.rb90
-rw-r--r--test/irb/test_type_completor.rb88
-rw-r--r--test/irb/test_workspace.rb127
-rw-r--r--test/irb/yamatanooroti/test_rendering.rb517
-rw-r--r--test/json/fixtures/fail15.json (renamed from test/json/fixtures/pass15.json)0
-rw-r--r--test/json/fixtures/fail16.json (renamed from test/json/fixtures/pass16.json)0
-rw-r--r--test/json/fixtures/fail17.json (renamed from test/json/fixtures/pass17.json)0
-rw-r--r--test/json/fixtures/fail26.json (renamed from test/json/fixtures/pass26.json)0
-rw-r--r--test/json/fixtures/fail4.json1
-rw-r--r--test/json/fixtures/fail9.json1
-rw-r--r--test/json/fixtures/pass1.json2
-rw-r--r--test/json/json_addition_test.rb25
-rwxr-xr-xtest/json/json_coder_test.rb149
-rw-r--r--test/json/json_common_interface_test.rb202
-rw-r--r--test/json/json_encoding_test.rb249
-rw-r--r--test/json/json_ext_parser_test.rb79
-rw-r--r--test/json/json_fixtures_test.rb40
-rwxr-xr-xtest/json/json_generator_test.rb909
-rw-r--r--test/json/json_generic_object_test.rb35
-rw-r--r--test/json/json_parser_test.rb488
-rw-r--r--test/json/json_ryu_fallback_test.rb169
-rw-r--r--test/json/json_string_matching_test.rb2
-rw-r--r--test/json/ractor_test.rb100
-rw-r--r--test/json/test_helper.rb62
-rw-r--r--test/lib/jit_support.rb16
-rw-r--r--test/lib/parser_support.rb20
-rw-r--r--test/logger/test_formatter.rb35
-rw-r--r--test/logger/test_logdevice.rb859
-rw-r--r--test/logger/test_logger.rb393
-rw-r--r--test/logger/test_logperiod.rb67
-rw-r--r--test/logger/test_severity.rb58
-rw-r--r--test/mkmf/test_flags.rb4
-rw-r--r--test/mkmf/test_pkg_config.rb17
-rw-r--r--test/mmtk/helper.rb32
-rw-r--r--test/mmtk/test_configuration.rb93
-rw-r--r--test/net/http/test_http.rb93
-rw-r--r--test/net/http/test_http_request.rb34
-rw-r--r--test/net/http/test_https.rb137
-rw-r--r--test/net/http/test_https_proxy.rb51
-rw-r--r--test/net/http/utils.rb364
-rw-r--r--test/objspace/test_objspace.rb196
-rw-r--r--test/objspace/test_ractor.rb74
-rw-r--r--test/open-uri/test_ftp.rb216
-rw-r--r--test/open-uri/test_open-uri.rb600
-rw-r--r--test/open-uri/test_proxy.rb174
-rw-r--r--test/open-uri/test_ssl.rb435
-rw-r--r--test/open-uri/utils.rb738
-rw-r--r--test/openssl/fixtures/pkey/certificate.derbin1325 -> 0 bytes-rw-r--r--test/openssl/fixtures/pkey/dsa1024.pem12
-rw-r--r--test/openssl/fixtures/pkey/dsa256.pem8
-rw-r--r--test/openssl/fixtures/pkey/dsa512.pem8
-rw-r--r--test/openssl/fixtures/pkey/empty.der0
-rw-r--r--test/openssl/fixtures/pkey/empty.pem0
-rw-r--r--test/openssl/fixtures/pkey/fullchain.pem56
-rw-r--r--test/openssl/fixtures/pkey/garbage.txt1
-rw-r--r--test/openssl/fixtures/pkey/mldsa65-1.pem88
-rw-r--r--test/openssl/fixtures/pkey/mldsa65-2.pem88
-rw-r--r--test/openssl/fixtures/pkey/p256_too_large.pem5
-rw-r--r--test/openssl/fixtures/pkey/p384_invalid.pem6
-rw-r--r--test/openssl/fixtures/pkey/rsa1024.pem15
-rw-r--r--test/openssl/test_asn1.rb109
-rw-r--r--test/openssl/test_bn.rb54
-rw-r--r--test/openssl/test_buffering.rb2
-rw-r--r--test/openssl/test_cipher.rb115
-rw-r--r--test/openssl/test_config.rb26
-rw-r--r--test/openssl/test_digest.rb85
-rw-r--r--test/openssl/test_fips.rb9
-rw-r--r--test/openssl/test_kdf.rb3
-rw-r--r--test/openssl/test_ns_spki.rb4
-rw-r--r--test/openssl/test_ocsp.rb14
-rw-r--r--test/openssl/test_ossl.rb71
-rw-r--r--test/openssl/test_pair.rb21
-rw-r--r--test/openssl/test_pkcs12.rb44
-rw-r--r--test/openssl/test_pkcs7.rb385
-rw-r--r--test/openssl/test_pkey.rb255
-rw-r--r--test/openssl/test_pkey_dh.rb145
-rw-r--r--test/openssl/test_pkey_dsa.rb168
-rw-r--r--test/openssl/test_pkey_ec.rb119
-rw-r--r--test/openssl/test_pkey_rsa.rb467
-rw-r--r--test/openssl/test_provider.rb26
-rw-r--r--test/openssl/test_ssl.rb828
-rw-r--r--test/openssl/test_ssl_session.rb96
-rw-r--r--test/openssl/test_ts.rb48
-rw-r--r--test/openssl/test_x509attr.rb4
-rw-r--r--test/openssl/test_x509cert.rb301
-rw-r--r--test/openssl/test_x509crl.rb85
-rw-r--r--test/openssl/test_x509name.rb16
-rw-r--r--test/openssl/test_x509req.rb97
-rw-r--r--test/openssl/test_x509store.rb19
-rw-r--r--test/openssl/ut_eof.rb4
-rw-r--r--test/openssl/utils.rb70
-rw-r--r--test/optparse/test_acceptable.rb2
-rw-r--r--test/optparse/test_load.rb61
-rw-r--r--test/optparse/test_optparse.rb30
-rw-r--r--test/optparse/test_placearg.rb25
-rw-r--r--test/optparse/test_switch.rb50
-rw-r--r--test/ostruct/test_ostruct.rb434
-rw-r--r--test/pathname/test_pathname.rb48
-rw-r--r--test/pathname/test_ractor.rb12
-rw-r--r--test/prism/api/command_line_test.rb7
-rw-r--r--test/prism/api/freeze_test.rb60
-rw-r--r--test/prism/api/lex_test.rb23
-rw-r--r--test/prism/api/parse_stream_test.rb8
-rw-r--r--test/prism/api/parse_test.rb119
-rw-r--r--test/prism/encoding/encodings_test.rb18
-rw-r--r--test/prism/encoding/regular_expression_encoding_test.rb4
-rw-r--r--test/prism/errors/1_2_3.txt11
-rw-r--r--test/prism/errors/3.3-3.3/circular_parameters.txt12
-rw-r--r--test/prism/errors/3.3-3.4/leading_logical.txt34
-rw-r--r--test/prism/errors/3.3-3.4/private_endless_method.txt3
-rw-r--r--test/prism/errors/3.4/block_args_in_array_assignment.txt3
-rw-r--r--test/prism/errors/3.4/dont_allow_return_inside_sclass_body.txt3
-rw-r--r--test/prism/errors/3.4/it_with_ordinary_parameter.txt3
-rw-r--r--test/prism/errors/3.4/keyword_args_in_array_assignment.txt3
-rw-r--r--test/prism/errors/aliasing_global_variable_with_global_number_variable.txt3
-rw-r--r--test/prism/errors/aliasing_global_variable_with_non_global_variable.txt3
-rw-r--r--test/prism/errors/aliasing_non_global_variable_with_global_variable.txt3
-rw-r--r--test/prism/errors/alnum_delimiters.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_2.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_3.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_4.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_5.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_6.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_7.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_8.txt3
-rw-r--r--test/prism/errors/alnum_delimiters_9.txt3
-rw-r--r--test/prism/errors/amperand_dot_after_endless_range.txt3
-rw-r--r--test/prism/errors/argument_after_ellipsis.txt3
-rw-r--r--test/prism/errors/argument_forwarding_only_effects_its_own_internals.txt3
-rw-r--r--test/prism/errors/argument_forwarding_when_parent_is_not_forwarding.txt3
-rw-r--r--test/prism/errors/arguments_after_block.txt17
-rw-r--r--test/prism/errors/arguments_binding_power_for_and.txt5
-rw-r--r--test/prism/errors/arguments_invalid_comma.txt4
-rw-r--r--test/prism/errors/arguments_splat_after_star_star.txt3
-rw-r--r--test/prism/errors/array_invalid_comma.txt4
-rw-r--r--test/prism/errors/array_with_double_commas.txt3
-rw-r--r--test/prism/errors/assign_to_numbered_parameter.txt11
-rw-r--r--test/prism/errors/bad_arguments.txt6
-rw-r--r--test/prism/errors/begin_at_toplevel.txt3
-rw-r--r--test/prism/errors/binary_range_with_left_unary_range.txt8
-rw-r--r--test/prism/errors/block_arg_and_block.txt3
-rw-r--r--test/prism/errors/block_args_with_endless_def.txt5
-rw-r--r--test/prism/errors/block_beginning_with_brace_and_ending_with_end.txt5
-rw-r--r--test/prism/errors/break_1.txt4
-rw-r--r--test/prism/errors/break_1_2_3.txt8
-rw-r--r--test/prism/errors/call_with_block_and_write.txt4
-rw-r--r--test/prism/errors/call_with_block_operator_write.txt4
-rw-r--r--test/prism/errors/call_with_block_or_write.txt4
-rw-r--r--test/prism/errors/cannot_assign_to_a_reserved_numbered_parameter.txt14
-rw-r--r--test/prism/errors/case_without_clauses.txt4
-rw-r--r--test/prism/errors/case_without_when_clauses_errors_on_else_clause.txt5
-rw-r--r--test/prism/errors/check_value_expression.txt20
-rw-r--r--test/prism/errors/class_definition_in_method_body.txt3
-rw-r--r--test/prism/errors/class_definition_in_method_defs.txt7
-rw-r--r--test/prism/errors/class_name.txt3
-rw-r--r--test/prism/errors/command_call_in.txt5
-rw-r--r--test/prism/errors/command_calls.txt10
-rw-r--r--test/prism/errors/command_calls_10.txt3
-rw-r--r--test/prism/errors/command_calls_11.txt3
-rw-r--r--test/prism/errors/command_calls_12.txt3
-rw-r--r--test/prism/errors/command_calls_13.txt3
-rw-r--r--test/prism/errors/command_calls_14.txt3
-rw-r--r--test/prism/errors/command_calls_15.txt3
-rw-r--r--test/prism/errors/command_calls_16.txt3
-rw-r--r--test/prism/errors/command_calls_17.txt5
-rw-r--r--test/prism/errors/command_calls_18.txt3
-rw-r--r--test/prism/errors/command_calls_19.txt3
-rw-r--r--test/prism/errors/command_calls_2.txt6
-rw-r--r--test/prism/errors/command_calls_20.txt3
-rw-r--r--test/prism/errors/command_calls_21.txt5
-rw-r--r--test/prism/errors/command_calls_22.txt3
-rw-r--r--test/prism/errors/command_calls_23.txt3
-rw-r--r--test/prism/errors/command_calls_24.txt5
-rw-r--r--test/prism/errors/command_calls_25.txt8
-rw-r--r--test/prism/errors/command_calls_26.txt3
-rw-r--r--test/prism/errors/command_calls_27.txt3
-rw-r--r--test/prism/errors/command_calls_28.txt3
-rw-r--r--test/prism/errors/command_calls_29.txt3
-rw-r--r--test/prism/errors/command_calls_3.txt3
-rw-r--r--test/prism/errors/command_calls_30.txt3
-rw-r--r--test/prism/errors/command_calls_31.txt17
-rw-r--r--test/prism/errors/command_calls_32.txt19
-rw-r--r--test/prism/errors/command_calls_33.txt6
-rw-r--r--test/prism/errors/command_calls_34.txt24
-rw-r--r--test/prism/errors/command_calls_35.txt46
-rw-r--r--test/prism/errors/command_calls_4.txt3
-rw-r--r--test/prism/errors/command_calls_5.txt3
-rw-r--r--test/prism/errors/command_calls_6.txt6
-rw-r--r--test/prism/errors/command_calls_7.txt6
-rw-r--r--test/prism/errors/command_calls_8.txt6
-rw-r--r--test/prism/errors/command_calls_9.txt6
-rw-r--r--test/prism/errors/conditional_predicate_closed.txt6
-rw-r--r--test/prism/errors/constant_assignment_in_method.txt3
-rw-r--r--test/prism/errors/constant_path_with_invalid_token_after.txt4
-rw-r--r--test/prism/errors/content_after_unterminated_heredoc.txt4
-rw-r--r--test/prism/errors/cr_without_lf_in_percent_expression.txt3
-rw-r--r--test/prism/errors/def_ivar.txt3
-rw-r--r--test/prism/errors/def_with_empty_expression_receiver.txt3
-rw-r--r--test/prism/errors/def_with_expression_receiver_and_no_identifier.txt4
-rw-r--r--test/prism/errors/def_with_multiple_statements_receiver.txt10
-rw-r--r--test/prism/errors/def_with_optional_splat.txt6
-rw-r--r--test/prism/errors/defined_empty.txt3
-rw-r--r--test/prism/errors/defining_numbered_parameter.txt3
-rw-r--r--test/prism/errors/defining_numbered_parameter_2.txt3
-rw-r--r--test/prism/errors/defs_endless_method.txt12
-rw-r--r--test/prism/errors/destroy_call_operator_write_arguments.txt11
-rw-r--r--test/prism/errors/do_not_allow_characters_other_than_0_9_a_f_and_A_F_in_u_Unicode_character_notation.txt4
-rw-r--r--test/prism/errors/do_not_allow_forward_arguments_in_blocks.txt3
-rw-r--r--test/prism/errors/do_not_allow_forward_arguments_in_lambda_literals.txt3
-rw-r--r--test/prism/errors/do_not_allow_more_than_6_hexadecimal_digits_in_u_Unicode_character_notation.txt3
-rw-r--r--test/prism/errors/do_not_allow_multiple_codepoints_in_a_single_character_literal.txt3
-rw-r--r--test/prism/errors/do_not_allow_trailing_commas_in_lambda_parameters.txt3
-rw-r--r--test/prism/errors/do_not_allow_trailing_commas_in_method_parameters.txt3
-rw-r--r--test/prism/errors/dont_allow_return_inside_class_body.txt3
-rw-r--r--test/prism/errors/dont_allow_return_inside_module_body.txt3
-rw-r--r--test/prism/errors/dont_allow_setting_to_back_and_nth_reference.txt7
-rw-r--r--test/prism/errors/double_arguments_forwarding.txt4
-rw-r--r--test/prism/errors/double_scope_numbered_parameters.txt3
-rw-r--r--test/prism/errors/double_scope_repeated_numbered_parameters.txt3
-rw-r--r--test/prism/errors/double_splat_followed_by_splat_argument.txt3
-rw-r--r--test/prism/errors/double_splat_with_double_commas.txt3
-rw-r--r--test/prism/errors/duplicate_pattern_capture.txt17
-rw-r--r--test/prism/errors/duplicate_pattern_hash_key.txt4
-rw-r--r--test/prism/errors/duplicate_pattern_hash_key_2.txt3
-rw-r--r--test/prism/errors/duplicated_parameter_names.txt3
-rw-r--r--test/prism/errors/duplicated_parameter_names_2.txt3
-rw-r--r--test/prism/errors/duplicated_parameter_names_3.txt3
-rw-r--r--test/prism/errors/duplicated_parameter_names_4.txt3
-rw-r--r--test/prism/errors/duplicated_parameter_names_5.txt3
-rw-r--r--test/prism/errors/dynamic_label_pattern.txt3
-rw-r--r--test/prism/errors/ellipsis_in_no_paren_call.txt3
-rw-r--r--test/prism/errors/endless_method_command_call.txt3
-rw-r--r--test/prism/errors/endless_method_command_call_parameters.txt27
-rw-r--r--test/prism/errors/escape_unicode_curly_whitespace.txt5
-rw-r--r--test/prism/errors/for_loop_delimiter.txt3
-rw-r--r--test/prism/errors/for_loops_index_missing.txt5
-rw-r--r--test/prism/errors/for_loops_only_end.txt6
-rw-r--r--test/prism/errors/forwarding_arg_after_keyword_rest.txt3
-rw-r--r--test/prism/errors/forwarding_arg_and_block.txt3
-rw-r--r--test/prism/errors/heredoc_percent_q_newline_delimiter.txt11
-rw-r--r--test/prism/errors/heredoc_unterminated.txt9
-rw-r--r--test/prism/errors/incomplete_instance_var_string.txt4
-rw-r--r--test/prism/errors/index_call_with_block_and_write.txt5
-rw-r--r--test/prism/errors/index_call_with_block_operator_write.txt5
-rw-r--r--test/prism/errors/index_call_with_block_or_write.txt5
-rw-r--r--test/prism/errors/infix_after_label.txt6
-rw-r--r--test/prism/errors/interpolated_regular_expression_with_unknown_regexp_options.txt3
-rw-r--r--test/prism/errors/invalid_global_variable_write.txt4
-rw-r--r--test/prism/errors/invalid_hex_escape.txt3
-rw-r--r--test/prism/errors/invalid_multi_target.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_10.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_11.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_12.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_13.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_14.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_15.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_16.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_17.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_18.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_19.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_2.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_20.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_3.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_4.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_5.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_6.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_7.txt3
-rw-r--r--test/prism/errors/invalid_multi_target_8.txt4
-rw-r--r--test/prism/errors/invalid_multi_target_9.txt4
-rw-r--r--test/prism/errors/invalid_number_underscores.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_10.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_11.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_12.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_2.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_3.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_4.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_5.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_6.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_7.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_8.txt3
-rw-r--r--test/prism/errors/invalid_number_underscores_9.txt3
-rw-r--r--test/prism/errors/invalid_operator_write_dot.txt3
-rw-r--r--test/prism/errors/invalid_operator_write_fcall.txt3
-rw-r--r--test/prism/errors/invalid_splat.txt4
-rw-r--r--test/prism/errors/keywords_parameters_before_required_parameters.txt4
-rw-r--r--test/prism/errors/label_in_interpolated_string.txt14
-rw-r--r--test/prism/errors/label_in_parentheses.txt3
-rw-r--r--test/prism/errors/loop_conditional_is_closed.txt4
-rw-r--r--test/prism/errors/match_plus.txt7
-rw-r--r--test/prism/errors/match_predicate_after_and_with_dot_method_call.txt3
-rw-r--r--test/prism/errors/match_predicate_after_and_with_opreator.txt3
-rw-r--r--test/prism/errors/match_predicate_after_or_with_dot_method_call.txt3
-rw-r--r--test/prism/errors/match_predicate_after_or_with_opreator.txt3
-rw-r--r--test/prism/errors/match_predicate_after_rescue_with_dot_method_call.txt3
-rw-r--r--test/prism/errors/match_predicate_after_rescue_with_opreator.txt3
-rw-r--r--test/prism/errors/match_required_after_and_with_dot_method_call.txt3
-rw-r--r--test/prism/errors/match_required_after_and_with_opreator.txt3
-rw-r--r--test/prism/errors/match_required_after_or_with_dot_method_call.txt3
-rw-r--r--test/prism/errors/match_required_after_or_with_opreator.txt3
-rw-r--r--test/prism/errors/match_required_after_rescue_with_dot_method_call.txt3
-rw-r--r--test/prism/errors/match_required_after_rescue_with_opreator.txt3
-rw-r--r--test/prism/errors/method_parameters_after_arguments_forwarding.txt4
-rw-r--r--test/prism/errors/method_parameters_after_block.txt4
-rw-r--r--test/prism/errors/method_with_arguments_after_anonymous_block.txt4
-rw-r--r--test/prism/errors/missing_terminator_in_parentheses.txt3
-rw-r--r--test/prism/errors/module_definition_in_method_body.txt3
-rw-r--r--test/prism/errors/module_definition_in_method_body_within_block.txt7
-rw-r--r--test/prism/errors/module_definition_in_method_defs.txt7
-rw-r--r--test/prism/errors/module_name_recoverable.txt4
-rw-r--r--test/prism/errors/multi_target_parens.txt19
-rw-r--r--test/prism/errors/multi_target_star.txt17
-rw-r--r--test/prism/errors/multiple_error_in_parameters_order.txt5
-rw-r--r--test/prism/errors/next_1.txt4
-rw-r--r--test/prism/errors/next_1_2_3.txt8
-rw-r--r--test/prism/errors/non_assoc_equality.txt25
-rw-r--r--test/prism/errors/non_assoc_range.txt5
-rw-r--r--test/prism/errors/numbered_and_write.txt3
-rw-r--r--test/prism/errors/numbered_operator_write.txt3
-rw-r--r--test/prism/errors/numbered_or_write.txt3
-rw-r--r--test/prism/errors/numbered_parameters_in_block_arguments.txt3
-rw-r--r--test/prism/errors/optional_block_parameters_with_unary_operator.txt3
-rw-r--r--test/prism/errors/optional_block_parameters_with_unary_operator_2.txt3
-rw-r--r--test/prism/errors/optional_block_parameters_with_unary_operator_3.txt3
-rw-r--r--test/prism/errors/optional_block_parameters_with_unary_operator_4.txt3
-rw-r--r--test/prism/errors/parameter_name_ending_with_bang_or_question_mark.txt4
-rw-r--r--test/prism/errors/parameters_invalid_comma.txt4
-rw-r--r--test/prism/errors/pattern-capture-in-alt-array.txt4
-rw-r--r--test/prism/errors/pattern-capture-in-alt-hash.txt3
-rw-r--r--test/prism/errors/pattern-capture-in-alt-name.txt3
-rw-r--r--test/prism/errors/pattern-capture-in-alt-top.txt4
-rw-r--r--test/prism/errors/pattern_arithmetic_expressions.txt3
-rw-r--r--test/prism/errors/pattern_match_implicit_rest.txt3
-rw-r--r--test/prism/errors/pattern_string_key.txt8
-rw-r--r--test/prism/errors/pre_execution_context.txt4
-rw-r--r--test/prism/errors/pre_execution_missing_brace.txt3
-rw-r--r--test/prism/errors/range_and_bin_op.txt5
-rw-r--r--test/prism/errors/range_and_bin_op_2.txt5
-rw-r--r--test/prism/errors/range_and_bin_op_3.txt3
-rw-r--r--test/prism/errors/range_and_bin_op_4.txt5
-rw-r--r--test/prism/errors/range_and_bin_op_5.txt6
-rw-r--r--test/prism/errors/range_and_bin_op_6.txt3
-rw-r--r--test/prism/errors/range_and_bin_op_7.txt3
-rw-r--r--test/prism/errors/range_and_bin_op_8.txt4
-rw-r--r--test/prism/errors/range_doubled.txt3
-rw-r--r--test/prism/errors/rational_number_with_exponential_portion.txt4
-rw-r--r--test/prism/errors/regexp_unicode_too_short.txt4
-rw-r--r--test/prism/errors/regular_expression_with_unknown_regexp_options.txt3
-rw-r--r--test/prism/errors/repeated_parameter_name_in_destructured_params.txt3
-rw-r--r--test/prism/errors/rest_keywords_parameters_before_required_parameters.txt4
-rw-r--r--test/prism/errors/return_1.txt3
-rw-r--r--test/prism/errors/return_1_2_3.txt7
-rw-r--r--test/prism/errors/returning_to_optional_parameters_multiple_times.txt4
-rw-r--r--test/prism/errors/semicolon_after_inheritance_operator.txt3
-rw-r--r--test/prism/errors/setter_method_cannot_be_defined_in_an_endless_method_definition.txt6
-rw-r--r--test/prism/errors/shadow_args_in_block.txt3
-rw-r--r--test/prism/errors/shadow_args_in_lambda.txt5
-rw-r--r--test/prism/errors/singleton_class_delimiter.txt3
-rw-r--r--test/prism/errors/singleton_method_for_literals.txt39
-rw-r--r--test/prism/errors/splat_argument_after_keyword_argument.txt3
-rw-r--r--test/prism/errors/statement_at_non_statement.txt9
-rw-r--r--test/prism/errors/statement_operators.txt25
-rw-r--r--test/prism/errors/switching_to_named_arguments_twice.txt5
-rw-r--r--test/prism/errors/switching_to_optional_arguments_twice.txt5
-rw-r--r--test/prism/errors/symbol_in_hash.txt3
-rw-r--r--test/prism/errors/symbol_in_keyword_parameter.txt3
-rw-r--r--test/prism/errors/targeting_numbered_parameter.txt3
-rw-r--r--test/prism/errors/top_level_constant_starting_with_downcased_identifier.txt4
-rw-r--r--test/prism/errors/top_level_constant_with_downcased_identifier.txt4
-rw-r--r--test/prism/errors/trailing_comma_after_block.txt3
-rw-r--r--test/prism/errors/trailing_comma_in_calls.txt3
-rw-r--r--test/prism/errors/unexpected_block.txt3
-rw-r--r--test/prism/errors/unterminated_W_list.txt3
-rw-r--r--test/prism/errors/unterminated_argument_expression.txt5
-rw-r--r--test/prism/errors/unterminated_begin.txt4
-rw-r--r--test/prism/errors/unterminated_begin_upcase.txt4
-rw-r--r--test/prism/errors/unterminated_block.txt4
-rw-r--r--test/prism/errors/unterminated_block_do_end.txt4
-rw-r--r--test/prism/errors/unterminated_class.txt4
-rw-r--r--test/prism/errors/unterminated_def.txt5
-rw-r--r--test/prism/errors/unterminated_embdoc.txt3
-rw-r--r--test/prism/errors/unterminated_embdoc_2.txt3
-rw-r--r--test/prism/errors/unterminated_empty_string.txt3
-rw-r--r--test/prism/errors/unterminated_end_upcase.txt4
-rw-r--r--test/prism/errors/unterminated_for.txt5
-rw-r--r--test/prism/errors/unterminated_global_variable.txt3
-rw-r--r--test/prism/errors/unterminated_global_variable_2.txt3
-rw-r--r--test/prism/errors/unterminated_i_list.txt3
-rw-r--r--test/prism/errors/unterminated_if.txt5
-rw-r--r--test/prism/errors/unterminated_if_else.txt5
-rw-r--r--test/prism/errors/unterminated_interpolated_string.txt3
-rw-r--r--test/prism/errors/unterminated_interpolated_symbol.txt3
-rw-r--r--test/prism/errors/unterminated_lambda_brace.txt4
-rw-r--r--test/prism/errors/unterminated_method_parameters.txt3
-rw-r--r--test/prism/errors/unterminated_module.txt4
-rw-r--r--test/prism/errors/unterminated_parenthesized_expression.txt4
-rw-r--r--test/prism/errors/unterminated_pattern_bracket.txt7
-rw-r--r--test/prism/errors/unterminated_pattern_paren.txt7
-rw-r--r--test/prism/errors/unterminated_regular_expression.txt3
-rw-r--r--test/prism/errors/unterminated_regular_expression_with_heredoc.txt4
-rw-r--r--test/prism/errors/unterminated_s_symbol.txt3
-rw-r--r--test/prism/errors/unterminated_string.txt3
-rw-r--r--test/prism/errors/unterminated_unicode_brackets_should_be_a_syntax_error.txt3
-rw-r--r--test/prism/errors/unterminated_until.txt5
-rw-r--r--test/prism/errors/unterminated_xstring.txt3
-rw-r--r--test/prism/errors/void_value_expression_in_arguments.txt17
-rw-r--r--test/prism/errors/void_value_expression_in_array.txt15
-rw-r--r--test/prism/errors/void_value_expression_in_assignment.txt9
-rw-r--r--test/prism/errors/void_value_expression_in_begin_statement.txt21
-rw-r--r--test/prism/errors/void_value_expression_in_binary_call.txt11
-rw-r--r--test/prism/errors/void_value_expression_in_call.txt11
-rw-r--r--test/prism/errors/void_value_expression_in_constant_path.txt5
-rw-r--r--test/prism/errors/void_value_expression_in_def.txt10
-rw-r--r--test/prism/errors/void_value_expression_in_expression.txt19
-rw-r--r--test/prism/errors/void_value_expression_in_hash.txt9
-rw-r--r--test/prism/errors/void_value_expression_in_modifier.txt13
-rw-r--r--test/prism/errors/void_value_expression_in_statement.txt26
-rw-r--r--test/prism/errors/void_value_expression_in_unary_call.txt5
-rw-r--r--test/prism/errors/while_endless_method.txt5
-rw-r--r--test/prism/errors/writing_numbered_parameter.txt3
-rw-r--r--test/prism/errors/xstring_concat.txt5
-rw-r--r--test/prism/errors_test.rb2299
-rw-r--r--test/prism/fixtures/3.3-3.3/block_args_in_array_assignment.txt1
-rw-r--r--test/prism/fixtures/3.3-3.3/it.txt5
-rw-r--r--test/prism/fixtures/3.3-3.3/it_indirect_writes.txt23
-rw-r--r--test/prism/fixtures/3.3-3.3/it_read_and_assignment.txt1
-rw-r--r--test/prism/fixtures/3.3-3.3/it_with_ordinary_parameter.txt1
-rw-r--r--test/prism/fixtures/3.3-3.3/keyword_args_in_array_assignment.txt1
-rw-r--r--test/prism/fixtures/3.3-3.3/return_in_sclass.txt1
-rw-r--r--test/prism/fixtures/3.4/circular_parameters.txt4
-rw-r--r--test/prism/fixtures/3.4/it.txt5
-rw-r--r--test/prism/fixtures/3.4/it_indirect_writes.txt23
-rw-r--r--test/prism/fixtures/3.4/it_read_and_assignment.txt1
-rw-r--r--test/prism/fixtures/4.0/endless_methods_command_call.txt8
-rw-r--r--test/prism/fixtures/4.0/leading_logical.txt21
-rw-r--r--test/prism/fixtures/__END__.txt3
-rw-r--r--test/prism/fixtures/begin_rescue.txt6
-rw-r--r--test/prism/fixtures/break.txt8
-rw-r--r--test/prism/fixtures/case_in_hash_key.txt6
-rw-r--r--test/prism/fixtures/character_literal.txt2
-rw-r--r--test/prism/fixtures/command_method_call_2.txt3
-rw-r--r--test/prism/fixtures/command_method_call_3.txt19
-rw-r--r--test/prism/fixtures/comment_single.txt1
-rw-r--r--test/prism/fixtures/defined.txt9
-rw-r--r--test/prism/fixtures/dstring.txt13
-rw-r--r--test/prism/fixtures/dsym_str.txt3
-rw-r--r--test/prism/fixtures/encoding_binary.txt9
-rw-r--r--test/prism/fixtures/encoding_euc_jp.txt6
-rw-r--r--test/prism/fixtures/endless_method_as_default_arg.txt11
-rw-r--r--test/prism/fixtures/endless_methods.txt2
-rw-r--r--test/prism/fixtures/heredoc_percent_q_newline_delimiter.txt22
-rw-r--r--test/prism/fixtures/heredocs_with_fake_newlines.txt55
-rw-r--r--test/prism/fixtures/it_assignment.txt1
-rw-r--r--test/prism/fixtures/keyword_method_names.txt9
-rw-r--r--test/prism/fixtures/lambda.txt16
-rw-r--r--test/prism/fixtures/methods.txt7
-rw-r--r--test/prism/fixtures/next.txt4
-rw-r--r--test/prism/fixtures/patterns.txt23
-rw-r--r--test/prism/fixtures/range_beginless.txt5
-rw-r--r--test/prism/fixtures/ranges.txt2
-rw-r--r--test/prism/fixtures/regex.txt12
-rw-r--r--test/prism/fixtures/regex_escape_encoding.txt3
-rw-r--r--test/prism/fixtures/regex_with_fake_newlines.txt41
-rw-r--r--test/prism/fixtures/rescue.txt4
-rw-r--r--test/prism/fixtures/rescue_modifier.txt7
-rw-r--r--test/prism/fixtures/return.txt3
-rw-r--r--test/prism/fixtures/string_concatination_frozen_false.txt5
-rw-r--r--test/prism/fixtures/string_concatination_frozen_true.txt5
-rw-r--r--test/prism/fixtures/strings.txt80
-rw-r--r--test/prism/fixtures/symbols.txt11
-rw-r--r--test/prism/fixtures/unary_method_calls.txt2
-rw-r--r--test/prism/fixtures/unparser/corpus/literal/unary.txt1
-rw-r--r--test/prism/fixtures/variables.txt2
-rw-r--r--test/prism/fixtures/whitequark/LICENSE3
-rw-r--r--test/prism/fixtures/whitequark/arg_combinations.txt29
-rw-r--r--test/prism/fixtures/whitequark/block_arg_combinations.txt57
-rw-r--r--test/prism/fixtures/whitequark/block_kwarg.txt1
-rw-r--r--test/prism/fixtures/whitequark/block_kwarg_combinations.txt5
-rw-r--r--test/prism/fixtures/whitequark/emit_arg_inside_procarg0_legacy.txt1
-rw-r--r--test/prism/fixtures/whitequark/find_pattern.txt7
-rw-r--r--test/prism/fixtures/whitequark/kwarg_combinations.txt7
-rw-r--r--test/prism/fixtures/whitequark/kwarg_no_paren.txt5
-rw-r--r--test/prism/fixtures/whitequark/lvar_injecting_match.txt2
-rw-r--r--test/prism/fixtures/whitequark/marg_combinations.txt19
-rw-r--r--test/prism/fixtures/whitequark/multiple_args_with_trailing_comma.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_const_pattern.txt11
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_constants.txt5
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_explicit_array_match.txt19
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_expr_in_paren.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_hash.txt48
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_if_unless_modifiers.txt3
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_implicit_array_match.txt15
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_keyword_variable.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_lambda.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_match_alt.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_match_as.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_nil_pattern.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_no_body.txt1
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_ranges.txt11
-rw-r--r--test/prism/fixtures/whitequark/pattern_matching_single_match.txt1
-rw-r--r--test/prism/fixtures/whitequark/pin_expr.txt14
-rw-r--r--test/prism/fixtures/whitequark/procarg0_legacy.txt1
-rw-r--r--test/prism/fixtures/whitequark/ruby_bug_18878.txt1
-rw-r--r--test/prism/fixtures/whitequark/ruby_bug_19281.txt7
-rw-r--r--test/prism/fixtures/whitequark/ruby_bug_19539.txt9
-rw-r--r--test/prism/fixtures/xstring.txt8
-rw-r--r--test/prism/fixtures_test.rb24
-rw-r--r--test/prism/lex_test.rb43
-rw-r--r--test/prism/locals_test.rb36
-rw-r--r--test/prism/magic_comment_test.rb10
-rw-r--r--test/prism/newline_test.rb3
-rw-r--r--test/prism/percent_delimiter_string_test.rb82
-rw-r--r--test/prism/ractor_test.rb74
-rw-r--r--test/prism/regexp_test.rb4
-rw-r--r--test/prism/result/breadth_first_search_test.rb18
-rw-r--r--test/prism/result/implicit_array_test.rb59
-rw-r--r--test/prism/result/integer_base_flags_test.rb4
-rw-r--r--test/prism/result/named_capture_test.rb29
-rw-r--r--test/prism/result/node_id_test.rb27
-rw-r--r--test/prism/result/numeric_value_test.rb11
-rw-r--r--test/prism/result/redundant_return_test.rb73
-rw-r--r--test/prism/result/source_location_test.rb12
-rw-r--r--test/prism/result/string_test.rb32
-rw-r--r--test/prism/result/warnings_test.rb186
-rw-r--r--test/prism/ruby/dispatcher_test.rb19
-rw-r--r--test/prism/ruby/location_test.rb87
-rw-r--r--test/prism/ruby/parameters_signature_test.rb7
-rw-r--r--test/prism/ruby/parser_test.rb245
-rw-r--r--test/prism/ruby/relocation_test.rb192
-rw-r--r--test/prism/ruby/ripper_test.rb110
-rw-r--r--test/prism/ruby/ruby_parser_test.rb53
-rw-r--r--test/prism/ruby/source_test.rb47
-rw-r--r--test/prism/ruby/string_query_test.rb60
-rw-r--r--test/prism/snapshots/alias.txt194
-rw-r--r--test/prism/snapshots/arithmetic.txt255
-rw-r--r--test/prism/snapshots/arrays.txt1837
-rw-r--r--test/prism/snapshots/begin_ensure.txt251
-rw-r--r--test/prism/snapshots/begin_rescue.txt699
-rw-r--r--test/prism/snapshots/blocks.txt774
-rw-r--r--test/prism/snapshots/boolean_operators.txt54
-rw-r--r--test/prism/snapshots/booleans.txt7
-rw-r--r--test/prism/snapshots/break.txt401
-rw-r--r--test/prism/snapshots/case.txt495
-rw-r--r--test/prism/snapshots/classes.txt365
-rw-r--r--test/prism/snapshots/command_method_call.txt755
-rw-r--r--test/prism/snapshots/comments.txt145
-rw-r--r--test/prism/snapshots/constants.txt1225
-rw-r--r--test/prism/snapshots/dash_heredocs.txt260
-rw-r--r--test/prism/snapshots/defined.txt88
-rw-r--r--test/prism/snapshots/dos_endings.txt110
-rw-r--r--test/prism/snapshots/dstring.txt85
-rw-r--r--test/prism/snapshots/dsym_str.txt11
-rw-r--r--test/prism/snapshots/embdoc_no_newline_at_end.txt5
-rw-r--r--test/prism/snapshots/emoji_method_calls.txt31
-rw-r--r--test/prism/snapshots/endless_methods.txt107
-rw-r--r--test/prism/snapshots/endless_range_in_conditional.txt53
-rw-r--r--test/prism/snapshots/for.txt188
-rw-r--r--test/prism/snapshots/global_variables.txt191
-rw-r--r--test/prism/snapshots/hashes.txt384
-rw-r--r--test/prism/snapshots/heredoc.txt11
-rw-r--r--test/prism/snapshots/heredoc_with_carriage_returns.txt11
-rw-r--r--test/prism/snapshots/heredoc_with_comment.txt21
-rw-r--r--test/prism/snapshots/heredoc_with_escaped_newline_at_start.txt67
-rw-r--r--test/prism/snapshots/heredoc_with_trailing_newline.txt11
-rw-r--r--test/prism/snapshots/heredocs_leading_whitespace.txt63
-rw-r--r--test/prism/snapshots/heredocs_nested.txt94
-rw-r--r--test/prism/snapshots/heredocs_with_ignored_newlines.txt70
-rw-r--r--test/prism/snapshots/heredocs_with_ignored_newlines_and_non_empty.txt11
-rw-r--r--test/prism/snapshots/if.txt531
-rw-r--r--test/prism/snapshots/indented_file_end.txt18
-rw-r--r--test/prism/snapshots/integer_operations.txt635
-rw-r--r--test/prism/snapshots/keyword_method_names.txt173
-rw-r--r--test/prism/snapshots/keywords.txt47
-rw-r--r--test/prism/snapshots/lambda.txt202
-rw-r--r--test/prism/snapshots/method_calls.txt2456
-rw-r--r--test/prism/snapshots/methods.txt2054
-rw-r--r--test/prism/snapshots/modules.txt180
-rw-r--r--test/prism/snapshots/multi_write.txt93
-rw-r--r--test/prism/snapshots/newline_terminated.txt107
-rw-r--r--test/prism/snapshots/next.txt329
-rw-r--r--test/prism/snapshots/nils.txt34
-rw-r--r--test/prism/snapshots/non_alphanumeric_methods.txt503
-rw-r--r--test/prism/snapshots/not.txt351
-rw-r--r--test/prism/snapshots/numbers.txt135
-rw-r--r--test/prism/snapshots/patterns.txt4909
-rw-r--r--test/prism/snapshots/procs.txt403
-rw-r--r--test/prism/snapshots/range_begin_open_exclusive.txt13
-rw-r--r--test/prism/snapshots/range_begin_open_inclusive.txt13
-rw-r--r--test/prism/snapshots/range_end_open_exclusive.txt13
-rw-r--r--test/prism/snapshots/range_end_open_inclusive.txt13
-rw-r--r--test/prism/snapshots/ranges.txt533
-rw-r--r--test/prism/snapshots/regex.txt510
-rw-r--r--test/prism/snapshots/regex_char_width.txt50
-rw-r--r--test/prism/snapshots/repeat_parameters.txt473
-rw-r--r--test/prism/snapshots/rescue.txt528
-rw-r--r--test/prism/snapshots/return.txt165
-rw-r--r--test/prism/snapshots/seattlerb/BEGIN.txt15
-rw-r--r--test/prism/snapshots/seattlerb/TestRubyParserShared.txt361
-rw-r--r--test/prism/snapshots/seattlerb/__ENCODING__.txt6
-rw-r--r--test/prism/snapshots/seattlerb/alias_gvar_backref.txt13
-rw-r--r--test/prism/snapshots/seattlerb/alias_resword.txt21
-rw-r--r--test/prism/snapshots/seattlerb/and_multi.txt26
-rw-r--r--test/prism/snapshots/seattlerb/aref_args_assocs.txt23
-rw-r--r--test/prism/snapshots/seattlerb/aref_args_lit_assocs.txt26
-rw-r--r--test/prism/snapshots/seattlerb/args_kw_block.txt39
-rw-r--r--test/prism/snapshots/seattlerb/array_line_breaks.txt25
-rw-r--r--test/prism/snapshots/seattlerb/array_lits_trailing_calls.txt35
-rw-r--r--test/prism/snapshots/seattlerb/assoc__bare.txt31
-rw-r--r--test/prism/snapshots/seattlerb/assoc_label.txt34
-rw-r--r--test/prism/snapshots/seattlerb/attr_asgn_colon_id.txt23
-rw-r--r--test/prism/snapshots/seattlerb/attrasgn_array_arg.txt42
-rw-r--r--test/prism/snapshots/seattlerb/attrasgn_array_lhs.txt83
-rw-r--r--test/prism/snapshots/seattlerb/attrasgn_primary_dot_constant.txt31
-rw-r--r--test/prism/snapshots/seattlerb/backticks_interpolation_line.txt38
-rw-r--r--test/prism/snapshots/seattlerb/bang_eq.txt24
-rw-r--r--test/prism/snapshots/seattlerb/bdot2.txt38
-rw-r--r--test/prism/snapshots/seattlerb/bdot3.txt38
-rw-r--r--test/prism/snapshots/seattlerb/begin_ensure_no_bodies.txt16
-rw-r--r--test/prism/snapshots/seattlerb/begin_rescue_else_ensure_bodies.txt47
-rw-r--r--test/prism/snapshots/seattlerb/begin_rescue_else_ensure_no_bodies.txt27
-rw-r--r--test/prism/snapshots/seattlerb/begin_rescue_ensure_no_bodies.txt23
-rw-r--r--test/prism/snapshots/seattlerb/block_arg__bare.txt31
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_kwsplat.txt39
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_opt_arg_block.txt54
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_opt_splat.txt51
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_opt_splat_arg_block_omfg.txt59
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_optional.txt43
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_scope.txt40
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_scope2.txt43
-rw-r--r--test/prism/snapshots/seattlerb/block_arg_splat_arg.txt45
-rw-r--r--test/prism/snapshots/seattlerb/block_args_kwargs.txt44
-rw-r--r--test/prism/snapshots/seattlerb/block_args_no_kwargs.txt37
-rw-r--r--test/prism/snapshots/seattlerb/block_args_opt1.txt59
-rw-r--r--test/prism/snapshots/seattlerb/block_args_opt2.txt52
-rw-r--r--test/prism/snapshots/seattlerb/block_args_opt2_2.txt71
-rw-r--r--test/prism/snapshots/seattlerb/block_args_opt3.txt79
-rw-r--r--test/prism/snapshots/seattlerb/block_call_defn_call_block_call.txt80
-rw-r--r--test/prism/snapshots/seattlerb/block_call_dot_op2_brace_block.txt100
-rw-r--r--test/prism/snapshots/seattlerb/block_call_dot_op2_cmd_args_do_block.txt113
-rw-r--r--test/prism/snapshots/seattlerb/block_call_operation_colon.txt54
-rw-r--r--test/prism/snapshots/seattlerb/block_call_operation_dot.txt54
-rw-r--r--test/prism/snapshots/seattlerb/block_call_paren_call_block_call.txt60
-rw-r--r--test/prism/snapshots/seattlerb/block_command_operation_colon.txt49
-rw-r--r--test/prism/snapshots/seattlerb/block_command_operation_dot.txt49
-rw-r--r--test/prism/snapshots/seattlerb/block_decomp_anon_splat_arg.txt46
-rw-r--r--test/prism/snapshots/seattlerb/block_decomp_arg_splat.txt46
-rw-r--r--test/prism/snapshots/seattlerb/block_decomp_arg_splat_arg.txt52
-rw-r--r--test/prism/snapshots/seattlerb/block_decomp_splat.txt46
-rw-r--r--test/prism/snapshots/seattlerb/block_kw.txt42
-rw-r--r--test/prism/snapshots/seattlerb/block_kw__required.txt38
-rw-r--r--test/prism/snapshots/seattlerb/block_kwarg_lvar.txt50
-rw-r--r--test/prism/snapshots/seattlerb/block_kwarg_lvar_multiple.txt61
-rw-r--r--test/prism/snapshots/seattlerb/block_opt_arg.txt46
-rw-r--r--test/prism/snapshots/seattlerb/block_opt_splat.txt48
-rw-r--r--test/prism/snapshots/seattlerb/block_opt_splat_arg_block_omfg.txt56
-rw-r--r--test/prism/snapshots/seattlerb/block_optarg.txt46
-rw-r--r--test/prism/snapshots/seattlerb/block_paren_splat.txt49
-rw-r--r--test/prism/snapshots/seattlerb/block_reg_optarg.txt49
-rw-r--r--test/prism/snapshots/seattlerb/block_return.txt57
-rw-r--r--test/prism/snapshots/seattlerb/block_scope.txt29
-rw-r--r--test/prism/snapshots/seattlerb/block_splat_reg.txt42
-rw-r--r--test/prism/snapshots/seattlerb/bug169.txt28
-rw-r--r--test/prism/snapshots/seattlerb/bug179.txt28
-rw-r--r--test/prism/snapshots/seattlerb/bug190.txt11
-rw-r--r--test/prism/snapshots/seattlerb/bug191.txt87
-rw-r--r--test/prism/snapshots/seattlerb/bug202.txt22
-rw-r--r--test/prism/snapshots/seattlerb/bug236.txt70
-rw-r--r--test/prism/snapshots/seattlerb/bug290.txt24
-rw-r--r--test/prism/snapshots/seattlerb/bug_187.txt59
-rw-r--r--test/prism/snapshots/seattlerb/bug_215.txt14
-rw-r--r--test/prism/snapshots/seattlerb/bug_249.txt86
-rw-r--r--test/prism/snapshots/seattlerb/bug_and.txt21
-rw-r--r--test/prism/snapshots/seattlerb/bug_args__19.txt58
-rw-r--r--test/prism/snapshots/seattlerb/bug_args_masgn.txt49
-rw-r--r--test/prism/snapshots/seattlerb/bug_args_masgn2.txt58
-rw-r--r--test/prism/snapshots/seattlerb/bug_args_masgn_outer_parens__19.txt55
-rw-r--r--test/prism/snapshots/seattlerb/bug_call_arglist_parens.txt110
-rw-r--r--test/prism/snapshots/seattlerb/bug_case_when_regexp.txt28
-rw-r--r--test/prism/snapshots/seattlerb/bug_comma.txt41
-rw-r--r--test/prism/snapshots/seattlerb/bug_cond_pct.txt22
-rw-r--r--test/prism/snapshots/seattlerb/bug_hash_args.txt38
-rw-r--r--test/prism/snapshots/seattlerb/bug_hash_args_trailing_comma.txt38
-rw-r--r--test/prism/snapshots/seattlerb/bug_hash_interp_array.txt26
-rw-r--r--test/prism/snapshots/seattlerb/bug_masgn_right.txt49
-rw-r--r--test/prism/snapshots/seattlerb/bug_not_parens.txt25
-rw-r--r--test/prism/snapshots/seattlerb/bug_op_asgn_rescue.txt26
-rw-r--r--test/prism/snapshots/seattlerb/call_and.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_arg_assoc.txt34
-rw-r--r--test/prism/snapshots/seattlerb/call_arg_assoc_kwsplat.txt43
-rw-r--r--test/prism/snapshots/seattlerb/call_arg_kwsplat.txt37
-rw-r--r--test/prism/snapshots/seattlerb/call_args_assoc_quoted.txt106
-rw-r--r--test/prism/snapshots/seattlerb/call_args_assoc_trailing_comma.txt34
-rw-r--r--test/prism/snapshots/seattlerb/call_args_command.txt54
-rw-r--r--test/prism/snapshots/seattlerb/call_array_arg.txt38
-rw-r--r--test/prism/snapshots/seattlerb/call_array_block_call.txt40
-rw-r--r--test/prism/snapshots/seattlerb/call_array_lambda_block_call.txt41
-rw-r--r--test/prism/snapshots/seattlerb/call_array_lit_inline_hash.txt45
-rw-r--r--test/prism/snapshots/seattlerb/call_assoc.txt31
-rw-r--r--test/prism/snapshots/seattlerb/call_assoc_new.txt34
-rw-r--r--test/prism/snapshots/seattlerb/call_assoc_new_if_multiline.txt58
-rw-r--r--test/prism/snapshots/seattlerb/call_assoc_trailing_comma.txt31
-rw-r--r--test/prism/snapshots/seattlerb/call_bang_command_call.txt41
-rw-r--r--test/prism/snapshots/seattlerb/call_bang_squiggle.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_begin_call_block_call.txt53
-rw-r--r--test/prism/snapshots/seattlerb/call_block_arg_named.txt28
-rw-r--r--test/prism/snapshots/seattlerb/call_carat.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_colon2.txt17
-rw-r--r--test/prism/snapshots/seattlerb/call_colon_parens.txt18
-rw-r--r--test/prism/snapshots/seattlerb/call_div.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_dot_parens.txt18
-rw-r--r--test/prism/snapshots/seattlerb/call_env.txt25
-rw-r--r--test/prism/snapshots/seattlerb/call_eq3.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_gt.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_kwsplat.txt27
-rw-r--r--test/prism/snapshots/seattlerb/call_leading_dots.txt35
-rw-r--r--test/prism/snapshots/seattlerb/call_leading_dots_comment.txt35
-rw-r--r--test/prism/snapshots/seattlerb/call_lt.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_lte.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_not.txt18
-rw-r--r--test/prism/snapshots/seattlerb/call_pipe.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_rshift.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_self_brackets.txt22
-rw-r--r--test/prism/snapshots/seattlerb/call_spaceship.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_stabby_do_end_with_block.txt41
-rw-r--r--test/prism/snapshots/seattlerb/call_stabby_with_braces_block.txt41
-rw-r--r--test/prism/snapshots/seattlerb/call_star.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_star2.txt24
-rw-r--r--test/prism/snapshots/seattlerb/call_trailing_comma.txt21
-rw-r--r--test/prism/snapshots/seattlerb/call_trailing_dots.txt35
-rw-r--r--test/prism/snapshots/seattlerb/call_unary_bang.txt18
-rw-r--r--test/prism/snapshots/seattlerb/case_in.txt976
-rw-r--r--test/prism/snapshots/seattlerb/case_in_31.txt49
-rw-r--r--test/prism/snapshots/seattlerb/case_in_37.txt58
-rw-r--r--test/prism/snapshots/seattlerb/case_in_42.txt44
-rw-r--r--test/prism/snapshots/seattlerb/case_in_42_2.txt40
-rw-r--r--test/prism/snapshots/seattlerb/case_in_47.txt52
-rw-r--r--test/prism/snapshots/seattlerb/case_in_67.txt33
-rw-r--r--test/prism/snapshots/seattlerb/case_in_86.txt51
-rw-r--r--test/prism/snapshots/seattlerb/case_in_86_2.txt51
-rw-r--r--test/prism/snapshots/seattlerb/case_in_array_pat_const.txt42
-rw-r--r--test/prism/snapshots/seattlerb/case_in_array_pat_const2.txt47
-rw-r--r--test/prism/snapshots/seattlerb/case_in_array_pat_paren_assign.txt48
-rw-r--r--test/prism/snapshots/seattlerb/case_in_const.txt28
-rw-r--r--test/prism/snapshots/seattlerb/case_in_else.txt40
-rw-r--r--test/prism/snapshots/seattlerb/case_in_find.txt47
-rw-r--r--test/prism/snapshots/seattlerb/case_in_find_array.txt44
-rw-r--r--test/prism/snapshots/seattlerb/case_in_hash_pat.txt68
-rw-r--r--test/prism/snapshots/seattlerb/case_in_hash_pat_assign.txt86
-rw-r--r--test/prism/snapshots/seattlerb/case_in_hash_pat_paren_assign.txt51
-rw-r--r--test/prism/snapshots/seattlerb/case_in_hash_pat_paren_true.txt47
-rw-r--r--test/prism/snapshots/seattlerb/case_in_hash_pat_rest.txt55
-rw-r--r--test/prism/snapshots/seattlerb/case_in_hash_pat_rest_solo.txt42
-rw-r--r--test/prism/snapshots/seattlerb/case_in_if_unless_post_mod.txt67
-rw-r--r--test/prism/snapshots/seattlerb/case_in_multiple.txt57
-rw-r--r--test/prism/snapshots/seattlerb/case_in_or.txt38
-rw-r--r--test/prism/snapshots/seattlerb/class_comments.txt31
-rw-r--r--test/prism/snapshots/seattlerb/cond_unary_minus.txt15
-rw-r--r--test/prism/snapshots/seattlerb/const_2_op_asgn_or2.txt22
-rw-r--r--test/prism/snapshots/seattlerb/const_3_op_asgn_or.txt17
-rw-r--r--test/prism/snapshots/seattlerb/const_op_asgn_and1.txt18
-rw-r--r--test/prism/snapshots/seattlerb/const_op_asgn_and2.txt17
-rw-r--r--test/prism/snapshots/seattlerb/const_op_asgn_or.txt19
-rw-r--r--test/prism/snapshots/seattlerb/defined_eh_parens.txt13
-rw-r--r--test/prism/snapshots/seattlerb/defn_arg_asplat_arg.txt37
-rw-r--r--test/prism/snapshots/seattlerb/defn_arg_forward_args.txt49
-rw-r--r--test/prism/snapshots/seattlerb/defn_args_forward_args.txt61
-rw-r--r--test/prism/snapshots/seattlerb/defn_comments.txt18
-rw-r--r--test/prism/snapshots/seattlerb/defn_endless_command.txt36
-rw-r--r--test/prism/snapshots/seattlerb/defn_endless_command_rescue.txt43
-rw-r--r--test/prism/snapshots/seattlerb/defn_forward_args.txt43
-rw-r--r--test/prism/snapshots/seattlerb/defn_forward_args__no_parens.txt43
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_env.txt55
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_kwarg.txt45
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_kwsplat.txt39
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_kwsplat_anon.txt39
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_lvar.txt42
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_no_parens.txt34
-rw-r--r--test/prism/snapshots/seattlerb/defn_kwarg_val.txt37
-rw-r--r--test/prism/snapshots/seattlerb/defn_no_kwargs.txt29
-rw-r--r--test/prism/snapshots/seattlerb/defn_oneliner.txt47
-rw-r--r--test/prism/snapshots/seattlerb/defn_oneliner_eq2.txt47
-rw-r--r--test/prism/snapshots/seattlerb/defn_oneliner_noargs.txt30
-rw-r--r--test/prism/snapshots/seattlerb/defn_oneliner_noargs_parentheses.txt30
-rw-r--r--test/prism/snapshots/seattlerb/defn_oneliner_rescue.txt158
-rw-r--r--test/prism/snapshots/seattlerb/defn_opt_last_arg.txt33
-rw-r--r--test/prism/snapshots/seattlerb/defn_opt_reg.txt36
-rw-r--r--test/prism/snapshots/seattlerb/defn_opt_splat_arg.txt43
-rw-r--r--test/prism/snapshots/seattlerb/defn_powarg.txt31
-rw-r--r--test/prism/snapshots/seattlerb/defn_reg_opt_reg.txt44
-rw-r--r--test/prism/snapshots/seattlerb/defn_splat_arg.txt34
-rw-r--r--test/prism/snapshots/seattlerb/defn_unary_not.txt21
-rw-r--r--test/prism/snapshots/seattlerb/defns_reserved.txt19
-rw-r--r--test/prism/snapshots/seattlerb/defs_as_arg_with_do_block_inside.txt60
-rw-r--r--test/prism/snapshots/seattlerb/defs_comments.txt19
-rw-r--r--test/prism/snapshots/seattlerb/defs_endless_command.txt46
-rw-r--r--test/prism/snapshots/seattlerb/defs_endless_command_rescue.txt53
-rw-r--r--test/prism/snapshots/seattlerb/defs_kwarg.txt35
-rw-r--r--test/prism/snapshots/seattlerb/defs_oneliner.txt48
-rw-r--r--test/prism/snapshots/seattlerb/defs_oneliner_eq2.txt48
-rw-r--r--test/prism/snapshots/seattlerb/defs_oneliner_rescue.txt161
-rw-r--r--test/prism/snapshots/seattlerb/difficult0_.txt73
-rw-r--r--test/prism/snapshots/seattlerb/difficult1_line_numbers.txt267
-rw-r--r--test/prism/snapshots/seattlerb/difficult1_line_numbers2.txt78
-rw-r--r--test/prism/snapshots/seattlerb/difficult2_.txt74
-rw-r--r--test/prism/snapshots/seattlerb/difficult3_.txt52
-rw-r--r--test/prism/snapshots/seattlerb/difficult3_2.txt42
-rw-r--r--test/prism/snapshots/seattlerb/difficult3_3.txt47
-rw-r--r--test/prism/snapshots/seattlerb/difficult3_4.txt38
-rw-r--r--test/prism/snapshots/seattlerb/difficult3_5.txt48
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__10.txt52
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__11.txt46
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__12.txt49
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__6.txt55
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__7.txt49
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__8.txt52
-rw-r--r--test/prism/snapshots/seattlerb/difficult3__9.txt49
-rw-r--r--test/prism/snapshots/seattlerb/difficult4__leading_dots.txt25
-rw-r--r--test/prism/snapshots/seattlerb/difficult4__leading_dots2.txt16
-rw-r--r--test/prism/snapshots/seattlerb/difficult6_.txt61
-rw-r--r--test/prism/snapshots/seattlerb/difficult6__7.txt55
-rw-r--r--test/prism/snapshots/seattlerb/difficult6__8.txt55
-rw-r--r--test/prism/snapshots/seattlerb/difficult7_.txt93
-rw-r--r--test/prism/snapshots/seattlerb/do_bug.txt63
-rw-r--r--test/prism/snapshots/seattlerb/do_lambda.txt17
-rw-r--r--test/prism/snapshots/seattlerb/dot2_nil__26.txt20
-rw-r--r--test/prism/snapshots/seattlerb/dot3_nil__26.txt20
-rw-r--r--test/prism/snapshots/seattlerb/dstr_evstr.txt38
-rw-r--r--test/prism/snapshots/seattlerb/dstr_evstr_empty_end.txt25
-rw-r--r--test/prism/snapshots/seattlerb/dstr_lex_state.txt35
-rw-r--r--test/prism/snapshots/seattlerb/dstr_str.txt28
-rw-r--r--test/prism/snapshots/seattlerb/dsym_esc_to_sym.txt11
-rw-r--r--test/prism/snapshots/seattlerb/dsym_to_sym.txt37
-rw-r--r--test/prism/snapshots/seattlerb/eq_begin_line_numbers.txt11
-rw-r--r--test/prism/snapshots/seattlerb/eq_begin_why_wont_people_use_their_spacebar.txt50
-rw-r--r--test/prism/snapshots/seattlerb/evstr_evstr.txt42
-rw-r--r--test/prism/snapshots/seattlerb/evstr_str.txt32
-rw-r--r--test/prism/snapshots/seattlerb/expr_not_bang.txt38
-rw-r--r--test/prism/snapshots/seattlerb/f_kw.txt34
-rw-r--r--test/prism/snapshots/seattlerb/f_kw__required.txt30
-rw-r--r--test/prism/snapshots/seattlerb/flip2_env_lvar.txt37
-rw-r--r--test/prism/snapshots/seattlerb/float_with_if_modifier.txt17
-rw-r--r--test/prism/snapshots/seattlerb/heredoc__backslash_dos_format.txt17
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_backslash_nl.txt17
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_bad_hex_escape.txt17
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_bad_oct_escape.txt17
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_comma_arg.txt27
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_lineno.txt26
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_nested.txt42
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly.txt34
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt67
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt34
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_empty.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_interp.txt49
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_no_indent.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_tabs.txt28
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt28
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt34
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_trailing_slash_continued_call.txt21
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_unicode.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_carriage_return_escapes.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_carriage_return_escapes_windows.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_extra_carriage_horrible_mix.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_extra_carriage_returns.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_extra_carriage_returns_windows.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_interpolation_and_carriage_return_escapes.txt27
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_interpolation_and_carriage_return_escapes_windows.txt27
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_not_global_interpolation.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_only_carriage_returns.txt11
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_with_only_carriage_returns_windows.txt11
-rw-r--r--test/prism/snapshots/seattlerb/if_elsif.txt25
-rw-r--r--test/prism/snapshots/seattlerb/if_symbol.txt31
-rw-r--r--test/prism/snapshots/seattlerb/in_expr_no_case.txt17
-rw-r--r--test/prism/snapshots/seattlerb/index_0.txt38
-rw-r--r--test/prism/snapshots/seattlerb/index_0_opasgn.txt36
-rw-r--r--test/prism/snapshots/seattlerb/integer_with_if_modifier.txt18
-rw-r--r--test/prism/snapshots/seattlerb/interpolated_symbol_array_line_breaks.txt25
-rw-r--r--test/prism/snapshots/seattlerb/interpolated_word_array_line_breaks.txt25
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_1.txt40
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_10_1.txt51
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_10_2.txt56
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_11_1.txt54
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_11_2.txt59
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_2__19.txt46
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_3.txt52
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_4.txt45
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_5.txt42
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_6.txt49
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_7_1.txt48
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_7_2.txt53
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_8_1.txt51
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_8_2.txt56
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_9_1.txt46
-rw-r--r--test/prism/snapshots/seattlerb/iter_args_9_2.txt51
-rw-r--r--test/prism/snapshots/seattlerb/iter_kwarg.txt42
-rw-r--r--test/prism/snapshots/seattlerb/iter_kwarg_kwsplat.txt47
-rw-r--r--test/prism/snapshots/seattlerb/label_vs_string.txt34
-rw-r--r--test/prism/snapshots/seattlerb/lambda_do_vs_brace.txt95
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_arg_rescue_arg.txt21
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_call_bracket_rescue_arg.txt34
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_call_nobracket_rescue_arg.txt34
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_command.txt37
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_env.txt14
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_ivar_env.txt13
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_lasgn_command_call.txt33
-rw-r--r--test/prism/snapshots/seattlerb/lasgn_middle_splat.txt49
-rw-r--r--test/prism/snapshots/seattlerb/magic_encoding_comment.txt46
-rw-r--r--test/prism/snapshots/seattlerb/masgn_anon_splat_arg.txt29
-rw-r--r--test/prism/snapshots/seattlerb/masgn_arg_colon_arg.txt42
-rw-r--r--test/prism/snapshots/seattlerb/masgn_arg_ident.txt42
-rw-r--r--test/prism/snapshots/seattlerb/masgn_arg_splat_arg.txt35
-rw-r--r--test/prism/snapshots/seattlerb/masgn_colon2.txt42
-rw-r--r--test/prism/snapshots/seattlerb/masgn_colon3.txt34
-rw-r--r--test/prism/snapshots/seattlerb/masgn_command_call.txt43
-rw-r--r--test/prism/snapshots/seattlerb/masgn_double_paren.txt35
-rw-r--r--test/prism/snapshots/seattlerb/masgn_lhs_splat.txt33
-rw-r--r--test/prism/snapshots/seattlerb/masgn_paren.txt39
-rw-r--r--test/prism/snapshots/seattlerb/masgn_splat_arg.txt32
-rw-r--r--test/prism/snapshots/seattlerb/masgn_splat_arg_arg.txt35
-rw-r--r--test/prism/snapshots/seattlerb/masgn_star.txt19
-rw-r--r--test/prism/snapshots/seattlerb/masgn_var_star_var.txt32
-rw-r--r--test/prism/snapshots/seattlerb/messy_op_asgn_lineno.txt59
-rw-r--r--test/prism/snapshots/seattlerb/method_call_assoc_trailing_comma.txt41
-rw-r--r--test/prism/snapshots/seattlerb/method_call_trailing_comma.txt31
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_back_anonsplat.txt35
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_back_splat.txt38
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_front_anonsplat.txt35
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_front_splat.txt38
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_keyword.txt30
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_mid_anonsplat.txt44
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_mid_splat.txt47
-rw-r--r--test/prism/snapshots/seattlerb/mlhs_rescue.txt36
-rw-r--r--test/prism/snapshots/seattlerb/module_comments.txt29
-rw-r--r--test/prism/snapshots/seattlerb/multiline_hash_declaration.txt95
-rw-r--r--test/prism/snapshots/seattlerb/non_interpolated_symbol_array_line_breaks.txt25
-rw-r--r--test/prism/snapshots/seattlerb/non_interpolated_word_array_line_breaks.txt25
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_command_call.txt37
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_dot_ident_command_call.txt32
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_index_command_call.txt53
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_primary_colon_const_command_call.txt40
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_primary_colon_identifier1.txt20
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_primary_colon_identifier_command_call.txt40
-rw-r--r--test/prism/snapshots/seattlerb/op_asgn_val_dot_ident_command_call.txt40
-rw-r--r--test/prism/snapshots/seattlerb/parse_def_special_name.txt18
-rw-r--r--test/prism/snapshots/seattlerb/parse_if_not_canonical.txt62
-rw-r--r--test/prism/snapshots/seattlerb/parse_if_not_noncanonical.txt62
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_block.txt30
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_block_inline_comment.txt35
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_block_inline_comment_leading_newlines.txt35
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_block_inline_multiline_comment.txt35
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_call_ivar_arg_no_parens_line_break.txt20
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_call_ivar_line_break_paren.txt20
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_call_no_args.txt61
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_defn_complex.txt67
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_defn_no_parens.txt31
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_defn_no_parens_args.txt29
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_dot2.txt51
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_dot2_open.txt38
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_dot3.txt51
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_dot3_open.txt38
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_dstr_escaped_newline.txt21
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_dstr_soft_newline.txt21
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_evstr_after_break.txt37
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_hash_lit.txt22
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_heredoc.txt43
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_heredoc_evstr.txt38
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_heredoc_hardnewline.txt22
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_heredoc_regexp_chars.txt33
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_iter_call_no_parens.txt74
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_iter_call_parens.txt74
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_multiline_str.txt14
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_multiline_str_literal_n.txt14
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_newlines.txt6
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_op_asgn.txt32
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_postexe.txt22
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_preexe.txt22
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_rescue.txt62
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_return.txt40
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_str_with_newline_escape.txt25
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_to_ary.txt39
-rw-r--r--test/prism/snapshots/seattlerb/parse_line_trailing_newlines.txt25
-rw-r--r--test/prism/snapshots/seattlerb/parse_opt_call_args_assocs_comma.txt34
-rw-r--r--test/prism/snapshots/seattlerb/parse_opt_call_args_lit_comma.txt24
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_019.txt33
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_044.txt38
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_051.txt47
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_058.txt73
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_058_2.txt67
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_069.txt48
-rw-r--r--test/prism/snapshots/seattlerb/parse_pattern_076.txt58
-rw-r--r--test/prism/snapshots/seattlerb/parse_until_not_canonical.txt49
-rw-r--r--test/prism/snapshots/seattlerb/parse_until_not_noncanonical.txt49
-rw-r--r--test/prism/snapshots/seattlerb/parse_while_not_canonical.txt49
-rw-r--r--test/prism/snapshots/seattlerb/parse_while_not_noncanonical.txt49
-rw-r--r--test/prism/snapshots/seattlerb/pctW_lineno.txt52
-rw-r--r--test/prism/snapshots/seattlerb/pct_Q_backslash_nl.txt11
-rw-r--r--test/prism/snapshots/seattlerb/pct_nl.txt17
-rw-r--r--test/prism/snapshots/seattlerb/pct_w_heredoc_interp_nested.txt51
-rw-r--r--test/prism/snapshots/seattlerb/pipe_semicolon.txt39
-rw-r--r--test/prism/snapshots/seattlerb/pipe_space.txt36
-rw-r--r--test/prism/snapshots/seattlerb/qWords_space.txt10
-rw-r--r--test/prism/snapshots/seattlerb/qsymbols.txt28
-rw-r--r--test/prism/snapshots/seattlerb/qsymbols_empty.txt10
-rw-r--r--test/prism/snapshots/seattlerb/qsymbols_empty_space.txt10
-rw-r--r--test/prism/snapshots/seattlerb/qsymbols_interp.txt57
-rw-r--r--test/prism/snapshots/seattlerb/quoted_symbol_hash_arg.txt35
-rw-r--r--test/prism/snapshots/seattlerb/quoted_symbol_keys.txt25
-rw-r--r--test/prism/snapshots/seattlerb/qw_escape.txt11
-rw-r--r--test/prism/snapshots/seattlerb/qw_escape_term.txt11
-rw-r--r--test/prism/snapshots/seattlerb/qwords_empty.txt10
-rw-r--r--test/prism/snapshots/seattlerb/read_escape_unicode_curlies.txt11
-rw-r--r--test/prism/snapshots/seattlerb/read_escape_unicode_h4.txt11
-rw-r--r--test/prism/snapshots/seattlerb/regexp.txt35
-rw-r--r--test/prism/snapshots/seattlerb/regexp_esc_C_slash.txt11
-rw-r--r--test/prism/snapshots/seattlerb/regexp_esc_u.txt11
-rw-r--r--test/prism/snapshots/seattlerb/regexp_escape_extended.txt11
-rw-r--r--test/prism/snapshots/seattlerb/regexp_unicode_curlies.txt17
-rw-r--r--test/prism/snapshots/seattlerb/required_kwarg_no_value.txt34
-rw-r--r--test/prism/snapshots/seattlerb/rescue_do_end_ensure_result.txt58
-rw-r--r--test/prism/snapshots/seattlerb/rescue_do_end_no_raise.txt75
-rw-r--r--test/prism/snapshots/seattlerb/rescue_do_end_raised.txt52
-rw-r--r--test/prism/snapshots/seattlerb/rescue_do_end_rescued.txt79
-rw-r--r--test/prism/snapshots/seattlerb/rescue_in_block.txt47
-rw-r--r--test/prism/snapshots/seattlerb/rescue_parens.txt48
-rw-r--r--test/prism/snapshots/seattlerb/return_call_assocs.txt218
-rw-r--r--test/prism/snapshots/seattlerb/rhs_asgn.txt15
-rw-r--r--test/prism/snapshots/seattlerb/ruby21_numbers.txt25
-rw-r--r--test/prism/snapshots/seattlerb/safe_attrasgn.txt31
-rw-r--r--test/prism/snapshots/seattlerb/safe_attrasgn_constant.txt31
-rw-r--r--test/prism/snapshots/seattlerb/safe_call.txt25
-rw-r--r--test/prism/snapshots/seattlerb/safe_call_after_newline.txt25
-rw-r--r--test/prism/snapshots/seattlerb/safe_call_dot_parens.txt25
-rw-r--r--test/prism/snapshots/seattlerb/safe_call_newline.txt25
-rw-r--r--test/prism/snapshots/seattlerb/safe_call_operator.txt31
-rw-r--r--test/prism/snapshots/seattlerb/safe_call_rhs_newline.txt31
-rw-r--r--test/prism/snapshots/seattlerb/safe_calls.txt41
-rw-r--r--test/prism/snapshots/seattlerb/safe_op_asgn.txt41
-rw-r--r--test/prism/snapshots/seattlerb/safe_op_asgn2.txt34
-rw-r--r--test/prism/snapshots/seattlerb/slashy_newlines_within_string.txt57
-rw-r--r--test/prism/snapshots/seattlerb/stabby_arg_no_paren.txt28
-rw-r--r--test/prism/snapshots/seattlerb/stabby_arg_opt_splat_arg_block_omfg.txt50
-rw-r--r--test/prism/snapshots/seattlerb/stabby_block_iter_call.txt58
-rw-r--r--test/prism/snapshots/seattlerb/stabby_block_iter_call_no_target_with_arg.txt54
-rw-r--r--test/prism/snapshots/seattlerb/stabby_block_kw.txt33
-rw-r--r--test/prism/snapshots/seattlerb/stabby_block_kw__required.txt29
-rw-r--r--test/prism/snapshots/seattlerb/stabby_proc_scope.txt31
-rw-r--r--test/prism/snapshots/seattlerb/str_backslashes.txt24
-rw-r--r--test/prism/snapshots/seattlerb/str_double_double_escaped_newline.txt34
-rw-r--r--test/prism/snapshots/seattlerb/str_double_escaped_newline.txt34
-rw-r--r--test/prism/snapshots/seattlerb/str_double_newline.txt34
-rw-r--r--test/prism/snapshots/seattlerb/str_evstr.txt32
-rw-r--r--test/prism/snapshots/seattlerb/str_evstr_escape.txt38
-rw-r--r--test/prism/snapshots/seattlerb/str_heredoc_interp.txt32
-rw-r--r--test/prism/snapshots/seattlerb/str_interp_ternary_or_label.txt105
-rw-r--r--test/prism/snapshots/seattlerb/str_lit_concat_bad_encodings.txt22
-rw-r--r--test/prism/snapshots/seattlerb/str_newline_hash_line_number.txt14
-rw-r--r--test/prism/snapshots/seattlerb/str_pct_Q_nested.txt38
-rw-r--r--test/prism/snapshots/seattlerb/str_pct_nested_nested.txt42
-rw-r--r--test/prism/snapshots/seattlerb/str_pct_q.txt11
-rw-r--r--test/prism/snapshots/seattlerb/str_single_double_escaped_newline.txt34
-rw-r--r--test/prism/snapshots/seattlerb/str_single_escaped_newline.txt34
-rw-r--r--test/prism/snapshots/seattlerb/str_single_newline.txt34
-rw-r--r--test/prism/snapshots/seattlerb/str_str.txt28
-rw-r--r--test/prism/snapshots/seattlerb/str_str_str.txt34
-rw-r--r--test/prism/snapshots/seattlerb/super_arg.txt17
-rw-r--r--test/prism/snapshots/seattlerb/symbol_empty.txt11
-rw-r--r--test/prism/snapshots/seattlerb/symbol_list.txt50
-rw-r--r--test/prism/snapshots/seattlerb/symbols.txt28
-rw-r--r--test/prism/snapshots/seattlerb/symbols_empty.txt10
-rw-r--r--test/prism/snapshots/seattlerb/symbols_empty_space.txt10
-rw-r--r--test/prism/snapshots/seattlerb/symbols_interp.txt28
-rw-r--r--test/prism/snapshots/seattlerb/thingy.txt57
-rw-r--r--test/prism/snapshots/seattlerb/uminus_float.txt7
-rw-r--r--test/prism/snapshots/seattlerb/unary_minus.txt25
-rw-r--r--test/prism/snapshots/seattlerb/unary_plus.txt25
-rw-r--r--test/prism/snapshots/seattlerb/unary_plus_on_literal.txt21
-rw-r--r--test/prism/snapshots/seattlerb/unary_tilde.txt25
-rw-r--r--test/prism/snapshots/seattlerb/utf8_bom.txt21
-rw-r--r--test/prism/snapshots/seattlerb/when_splat.txt39
-rw-r--r--test/prism/snapshots/seattlerb/words_interp.txt30
-rw-r--r--test/prism/snapshots/single_method_call_with_bang.txt15
-rw-r--r--test/prism/snapshots/single_quote_heredocs.txt11
-rw-r--r--test/prism/snapshots/spanning_heredoc.txt413
-rw-r--r--test/prism/snapshots/spanning_heredoc_newlines.txt155
-rw-r--r--test/prism/snapshots/strings.txt534
-rw-r--r--test/prism/snapshots/super.txt132
-rw-r--r--test/prism/snapshots/symbols.txt463
-rw-r--r--test/prism/snapshots/ternary_operator.txt295
-rw-r--r--test/prism/snapshots/tilde_heredocs.txt405
-rw-r--r--test/prism/snapshots/undef.txt117
-rw-r--r--test/prism/snapshots/unescaping.txt34
-rw-r--r--test/prism/snapshots/unless.txt173
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/alias.txt29
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/assignment.txt1076
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/block.txt1402
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/case.txt446
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/class.txt226
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/def.txt1204
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/defined.txt55
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/defs.txt358
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/dstr.txt353
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/empty.txt5
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/empty_begin.txt9
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/flipflop.txt237
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/for.txt171
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/hookexe.txt49
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/if.txt288
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/kwbegin.txt491
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/lambda.txt151
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/literal.txt1196
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/module.txt104
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/opasgn.txt509
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/pattern.txt446
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/pragma.txt20
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/range.txt55
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/rescue.txt103
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/send.txt2190
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/since/27.txt49
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/since/30.txt88
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/since/31.txt90
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/since/32.txt156
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/singletons.txt9
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/super.txt277
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/unary.txt248
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/undef.txt29
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/variables.txt49
-rw-r--r--test/prism/snapshots/unparser/corpus/literal/while.txt704
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/and.txt235
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/block.txt191
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/def.txt90
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/dstr.txt598
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/kwbegin.txt259
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/literal.txt102
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/opasgn.txt69
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/send.txt163
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/undef.txt29
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/while.txt277
-rw-r--r--test/prism/snapshots/until.txt180
-rw-r--r--test/prism/snapshots/variables.txt408
-rw-r--r--test/prism/snapshots/while.txt470
-rw-r--r--test/prism/snapshots/whitequark/__ENCODING__.txt6
-rw-r--r--test/prism/snapshots/whitequark/__ENCODING___legacy_.txt6
-rw-r--r--test/prism/snapshots/whitequark/alias.txt21
-rw-r--r--test/prism/snapshots/whitequark/alias_gvar.txt21
-rw-r--r--test/prism/snapshots/whitequark/ambiuous_quoted_label_in_ternary_operator.txt60
-rw-r--r--test/prism/snapshots/whitequark/and.txt53
-rw-r--r--test/prism/snapshots/whitequark/and_asgn.txt59
-rw-r--r--test/prism/snapshots/whitequark/and_or_masgn.txt93
-rw-r--r--test/prism/snapshots/whitequark/anonymous_blockarg.txt46
-rw-r--r--test/prism/snapshots/whitequark/arg.txt56
-rw-r--r--test/prism/snapshots/whitequark/arg_duplicate_ignored.txt59
-rw-r--r--test/prism/snapshots/whitequark/arg_label.txt115
-rw-r--r--test/prism/snapshots/whitequark/arg_scope.txt34
-rw-r--r--test/prism/snapshots/whitequark/args.txt1075
-rw-r--r--test/prism/snapshots/whitequark/args_args_assocs.txt96
-rw-r--r--test/prism/snapshots/whitequark/args_args_assocs_comma.txt54
-rw-r--r--test/prism/snapshots/whitequark/args_args_comma.txt38
-rw-r--r--test/prism/snapshots/whitequark/args_args_star.txt90
-rw-r--r--test/prism/snapshots/whitequark/args_assocs_comma.txt44
-rw-r--r--test/prism/snapshots/whitequark/args_block_pass.txt28
-rw-r--r--test/prism/snapshots/whitequark/args_cmd.txt41
-rw-r--r--test/prism/snapshots/whitequark/args_star.txt70
-rw-r--r--test/prism/snapshots/whitequark/array_assocs.txt44
-rw-r--r--test/prism/snapshots/whitequark/array_plain.txt16
-rw-r--r--test/prism/snapshots/whitequark/array_splat.txt68
-rw-r--r--test/prism/snapshots/whitequark/array_symbols.txt22
-rw-r--r--test/prism/snapshots/whitequark/array_symbols_empty.txt15
-rw-r--r--test/prism/snapshots/whitequark/array_symbols_interp.txt67
-rw-r--r--test/prism/snapshots/whitequark/array_words.txt22
-rw-r--r--test/prism/snapshots/whitequark/array_words_empty.txt15
-rw-r--r--test/prism/snapshots/whitequark/array_words_interp.txt80
-rw-r--r--test/prism/snapshots/whitequark/asgn_cmd.txt55
-rw-r--r--test/prism/snapshots/whitequark/asgn_mrhs.txt87
-rw-r--r--test/prism/snapshots/whitequark/back_ref.txt7
-rw-r--r--test/prism/snapshots/whitequark/bang.txt25
-rw-r--r--test/prism/snapshots/whitequark/bang_cmd.txt38
-rw-r--r--test/prism/snapshots/whitequark/begin_cmdarg.txt51
-rw-r--r--test/prism/snapshots/whitequark/beginless_erange_after_newline.txt23
-rw-r--r--test/prism/snapshots/whitequark/beginless_irange_after_newline.txt23
-rw-r--r--test/prism/snapshots/whitequark/beginless_range.txt21
-rw-r--r--test/prism/snapshots/whitequark/blockarg.txt31
-rw-r--r--test/prism/snapshots/whitequark/blockargs.txt1339
-rw-r--r--test/prism/snapshots/whitequark/bug_435.txt39
-rw-r--r--test/prism/snapshots/whitequark/bug_447.txt56
-rw-r--r--test/prism/snapshots/whitequark/bug_452.txt63
-rw-r--r--test/prism/snapshots/whitequark/bug_466.txt70
-rw-r--r--test/prism/snapshots/whitequark/bug_473.txt34
-rw-r--r--test/prism/snapshots/whitequark/bug_480.txt37
-rw-r--r--test/prism/snapshots/whitequark/bug_481.txt50
-rw-r--r--test/prism/snapshots/whitequark/bug_ascii_8bit_in_literal.txt11
-rw-r--r--test/prism/snapshots/whitequark/bug_cmd_string_lookahead.txt30
-rw-r--r--test/prism/snapshots/whitequark/bug_cmdarg.txt106
-rw-r--r--test/prism/snapshots/whitequark/bug_def_no_paren_eql_begin.txt18
-rw-r--r--test/prism/snapshots/whitequark/bug_do_block_in_call_args.txt50
-rw-r--r--test/prism/snapshots/whitequark/bug_do_block_in_cmdarg.txt40
-rw-r--r--test/prism/snapshots/whitequark/bug_do_block_in_hash_brace.txt383
-rw-r--r--test/prism/snapshots/whitequark/bug_heredoc_do.txt30
-rw-r--r--test/prism/snapshots/whitequark/bug_interp_single.txt38
-rw-r--r--test/prism/snapshots/whitequark/bug_lambda_leakage.txt38
-rw-r--r--test/prism/snapshots/whitequark/bug_regex_verification.txt11
-rw-r--r--test/prism/snapshots/whitequark/bug_rescue_empty_else.txt25
-rw-r--r--test/prism/snapshots/whitequark/bug_while_not_parens_do.txt28
-rw-r--r--test/prism/snapshots/whitequark/case_cond.txt34
-rw-r--r--test/prism/snapshots/whitequark/case_cond_else.txt46
-rw-r--r--test/prism/snapshots/whitequark/case_expr.txt44
-rw-r--r--test/prism/snapshots/whitequark/case_expr_else.txt60
-rw-r--r--test/prism/snapshots/whitequark/casgn_scoped.txt19
-rw-r--r--test/prism/snapshots/whitequark/casgn_toplevel.txt17
-rw-r--r--test/prism/snapshots/whitequark/casgn_unscoped.txt13
-rw-r--r--test/prism/snapshots/whitequark/character.txt11
-rw-r--r--test/prism/snapshots/whitequark/class.txt27
-rw-r--r--test/prism/snapshots/whitequark/class_super.txt18
-rw-r--r--test/prism/snapshots/whitequark/class_super_label.txt35
-rw-r--r--test/prism/snapshots/whitequark/comments_before_leading_dot__27.txt85
-rw-r--r--test/prism/snapshots/whitequark/complex.txt26
-rw-r--r--test/prism/snapshots/whitequark/cond_begin.txt40
-rw-r--r--test/prism/snapshots/whitequark/cond_begin_masgn.txt52
-rw-r--r--test/prism/snapshots/whitequark/cond_eflipflop.txt78
-rw-r--r--test/prism/snapshots/whitequark/cond_eflipflop_with_beginless_range.txt27
-rw-r--r--test/prism/snapshots/whitequark/cond_eflipflop_with_endless_range.txt27
-rw-r--r--test/prism/snapshots/whitequark/cond_iflipflop.txt78
-rw-r--r--test/prism/snapshots/whitequark/cond_iflipflop_with_beginless_range.txt27
-rw-r--r--test/prism/snapshots/whitequark/cond_iflipflop_with_endless_range.txt27
-rw-r--r--test/prism/snapshots/whitequark/cond_match_current_line.txt34
-rw-r--r--test/prism/snapshots/whitequark/const_op_asgn.txt97
-rw-r--r--test/prism/snapshots/whitequark/const_scoped.txt12
-rw-r--r--test/prism/snapshots/whitequark/const_toplevel.txt10
-rw-r--r--test/prism/snapshots/whitequark/const_unscoped.txt7
-rw-r--r--test/prism/snapshots/whitequark/cpath.txt31
-rw-r--r--test/prism/snapshots/whitequark/cvar.txt7
-rw-r--r--test/prism/snapshots/whitequark/cvasgn.txt13
-rw-r--r--test/prism/snapshots/whitequark/dedenting_heredoc.txt496
-rw-r--r--test/prism/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt22
-rw-r--r--test/prism/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt22
-rw-r--r--test/prism/snapshots/whitequark/def.txt83
-rw-r--r--test/prism/snapshots/whitequark/defined.txt42
-rw-r--r--test/prism/snapshots/whitequark/defs.txt90
-rw-r--r--test/prism/snapshots/whitequark/empty_stmt.txt5
-rw-r--r--test/prism/snapshots/whitequark/endless_comparison_method.txt221
-rw-r--r--test/prism/snapshots/whitequark/endless_method.txt151
-rw-r--r--test/prism/snapshots/whitequark/endless_method_command_syntax.txt394
-rw-r--r--test/prism/snapshots/whitequark/endless_method_forwarded_args_legacy.txt43
-rw-r--r--test/prism/snapshots/whitequark/endless_method_with_rescue_mod.txt56
-rw-r--r--test/prism/snapshots/whitequark/endless_method_without_args.txt89
-rw-r--r--test/prism/snapshots/whitequark/ensure.txt40
-rw-r--r--test/prism/snapshots/whitequark/ensure_empty.txt16
-rw-r--r--test/prism/snapshots/whitequark/false.txt6
-rw-r--r--test/prism/snapshots/whitequark/float.txt9
-rw-r--r--test/prism/snapshots/whitequark/for.txt83
-rw-r--r--test/prism/snapshots/whitequark/for_mlhs.txt56
-rw-r--r--test/prism/snapshots/whitequark/forward_arg.txt43
-rw-r--r--test/prism/snapshots/whitequark/forward_arg_with_open_args.txt404
-rw-r--r--test/prism/snapshots/whitequark/forward_args_legacy.txt99
-rw-r--r--test/prism/snapshots/whitequark/forwarded_argument_with_kwrestarg.txt58
-rw-r--r--test/prism/snapshots/whitequark/forwarded_argument_with_restarg.txt55
-rw-r--r--test/prism/snapshots/whitequark/forwarded_kwrestarg.txt52
-rw-r--r--test/prism/snapshots/whitequark/forwarded_kwrestarg_with_additional_kwarg.txt63
-rw-r--r--test/prism/snapshots/whitequark/forwarded_restarg.txt49
-rw-r--r--test/prism/snapshots/whitequark/gvar.txt7
-rw-r--r--test/prism/snapshots/whitequark/gvasgn.txt13
-rw-r--r--test/prism/snapshots/whitequark/hash_empty.txt9
-rw-r--r--test/prism/snapshots/whitequark/hash_hashrocket.txt49
-rw-r--r--test/prism/snapshots/whitequark/hash_kwsplat.txt35
-rw-r--r--test/prism/snapshots/whitequark/hash_label.txt22
-rw-r--r--test/prism/snapshots/whitequark/hash_label_end.txt100
-rw-r--r--test/prism/snapshots/whitequark/hash_pair_value_omission.txt97
-rw-r--r--test/prism/snapshots/whitequark/heredoc.txt23
-rw-r--r--test/prism/snapshots/whitequark/if.txt63
-rw-r--r--test/prism/snapshots/whitequark/if_else.txt95
-rw-r--r--test/prism/snapshots/whitequark/if_elsif.txt65
-rw-r--r--test/prism/snapshots/whitequark/if_masgn__24.txt42
-rw-r--r--test/prism/snapshots/whitequark/if_mod.txt34
-rw-r--r--test/prism/snapshots/whitequark/if_nl_then.txt34
-rw-r--r--test/prism/snapshots/whitequark/int.txt14
-rw-r--r--test/prism/snapshots/whitequark/int___LINE__.txt6
-rw-r--r--test/prism/snapshots/whitequark/interp_digit_var.txt273
-rw-r--r--test/prism/snapshots/whitequark/ivar.txt7
-rw-r--r--test/prism/snapshots/whitequark/ivasgn.txt13
-rw-r--r--test/prism/snapshots/whitequark/keyword_argument_omission.txt65
-rw-r--r--test/prism/snapshots/whitequark/kwarg.txt30
-rw-r--r--test/prism/snapshots/whitequark/kwbegin_compstmt.txt34
-rw-r--r--test/prism/snapshots/whitequark/kwnilarg.txt84
-rw-r--r--test/prism/snapshots/whitequark/kwoptarg.txt34
-rw-r--r--test/prism/snapshots/whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt58
-rw-r--r--test/prism/snapshots/whitequark/kwrestarg_named.txt31
-rw-r--r--test/prism/snapshots/whitequark/kwrestarg_unnamed.txt31
-rw-r--r--test/prism/snapshots/whitequark/lbrace_arg_after_command_args.txt54
-rw-r--r--test/prism/snapshots/whitequark/lparenarg_after_lvar__since_25.txt67
-rw-r--r--test/prism/snapshots/whitequark/lvar.txt15
-rw-r--r--test/prism/snapshots/whitequark/lvar_injecting_match.txt39
-rw-r--r--test/prism/snapshots/whitequark/lvasgn.txt17
-rw-r--r--test/prism/snapshots/whitequark/masgn.txt83
-rw-r--r--test/prism/snapshots/whitequark/masgn_attr.txt82
-rw-r--r--test/prism/snapshots/whitequark/masgn_cmd.txt35
-rw-r--r--test/prism/snapshots/whitequark/masgn_const.txt44
-rw-r--r--test/prism/snapshots/whitequark/masgn_nested.txt66
-rw-r--r--test/prism/snapshots/whitequark/masgn_splat.txt284
-rw-r--r--test/prism/snapshots/whitequark/method_definition_in_while_cond.txt199
-rw-r--r--test/prism/snapshots/whitequark/module.txt14
-rw-r--r--test/prism/snapshots/whitequark/multiple_pattern_matches.txt173
-rw-r--r--test/prism/snapshots/whitequark/newline_in_hash_argument.txt163
-rw-r--r--test/prism/snapshots/whitequark/nil.txt6
-rw-r--r--test/prism/snapshots/whitequark/nil_expression.txt16
-rw-r--r--test/prism/snapshots/whitequark/non_lvar_injecting_match.txt44
-rw-r--r--test/prism/snapshots/whitequark/not.txt55
-rw-r--r--test/prism/snapshots/whitequark/not_cmd.txt38
-rw-r--r--test/prism/snapshots/whitequark/not_masgn__24.txt45
-rw-r--r--test/prism/snapshots/whitequark/nth_ref.txt7
-rw-r--r--test/prism/snapshots/whitequark/numbered_args_after_27.txt143
-rw-r--r--test/prism/snapshots/whitequark/numparam_outside_block.txt114
-rw-r--r--test/prism/snapshots/whitequark/numparam_ruby_bug_19025.txt49
-rw-r--r--test/prism/snapshots/whitequark/op_asgn.txt74
-rw-r--r--test/prism/snapshots/whitequark/op_asgn_cmd.txt177
-rw-r--r--test/prism/snapshots/whitequark/op_asgn_index.txt38
-rw-r--r--test/prism/snapshots/whitequark/op_asgn_index_cmd.txt58
-rw-r--r--test/prism/snapshots/whitequark/optarg.txt74
-rw-r--r--test/prism/snapshots/whitequark/or.txt53
-rw-r--r--test/prism/snapshots/whitequark/or_asgn.txt59
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_272.txt42
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_490.txt106
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_507.txt36
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_518.txt18
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_525.txt65
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_604.txt57
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_640.txt22
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_645.txt35
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_830.txt11
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_989.txt11
-rw-r--r--test/prism/snapshots/whitequark/parser_drops_truncated_parts_of_squiggly_heredoc.txt20
-rw-r--r--test/prism/snapshots/whitequark/parser_slash_slash_n_escaping_in_literals.txt139
-rw-r--r--test/prism/snapshots/whitequark/pattern_matching__FILE__LINE_literals.txt54
-rw-r--r--test/prism/snapshots/whitequark/pattern_matching_blank_else.txt31
-rw-r--r--test/prism/snapshots/whitequark/pattern_matching_else.txt36
-rw-r--r--test/prism/snapshots/whitequark/pattern_matching_single_line.txt45
-rw-r--r--test/prism/snapshots/whitequark/pattern_matching_single_line_allowed_omission_of_parentheses.txt249
-rw-r--r--test/prism/snapshots/whitequark/postexe.txt15
-rw-r--r--test/prism/snapshots/whitequark/preexe.txt15
-rw-r--r--test/prism/snapshots/whitequark/procarg0.txt78
-rw-r--r--test/prism/snapshots/whitequark/range_exclusive.txt16
-rw-r--r--test/prism/snapshots/whitequark/range_inclusive.txt16
-rw-r--r--test/prism/snapshots/whitequark/rational.txt13
-rw-r--r--test/prism/snapshots/whitequark/regex_interp.txt38
-rw-r--r--test/prism/snapshots/whitequark/regex_plain.txt11
-rw-r--r--test/prism/snapshots/whitequark/resbody_list.txt45
-rw-r--r--test/prism/snapshots/whitequark/resbody_list_mrhs.txt55
-rw-r--r--test/prism/snapshots/whitequark/resbody_list_var.txt56
-rw-r--r--test/prism/snapshots/whitequark/resbody_var.txt86
-rw-r--r--test/prism/snapshots/whitequark/rescue.txt43
-rw-r--r--test/prism/snapshots/whitequark/rescue_else.txt59
-rw-r--r--test/prism/snapshots/whitequark/rescue_else_ensure.txt75
-rw-r--r--test/prism/snapshots/whitequark/rescue_ensure.txt59
-rw-r--r--test/prism/snapshots/whitequark/rescue_in_lambda_block.txt26
-rw-r--r--test/prism/snapshots/whitequark/rescue_mod.txt29
-rw-r--r--test/prism/snapshots/whitequark/rescue_mod_asgn.txt35
-rw-r--r--test/prism/snapshots/whitequark/rescue_mod_masgn.txt44
-rw-r--r--test/prism/snapshots/whitequark/rescue_mod_op_assign.txt36
-rw-r--r--test/prism/snapshots/whitequark/rescue_without_begin_end.txt59
-rw-r--r--test/prism/snapshots/whitequark/restarg_named.txt31
-rw-r--r--test/prism/snapshots/whitequark/restarg_unnamed.txt31
-rw-r--r--test/prism/snapshots/whitequark/return.txt60
-rw-r--r--test/prism/snapshots/whitequark/return_block.txt41
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_10279.txt32
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_10653.txt173
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11107.txt48
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11380.txt55
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11873.txt767
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11873_a.txt1231
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11873_b.txt98
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11989.txt24
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11990.txt35
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_12073.txt95
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_12402.txt565
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_12669.txt133
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_12686.txt39
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_13547.txt31
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_14690.txt59
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_15789.txt120
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_9669.txt59
-rw-r--r--test/prism/snapshots/whitequark/sclass.txt25
-rw-r--r--test/prism/snapshots/whitequark/self.txt6
-rw-r--r--test/prism/snapshots/whitequark/send_attr_asgn.txt105
-rw-r--r--test/prism/snapshots/whitequark/send_attr_asgn_conditional.txt31
-rw-r--r--test/prism/snapshots/whitequark/send_binary_op.txt551
-rw-r--r--test/prism/snapshots/whitequark/send_block_chain_cmd.txt325
-rw-r--r--test/prism/snapshots/whitequark/send_block_conditional.txt31
-rw-r--r--test/prism/snapshots/whitequark/send_call.txt57
-rw-r--r--test/prism/snapshots/whitequark/send_conditional.txt25
-rw-r--r--test/prism/snapshots/whitequark/send_index.txt34
-rw-r--r--test/prism/snapshots/whitequark/send_index_asgn.txt37
-rw-r--r--test/prism/snapshots/whitequark/send_index_asgn_legacy.txt37
-rw-r--r--test/prism/snapshots/whitequark/send_index_cmd.txt51
-rw-r--r--test/prism/snapshots/whitequark/send_index_legacy.txt34
-rw-r--r--test/prism/snapshots/whitequark/send_lambda.txt44
-rw-r--r--test/prism/snapshots/whitequark/send_lambda_args.txt51
-rw-r--r--test/prism/snapshots/whitequark/send_lambda_args_noparen.txt57
-rw-r--r--test/prism/snapshots/whitequark/send_lambda_args_shadow.txt34
-rw-r--r--test/prism/snapshots/whitequark/send_lambda_legacy.txt12
-rw-r--r--test/prism/snapshots/whitequark/send_op_asgn_conditional.txt27
-rw-r--r--test/prism/snapshots/whitequark/send_plain.txt65
-rw-r--r--test/prism/snapshots/whitequark/send_plain_cmd.txt104
-rw-r--r--test/prism/snapshots/whitequark/send_self.txt41
-rw-r--r--test/prism/snapshots/whitequark/send_self_block.txt75
-rw-r--r--test/prism/snapshots/whitequark/send_unary_op.txt65
-rw-r--r--test/prism/snapshots/whitequark/slash_newline_in_heredocs.txt34
-rw-r--r--test/prism/snapshots/whitequark/space_args_arg.txt27
-rw-r--r--test/prism/snapshots/whitequark/space_args_arg_block.txt109
-rw-r--r--test/prism/snapshots/whitequark/space_args_arg_call.txt37
-rw-r--r--test/prism/snapshots/whitequark/space_args_arg_newline.txt27
-rw-r--r--test/prism/snapshots/whitequark/space_args_block.txt28
-rw-r--r--test/prism/snapshots/whitequark/space_args_cmd.txt47
-rw-r--r--test/prism/snapshots/whitequark/string___FILE__.txt8
-rw-r--r--test/prism/snapshots/whitequark/string_concat.txt32
-rw-r--r--test/prism/snapshots/whitequark/string_dvar.txt37
-rw-r--r--test/prism/snapshots/whitequark/string_interp.txt38
-rw-r--r--test/prism/snapshots/whitequark/string_plain.txt17
-rw-r--r--test/prism/snapshots/whitequark/super.txt49
-rw-r--r--test/prism/snapshots/whitequark/super_block.txt48
-rw-r--r--test/prism/snapshots/whitequark/symbol_interp.txt37
-rw-r--r--test/prism/snapshots/whitequark/symbol_plain.txt17
-rw-r--r--test/prism/snapshots/whitequark/ternary.txt36
-rw-r--r--test/prism/snapshots/whitequark/ternary_ambiguous_symbol.txt50
-rw-r--r--test/prism/snapshots/whitequark/trailing_forward_arg.txt55
-rw-r--r--test/prism/snapshots/whitequark/true.txt6
-rw-r--r--test/prism/snapshots/whitequark/unary_num_pow_precedence.txt80
-rw-r--r--test/prism/snapshots/whitequark/undef.txt39
-rw-r--r--test/prism/snapshots/whitequark/unless.txt63
-rw-r--r--test/prism/snapshots/whitequark/unless_else.txt95
-rw-r--r--test/prism/snapshots/whitequark/unless_mod.txt34
-rw-r--r--test/prism/snapshots/whitequark/until.txt61
-rw-r--r--test/prism/snapshots/whitequark/until_mod.txt33
-rw-r--r--test/prism/snapshots/whitequark/until_post.txt42
-rw-r--r--test/prism/snapshots/whitequark/var_and_asgn.txt14
-rw-r--r--test/prism/snapshots/whitequark/var_op_asgn.txt57
-rw-r--r--test/prism/snapshots/whitequark/var_op_asgn_cmd.txt28
-rw-r--r--test/prism/snapshots/whitequark/var_or_asgn.txt14
-rw-r--r--test/prism/snapshots/whitequark/when_multi.txt50
-rw-r--r--test/prism/snapshots/whitequark/when_splat.txt72
-rw-r--r--test/prism/snapshots/whitequark/when_then.txt44
-rw-r--r--test/prism/snapshots/whitequark/while.txt61
-rw-r--r--test/prism/snapshots/whitequark/while_mod.txt33
-rw-r--r--test/prism/snapshots/whitequark/while_post.txt42
-rw-r--r--test/prism/snapshots/whitequark/xstring_interp.txt37
-rw-r--r--test/prism/snapshots/whitequark/xstring_plain.txt11
-rw-r--r--test/prism/snapshots/whitequark/zsuper.txt7
-rw-r--r--test/prism/snapshots/xstring.txt67
-rw-r--r--test/prism/snapshots/xstring_with_backslash.txt11
-rw-r--r--test/prism/snapshots/yield.txt103
-rw-r--r--test/prism/snapshots_test.rb73
-rw-r--r--test/prism/snippets_test.rb13
-rw-r--r--test/prism/test_helper.rb93
-rw-r--r--test/prism/unescape_test.rb12
-rw-r--r--test/prism/version_test.rb2
-rw-r--r--test/psych/helper.rb1
-rw-r--r--test/psych/test_data.rb94
-rw-r--r--test/psych/test_date_time.rb16
-rw-r--r--test/psych/test_exception.rb13
-rw-r--r--test/psych/test_object_references.rb5
-rw-r--r--test/psych/test_psych.rb11
-rw-r--r--test/psych/test_psych_set.rb57
-rw-r--r--test/psych/test_ractor.rb6
-rw-r--r--test/psych/test_safe_load.rb32
-rw-r--r--test/psych/test_scalar_scanner.rb19
-rw-r--r--test/psych/test_serialize_subclasses.rb18
-rw-r--r--test/psych/test_set.rb61
-rw-r--r--test/psych/test_stream.rb8
-rw-r--r--test/psych/test_string.rb10
-rw-r--r--test/psych/test_stringio.rb14
-rw-r--r--test/psych/test_yaml.rb928
-rw-r--r--test/psych/test_yaml_special_cases.rb12
-rw-r--r--test/psych/test_yamlstore.rb16
-rw-r--r--test/psych/visitors/test_to_ruby.rb6
-rw-r--r--test/psych/visitors/test_yaml_tree.rb21
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text21
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Auto links.text13
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text120
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text11
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Code Blocks.text14
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Code Spans.text6
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text8
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text67
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text15
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text69
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text13
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Links, inline style.text12
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Links, reference style.text71
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text20
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text7
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text306
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text888
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text5
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text131
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Strong and em together.text7
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Tabs.text21
-rw-r--r--test/rdoc/MarkdownTest_1.0.3/Tidyness.text5
-rw-r--r--test/rdoc/README1
-rw-r--r--test/rdoc/binary.datbin1024 -> 0 bytes-rw-r--r--test/rdoc/helper.rb5
-rw-r--r--test/rdoc/hidden.zip.txt1
-rw-r--r--test/rdoc/support/formatter_test_case.rb764
-rw-r--r--test/rdoc/support/test_case.rb217
-rw-r--r--test/rdoc/support/text_formatter_test_case.rb114
-rw-r--r--test/rdoc/test.ja.largedoc3
-rw-r--r--test/rdoc/test.ja.rdoc10
-rw-r--r--test/rdoc/test.ja.txt8
-rw-r--r--test/rdoc/test.txt1
-rw-r--r--test/rdoc/test_rdoc_alias.rb13
-rw-r--r--test/rdoc/test_rdoc_any_method.rb609
-rw-r--r--test/rdoc/test_rdoc_attr.rb190
-rw-r--r--test/rdoc/test_rdoc_class_module.rb1503
-rw-r--r--test/rdoc/test_rdoc_code_object.rb440
-rw-r--r--test/rdoc/test_rdoc_comment.rb506
-rw-r--r--test/rdoc/test_rdoc_constant.rb182
-rw-r--r--test/rdoc/test_rdoc_context.rb971
-rw-r--r--test/rdoc/test_rdoc_context_section.rb146
-rw-r--r--test/rdoc/test_rdoc_cross_reference.rb219
-rw-r--r--test/rdoc/test_rdoc_encoding.rb184
-rw-r--r--test/rdoc/test_rdoc_extend.rb94
-rw-r--r--test/rdoc/test_rdoc_generator_darkfish.rb353
-rw-r--r--test/rdoc/test_rdoc_generator_json_index.rb361
-rw-r--r--test/rdoc/test_rdoc_generator_markup.rb59
-rw-r--r--test/rdoc/test_rdoc_generator_pot.rb92
-rw-r--r--test/rdoc/test_rdoc_generator_pot_po.rb52
-rw-r--r--test/rdoc/test_rdoc_generator_pot_po_entry.rb140
-rw-r--r--test/rdoc/test_rdoc_generator_ri.rb76
-rw-r--r--test/rdoc/test_rdoc_i18n_locale.rb74
-rw-r--r--test/rdoc/test_rdoc_i18n_text.rb124
-rw-r--r--test/rdoc/test_rdoc_include.rb109
-rw-r--r--test/rdoc/test_rdoc_markdown.rb1109
-rw-r--r--test/rdoc/test_rdoc_markdown_test.rb1883
-rw-r--r--test/rdoc/test_rdoc_markup.rb95
-rw-r--r--test/rdoc/test_rdoc_markup_attribute_manager.rb395
-rw-r--r--test/rdoc/test_rdoc_markup_attributes.rb39
-rw-r--r--test/rdoc/test_rdoc_markup_document.rb207
-rw-r--r--test/rdoc/test_rdoc_markup_formatter.rb181
-rw-r--r--test/rdoc/test_rdoc_markup_hard_break.rb31
-rw-r--r--test/rdoc/test_rdoc_markup_heading.rb29
-rw-r--r--test/rdoc/test_rdoc_markup_include.rb19
-rw-r--r--test/rdoc/test_rdoc_markup_indented_paragraph.rb53
-rw-r--r--test/rdoc/test_rdoc_markup_paragraph.rb32
-rw-r--r--test/rdoc/test_rdoc_markup_parser.rb1684
-rw-r--r--test/rdoc/test_rdoc_markup_pre_process.rb467
-rw-r--r--test/rdoc/test_rdoc_markup_raw.rb22
-rw-r--r--test/rdoc/test_rdoc_markup_to_ansi.rb369
-rw-r--r--test/rdoc/test_rdoc_markup_to_bs.rb352
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb991
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb280
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_snippet.rb709
-rw-r--r--test/rdoc/test_rdoc_markup_to_joined_paragraph.rb32
-rw-r--r--test/rdoc/test_rdoc_markup_to_label.rb112
-rw-r--r--test/rdoc/test_rdoc_markup_to_markdown.rb386
-rw-r--r--test/rdoc/test_rdoc_markup_to_rdoc.rb377
-rw-r--r--test/rdoc/test_rdoc_markup_to_table_of_contents.rb126
-rw-r--r--test/rdoc/test_rdoc_markup_to_tt_only.rb246
-rw-r--r--test/rdoc/test_rdoc_markup_verbatim.rb29
-rw-r--r--test/rdoc/test_rdoc_method_attr.rb193
-rw-r--r--test/rdoc/test_rdoc_normal_class.rb47
-rw-r--r--test/rdoc/test_rdoc_normal_module.rb42
-rw-r--r--test/rdoc/test_rdoc_options.rb931
-rw-r--r--test/rdoc/test_rdoc_parser.rb337
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb2103
-rw-r--r--test/rdoc/test_rdoc_parser_changelog.rb484
-rw-r--r--test/rdoc/test_rdoc_parser_markdown.rb61
-rw-r--r--test/rdoc/test_rdoc_parser_rd.rb55
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb4398
-rw-r--r--test/rdoc/test_rdoc_parser_simple.rb115
-rw-r--r--test/rdoc/test_rdoc_rd.rb30
-rw-r--r--test/rdoc/test_rdoc_rd_block_parser.rb557
-rw-r--r--test/rdoc/test_rdoc_rd_inline.rb63
-rw-r--r--test/rdoc/test_rdoc_rd_inline_parser.rb178
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb583
-rw-r--r--test/rdoc/test_rdoc_require.rb25
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb1561
-rw-r--r--test/rdoc/test_rdoc_ri_paths.rb157
-rw-r--r--test/rdoc/test_rdoc_rubygems_hook.rb287
-rw-r--r--test/rdoc/test_rdoc_servlet.rb555
-rw-r--r--test/rdoc/test_rdoc_single_class.rb20
-rw-r--r--test/rdoc/test_rdoc_stats.rb722
-rw-r--r--test/rdoc/test_rdoc_store.rb1012
-rw-r--r--test/rdoc/test_rdoc_task.rb182
-rw-r--r--test/rdoc/test_rdoc_text.rb585
-rw-r--r--test/rdoc/test_rdoc_token_stream.rb109
-rw-r--r--test/rdoc/test_rdoc_tom_doc.rb579
-rw-r--r--test/rdoc/test_rdoc_top_level.rb290
-rw-r--r--test/rdoc/xref_data.rb163
-rw-r--r--test/rdoc/xref_test_case.rb93
-rw-r--r--test/reline/helper.rb174
-rw-r--r--test/reline/test_ansi_with_terminfo.rb112
-rw-r--r--test/reline/test_ansi_without_terminfo.rb77
-rw-r--r--test/reline/test_config.rb565
-rw-r--r--test/reline/test_face.rb257
-rw-r--r--test/reline/test_history.rb308
-rw-r--r--test/reline/test_key_actor_emacs.rb1627
-rw-r--r--test/reline/test_key_actor_vi.rb923
-rw-r--r--test/reline/test_key_stroke.rb105
-rw-r--r--test/reline/test_kill_ring.rb268
-rw-r--r--test/reline/test_line_editor.rb183
-rw-r--r--test/reline/test_macro.rb40
-rw-r--r--test/reline/test_reline.rb444
-rw-r--r--test/reline/test_reline_key.rb11
-rw-r--r--test/reline/test_string_processing.rb69
-rw-r--r--test/reline/test_terminfo.rb61
-rw-r--r--test/reline/test_unicode.rb92
-rw-r--r--test/reline/test_within_pipe.rb77
-rw-r--r--test/reline/windows/test_key_event_record.rb41
-rwxr-xr-xtest/reline/yamatanooroti/multiline_repl257
-rw-r--r--test/reline/yamatanooroti/termination_checker.rb26
-rw-r--r--test/reline/yamatanooroti/test_rendering.rb1852
-rw-r--r--test/resolv/test_dns.rb282
-rw-r--r--test/resolv/test_win32_config.rb26
-rw-r--r--test/ripper/assert_parse_files.rb1
-rw-r--r--test/ripper/test_lexer.rb196
-rw-r--r--test/ripper/test_parser_events.rb72
-rw-r--r--test/ripper/test_ripper.rb29
-rw-r--r--test/ripper/test_scanner_events.rb6
-rw-r--r--test/ruby/box/a.1_1_0.rb17
-rw-r--r--test/ruby/box/a.1_2_0.rb17
-rw-r--r--test/ruby/box/a.rb15
-rw-r--r--test/ruby/box/autoloading.rb8
-rw-r--r--test/ruby/box/blank.rb2
-rw-r--r--test/ruby/box/blank1.rb2
-rw-r--r--test/ruby/box/blank2.rb2
-rw-r--r--test/ruby/box/box.rb10
-rw-r--r--test/ruby/box/call_proc.rb5
-rw-r--r--test/ruby/box/call_toplevel.rb8
-rw-r--r--test/ruby/box/consts.rb148
-rw-r--r--test/ruby/box/define_toplevel.rb5
-rw-r--r--test/ruby/box/global_vars.rb37
-rw-r--r--test/ruby/box/instance_variables.rb21
-rw-r--r--test/ruby/box/line_splitter.rb9
-rw-r--r--test/ruby/box/load_path.rb26
-rw-r--r--test/ruby/box/open_class_with_include.rb31
-rw-r--r--test/ruby/box/proc_callee.rb14
-rw-r--r--test/ruby/box/proc_caller.rb5
-rw-r--r--test/ruby/box/procs.rb64
-rw-r--r--test/ruby/box/raise.rb3
-rw-r--r--test/ruby/box/returns_proc.rb12
-rw-r--r--test/ruby/box/singleton_methods.rb65
-rw-r--r--test/ruby/box/string_ext.rb13
-rw-r--r--test/ruby/box/string_ext_caller.rb5
-rw-r--r--test/ruby/box/string_ext_calling.rb1
-rw-r--r--test/ruby/box/string_ext_eval_caller.rb12
-rw-r--r--test/ruby/box/top_level.rb33
-rw-r--r--test/ruby/enc/test_case_comprehensive.rb61
-rw-r--r--test/ruby/enc/test_emoji_breaks.rb2
-rw-r--r--test/ruby/rjit/test_assembler.rb368
-rw-r--r--test/ruby/sentence.rb2
-rw-r--r--test/ruby/test_alias.rb49
-rw-r--r--test/ruby/test_allocation.rb440
-rw-r--r--test/ruby/test_array.rb199
-rw-r--r--test/ruby/test_assignment.rb10
-rw-r--r--test/ruby/test_ast.rb515
-rw-r--r--test/ruby/test_autoload.rb31
-rw-r--r--test/ruby/test_backtrace.rb12
-rw-r--r--test/ruby/test_bignum.rb50
-rw-r--r--test/ruby/test_box.rb874
-rw-r--r--test/ruby/test_call.rb163
-rw-r--r--test/ruby/test_case.rb9
-rw-r--r--test/ruby/test_class.rb133
-rw-r--r--test/ruby/test_compile_prism.rb162
-rw-r--r--test/ruby/test_complex.rb11
-rw-r--r--test/ruby/test_data.rb9
-rw-r--r--test/ruby/test_defined.rb55
-rw-r--r--test/ruby/test_dir.rb21
-rw-r--r--test/ruby/test_encoding.rb52
-rw-r--r--test/ruby/test_enum.rb8
-rw-r--r--test/ruby/test_enumerator.rb43
-rw-r--r--test/ruby/test_env.rb580
-rw-r--r--test/ruby/test_eval.rb46
-rw-r--r--test/ruby/test_exception.rb35
-rw-r--r--test/ruby/test_fiber.rb17
-rw-r--r--test/ruby/test_file.rb49
-rw-r--r--test/ruby/test_file_exhaustive.rb60
-rw-r--r--test/ruby/test_float.rb48
-rw-r--r--test/ruby/test_frozen.rb16
-rw-r--r--test/ruby/test_gc.rb442
-rw-r--r--test/ruby/test_gc_compact.rb67
-rw-r--r--test/ruby/test_hash.rb83
-rw-r--r--test/ruby/test_integer.rb37
-rw-r--r--test/ruby/test_io.rb297
-rw-r--r--test/ruby/test_io_buffer.rb390
-rw-r--r--test/ruby/test_io_m17n.rb41
-rw-r--r--test/ruby/test_iseq.rb212
-rw-r--r--test/ruby/test_iterator.rb16
-rw-r--r--test/ruby/test_keyword.rb76
-rw-r--r--test/ruby/test_lambda.rb14
-rw-r--r--test/ruby/test_lazy_enumerator.rb4
-rw-r--r--test/ruby/test_literal.rb31
-rw-r--r--test/ruby/test_m17n.rb205
-rw-r--r--test/ruby/test_marshal.rb50
-rw-r--r--test/ruby/test_math.rb32
-rw-r--r--test/ruby/test_memory_view.rb2
-rw-r--r--test/ruby/test_method.rb207
-rw-r--r--test/ruby/test_mixed_unicode_escapes.rb2
-rw-r--r--test/ruby/test_module.rb157
-rw-r--r--test/ruby/test_nomethod_error.rb30
-rw-r--r--test/ruby/test_numeric.rb34
-rw-r--r--test/ruby/test_object.rb127
-rw-r--r--test/ruby/test_object_id.rb303
-rw-r--r--test/ruby/test_objectspace.rb108
-rw-r--r--test/ruby/test_optimization.rb272
-rw-r--r--test/ruby/test_pack.rb23
-rw-r--r--test/ruby/test_parse.rb81
-rw-r--r--test/ruby/test_pattern_matching.rb52
-rw-r--r--test/ruby/test_proc.rb393
-rw-r--r--test/ruby/test_process.rb117
-rw-r--r--test/ruby/test_ractor.rb229
-rw-r--r--test/ruby/test_rand.rb5
-rw-r--r--test/ruby/test_random_formatter.rb5
-rw-r--r--test/ruby/test_range.rb422
-rw-r--r--test/ruby/test_rational.rb19
-rw-r--r--test/ruby/test_refinement.rb55
-rw-r--r--test/ruby/test_regexp.rb246
-rw-r--r--test/ruby/test_require.rb48
-rw-r--r--test/ruby/test_require_lib.rb4
-rw-r--r--test/ruby/test_rubyoptions.rb230
-rw-r--r--test/ruby/test_rubyvm.rb11
-rw-r--r--test/ruby/test_set.rb1052
-rw-r--r--test/ruby/test_settracefunc.rb286
-rw-r--r--test/ruby/test_shapes.rb258
-rw-r--r--test/ruby/test_signal.rb32
-rw-r--r--test/ruby/test_sleep.rb35
-rw-r--r--test/ruby/test_sprintf.rb14
-rw-r--r--test/ruby/test_string.rb420
-rw-r--r--test/ruby/test_string_memory.rb38
-rw-r--r--test/ruby/test_struct.rb10
-rw-r--r--test/ruby/test_super.rb65
-rw-r--r--test/ruby/test_symbol.rb6
-rw-r--r--test/ruby/test_syntax.rb178
-rw-r--r--test/ruby/test_thread.rb103
-rw-r--r--test/ruby/test_thread_cv.rb2
-rw-r--r--test/ruby/test_thread_queue.rb14
-rw-r--r--test/ruby/test_time.rb71
-rw-r--r--test/ruby/test_time_tz.rb1
-rw-r--r--test/ruby/test_transcode.rb108
-rw-r--r--test/ruby/test_variable.rb120
-rw-r--r--test/ruby/test_vm_dump.rb7
-rw-r--r--test/ruby/test_warning.rb32
-rw-r--r--test/ruby/test_weakkeymap.rb14
-rw-r--r--test/ruby/test_weakmap.rb36
-rw-r--r--test/ruby/test_yield.rb2
-rw-r--r--test/ruby/test_yjit.rb223
-rw-r--r--test/ruby/test_zjit.rb4542
-rw-r--r--test/rubygems/helper.rb89
-rw-r--r--test/rubygems/installer_test_case.rb25
-rw-r--r--test/rubygems/mock_gem_ui.rb4
-rw-r--r--test/rubygems/package/tar_test_case.rb38
-rw-r--r--test/rubygems/rubygems/commands/ins_command.rb7
-rw-r--r--test/rubygems/rubygems/commands/interrupt_command.rb11
-rw-r--r--test/rubygems/rubygems_plugin.rb19
-rw-r--r--test/rubygems/test_bundled_ca.rb2
-rw-r--r--test/rubygems/test_config.rb7
-rw-r--r--test/rubygems/test_gem.rb57
-rw-r--r--test/rubygems/test_gem_bundler_version_finder.rb79
-rw-r--r--test/rubygems/test_gem_command_manager.rb54
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb10
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_exec_command.rb28
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb96
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb49
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb148
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb29
-rw-r--r--test/rubygems/test_gem_commands_lock_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb112
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb70
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb59
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb830
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb35
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb563
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb55
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb34
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb14
-rw-r--r--test/rubygems/test_gem_config_file.rb71
-rw-r--r--test/rubygems/test_gem_dependency.rb2
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb211
-rw-r--r--test/rubygems/test_gem_ext_builder.rb70
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder.rb62
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock10
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock10
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml2
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb2
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb97
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb33
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb2
-rw-r--r--test/rubygems/test_gem_gem_runner.rb17
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb12
-rw-r--r--test/rubygems/test_gem_install_update_options.rb12
-rw-r--r--test/rubygems/test_gem_installer.rb351
-rw-r--r--test/rubygems/test_gem_name_tuple.rb37
-rw-r--r--test/rubygems/test_gem_package.rb103
-rw-r--r--test/rubygems/test_gem_package_old.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_header_ractor.rb61
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb33
-rw-r--r--test/rubygems/test_gem_platform.rb360
-rw-r--r--test/rubygems/test_gem_rdoc.rb10
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb765
-rw-r--r--test/rubygems/test_gem_remote_fetcher_local_server.rb220
-rw-r--r--test/rubygems/test_gem_remote_fetcher_local_ssl_server.rb195
-rw-r--r--test/rubygems/test_gem_remote_fetcher_s3.rb437
-rw-r--r--test/rubygems/test_gem_request.rb24
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb12
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb2
-rw-r--r--test/rubygems/test_gem_requirement.rb22
-rw-r--r--test/rubygems/test_gem_resolver.rb2
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb19
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb90
-rw-r--r--test/rubygems/test_gem_safe_marshal.rb134
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb6
-rw-r--r--test/rubygems/test_gem_source.rb2
-rw-r--r--test/rubygems/test_gem_source_git.rb4
-rw-r--r--test/rubygems/test_gem_source_installed.rb5
-rw-r--r--test/rubygems/test_gem_source_list.rb127
-rw-r--r--test/rubygems/test_gem_source_local.rb5
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb4
-rw-r--r--test/rubygems/test_gem_source_subpath_problem.rb2
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb44
-rw-r--r--test/rubygems/test_gem_specification.rb283
-rw-r--r--test/rubygems/test_gem_stub_specification.rb95
-rw-r--r--test/rubygems/test_gem_uninstaller.rb2
-rw-r--r--test/rubygems/test_gem_uri.rb2
-rw-r--r--test/rubygems/test_gem_util.rb11
-rw-r--r--test/rubygems/test_gem_util_atomic_file_writer.rb12
-rw-r--r--test/rubygems/test_gem_version.rb33
-rw-r--r--test/rubygems/test_project_sanity.rb11
-rw-r--r--test/rubygems/test_require.rb56
-rw-r--r--test/rubygems/test_webauthn_listener.rb2
-rw-r--r--test/rubygems/utilities.rb24
-rw-r--r--test/set/fixtures/fake_sorted_set_gem/sorted_set.rb9
-rw-r--r--test/set/test_set.rb892
-rw-r--r--test/set/test_sorted_set.rb45
-rw-r--r--test/socket/test_addrinfo.rb6
-rw-r--r--test/socket/test_socket.rb280
-rw-r--r--test/socket/test_tcp.rb294
-rw-r--r--test/socket/test_unix.rb21
-rw-r--r--test/stringio/test_ractor.rb6
-rw-r--r--test/stringio/test_stringio.rb97
-rw-r--r--test/strscan/test_ractor.rb8
-rw-r--r--test/strscan/test_stringscanner.rb910
-rw-r--r--test/test_bundled_gems.rb48
-rw-r--r--test/test_delegate.rb41
-rw-r--r--test/test_extlibs.rb4
-rw-r--r--test/test_ipaddr.rb102
-rw-r--r--test/test_pp.rb119
-rw-r--r--test/test_pstore.rb182
-rw-r--r--test/test_pty.rb8
-rw-r--r--test/test_rbconfig.rb15
-rw-r--r--test/test_securerandom.rb20
-rw-r--r--test/test_shellwords.rb9
-rw-r--r--test/test_tempfile.rb45
-rw-r--r--test/test_time.rb2
-rw-r--r--test/test_timeout.rb193
-rw-r--r--test/test_tmpdir.rb49
-rw-r--r--test/test_tsort.rb115
-rw-r--r--test/test_unicode_normalize.rb28
-rw-r--r--test/uri/test_common.rb67
-rw-r--r--test/uri/test_ftp.rb10
-rw-r--r--test/uri/test_generic.rb92
-rw-r--r--test/uri/test_http.rb20
-rw-r--r--test/uri/test_mailto.rb72
-rw-r--r--test/uri/test_parser.rb40
-rw-r--r--test/uri/test_ws.rb16
-rw-r--r--test/uri/test_wss.rb16
-rw-r--r--test/win32/test_registry.rb229
-rw-r--r--test/win32ole/available_ole.rb41
-rw-r--r--test/win32ole/err_in_callback.rb10
-rw-r--r--test/win32ole/orig_data.csv5
-rw-r--r--test/win32ole/test_err_in_callback.rb56
-rw-r--r--test/win32ole/test_folderitem2_invokeverb.rb66
-rw-r--r--test/win32ole/test_nil2vtempty.rb37
-rw-r--r--test/win32ole/test_ole_methods.rb35
-rw-r--r--test/win32ole/test_propertyputref.rb31
-rw-r--r--test/win32ole/test_thread.rb34
-rw-r--r--test/win32ole/test_win32ole.rb541
-rw-r--r--test/win32ole/test_win32ole_event.rb411
-rw-r--r--test/win32ole/test_win32ole_method.rb138
-rw-r--r--test/win32ole/test_win32ole_method_event.rb36
-rw-r--r--test/win32ole/test_win32ole_param.rb102
-rw-r--r--test/win32ole/test_win32ole_param_event.rb30
-rw-r--r--test/win32ole/test_win32ole_record.rb215
-rw-r--r--test/win32ole/test_win32ole_type.rb203
-rw-r--r--test/win32ole/test_win32ole_type_event.rb44
-rw-r--r--test/win32ole/test_win32ole_typelib.rb121
-rw-r--r--test/win32ole/test_win32ole_variable.rb70
-rw-r--r--test/win32ole/test_win32ole_variant.rb726
-rw-r--r--test/win32ole/test_win32ole_variant_m.rb41
-rw-r--r--test/win32ole/test_win32ole_variant_outarg.rb69
-rw-r--r--test/win32ole/test_word.rb73
-rw-r--r--test/yaml/test_dbm.rb46
-rw-r--r--test/yaml/test_store.rb12
-rw-r--r--test/zlib/test_zlib.rb9
-rw-r--r--thread.c897
-rw-r--r--thread_none.c25
-rw-r--r--thread_pthread.c610
-rw-r--r--thread_pthread.h67
-rw-r--r--thread_pthread_mn.c208
-rw-r--r--thread_sync.c1172
-rw-r--r--thread_sync.rb471
-rw-r--r--thread_win32.c53
-rw-r--r--time.c362
-rw-r--r--timev.rb61
-rw-r--r--tool/annocheck/Dockerfile2
-rw-r--r--tool/annocheck/Dockerfile-copy7
-rwxr-xr-xtool/auto-style.rb284
-rwxr-xr-xtool/auto_review_pr.rb93
-rw-r--r--tool/bundler/dev_gems.rb8
-rw-r--r--tool/bundler/dev_gems.rb.lock132
-rw-r--r--tool/bundler/rubocop_gems.rb3
-rw-r--r--tool/bundler/rubocop_gems.rb.lock159
-rw-r--r--tool/bundler/standard_gems.rb3
-rw-r--r--tool/bundler/standard_gems.rb.lock179
-rw-r--r--tool/bundler/test_gems.rb14
-rw-r--r--tool/bundler/test_gems.rb.lock106
-rw-r--r--tool/bundler/vendor_gems.rb20
-rw-r--r--tool/bundler/vendor_gems.rb.lock75
-rwxr-xr-xtool/commit-email.rb372
-rw-r--r--tool/downloader.rb156
-rwxr-xr-xtool/enc-unicode.rb26
-rwxr-xr-xtool/extlibs.rb2
-rw-r--r--tool/fake.rb2
-rwxr-xr-xtool/fetch-bundled_gems.rb30
-rwxr-xr-xtool/file2lastrev.rb1
-rwxr-xr-xtool/format-release51
-rw-r--r--tool/generic_erb.rb2
-rw-r--r--tool/gperf.sed19
-rwxr-xr-xtool/ifchange6
-rwxr-xr-xtool/leaked-globals1
-rw-r--r--tool/lib/_tmpdir.rb6
-rw-r--r--tool/lib/bundle_env.rb4
-rw-r--r--tool/lib/bundled_gem.rb13
-rw-r--r--tool/lib/core_assertions.rb231
-rw-r--r--tool/lib/dump.gdb17
-rw-r--r--tool/lib/dump.lldb13
-rw-r--r--tool/lib/envutil.rb121
-rw-r--r--tool/lib/gem_env.rb1
-rw-r--r--tool/lib/launchable.rb91
-rw-r--r--tool/lib/leakchecker.rb12
-rw-r--r--tool/lib/memory_status.rb100
-rw-r--r--tool/lib/path.rb16
-rw-r--r--tool/lib/test/jobserver.rb47
-rw-r--r--tool/lib/test/unit.rb160
-rw-r--r--tool/lib/test/unit/assertions.rb34
-rw-r--r--tool/lib/test/unit/parallel.rb13
-rw-r--r--tool/lib/vcs.rb319
-rw-r--r--tool/lib/webrick.rb232
-rw-r--r--tool/lib/webrick/.document6
-rw-r--r--tool/lib/webrick/accesslog.rb157
-rw-r--r--tool/lib/webrick/cgi.rb313
-rw-r--r--tool/lib/webrick/compat.rb36
-rw-r--r--tool/lib/webrick/config.rb158
-rw-r--r--tool/lib/webrick/cookie.rb172
-rw-r--r--tool/lib/webrick/htmlutils.rb30
-rw-r--r--tool/lib/webrick/httpauth.rb96
-rw-r--r--tool/lib/webrick/httpauth/authenticator.rb117
-rw-r--r--tool/lib/webrick/httpauth/basicauth.rb116
-rw-r--r--tool/lib/webrick/httpauth/digestauth.rb395
-rw-r--r--tool/lib/webrick/httpauth/htdigest.rb132
-rw-r--r--tool/lib/webrick/httpauth/htgroup.rb97
-rw-r--r--tool/lib/webrick/httpauth/htpasswd.rb158
-rw-r--r--tool/lib/webrick/httpauth/userdb.rb53
-rw-r--r--tool/lib/webrick/httpproxy.rb354
-rw-r--r--tool/lib/webrick/httprequest.rb636
-rw-r--r--tool/lib/webrick/httpresponse.rb564
-rw-r--r--tool/lib/webrick/https.rb152
-rw-r--r--tool/lib/webrick/httpserver.rb293
-rw-r--r--tool/lib/webrick/httpservlet.rb23
-rw-r--r--tool/lib/webrick/httpservlet/abstract.rb152
-rw-r--r--tool/lib/webrick/httpservlet/cgi_runner.rb47
-rw-r--r--tool/lib/webrick/httpservlet/cgihandler.rb126
-rw-r--r--tool/lib/webrick/httpservlet/erbhandler.rb88
-rw-r--r--tool/lib/webrick/httpservlet/filehandler.rb552
-rw-r--r--tool/lib/webrick/httpservlet/prochandler.rb47
-rw-r--r--tool/lib/webrick/httpstatus.rb194
-rw-r--r--tool/lib/webrick/httputils.rb512
-rw-r--r--tool/lib/webrick/httpversion.rb76
-rw-r--r--tool/lib/webrick/log.rb156
-rw-r--r--tool/lib/webrick/server.rb381
-rw-r--r--tool/lib/webrick/ssl.rb215
-rw-r--r--tool/lib/webrick/utils.rb265
-rw-r--r--tool/lib/webrick/version.rb18
-rw-r--r--tool/lrama/NEWS.md704
-rwxr-xr-xtool/lrama/exe/lrama3
-rw-r--r--tool/lrama/lib/lrama.rb39
-rw-r--r--tool/lrama/lib/lrama/bitmap.rb26
-rw-r--r--tool/lrama/lib/lrama/command.rb145
-rw-r--r--tool/lrama/lib/lrama/context.rb60
-rw-r--r--tool/lrama/lib/lrama/counterexamples.rb336
-rw-r--r--tool/lrama/lib/lrama/counterexamples/derivation.rb31
-rw-r--r--tool/lrama/lib/lrama/counterexamples/example.rb76
-rw-r--r--tool/lrama/lib/lrama/counterexamples/node.rb30
-rw-r--r--tool/lrama/lib/lrama/counterexamples/path.rb24
-rw-r--r--tool/lrama/lib/lrama/counterexamples/production_path.rb17
-rw-r--r--tool/lrama/lib/lrama/counterexamples/start_path.rb21
-rw-r--r--tool/lrama/lib/lrama/counterexamples/state_item.rb27
-rw-r--r--tool/lrama/lib/lrama/counterexamples/transition_path.rb17
-rw-r--r--tool/lrama/lib/lrama/counterexamples/triple.rb38
-rw-r--r--tool/lrama/lib/lrama/diagram.rb77
-rw-r--r--tool/lrama/lib/lrama/digraph.rb55
-rw-r--r--tool/lrama/lib/lrama/erb.rb29
-rw-r--r--tool/lrama/lib/lrama/grammar.rb334
-rw-r--r--tool/lrama/lib/lrama/grammar/auxiliary.rb9
-rw-r--r--tool/lrama/lib/lrama/grammar/binding.rb75
-rw-r--r--tool/lrama/lib/lrama/grammar/code.rb29
-rw-r--r--tool/lrama/lib/lrama/grammar/code/destructor_code.rb13
-rw-r--r--tool/lrama/lib/lrama/grammar/code/initial_action_code.rb5
-rw-r--r--tool/lrama/lib/lrama/grammar/code/no_reference_code.rb5
-rw-r--r--tool/lrama/lib/lrama/grammar/code/printer_code.rb13
-rw-r--r--tool/lrama/lib/lrama/grammar/code/rule_action.rb27
-rw-r--r--tool/lrama/lib/lrama/grammar/counter.rb12
-rw-r--r--tool/lrama/lib/lrama/grammar/destructor.rb17
-rw-r--r--tool/lrama/lib/lrama/grammar/error_token.rb17
-rw-r--r--tool/lrama/lib/lrama/grammar/inline.rb3
-rw-r--r--tool/lrama/lib/lrama/grammar/inline/resolver.rb80
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterized.rb5
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterized/resolver.rb73
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterized/rhs.rb45
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterized/rule.rb36
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterizing_rule.rb3
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterizing_rule/resolver.rb56
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterizing_rule/rhs.rb37
-rw-r--r--tool/lrama/lib/lrama/grammar/parameterizing_rule/rule.rb18
-rw-r--r--tool/lrama/lib/lrama/grammar/percent_code.rb15
-rw-r--r--tool/lrama/lib/lrama/grammar/precedence.rb46
-rw-r--r--tool/lrama/lib/lrama/grammar/printer.rb11
-rw-r--r--tool/lrama/lib/lrama/grammar/reference.rb15
-rw-r--r--tool/lrama/lib/lrama/grammar/rule.rb83
-rw-r--r--tool/lrama/lib/lrama/grammar/rule_builder.rb214
-rw-r--r--tool/lrama/lib/lrama/grammar/stdlib.y116
-rw-r--r--tool/lrama/lib/lrama/grammar/symbol.rb84
-rw-r--r--tool/lrama/lib/lrama/grammar/symbols.rb2
-rw-r--r--tool/lrama/lib/lrama/grammar/symbols/resolver.rb77
-rw-r--r--tool/lrama/lib/lrama/grammar/type.rb16
-rw-r--r--tool/lrama/lib/lrama/grammar/union.rb15
-rw-r--r--tool/lrama/lib/lrama/lexer.rb99
-rw-r--r--tool/lrama/lib/lrama/lexer/grammar_file.rb11
-rw-r--r--tool/lrama/lib/lrama/lexer/location.rb53
-rw-r--r--tool/lrama/lib/lrama/lexer/token.rb64
-rw-r--r--tool/lrama/lib/lrama/lexer/token/base.rb73
-rw-r--r--tool/lrama/lib/lrama/lexer/token/char.rb20
-rw-r--r--tool/lrama/lib/lrama/lexer/token/empty.rb14
-rw-r--r--tool/lrama/lib/lrama/lexer/token/ident.rb7
-rw-r--r--tool/lrama/lib/lrama/lexer/token/instantiate_rule.rb13
-rw-r--r--tool/lrama/lib/lrama/lexer/token/int.rb14
-rw-r--r--tool/lrama/lib/lrama/lexer/token/str.rb11
-rw-r--r--tool/lrama/lib/lrama/lexer/token/tag.rb10
-rw-r--r--tool/lrama/lib/lrama/lexer/token/token.rb11
-rw-r--r--tool/lrama/lib/lrama/lexer/token/user_code.rb112
-rw-r--r--tool/lrama/lib/lrama/logger.rb31
-rw-r--r--tool/lrama/lib/lrama/option_parser.rb157
-rw-r--r--tool/lrama/lib/lrama/options.rb34
-rw-r--r--tool/lrama/lib/lrama/output.rb120
-rw-r--r--tool/lrama/lib/lrama/parser.rb1743
-rw-r--r--tool/lrama/lib/lrama/report.rb2
-rw-r--r--tool/lrama/lib/lrama/report/duration.rb25
-rw-r--r--tool/lrama/lib/lrama/report/profile.rb14
-rw-r--r--tool/lrama/lib/lrama/reporter.rb39
-rw-r--r--tool/lrama/lib/lrama/reporter/conflicts.rb44
-rw-r--r--tool/lrama/lib/lrama/reporter/grammar.rb39
-rw-r--r--tool/lrama/lib/lrama/reporter/precedences.rb54
-rw-r--r--tool/lrama/lib/lrama/reporter/profile.rb4
-rw-r--r--tool/lrama/lib/lrama/reporter/profile/call_stack.rb45
-rw-r--r--tool/lrama/lib/lrama/reporter/profile/memory.rb44
-rw-r--r--tool/lrama/lib/lrama/reporter/rules.rb43
-rw-r--r--tool/lrama/lib/lrama/reporter/states.rb387
-rw-r--r--tool/lrama/lib/lrama/reporter/terms.rb44
-rw-r--r--tool/lrama/lib/lrama/state.rb452
-rw-r--r--tool/lrama/lib/lrama/state/action.rb5
-rw-r--r--tool/lrama/lib/lrama/state/action/goto.rb33
-rw-r--r--tool/lrama/lib/lrama/state/action/reduce.rb71
-rw-r--r--tool/lrama/lib/lrama/state/action/shift.rb39
-rw-r--r--tool/lrama/lib/lrama/state/inadequacy_annotation.rb140
-rw-r--r--tool/lrama/lib/lrama/state/item.rb120
-rw-r--r--tool/lrama/lib/lrama/state/reduce.rb35
-rw-r--r--tool/lrama/lib/lrama/state/reduce_reduce_conflict.rb17
-rw-r--r--tool/lrama/lib/lrama/state/resolved_conflict.rb46
-rw-r--r--tool/lrama/lib/lrama/state/shift.rb13
-rw-r--r--tool/lrama/lib/lrama/state/shift_reduce_conflict.rb17
-rw-r--r--tool/lrama/lib/lrama/states.rb651
-rw-r--r--tool/lrama/lib/lrama/states/item.rb81
-rw-r--r--tool/lrama/lib/lrama/states_reporter.rb321
-rw-r--r--tool/lrama/lib/lrama/tracer.rb51
-rw-r--r--tool/lrama/lib/lrama/tracer/actions.rb22
-rw-r--r--tool/lrama/lib/lrama/tracer/closure.rb30
-rw-r--r--tool/lrama/lib/lrama/tracer/duration.rb38
-rw-r--r--tool/lrama/lib/lrama/tracer/only_explicit_rules.rb24
-rw-r--r--tool/lrama/lib/lrama/tracer/rules.rb23
-rw-r--r--tool/lrama/lib/lrama/tracer/state.rb33
-rw-r--r--tool/lrama/lib/lrama/version.rb5
-rw-r--r--tool/lrama/lib/lrama/warning.rb25
-rw-r--r--tool/lrama/lib/lrama/warnings.rb33
-rw-r--r--tool/lrama/lib/lrama/warnings/conflicts.rb27
-rw-r--r--tool/lrama/lib/lrama/warnings/implicit_empty.rb29
-rw-r--r--tool/lrama/lib/lrama/warnings/name_conflicts.rb63
-rw-r--r--tool/lrama/lib/lrama/warnings/redefined_rules.rb23
-rw-r--r--tool/lrama/lib/lrama/warnings/required.rb23
-rw-r--r--tool/lrama/lib/lrama/warnings/useless_precedence.rb25
-rw-r--r--tool/lrama/template/bison/_yacc.h8
-rw-r--r--tool/lrama/template/bison/yacc.c43
-rw-r--r--tool/lrama/template/diagram/diagram.html102
-rw-r--r--tool/m4/ruby_append_option.m44
-rw-r--r--tool/m4/ruby_check_builtin_overflow.m428
-rw-r--r--tool/m4/ruby_check_builtin_setjmp.m42
-rw-r--r--tool/m4/ruby_defint.m43
-rw-r--r--tool/m4/ruby_modular_gc.m441
-rw-r--r--tool/m4/ruby_setjmp_type.m419
-rw-r--r--tool/m4/ruby_shared_gc.m419
-rw-r--r--tool/m4/ruby_try_cflags.m417
-rwxr-xr-xtool/make-snapshot103
-rwxr-xr-xtool/merger.rb24
-rwxr-xr-xtool/missing-baseruby.bat15
-rw-r--r--tool/mk_builtin_loader.rb58
-rwxr-xr-xtool/mk_rbbin.rb48
-rwxr-xr-xtool/mkconfig.rb12
-rwxr-xr-xtool/mkrunnable.rb5
-rw-r--r--tool/notes-github-pr.rb138
-rw-r--r--tool/notify-slack-commits.rb87
-rwxr-xr-xtool/outdate-bundled-gems.rb2
-rw-r--r--tool/prereq.status3
-rwxr-xr-xtool/rbinstall.rb232
-rw-r--r--tool/rbs_skip_tests62
-rw-r--r--tool/rbs_skip_tests_windows111
-rwxr-xr-xtool/rdoc-srcdir14
-rwxr-xr-xtool/redmine-backporter.rb25
-rwxr-xr-xtool/release.sh7
-rwxr-xr-xtool/releng/gen-mail.rb2
-rwxr-xr-xtool/releng/update-www-meta.rb25
-rwxr-xr-xtool/rjit/bindgen.rb665
-rwxr-xr-xtool/ruby-version.rb52
-rw-r--r--tool/ruby_vm/controllers/application_controller.rb1
-rw-r--r--tool/ruby_vm/helpers/c_escape.rb1
-rw-r--r--tool/ruby_vm/helpers/dumper.rb1
-rw-r--r--tool/ruby_vm/helpers/scanner.rb1
-rw-r--r--tool/ruby_vm/loaders/insns_def.rb1
-rw-r--r--tool/ruby_vm/loaders/opt_insn_unif_def.rb1
-rw-r--r--tool/ruby_vm/loaders/opt_operand_def.rb1
-rw-r--r--tool/ruby_vm/loaders/vm_opts_h.rb1
-rw-r--r--tool/ruby_vm/models/attribute.rb1
-rw-r--r--tool/ruby_vm/models/bare_instruction.rb236
-rwxr-xr-xtool/ruby_vm/models/bare_instructions.rb240
-rw-r--r--tool/ruby_vm/models/c_expr.rb1
-rw-r--r--tool/ruby_vm/models/instructions.rb19
-rw-r--r--tool/ruby_vm/models/instructions_unification.rb42
-rw-r--r--tool/ruby_vm/models/instructions_unifications.rb43
-rw-r--r--tool/ruby_vm/models/operands_unification.rb141
-rw-r--r--tool/ruby_vm/models/operands_unifications.rb142
-rw-r--r--tool/ruby_vm/models/trace_instruction.rb70
-rw-r--r--tool/ruby_vm/models/trace_instructions.rb71
-rw-r--r--tool/ruby_vm/models/typemap.rb1
-rw-r--r--tool/ruby_vm/models/zjit_instruction.rb56
-rw-r--r--tool/ruby_vm/scripts/insns2vm.rb1
-rw-r--r--tool/ruby_vm/tests/.gitkeep0
-rw-r--r--tool/ruby_vm/views/_comptime_insn_stack_increase.erb25
-rw-r--r--tool/ruby_vm/views/_insn_leaf_info.erb18
-rw-r--r--tool/ruby_vm/views/_insn_len_info.erb12
-rw-r--r--tool/ruby_vm/views/_insn_name_info.erb33
-rw-r--r--tool/ruby_vm/views/_insn_operand_info.erb32
-rw-r--r--tool/ruby_vm/views/_insn_sp_pc_dependency.erb27
-rw-r--r--tool/ruby_vm/views/_leaf_helpers.erb6
-rw-r--r--tool/ruby_vm/views/_sp_inc_helpers.erb2
-rw-r--r--tool/ruby_vm/views/_zjit_helpers.erb31
-rw-r--r--tool/ruby_vm/views/_zjit_instruction.erb12
-rw-r--r--tool/ruby_vm/views/insns.inc.erb17
-rw-r--r--tool/ruby_vm/views/insns_info.inc.erb6
-rw-r--r--tool/ruby_vm/views/lib/ruby_vm/rjit/instruction.rb.erb2
-rw-r--r--tool/ruby_vm/views/optinsn.inc.erb4
-rw-r--r--tool/ruby_vm/views/optunifs.inc.erb5
-rw-r--r--tool/ruby_vm/views/vm.inc.erb12
-rw-r--r--tool/ruby_vm/views/vmtc.inc.erb10
-rw-r--r--tool/run-gcov.rb3
-rw-r--r--tool/run-lcov.rb14
-rwxr-xr-xtool/sync_default_gems.rb1165
-rwxr-xr-xtool/test-annocheck.sh11
-rw-r--r--tool/test-bundled-gems.rb78
-rw-r--r--tool/test-coverage.rb4
-rw-r--r--tool/test/init.rb12
-rw-r--r--tool/test/test_commit_email.rb102
-rwxr-xr-xtool/test/test_sync_default_gems.rb104
-rw-r--r--tool/test/testunit/test_assertion.rb162
-rw-r--r--tool/test/testunit/test_hideskip.rb1
-rw-r--r--tool/test/testunit/test_launchable.rb3
-rw-r--r--tool/test/testunit/test_parallel.rb85
-rw-r--r--tool/test/testunit/tests_for_parallel/ptest_forth.rb8
-rw-r--r--tool/test/testunit/tests_for_parallel/test4test_hungup.rb2
-rw-r--r--tool/test/testunit/tests_for_parallel/test4test_slow_0.rb5
-rw-r--r--tool/test/testunit/tests_for_parallel/test4test_slow_1.rb5
-rw-r--r--tool/test/webrick/.htaccess1
-rw-r--r--tool/test/webrick/test_cgi.rb148
-rw-r--r--tool/test/webrick/test_config.rb17
-rw-r--r--tool/test/webrick/test_cookie.rb141
-rw-r--r--tool/test/webrick/test_do_not_reverse_lookup.rb71
-rw-r--r--tool/test/webrick/test_filehandler.rb397
-rw-r--r--tool/test/webrick/test_htgroup.rb19
-rw-r--r--tool/test/webrick/test_htmlutils.rb21
-rw-r--r--tool/test/webrick/test_httpauth.rb366
-rw-r--r--tool/test/webrick/test_httpproxy.rb467
-rw-r--r--tool/test/webrick/test_httprequest.rb488
-rw-r--r--tool/test/webrick/test_httpresponse.rb282
-rw-r--r--tool/test/webrick/test_https.rb112
-rw-r--r--tool/test/webrick/test_httpserver.rb543
-rw-r--r--tool/test/webrick/test_httpstatus.rb35
-rw-r--r--tool/test/webrick/test_httputils.rb101
-rw-r--r--tool/test/webrick/test_httpversion.rb41
-rw-r--r--tool/test/webrick/test_server.rb191
-rw-r--r--tool/test/webrick/test_ssl_server.rb67
-rw-r--r--tool/test/webrick/test_utils.rb110
-rw-r--r--tool/test/webrick/utils.rb104
-rwxr-xr-xtool/test/webrick/webrick.cgi38
-rw-r--r--tool/test/webrick/webrick.rhtml4
-rw-r--r--tool/test/webrick/webrick_long_filename.cgi36
-rw-r--r--tool/test_for_warn_bundled_gems/.gitignore1
-rw-r--r--tool/test_for_warn_bundled_gems/Gemfile0
-rw-r--r--tool/test_for_warn_bundled_gems/Gemfile.lock11
-rw-r--r--tool/test_for_warn_bundled_gems/README.md3
-rwxr-xr-xtool/test_for_warn_bundled_gems/test.sh53
-rw-r--r--tool/test_for_warn_bundled_gems/test_no_warn_dash_gem.rb8
-rw-r--r--tool/test_for_warn_bundled_gems/test_no_warn_dependency.rb10
-rw-r--r--tool/test_for_warn_bundled_gems/test_no_warn_sub_feature.rb8
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_bootsnap.rb11
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb11
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_bundle_exec.rb1
-rwxr-xr-xtool/test_for_warn_bundled_gems/test_warn_bundle_exec_shebang.rb3
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_bundled_gems.rb8
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_dash_gem.rb7
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_dependency.rb8
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_sub_feature.rb7
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_zeitwerk.rb12
-rwxr-xr-xtool/update-NEWS-gemlist.rb21
-rwxr-xr-xtool/update-bundled_gems.rb9
-rwxr-xr-xtool/update-deps31
-rwxr-xr-xtool/zjit_bisect.rb158
-rw-r--r--tool/zjit_iongraph.html551
-rwxr-xr-xtool/zjit_iongraph.rb38
-rw-r--r--trace_point.rb355
-rw-r--r--transcode.c346
-rw-r--r--universal_parser.c21
-rw-r--r--util.c41
-rw-r--r--variable.c2242
-rw-r--r--variable.h28
-rw-r--r--vcpkg.json4
-rw-r--r--version.c163
-rw-r--r--vm.c822
-rw-r--r--vm_args.c295
-rw-r--r--vm_backtrace.c197
-rw-r--r--vm_callinfo.h200
-rw-r--r--vm_core.h404
-rw-r--r--vm_debug.h8
-rw-r--r--vm_dump.c365
-rw-r--r--vm_eval.c313
-rw-r--r--vm_exec.c6
-rw-r--r--vm_exec.h19
-rw-r--r--vm_insnhelper.c1363
-rw-r--r--vm_insnhelper.h17
-rw-r--r--vm_method.c883
-rw-r--r--vm_sync.c116
-rw-r--r--vm_sync.h31
-rw-r--r--vm_trace.c367
-rw-r--r--warning.rb8
-rw-r--r--wasm/README.md60
-rw-r--r--wasm/missing.c7
-rw-r--r--wasm/setjmp.c8
-rw-r--r--wasm/setjmp.h3
-rw-r--r--weakmap.c505
-rw-r--r--win32/Makefile.sub355
-rwxr-xr-xwin32/configure.bat249
-rw-r--r--win32/dir.h2
-rw-r--r--win32/file.c10
-rwxr-xr-xwin32/ifchange.bat136
-rwxr-xr-xwin32/install-buildtools.cmd14
-rwxr-xr-xwin32/install-msys-packages.cmd29
-rwxr-xr-xwin32/lastrev.bat30
-rwxr-xr-xwin32/makedirs.bat2
-rwxr-xr-xwin32/mkexports.rb21
-rwxr-xr-xwin32/rm.bat72
-rwxr-xr-xwin32/rmdirs.bat8
-rwxr-xr-xwin32/rtname.cmd1
-rw-r--r--win32/setup.mak122
-rwxr-xr-xwin32/vssetup.cmd56
-rw-r--r--win32/win32.c744
-rw-r--r--win32/winmain.c4
-rw-r--r--yjit.c857
-rw-r--r--yjit.h8
-rw-r--r--yjit.rb157
-rw-r--r--yjit/Cargo.lock8
-rw-r--r--yjit/Cargo.toml44
-rw-r--r--yjit/bindgen/Cargo.lock354
-rw-r--r--yjit/bindgen/Cargo.toml6
-rw-r--r--yjit/bindgen/src/main.rs166
-rw-r--r--yjit/not_gmake.mk2
-rw-r--r--yjit/src/asm/arm64/arg/bitmask_imm.rs2
-rw-r--r--yjit/src/asm/arm64/arg/sys_reg.rs4
-rw-r--r--yjit/src/asm/arm64/inst/atomic.rs4
-rw-r--r--yjit/src/asm/arm64/inst/branch.rs8
-rw-r--r--yjit/src/asm/arm64/inst/branch_cond.rs4
-rw-r--r--yjit/src/asm/arm64/inst/breakpoint.rs4
-rw-r--r--yjit/src/asm/arm64/inst/call.rs6
-rw-r--r--yjit/src/asm/arm64/inst/conditional.rs4
-rw-r--r--yjit/src/asm/arm64/inst/data_imm.rs12
-rw-r--r--yjit/src/asm/arm64/inst/data_reg.rs12
-rw-r--r--yjit/src/asm/arm64/inst/halfword_imm.rs14
-rw-r--r--yjit/src/asm/arm64/inst/load_literal.rs4
-rw-r--r--yjit/src/asm/arm64/inst/load_register.rs4
-rw-r--r--yjit/src/asm/arm64/inst/load_store.rs22
-rw-r--r--yjit/src/asm/arm64/inst/load_store_exclusive.rs6
-rw-r--r--yjit/src/asm/arm64/inst/logical_imm.rs14
-rw-r--r--yjit/src/asm/arm64/inst/logical_reg.rs18
-rw-r--r--yjit/src/asm/arm64/inst/madd.rs2
-rw-r--r--yjit/src/asm/arm64/inst/mov.rs6
-rw-r--r--yjit/src/asm/arm64/inst/nop.rs2
-rw-r--r--yjit/src/asm/arm64/inst/pc_rel.rs6
-rw-r--r--yjit/src/asm/arm64/inst/reg_pair.rs26
-rw-r--r--yjit/src/asm/arm64/inst/sbfm.rs6
-rw-r--r--yjit/src/asm/arm64/inst/shift_imm.rs6
-rw-r--r--yjit/src/asm/arm64/inst/smulh.rs2
-rw-r--r--yjit/src/asm/arm64/inst/sys_reg.rs6
-rw-r--r--yjit/src/asm/arm64/inst/test_bit.rs6
-rw-r--r--yjit/src/asm/arm64/mod.rs4
-rw-r--r--yjit/src/asm/mod.rs91
-rw-r--r--yjit/src/asm/x86_64/mod.rs10
-rw-r--r--yjit/src/asm/x86_64/tests.rs1
-rw-r--r--yjit/src/backend/arm64/mod.rs40
-rw-r--r--yjit/src/backend/ir.rs381
-rw-r--r--yjit/src/backend/tests.rs19
-rw-r--r--yjit/src/backend/x86_64/mod.rs42
-rw-r--r--yjit/src/codegen.rs2814
-rw-r--r--yjit/src/core.rs1826
-rw-r--r--yjit/src/cruby.rs89
-rw-r--r--yjit/src/cruby_bindings.inc.rs718
-rw-r--r--yjit/src/disasm.rs159
-rw-r--r--yjit/src/invariants.rs36
-rw-r--r--yjit/src/lib.rs14
-rw-r--r--yjit/src/log.rs179
-rw-r--r--yjit/src/options.rs121
-rw-r--r--yjit/src/stats.rs255
-rw-r--r--yjit/src/utils.rs28
-rw-r--r--yjit/src/virtualmem.rs119
-rw-r--r--yjit/src/yjit.rs65
-rw-r--r--yjit/yjit.mk93
-rw-r--r--zjit.c325
-rw-r--r--zjit.h47
-rw-r--r--zjit.rb357
-rw-r--r--zjit/.gitignore2
-rw-r--r--zjit/Cargo.lock74
-rw-r--r--zjit/Cargo.toml23
-rw-r--r--zjit/bindgen/Cargo.lock392
-rw-r--r--zjit/bindgen/Cargo.toml12
-rw-r--r--zjit/bindgen/src/main.rs454
-rw-r--r--zjit/build.rs37
-rw-r--r--zjit/src/asm/arm64/README.md16
-rw-r--r--zjit/src/asm/arm64/arg/bitmask_imm.rs255
-rw-r--r--zjit/src/asm/arm64/arg/condition.rs52
-rw-r--r--zjit/src/asm/arm64/arg/inst_offset.rs47
-rw-r--r--zjit/src/asm/arm64/arg/mod.rs18
-rw-r--r--zjit/src/asm/arm64/arg/sf.rs19
-rw-r--r--zjit/src/asm/arm64/arg/shifted_imm.rs80
-rw-r--r--zjit/src/asm/arm64/arg/sys_reg.rs6
-rw-r--r--zjit/src/asm/arm64/arg/truncate.rs66
-rw-r--r--zjit/src/asm/arm64/inst/atomic.rs86
-rw-r--r--zjit/src/asm/arm64/inst/branch.rs100
-rw-r--r--zjit/src/asm/arm64/inst/branch_cond.rs78
-rw-r--r--zjit/src/asm/arm64/inst/breakpoint.rs55
-rw-r--r--zjit/src/asm/arm64/inst/call.rs104
-rw-r--r--zjit/src/asm/arm64/inst/conditional.rs73
-rw-r--r--zjit/src/asm/arm64/inst/data_imm.rs143
-rw-r--r--zjit/src/asm/arm64/inst/data_reg.rs192
-rw-r--r--zjit/src/asm/arm64/inst/halfword_imm.rs179
-rw-r--r--zjit/src/asm/arm64/inst/load_literal.rs91
-rw-r--r--zjit/src/asm/arm64/inst/load_register.rs108
-rw-r--r--zjit/src/asm/arm64/inst/load_store.rs255
-rw-r--r--zjit/src/asm/arm64/inst/load_store_exclusive.rs109
-rw-r--r--zjit/src/asm/arm64/inst/logical_imm.rs154
-rw-r--r--zjit/src/asm/arm64/inst/logical_reg.rs207
-rw-r--r--zjit/src/asm/arm64/inst/madd.rs73
-rw-r--r--zjit/src/asm/arm64/inst/mod.rs54
-rw-r--r--zjit/src/asm/arm64/inst/mov.rs192
-rw-r--r--zjit/src/asm/arm64/inst/nop.rs44
-rw-r--r--zjit/src/asm/arm64/inst/pc_rel.rs107
-rw-r--r--zjit/src/asm/arm64/inst/reg_pair.rs212
-rw-r--r--zjit/src/asm/arm64/inst/sbfm.rs103
-rw-r--r--zjit/src/asm/arm64/inst/shift_imm.rs147
-rw-r--r--zjit/src/asm/arm64/inst/smulh.rs60
-rw-r--r--zjit/src/asm/arm64/inst/sys_reg.rs86
-rw-r--r--zjit/src/asm/arm64/inst/test_bit.rs133
-rw-r--r--zjit/src/asm/arm64/mod.rs1981
-rw-r--r--zjit/src/asm/arm64/opnd.rs270
-rw-r--r--zjit/src/asm/mod.rs453
-rw-r--r--zjit/src/asm/x86_64/mod.rs1446
-rw-r--r--zjit/src/asm/x86_64/tests.rs966
-rw-r--r--zjit/src/backend/arm64/mod.rs2780
-rw-r--r--zjit/src/backend/lir.rs2674
-rw-r--r--zjit/src/backend/mod.rs18
-rw-r--r--zjit/src/backend/tests.rs307
-rw-r--r--zjit/src/backend/x86_64/mod.rs1825
-rw-r--r--zjit/src/bitset.rs126
-rw-r--r--zjit/src/cast.rs64
-rw-r--r--zjit/src/codegen.rs2897
-rw-r--r--zjit/src/cruby.rs1411
-rw-r--r--zjit/src/cruby_bindings.inc.rs2203
-rw-r--r--zjit/src/cruby_methods.rs885
-rw-r--r--zjit/src/disasm.rs52
-rw-r--r--zjit/src/distribution.rs276
-rw-r--r--zjit/src/gc.rs211
-rw-r--r--zjit/src/hir.rs7604
-rw-r--r--zjit/src/hir/opt_tests.rs11123
-rw-r--r--zjit/src/hir/tests.rs4567
-rw-r--r--zjit/src/hir_effect/gen_hir_effect.rb119
-rw-r--r--zjit/src/hir_effect/hir_effect.inc.rs55
-rw-r--r--zjit/src/hir_effect/mod.rs420
-rw-r--r--zjit/src/hir_type/gen_hir_type.rb225
-rw-r--r--zjit/src/hir_type/hir_type.inc.rs253
-rw-r--r--zjit/src/hir_type/mod.rs1063
-rw-r--r--zjit/src/invariants.rs475
-rw-r--r--zjit/src/json.rs700
-rw-r--r--zjit/src/lib.rs34
-rw-r--r--zjit/src/options.rs523
-rw-r--r--zjit/src/payload.rs116
-rw-r--r--zjit/src/profile.rs434
-rw-r--r--zjit/src/state.rs549
-rw-r--r--zjit/src/stats.rs944
-rw-r--r--zjit/src/ttycolors.rs31
-rw-r--r--zjit/src/virtualmem.rs488
-rw-r--r--zjit/zjit.mk140
6027 files changed, 374943 insertions, 485085 deletions
diff --git a/.document b/.document
index 0665d415b9..82ca602bfb 100644
--- a/.document
+++ b/.document
@@ -15,13 +15,14 @@ array.rb
ast.rb
dir.rb
gc.rb
+hash.rb
io.rb
kernel.rb
marshal.rb
-rjit.rb
numeric.rb
nilclass.rb
pack.rb
+pathname_builtin.rb
ractor.rb
string.rb
symbol.rb
@@ -30,6 +31,7 @@ thread_sync.rb
trace_point.rb
warning.rb
yjit.rb
+zjit.rb
# Errno::*
known_errors.inc
diff --git a/.gdbinit b/.gdbinit
index 7dd3336e28..bda544c641 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,23 +1,7 @@
-set startup-with-shell off
-
-define hook-run
- set $color_type = 0
- set $color_highlite = 0
- set $color_end = 0
-end
-
define ruby_gdb_init
- if !$color_type
- set $color_type = "\033[31m"
- end
- if !$color_highlite
- set $color_highlite = "\033[36m"
- end
- if !$color_end
- set $color_end = "\033[m"
- end
- if ruby_dummy_gdb_enums.special_consts
- end
+ init-if-undefined $color_type = "\033[31m"
+ init-if-undefined $color_highlite = "\033[36m"
+ init-if-undefined $color_end = "\033[m"
end
# set prompt \033[36m(gdb)\033[m\040
@@ -67,7 +51,7 @@ define rp
printf "%sT_OBJECT%s: ", $color_type, $color_end
print ((struct RObject *)($arg0))->basic
if ($flags & ROBJECT_EMBED)
- print/x *((VALUE*)((struct RObject*)($arg0))->as.ary) @ (rb_shape_get_shape($arg0)->capacity)
+ print/x *((VALUE*)((struct RObject*)($arg0))->as.ary) @ (RSHAPE_CAPACITY(rb_obj_shape_id($arg0)))
else
print (((struct RObject *)($arg0))->as.heap)
if (((struct RObject*)($arg0))->as.heap.numiv) > 0
@@ -99,13 +83,11 @@ define rp
set $regsrc = ((struct RRegexp*)($arg0))->src
set $rsflags = ((struct RBasic*)$regsrc)->flags
printf "%sT_REGEXP%s: ", $color_type, $color_end
- set $len = ($rsflags & RUBY_FL_USER1) ? \
- ((struct RString*)$regsrc)->as.heap.len : \
- (($rsflags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
+ set $len = ((struct RString*)($arg0))->len
set print address off
output *(char *)(($rsflags & RUBY_FL_USER1) ? \
((struct RString*)$regsrc)->as.heap.ptr : \
- ((struct RString*)$regsrc)->as.ary) @ $len
+ ((struct RString*)$regsrc)->as.embed.ary) @ $len
set print address on
printf " len:%ld ", $len
if $flags & RUBY_FL_USER6
@@ -157,13 +139,15 @@ define rp
if ($flags & RUBY_T_MASK) == RUBY_T_HASH
printf "%sT_HASH%s: ", $color_type, $color_end,
if (((struct RHash *)($arg0))->basic.flags & RHASH_ST_TABLE_FLAG)
- printf "st len=%ld ", ((struct RHash *)($arg0))->as.st->num_entries
+ set $st = (struct st_table *)((uintptr_t)($arg0) + sizeof(struct RHash))
+ printf "st len=%ld ", $st->num_entries
+ print $st
else
printf "li len=%ld bound=%ld ", \
((((struct RHash *)($arg0))->basic.flags & RHASH_AR_TABLE_SIZE_MASK) >> RHASH_AR_TABLE_SIZE_SHIFT), \
((((struct RHash *)($arg0))->basic.flags & RHASH_AR_TABLE_BOUND_MASK) >> RHASH_AR_TABLE_BOUND_SHIFT)
+ print (struct ar_table_struct *)((uintptr_t)($arg0) + sizeof(struct RHash))
end
- print (struct RHash *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_STRUCT
set $len = (($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \
@@ -201,12 +185,19 @@ define rp
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_DATA
- if ((struct RTypedData *)($arg0))->typed_flag == 1
- printf "%sT_DATA%s(%s): ", $color_type, $color_end, ((struct RTypedData *)($arg0))->type->wrap_struct_name
- print (struct RTypedData *)($arg0)
+ if ($flags & RUBY_TYPED_FL_IS_TYPED_DATA)
+ set $data = (struct RTypedData *)($arg0)
+ set $type = (const rb_data_type_t *)($data->type & ~1)
+ printf "%sT_DATA%s(%s): ", $color_type, $color_end, $type->wrap_struct_name
+ print *$type
+ if ($data->type & 1)
+ print (void *)&$data->data
+ else
+ print $data
+ end
else
printf "%sT_DATA%s: ", $color_type, $color_end
- print (struct RData *)($arg0)
+ print *(struct RData *)($arg0)
end
else
if ($flags & RUBY_T_MASK) == RUBY_T_MATCH
@@ -440,13 +431,11 @@ end
define output_string
set $flags = ((struct RBasic*)($arg0))->flags
- set $len = ($flags & RUBY_FL_USER1) ? \
- ((struct RString*)($arg0))->as.heap.len : \
- (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
+ set $len = ((struct RString*)($arg0))->len
if $len > 0
output *(char *)(($flags & RUBY_FL_USER1) ? \
((struct RString*)($arg0))->as.heap.ptr : \
- ((struct RString*)($arg0))->as.ary) @ $len
+ ((struct RString*)($arg0))->as.embed.ary) @ $len
else
output ""
end
@@ -454,13 +443,11 @@ end
define print_string
set $flags = ((struct RBasic*)($arg0))->flags
- set $len = ($flags & RUBY_FL_USER1) ? \
- ((struct RString*)($arg0))->as.heap.len : \
- (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
+ set $len = ((struct RString*)($arg0))->len
if $len > 0
printf "%s", *(char *)(($flags & RUBY_FL_USER1) ? \
((struct RString*)($arg0))->as.heap.ptr : \
- ((struct RString*)($arg0))->as.ary) @ $len
+ ((struct RString*)($arg0))->as.embed.ary) @ $len
end
end
@@ -543,14 +530,14 @@ document rp_bignum
end
define rp_class
+ set $class_and_classext = (struct RClass_and_rb_classext_t *)($arg0)
printf "(struct RClass *) %p", (void*)$arg0
- if RCLASS_ORIGIN((struct RClass *)($arg0)) != $arg0
- printf " -> %p", RCLASS_ORIGIN((struct RClass *)($arg0))
+ if $class_and_classext->classext->origin_ != (VALUE)$arg0
+ printf " -> %p", $class_and_classext->classext->origin_
end
printf "\n"
rb_classname $arg0
- print/x *(struct RClass *)($arg0)
- print *RCLASS_EXT((struct RClass *)($arg0))
+ print/x *$class_and_classext
end
document rp_class
Print the content of a Class/Module.
@@ -916,10 +903,10 @@ document rb_method_entry
end
define rb_classname
- # up to 128bit int
- set $rb_classname = rb_mod_name($arg0)
- if $rb_classname != RUBY_Qnil
- rp $rb_classname
+ set $rb_classname = ((struct RClass_and_rb_classext_t*)$arg0)->classext->classpath
+ if $rb_classname != RUBY_Qfalse
+ print_string $rb_classname
+ printf "\n"
else
echo anonymous class/module\n
end
@@ -1126,7 +1113,7 @@ define rb_ps_thread
set $ps_thread = (struct RTypedData*)$arg0
set $ps_thread_th = (rb_thread_t*)$ps_thread->data
printf "* #<Thread:%p rb_thread_t:%p native_thread:%p>\n", \
- $ps_thread, $ps_thread_th, $ps_thread_th->thread_id
+ $ps_thread, $ps_thread_th, $ps_thread_th->nt
set $cfp = $ps_thread_th->ec->cfp
set $cfpend = (rb_control_frame_t *)($ps_thread_th->ec->vm_stack + $ps_thread_th->ec->vm_stack_size)-1
while $cfp < $cfpend
@@ -1311,13 +1298,12 @@ define dump_node
set $flags = ((struct RBasic*)($str))->flags
printf "%s", (char *)(($flags & RUBY_FL_USER1) ? \
((struct RString*)$str)->as.heap.ptr : \
- ((struct RString*)$str)->as.ary)
+ ((struct RString*)$str)->as.embed.ary)
end
define print_flags
printf "RUBY_FL_WB_PROTECTED: %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_WB_PROTECTED ? "1" : "0"
- printf "RUBY_FL_PROMOTED0 : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_PROMOTED0 ? "1" : "0"
- printf "RUBY_FL_PROMOTED1 : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_PROMOTED1 ? "1" : "0"
+ printf "RUBY_FL_PROMOTED : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_PROMOTED ? "1" : "0"
printf "RUBY_FL_FINALIZE : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_FINALIZE ? "1" : "0"
printf "RUBY_FL_SHAREABLE : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_SHAREABLE ? "1" : "0"
printf "RUBY_FL_EXIVAR : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_EXIVAR ? "1" : "0"
@@ -1344,4 +1330,7 @@ define print_flags
printf "RUBY_FL_USER18 : %s\n", ((struct RBasic*)($arg0))->flags & RUBY_FL_USER18 ? "1" : "0"
end
-source misc/gdb.py
+source -s misc/gdb.py
+
+# Moved from beginning, since it fails on older gdbs
+set startup-with-shell off
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 1cafd3df75..d98646febf 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -6,6 +6,11 @@
# Expand tabs
5b21e94bebed90180d8ff63dad03b8b948361089
c5e9af9c9d890578182a21e7b71b50334cd5579e
+e63a2115f64433b21cb5dd67c5bf8b30f87ef293
+712ac99e4d0384a941c80a9f48f62943ba7d97c0
+d1474affa8e105bece209cc9d594bb0a989859e1
+2da92388b948821269b18d6b178a680f17e41750
+5062c0c621d887367af8a054e5e5d83d7ec57dd3
# Enable Style/StringLiterals cop for RubyGems/Bundler
d7ffd3fea402239b16833cc434404a7af82d44f3
@@ -30,3 +35,7 @@ d2c5867357ed88eccc28c2b3bd4a46e206e7ff85
# Miss-and-revived commits
a0f7de814ae5c299d6ce99bed5fb308a05d50ba0
d4e24021d39e1f80f0055b55d91f8d5f22e15084
+7a56c316418980b8a41fcbdc94067b2bda2ad112
+e90282be7ba1bc8e3119f6e1a2c80356ceb3f80a
+26a9e0b4e31f7b5a9cbd755e0a15823a8fa51bae
+2f53985da9ee593fe524d408256835667938c7d7
diff --git a/.gitattributes b/.gitattributes
index d0c2d266b4..6ac6e6fcc3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,5 +1,6 @@
*.gemspec diff=ruby
*.rb diff=ruby
+*.inc.rs linguist-generated=true
bin svn-properties=svn:ignore=ruby
bin/* diff=ruby
tool/update-deps diff=ruby
diff --git a/.github/actions/capiext/action.yml b/.github/actions/capiext/action.yml
new file mode 100644
index 0000000000..49562725f4
--- /dev/null
+++ b/.github/actions/capiext/action.yml
@@ -0,0 +1,86 @@
+name: rubyspec C-API extensions
+
+inputs:
+ builddir:
+ required: false
+ default: '.'
+ make:
+ required: false
+ default: 'make -s'
+
+outputs:
+ key:
+ value: >-
+ ${{
+ !steps.restore.outputs.cache-hit &&
+ github.ref == 'refs/heads/master' &&
+ steps.config.outputs.key
+ }}
+
+runs:
+ using: composite
+
+ steps:
+ - id: config
+ shell: bash
+ run: |
+ eval $(grep -e '^arch *=' -e '^ruby_version *=' -e '^DLEXT *=' Makefile |
+ sed 's/ *= */=/')
+ case "${ruby_version}" in
+ *+*) key=capiexts-${arch}-${ruby_version}-${{ hashFiles('src/spec/ruby/optional/capi/ext/*.[ch]') }};;
+ *) key=;;
+ esac
+ echo version=$ruby_version >> $GITHUB_OUTPUT
+ echo key="$key" >> $GITHUB_OUTPUT
+ echo DLEXT=$DLEXT >> $GITHUB_OUTPUT
+ working-directory: ${{ inputs.builddir }}
+
+ - name: Restore previous CAPI extensions
+ uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
+ id: cache
+ with:
+ path: ${{ inputs.builddir }}/spec/ruby/optional/capi/ext/
+ key: ${{ steps.config.outputs.key }}
+ if: ${{ steps.config.outputs.key }}
+
+ - name: Run test-spec with previous CAPI extension binaries
+ id: check
+ shell: bash
+ run: |
+ touch spec/ruby/optional/capi/ext/*.$DLEXT
+ [ ! -f spec/ruby/optional/capi/ext/\*.$DLEXT ]
+ ${{ inputs.make }} SPECOPTS=optional/capi test-spec
+ env:
+ DLEXT: ${{ steps.config.outputs.DLEXT }}
+ working-directory: ${{ inputs.builddir }}
+ if: ${{ steps.cache.outputs.cache-hit }}
+
+ - name: Strip CAPI extensions
+ id: strip
+ shell: bash
+ run: |
+ rm -f spec/ruby/optional/capi/ext/*.c
+ [ "$DLEXT" = bundle ] || # separated to .dSYM directories
+ strip spec/ruby/optional/capi/ext/*.$DLEXT
+ env:
+ DLEXT: ${{ steps.config.outputs.DLEXT }}
+ working-directory: ${{ inputs.builddir }}
+ if: >-
+ ${{true
+ && ! steps.cache.outputs.cache-hit
+ && github.ref_name == 'master'
+ }}
+
+ - name: Save CAPI extensions
+ uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
+ with:
+ path: ${{ inputs.builddir }}/spec/ruby/optional/capi/ext/
+ key: ${{ steps.config.outputs.key }}
+ if: ${{ steps.strip.outcome == 'success' }}
+
+ - shell: bash
+ run: |
+ echo "::error::Change from ${prev} detected; bump up ABI version"
+ env:
+ prev: ${{ steps.config.outputs.version }}
+ if: ${{ always() && steps.check.outcome == 'failure' }}
diff --git a/.github/actions/compilers/action.yml b/.github/actions/compilers/action.yml
new file mode 100644
index 0000000000..ab5b56a889
--- /dev/null
+++ b/.github/actions/compilers/action.yml
@@ -0,0 +1,133 @@
+name: Compiles ruby in a container
+description: >-
+ Makes ruby using a dedicated container
+
+inputs:
+ tag:
+ required: false
+ default: clang-20
+ description: >-
+ container image tag to use in this run.
+
+ with_gcc:
+ required: false
+ description: >-
+ override compiler path & flags.
+
+ CFLAGS:
+ required: false
+ description: >-
+ C compiler flags to override.
+
+ CXXFLAGS:
+ required: false
+ description: >-
+ C++ compiler flags to override.
+
+ optflags:
+ required: false
+ # -O1 is faster than -O3 in our tests... Majority of time are consumed trying
+ # to optimize binaries. Also GitHub Actions run on relatively modern CPUs
+ # compared to, say, GCC 4 or Clang 3. We don't specify `-march=native`
+ # because compilers tend not understand what the CPU is.
+ default: '-O1'
+ description: >-
+ Compiler flags for optimisations.
+
+ cppflags:
+ required: false
+ description: >-
+ Additional preprocessor flags.
+
+ append_configure:
+ required: false
+ default: >-
+ --without-valgrind
+ --without-jemalloc
+ --without-gmp
+ description: >-
+ flags to append to configure.
+
+ enable_shared:
+ required: false
+ default: true
+ description: >-
+ Whether to build libruby.so.
+
+ check:
+ required: false
+ default: ''
+ description: >-
+ Whether to run `make check`
+
+ test_all:
+ required: false
+ default: ''
+ description: >-
+ Whether to run `make test-all` with options for test-all.
+
+ test_spec:
+ required: false
+ default: ''
+ description: >-
+ Whether to run `make test-spec` with options for mspec.
+
+ static_exts:
+ required: false
+ description: >-
+ whitespace separated list of extensions that need be linked statically.
+
+runs:
+ using: composite
+ steps:
+ - shell: bash
+ run: docker pull --quiet 'ghcr.io/ruby/ruby-ci-image:${{ inputs.tag }}'
+
+ - name: Enable Launchable conditionally
+ id: enable-launchable
+ run: echo "enable-launchable=true" >> $GITHUB_OUTPUT
+ shell: bash
+ if: >-
+ ${{
+ github.repository == 'ruby/ruby' ||
+ (github.repository != 'ruby/ruby' && env.LAUNCHABLE_TOKEN)
+ }}
+
+ - name: compile
+ shell: bash
+ run: >-
+ docker run
+ --rm
+ --user=root
+ --volume '${{ github.workspace }}:/github/workspace:ro'
+ --workdir=/github/workspace
+ --entrypoint=/github/workspace/.github/actions/compilers/entrypoint.sh
+ --env CI
+ --env GITHUB_ACTION
+ --env INPUT_WITH_GCC='${{ inputs.with_gcc || inputs.tag }}'
+ --env INPUT_CFLAGS='${{ inputs.CFLAGS }}'
+ --env INPUT_CXXFLAGS='${{ inputs.CXXFLAGS }}'
+ --env INPUT_OPTFLAGS='${{ inputs.OPTFLAGS }}'
+ --env INPUT_CPPFLAGS='${{ inputs.cppflags }}'
+ --env INPUT_APPEND_CONFIGURE='${{ inputs.append_configure }}'
+ --env INPUT_CHECK='${{ inputs.check }}'
+ --env INPUT_TEST_ALL='${{ inputs.test_all }}'
+ --env INPUT_TEST_SPEC='${{ inputs.test_spec }}'
+ --env INPUT_ENABLE_SHARED='${{ inputs.enable_shared }}'
+ --env INPUT_STATIC_EXTS='${{ inputs.static_exts }}'
+ --env LAUNCHABLE_ORGANIZATION='${{ github.repository_owner }}'
+ --env LAUNCHABLE_WORKSPACE='${{ github.event.repository.name }}'
+ --env LAUNCHABLE_ENABLED='${{ steps.enable-launchable.outputs.enable-launchable || false }}'
+ --env GITHUB_PR_HEAD_SHA='${{ github.event.pull_request.head.sha || github.sha }}'
+ --env GITHUB_PULL_REQUEST_URL='${{ github.event.pull_request.html_url }}'
+ --env GITHUB_REF='${{ github.ref }}'
+ --env GITHUB_ACTIONS
+ --env GITHUB_RUN_ID
+ --env GITHUB_REPOSITORY
+ --env GITHUB_WORKFLOW
+ --env GITHUB_RUN_NUMBER
+ --env GITHUB_EVENT_NAME
+ --env GITHUB_SHA
+ --env GITHUB_HEAD_REF
+ --env GITHUB_SERVER_URL
+ 'ghcr.io/ruby/ruby-ci-image:${{ inputs.tag }}'
diff --git a/.github/actions/compilers/entrypoint.sh b/.github/actions/compilers/entrypoint.sh
new file mode 100755
index 0000000000..b554151091
--- /dev/null
+++ b/.github/actions/compilers/entrypoint.sh
@@ -0,0 +1,90 @@
+#! /bin/bash
+
+# Copyright (c) 2024 Ruby developers. All rights reserved.
+#
+# This file is a part of the programming language Ruby. Permission is hereby
+# granted, to either redistribute and/or modify this file, provided that the
+# conditions mentioned in the file COPYING are met. Consult the file for
+# details.
+
+grouped()
+{
+ echo "::group::${@}"
+ "${@}"
+ echo "::endgroup::"
+}
+
+set -e
+set -u
+set -o pipefail
+
+srcdir="/github/workspace/src"
+builddir="$(mktemp -dt)"
+
+export GITHUB_WORKFLOW='Compilations'
+export CONFIGURE_TTY='never'
+export RUBY_DEBUG='ci rgengc'
+export RUBY_TESTOPTS='-q --color=always --tty=no'
+export RUBY_DEBUG_COUNTER_DISABLE='1'
+export GNUMAKEFLAGS="-j$((1 + $(nproc)))"
+
+case "x${INPUT_ENABLE_SHARED}" in
+x | xno | xfalse )
+ enable_shared='--disable-shared'
+ ;;
+*)
+ enable_shared='--enable-shared'
+ ;;
+esac
+
+pushd ${builddir}
+
+grouped git config --global --add safe.directory ${srcdir}
+
+grouped ${srcdir}/configure \
+ -C \
+ --with-gcc="${INPUT_WITH_GCC}" \
+ --enable-debug-env \
+ --disable-install-doc \
+ --with-ext=-test-/cxxanyargs,+ \
+ --without-git \
+ ${enable_shared} \
+ ${INPUT_APPEND_CONFIGURE} \
+ CFLAGS="${INPUT_CFLAGS}" \
+ CXXFLAGS="${INPUT_CXXFLAGS}" \
+ optflags="${INPUT_OPTFLAGS}" \
+ cppflags="${INPUT_CPPFLAGS}" \
+ debugflags='-ggdb3' # -g0 disables backtraces when SEGV. Do not set that.
+
+popd
+
+if [[ -n "${INPUT_STATIC_EXTS}" ]]; then
+ echo "::group::ext/Setup"
+ set -x
+ mkdir ${builddir}/ext
+ (
+ for ext in ${INPUT_STATIC_EXTS}; do
+ echo "${ext}"
+ done
+ ) >> ${builddir}/ext/Setup
+ set +x
+ echo "::endgroup::"
+fi
+
+if [ -n "$INPUT_TEST_ALL" ]; then
+ tests=" -- $INPUT_TEST_ALL"
+else
+ tests=" -- ruby -ext-"
+fi
+
+pushd ${builddir}
+
+grouped make showflags
+grouped make all
+# grouped make install
+
+# Run only `make test` by default. Run other tests if specified.
+grouped make test
+if [[ -n "$INPUT_CHECK" ]]; then grouped make test-tool; fi
+if [[ -n "$INPUT_CHECK" || -n "$INPUT_TEST_ALL" ]]; then grouped make test-all TESTS="$tests"; fi
+if [[ -n "$INPUT_CHECK" || -n "$INPUT_TEST_SPEC" ]]; then grouped env CHECK_LEAKS=true make test-spec MSPECOPT="$INPUT_TEST_SPEC"; fi
diff --git a/.github/actions/launchable/setup/action.yml b/.github/actions/launchable/setup/action.yml
index 6d50318ded..16af8fc3fd 100644
--- a/.github/actions/launchable/setup/action.yml
+++ b/.github/actions/launchable/setup/action.yml
@@ -3,11 +3,6 @@ description: >-
Install the required dependencies and execute the necessary Launchable commands for test recording
inputs:
- report-path:
- default: launchable_reports.json
- required: true
- description: The file path of the test report for uploading to Launchable
-
os:
required: true
description: The operating system that CI runs on. This value is used in Launchable flavor.
@@ -35,9 +30,42 @@ inputs:
required: false
default: ${{ github.workspace }}
description: >-
- Directory to (re-)checkout source codes. Launchable retrives the commit information
+ Directory to (re-)checkout source codes. Launchable retrieves the commit information
from the directory.
+ test-task:
+ required: false
+ default: ${{ matrix.test_task }}
+ description: >-
+ Specifies a single test task to be executed.
+ This value is used in the Launchable flavor.
+ Either 'test-task' or 'multi-test-tasks' must be configured.
+
+ test-tasks:
+ required: false
+ default: '[]'
+ description: >-
+ Specifies an array of multiple test tasks to be executed.
+ For example: '["test", "test-all"]'.
+ If you want to run a single test task, use the 'test-task' input instead.
+
+ is-yjit:
+ required: false
+ default: 'false'
+ description: >-
+ Whether this workflow is executed on YJIT.
+
+outputs:
+ stdout_report_path:
+ value: ${{ steps.global.outputs.stdout_report_path }}
+ description: >-
+ Report file path for standard output.
+
+ stderr_report_path:
+ value: ${{ steps.global.outputs.stderr_report_path }}
+ description: >-
+ Report file path for standard error.
+
runs:
using: composite
@@ -48,9 +76,14 @@ runs:
shell: bash
if: >-
${{
- (github.repository == 'ruby/ruby' ||
- (github.repository != 'ruby/ruby' && env.LAUNCHABLE_TOKEN)) &&
- (matrix.test_task == 'check' || matrix.test_task == 'test-all')
+ (github.repository == 'ruby/ruby'
+ || (github.repository != 'ruby/ruby'
+ && env.LAUNCHABLE_TOKEN))
+ && (inputs.test-task == 'check'
+ || inputs.test-task == 'test-all'
+ || inputs.test-task == 'test'
+ || contains(fromJSON(inputs.test-tasks), 'test-all')
+ || contains(fromJSON(inputs.test-tasks), 'test'))
}}
# Launchable CLI requires Python and Java.
@@ -59,13 +92,54 @@ runs:
uses: actions/setup-python@871daa956ca9ea99f3c3e30acb424b7960676734 # v5.0.0
with:
python-version: "3.x"
- if: steps.enable-launchable.outputs.enable-launchable
+ if: >-
+ ${{ steps.enable-launchable.outputs.enable-launchable
+ && !endsWith(inputs.os, 'ppc64le') && !endsWith(inputs.os, 's390x') }}
- name: Set up Java
uses: actions/setup-java@7a445ee88d4e23b52c33fdc7601e40278616c7f8 # v4.0.0
with:
distribution: 'temurin'
java-version: '17'
+ if: >-
+ ${{ steps.enable-launchable.outputs.enable-launchable
+ && !endsWith(inputs.os, 'ppc64le') && !endsWith(inputs.os, 's390x') }}
+
+ - name: Set up Java ppc64le
+ uses: actions/setup-java@7a445ee88d4e23b52c33fdc7601e40278616c7f8 # v4.0.0
+ with:
+ distribution: 'semeru'
+ architecture: 'ppc64le'
+ java-version: '17'
+ if: >-
+ ${{ steps.enable-launchable.outputs.enable-launchable
+ && endsWith(inputs.os, 'ppc64le') }}
+
+ - name: Set up Java s390x
+ uses: actions/setup-java@7a445ee88d4e23b52c33fdc7601e40278616c7f8 # v4.0.0
+ with:
+ distribution: 'semeru'
+ architecture: 's390x'
+ java-version: '17'
+ if: >-
+ ${{ steps.enable-launchable.outputs.enable-launchable
+ && endsWith(inputs.os, 's390x') }}
+
+ - name: Set global vars
+ id: global
+ shell: bash
+ run: |
+ test_all_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test-all' || contains(fromJSON(inputs.test-tasks), 'test-all') }}"
+ btest_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test' || contains(fromJSON(inputs.test-tasks), 'test') }}"
+ test_spec_enabled="${{ inputs.test-task == 'check' || inputs.test-task == 'test-spec' || contains(fromJSON(inputs.test-tasks), 'test-spec') }}"
+ echo test_all_enabled="${test_all_enabled}" >> $GITHUB_OUTPUT
+ echo btest_enabled="${btest_enabled}" >> $GITHUB_OUTPUT
+ echo test_spec_enabled="${test_spec_enabled}" >> $GITHUB_OUTPUT
+ echo test_all_report_file='launchable_test_all_report.json' >> $GITHUB_OUTPUT
+ echo btest_report_file='launchable_btest_report.json' >> $GITHUB_OUTPUT
+ echo test_spec_report_dir='launchable_test_spec_report' >> $GITHUB_OUTPUT
+ echo stdout_report_path="launchable_stdout.log" >> $GITHUB_OUTPUT
+ echo stderr_report_path="launchable_stderr.log" >> $GITHUB_OUTPUT
if: steps.enable-launchable.outputs.enable-launchable
- name: Set environment variables for Launchable
@@ -81,64 +155,159 @@ runs:
: # https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L71
echo "GITHUB_PR_HEAD_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_ENV
echo "LAUNCHABLE_TOKEN=${{ inputs.launchable-token }}" >> $GITHUB_ENV
+ : # To prevent a slowdown in CI, disable request retries when the Launchable server is unstable.
+ echo "LAUNCHABLE_SKIP_TIMEOUT_RETRY=1" >> $GITHUB_ENV
+ echo "LAUNCHABLE_COMMIT_TIMEOUT=1" >> $GITHUB_ENV
if: steps.enable-launchable.outputs.enable-launchable
+ - name: Set up path
+ shell: bash
+ working-directory: ${{ inputs.srcdir }}
+ # Since updated PATH variable will be available in only subsequent actions, we need to add the path beforehand.
+ # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
+ run: echo "$(python -msite --user-base)/bin" >> $GITHUB_PATH
+ if: >-
+ ${{
+ steps.enable-launchable.outputs.enable-launchable
+ && (startsWith(inputs.os, 'macos')
+ || endsWith(inputs.os, 'ppc64le')
+ || endsWith(inputs.os, 's390x'))
+ }}
+
- name: Set up Launchable
+ id: setup-launchable
shell: bash
working-directory: ${{ inputs.srcdir }}
run: |
set -x
- PATH=$PATH:$(python -msite --user-base)/bin
- echo "PATH=$PATH" >> $GITHUB_ENV
pip install --user launchable
- launchable verify || true
: # The build name cannot include a slash, so we replace the string here.
github_ref="${{ github.ref }}"
github_ref="${github_ref//\//_}"
: # With the --name option, we need to configure a unique identifier for this build.
: # To avoid setting the same build name as the CI which runs on other branches, we use the branch name here.
- : #
- : # FIXME: Need to fix `WARNING: Failed to process a change to a file`.
- : # https://github.com/launchableinc/cli/issues/786
- launchable record build --name ${github_ref}_${GITHUB_PR_HEAD_SHA}
- echo "TESTS=${TESTS} --launchable-test-reports=${{ inputs.report-path }}" >> $GITHUB_ENV
- if: steps.enable-launchable.outputs.enable-launchable
-
- - name: Variables to report Launchable
- id: variables
- shell: bash
- run: |
- set -x
- : # flavor
+ build_name="${github_ref}_${GITHUB_PR_HEAD_SHA}"
test_opts="${{ inputs.test-opts }}"
test_opts="${test_opts// /}"
test_opts="${test_opts//=/:}"
- echo test-opts="$test_opts" >> $GITHUB_OUTPUT
- : # report-path from srcdir
- if [ "${srcdir}" = "${{ github.workspace }}" ]; then
- dir=
- else
- # srcdir must be equal to or under workspace
- dir=$(echo ${srcdir:+${srcdir}/} | sed 's:[^/][^/]*/:../:g')
+ test_all_test_suite='test-all'
+ btest_test_suite='btest'
+ test_spec_test_suite='test-spec'
+ if [ "${{ inputs.is-yjit }}" = "true" ]; then
+ test_all_test_suite="yjit-${test_all_test_suite}"
+ btest_test_suite="yjit-${btest_test_suite}"
+ test_spec_test_suite="yjit-${test_spec_test_suite}"
+ fi
+ # launchable_setup target var -- refers ${target} prefixed variables
+ launchable_setup() {
+ local target=$1 session
+ eval [ "\${${target}_enabled}" = "true" ] || return
+ eval local suite=\${${target}_test_suite}
+ session=$(launchable record session \
+ --build "${build_name}" \
+ --observation \
+ --flavor os="${{ inputs.os }}" \
+ --flavor test_task="${{ inputs.test-task }}" \
+ --flavor test_opts="${test_opts}" \
+ --flavor workflow="${{ github.workflow }}" \
+ --test-suite ${suite} \
+ )
+ echo "${target}_session=${session}" >> $GITHUB_OUTPUT
+ }
+
+ launchable record build --name "${build_name}"
+ if launchable_setup test_all; then
+ echo "TESTS=${TESTS:+$TESTS }--launchable-test-reports=${test_all_report_file}" >> $GITHUB_ENV
fi
- report_path="${dir}${builddir:+${builddir}/}${report_path}"
- echo report-path="${report_path}" >> $GITHUB_OUTPUT
+ if launchable_setup btest; then
+ echo "BTESTS=${BTESTS:+$BTESTS }--launchable-test-reports=${btest_report_file}" >> $GITHUB_ENV
+ fi
+ if launchable_setup test_spec; then
+ echo "SPECOPTS=${SPECOPTS:$SPECOPTS }--launchable-test-reports=${test_spec_report_dir}" >> $GITHUB_ENV
+ echo test_spec_enabled=true >> $GITHUB_OUTPUT
+ fi
+
+ echo launchable_setup_dir=$(pwd) >> $GITHUB_OUTPUT
if: steps.enable-launchable.outputs.enable-launchable
env:
- srcdir: ${{ inputs.srcdir }}
- builddir: ${{ inputs.builddir }}
- report_path: ${{ inputs.report-path }}
+ test_all_enabled: ${{ steps.global.outputs.test_all_enabled }}
+ btest_enabled: ${{ steps.global.outputs.btest_enabled }}
+ test_spec_enabled: ${{ steps.global.outputs.test_spec_enabled }}
+ test_all_report_file: ${{ steps.global.outputs.test_all_report_file }}
+ btest_report_file: ${{ steps.global.outputs.btest_report_file }}
+ test_spec_report_dir: ${{ steps.global.outputs.test_spec_report_dir }}
+
+ - name: make test-spec report directory in build directory
+ shell: bash
+ working-directory: ${{ inputs.builddir }}
+ run: mkdir "${test_spec_report_dir}"
+ if: ${{ steps.setup-launchable.outputs.test_spec_enabled == 'true' }}
+ env:
+ test_spec_report_dir: ${{ steps.global.outputs.test_spec_report_dir }}
+
+ - name: Clean up test results in Launchable
+ uses: gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0
+ with:
+ shell: bash
+ working-directory: ${{ inputs.builddir }}
+ post: |
+ rm -f "${test_all_report_file}"
+ rm -f "${btest_report_file}"
+ rm -fr "${test_spec_report_dir}"
+ rm -f launchable_stdout.log
+ rm -f launchable_stderr.log
+ if: always() && steps.setup-launchable.outcome == 'success'
+ env:
+ test_all_report_file: ${{ steps.global.outputs.test_all_report_file }}
+ btest_report_file: ${{ steps.global.outputs.btest_report_file }}
+ test_spec_report_dir: ${{ steps.global.outputs.test_spec_report_dir }}
- name: Record test results in Launchable
uses: gacts/run-and-post-run@674528335da98a7afc80915ff2b4b860a0b3553a # v1.4.0
with:
shell: bash
- working-directory: ${{ inputs.srcdir }}
+ working-directory: ${{ inputs.builddir }}
post: |
- : # record
- launchable record tests --flavor os=${{ inputs.os }} --flavor test_task=${{ matrix.test_task }} --flavor test_opts=${test_opts} raw ${report_path}
- rm -f ${report_path}
- if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }}
+ if [[ "${test_all_enabled}" = "true" ]]; then \
+ launchable record attachment \
+ --session "${test_all_session}" \
+ "${stdout_report_path}" \
+ "${stderr_report_path}"; \
+ launchable record tests \
+ --session "${test_all_session}" \
+ raw "${test_all_report_file}" || true; \
+ fi
+
+ if [[ "${btest_enabled}" = "true" ]]; then \
+ launchable record attachment \
+ --session "${btest_session}" \
+ "${stdout_report_path}" \
+ "${stderr_report_path}"; \
+ launchable record tests \
+ --session "${btest_session}" \
+ raw "${btest_report_file}" || true; \
+ fi
+
+ if [[ "${test_spec_enabled}" = "true" ]]; then \
+ launchable record attachment \
+ --session "${test_spec_session}" \
+ "${stdout_report_path}" \
+ "${stderr_report_path}"; \
+ launchable record tests \
+ --session "${test_spec_session}" \
+ raw ${test_spec_report_dir}/* || true; \
+ fi
+ if: ${{ always() && steps.setup-launchable.outcome == 'success' }}
env:
- test_opts: ${{ steps.variables.outputs.test-opts }}
- report_path: ${{ steps.variables.outputs.report-path }}
+ test_all_report_file: ${{ steps.global.outputs.test_all_report_file }}
+ btest_report_file: ${{ steps.global.outputs.btest_report_file }}
+ test_spec_report_dir: ${{ steps.global.outputs.test_spec_report_dir }}
+ test_all_enabled: ${{ steps.global.outputs.test_all_enabled }}
+ btest_enabled: ${{ steps.global.outputs.btest_enabled }}
+ test_spec_enabled: ${{ steps.global.outputs.test_spec_enabled }}
+ test_all_session: ${{ steps.setup-launchable.outputs.test_all_session }}
+ btest_session: ${{ steps.setup-launchable.outputs.btest_session }}
+ test_spec_session: ${{ steps.setup-launchable.outputs.test_spec_session }}
+ stdout_report_path: ${{ steps.global.outputs.stdout_report_path }}
+ stderr_report_path: ${{ steps.global.outputs.stderr_report_path }}
+ LAUNCHABLE_SETUP_DIR: ${{ steps.setup-launchable.outputs.launchable_setup_dir }}
diff --git a/.github/actions/setup/directories/action.yml b/.github/actions/setup/directories/action.yml
index 5264e0e969..0e8ffd59ef 100644
--- a/.github/actions/setup/directories/action.yml
+++ b/.github/actions/setup/directories/action.yml
@@ -19,6 +19,13 @@ inputs:
Where binaries and other generated contents go. This will be
created if absent.
+ make-command:
+ required: false
+ type: string
+ default: 'make'
+ description: >-
+ The command of `make`.
+
makeup:
required: false
type: boolean
@@ -76,7 +83,7 @@ runs:
shell: bash
run: |
echo "git=`command -v git`" >> "$GITHUB_OUTPUT"
- echo "sudo=`command -v sudo`" >> "$GITHUB_OUTPUT"
+ echo "sudo=`sudo true && command -v sudo`" >> "$GITHUB_OUTPUT"
echo "autoreconf=`command -v autoreconf`" >> "$GITHUB_OUTPUT"
- if: steps.which.outputs.git
@@ -88,20 +95,20 @@ runs:
git config --global init.defaultBranch garbage
- if: inputs.checkout
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: ${{ inputs.srcdir }}
fetch-depth: ${{ inputs.fetch-depth }}
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
+ - uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ${{ inputs.srcdir }}/.downloaded-cache
- key: downloaded-cache
+ key: ${{ runner.os }}-${{ runner.arch }}-downloaded-cache
- if: steps.which.outputs.autoreconf
shell: bash
working-directory: ${{ inputs.srcdir }}
- run: ./autogen.sh
+ run: ./autogen.sh --install
# This is for MinGW.
- if: runner.os == 'Windows'
@@ -110,7 +117,7 @@ runs:
- if: runner.os == 'Linux'
shell: bash
- run: echo "GNUMAKEFLAGS=-sj$((1 + $(nproc --all)))" >> "$GITHUB_ENV"
+ run: echo "GNUMAKEFLAGS=-sj$((1 + $(nproc)))" >> "$GITHUB_ENV"
# macOS' GNU make is so old that they doesn't understand `GNUMAKEFLAGS`.
- if: runner.os == 'macOS'
@@ -121,24 +128,35 @@ runs:
shell: bash
working-directory: ${{ inputs.srcdir }}
run: |
- touch config.status
- touch .rbconfig.time
- sed -f tool/prereq.status template/Makefile.in > Makefile
- sed -f tool/prereq.status template/GNUmakefile.in > GNUmakefile
+ touch config.status .rbconfig.time
+ for mk in Makefile GNUmakefile; do
+ sed -f tool/prereq.status template/$mk.in > $mk
+ done
make up
# Cleanup, runs even on failure
- if: always() && inputs.makeup
shell: bash
working-directory: ${{ inputs.srcdir }}
- run: rm -f config.status Makefile rbconfig.rb .rbconfig.time
+ run: |
+ rm -f config.status .rbconfig.time \
+ Makefile GNUmakefile uncommon.mk enc.mk noarch-fake.rb
- if: steps.which.outputs.sudo
shell: bash
run: |
sudo chmod -R go-w /usr/share
chmod -v go-w $HOME $HOME/.config || :
- sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || :
+ declare -a dirs # -A is not supported by old bash, e.g. macos
+ SAVE_IFS="$IFS" IFS=:; set $PATH
+ for d do
+ while [ -d "$d" ]; do
+ case "$IFS${dirs[*]}$IFS" in *"$IFS$d$IFS"*) ;; *) dirs+=("$d");; esac
+ d="${d%/*}"
+ done
+ done
+ IFS="$SAVE_IFS"
+ sudo chmod -v go-w "${dirs[@]}" || :
- if: inputs.dummy-files == 'true'
shell: bash
@@ -158,13 +176,13 @@ runs:
shell: bash
id: clean
run: |
- echo distclean='make -C ${{ inputs.builddir }} distclean' >> $GITHUB_OUTPUT
+ echo distclean='cd ${{ inputs.builddir }} && ${{ inputs.make-command }} distclean' >> $GITHUB_OUTPUT
echo remained-files='find ${{ inputs.builddir }} -ls' >> $GITHUB_OUTPUT
[ "${{ inputs.builddir }}" = "${{ inputs.srcdir }}" ] ||
echo final='rmdir ${{ inputs.builddir }}' >> $GITHUB_OUTPUT
- name: clean
- uses: gacts/run-and-post-run@7aec950f3b114c4fcf6012070c3709ecff0eb6f8 # v1.4.0
+ uses: gacts/run-and-post-run@81b6ce503cde93862cec047c54652e45c5dca991 # v1.4.3
with:
working-directory:
post: |
@@ -172,3 +190,5 @@ runs:
${{ steps.clean.outputs.distclean }}
${{ steps.clean.outputs.remained-files }}
${{ steps.clean.outputs.final }}
+ # rmdir randomly fails due to launchable files
+ continue-on-error: true
diff --git a/.github/actions/setup/macos/action.yml b/.github/actions/setup/macos/action.yml
index b96e959aa6..d0072ff828 100644
--- a/.github/actions/setup/macos/action.yml
+++ b/.github/actions/setup/macos/action.yml
@@ -13,16 +13,17 @@ runs:
- name: brew
shell: bash
run: |
- brew install --quiet gmp libffi openssl@1.1 zlib autoconf automake libtool
+ brew install --quiet jemalloc gmp libffi openssl@3 zlib autoconf automake libtool
- name: Set ENV
shell: bash
run: |
- for lib in gmp; do
- ruby_configure_args="${ruby_configure_args:+$ruby_configure_args }--with-${lib%@*}-dir=$(brew --prefix $lib)"
- done
- for lib in openssl@1.1; do
- CONFIGURE_ARGS="${CONFIGURE_ARGS:+$CONFIGURE_ARGS }--with-${lib%@*}-dir=$(brew --prefix $lib)"
- done
- echo ruby_configure_args="${ruby_configure_args}" >> $GITHUB_ENV
- echo CONFIGURE_ARGS="${CONFIGURE_ARGS}" >> $GITHUB_ENV
+ dir_config() {
+ local args=() lib var="$1"; shift
+ for lib in "$@"; do
+ args+=("--with-${lib%@*}-dir=$(brew --prefix $lib)")
+ done
+ echo "$var=${args[*]}" >> $GITHUB_ENV
+ }
+ dir_config ruby_configure_args gmp
+ dir_config CONFIGURE_ARGS openssl@3
diff --git a/.github/actions/slack/action.yml b/.github/actions/slack/action.yml
index f0481f5bc2..4a398da1d1 100644
--- a/.github/actions/slack/action.yml
+++ b/.github/actions/slack/action.yml
@@ -9,7 +9,7 @@ inputs:
required: true
description: >-
The URL to post the payload. This is an input because it tends
- to be stored in a secrets valut and a composite action cannot
+ to be stored in a secrets vault and a composite action cannot
look into one.
label:
@@ -18,6 +18,17 @@ inputs:
Human-readable description of the run, something like "DEBUG=1".
This need not be unique among runs.
+ event_name:
+ required: false
+ default: 'push'
+ description: >-
+ Target event to trigger notification. Notify only push by default.
+
+ extra_channel_id:
+ required: false
+ description: >-
+ Slack channel ID to notify besides #alerts and #alerts-emoji.
+
outputs: {} # Nothing?
runs:
@@ -33,7 +44,8 @@ runs:
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"commit": "${{ github.sha }}",
"branch": "${{ github.ref_name }}"
+ ${{ inputs.extra_channel_id && format(', "extra_channel_id": "{0}"', inputs.extra_channel_id) }}
}
env:
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
- if: ${{github.event_name == 'push' && startsWith(github.repository, 'ruby/')}}
+ if: ${{ github.event_name == inputs.event_name && startsWith(github.repository, 'ruby/') }}
diff --git a/.github/auto_request_review.yml b/.github/auto_request_review.yml
index 8726df577d..38496d5ceb 100644
--- a/.github/auto_request_review.yml
+++ b/.github/auto_request_review.yml
@@ -1,13 +1,20 @@
files:
- 'yjit*': [team:yjit]
- 'yjit/**/*': [team:yjit]
+ 'yjit*': [team:jit]
+ 'yjit/**/*': [team:jit]
'yjit/src/cruby_bindings.inc.rs': []
- 'doc/yjit/*': [team:yjit]
- 'bootstraptest/test_yjit*': [team:yjit]
- 'test/ruby/test_yjit*': [team:yjit]
+ 'bootstraptest/test_yjit*': [team:jit]
+ 'test/ruby/test_yjit*': [team:jit]
+ 'zjit*': [team:jit]
+ 'zjit/**/*': [team:jit]
+ 'zjit/src/cruby_bindings.inc.rs': []
+ 'test/ruby/test_zjit*': [team:jit]
+ 'defs/jit.mk': [team:jit]
+ 'tool/zjit_bisect.rb': [team:jit]
+ 'doc/jit/*': [team:jit]
+ # Skip github workflow files because the team don't necessarily need to review dependabot updates for GitHub Actions. It's noisy in notifications, and they're auto-merged anyway.
options:
ignore_draft: true
# This currently doesn't work as intended. We want to skip reviews when only
# cruby_bingings.inc.rs is modified, but this skips reviews even when other
- # yjit files are modified as well. To be enabled after fixing the behavior.
+ # files are modified as well. To be enabled after fixing the behavior.
#last_files_match_only: true
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 426893be2a..2c2982d1d4 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -16,3 +16,7 @@ updates:
directory: '/yjit'
schedule:
interval: 'daily'
+ - package-ecosystem: 'vcpkg'
+ directory: '/'
+ schedule:
+ interval: 'daily'
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 0000000000..e81aed8e98
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,6 @@
+Documentation:
+- changed-files:
+ - all-globs-to-all-files: doc/**
+
+Backport:
+- base-branch: 'ruby_3_\d'
diff --git a/.github/workflows/annocheck.yml b/.github/workflows/annocheck.yml
index 9be4c5fc36..899d601aef 100644
--- a/.github/workflows/annocheck.yml
+++ b/.github/workflows/annocheck.yml
@@ -39,11 +39,9 @@ jobs:
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
env:
@@ -63,7 +61,7 @@ jobs:
- run: id
working-directory:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
@@ -74,9 +72,9 @@ jobs:
builddir: build
makeup: true
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
- ruby-version: '3.0'
+ ruby-version: '3.1'
bundler: none
# Minimal flags to pass the check.
diff --git a/.github/workflows/auto_request_review.yml b/.github/workflows/auto_request_review.yml
index ca27244b46..207315a084 100644
--- a/.github/workflows/auto_request_review.yml
+++ b/.github/workflows/auto_request_review.yml
@@ -2,6 +2,7 @@ name: Auto Request Review
on:
pull_request_target:
types: [opened, ready_for_review, reopened]
+ branches: [master]
permissions:
contents: read
@@ -16,4 +17,4 @@ jobs:
uses: necojackarc/auto-request-review@e89da1a8cd7c8c16d9de9c6e763290b6b0e3d424 # v0.13.0
with:
# scope: public_repo
- token: ${{ secrets.MATZBOT_GITHUB_TOKEN }}
+ token: ${{ secrets.MATZBOT_AUTO_REQUEST_REVIEW_TOKEN }}
diff --git a/.github/workflows/auto_review_pr.yml b/.github/workflows/auto_review_pr.yml
new file mode 100644
index 0000000000..ad0e63ba12
--- /dev/null
+++ b/.github/workflows/auto_review_pr.yml
@@ -0,0 +1,33 @@
+name: Auto Review PR
+on:
+ pull_request_target:
+ types: [opened, ready_for_review, reopened]
+ branches: [master]
+
+permissions:
+ contents: read
+
+jobs:
+ auto-review-pr:
+ name: Auto Review PR
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'ruby/ruby' && github.base_ref == 'master' }}
+
+ permissions:
+ pull-requests: write
+ contents: read
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6.0.1
+
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
+ with:
+ ruby-version: '3.4'
+ bundler: none
+
+ - name: Auto Review PR
+ run: ruby tool/auto_review_pr.rb "$GITHUB_PR_NUMBER"
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
diff --git a/.github/workflows/baseruby.yml b/.github/workflows/baseruby.yml
index 6abaf19264..d3e734f885 100644
--- a/.github/workflows/baseruby.yml
+++ b/.github/workflows/baseruby.yml
@@ -30,33 +30,30 @@ jobs:
baseruby:
name: BASERUBY
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
strategy:
matrix:
ruby:
- - ruby-3.0
- ruby-3.1
- ruby-3.2
- ruby-3.3
steps:
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
ruby-version: ${{ matrix.ruby }}
bundler: none
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/setup/ubuntu
diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml
index 6f06451a99..59f64e8312 100644
--- a/.github/workflows/bundled_gems.yml
+++ b/.github/workflows/bundled_gems.yml
@@ -1,5 +1,8 @@
name: bundled_gems
+env:
+ UPDATE_ENABLED: true
+
on:
push:
branches: ['master']
@@ -31,13 +34,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
- token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
+ token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup/directories
with:
- # Skip overwriting MATZBOT_GITHUB_TOKEN
+ # Skip overwriting MATZBOT_AUTO_UPDATE_TOKEN
checkout: '' # false (ref: https://github.com/actions/runner/issues/2238)
- name: Set ENV
@@ -46,15 +49,17 @@ jobs:
- name: Download previous gems list
run: |
- data=bundled_gems.json
mkdir -p .downloaded-cache
- ln -s .downloaded-cache/$data .
- curl -O -R -z ./$data https://stdgems.org/$data
+ for data in bundled_gems.json default_gems.json; do
+ ln -s .downloaded-cache/$data .
+ curl -O -R -z ./$data https://stdgems.org/$data
+ done
- name: Update bundled gems list
id: bundled_gems
run: |
ruby -i~ tool/update-bundled_gems.rb gems/bundled_gems >> $GITHUB_OUTPUT
+ if: ${{ env.UPDATE_ENABLED == 'true' }}
- name: Update spec/bundler/support/builders.rb
run: |
@@ -62,10 +67,12 @@ jobs:
rake_version = File.read("gems/bundled_gems")[/^rake\s+(\S+)/, 1]
print ARGF.read.sub(/^ *def rake_version\s*\K".*?"/) {rake_version.dump}
shell: ruby -i~ {0} spec/bundler/support/builders.rb
+ if: ${{ env.UPDATE_ENABLED == 'true' }}
- name: Maintain updated gems list in NEWS
run: |
ruby tool/update-NEWS-gemlist.rb bundled
+ if: ${{ env.UPDATE_ENABLED == 'true' }}
- name: Check diffs
id: diff
@@ -81,6 +88,67 @@ jobs:
echo gems=$gems >> $GITHUB_OUTPUT
echo update=${news:-$gems} >> $GITHUB_OUTPUT
+ - name: Commit
+ id: commit
+ run: |
+ git pull --ff-only origin ${GITHUB_REF#refs/heads/}
+ message="Update bundled gems list"
+ if [ -z "${gems}" ]; then
+ git commit --message="[DOC] ${message} at ${GITHUB_SHA:0:30}"
+ else
+ git commit --message="${message} as of ${TODAY}"
+ fi
+ env:
+ TODAY: ${{ steps.bundled_gems.outputs.latest_date || env.TODAY }}
+ EMAIL: svn-admin@ruby-lang.org
+ GIT_AUTHOR_NAME: git
+ GIT_COMMITTER_NAME: git
+ gems: ${{ steps.diff.outputs.gems }}
+ if: ${{ steps.diff.outputs.update }}
+
+ - name: Development revision of bundled gems
+ run: |
+ #!ruby
+ file = "gems/bundled_gems"
+
+ SECONDS_IN_DAY = 86400
+ today = Time.new("#{ENV['TODAY']}Z")
+ if !(december = today.month == 12)
+ days = 30
+ elsif (days = 26 - today.day).positive?
+ days += 4
+ else
+ puts "::info:: just after released"
+ exit
+ end
+
+ since = "#{today.year-1}-12-26"
+ ref = ENV['GITHUB_REF']
+ puts "::group::\e[94mfetching \e[1m#{file}\e[22m since \e[1m#{since}\e[22m from \e[1m#{ref}\e[m"
+ system(*%W[git fetch --shallow-since=#{since} --no-tags origin #{ref}], exception: true)
+ puts "::endgroup::"
+
+ puts "\e[94mchecking development version bundled gems older than \e[1m#{days}\e[22m days\e[m"
+ limit = today.to_i - days * SECONDS_IN_DAY
+ old = 0
+ IO.popen(%W"git blame --line-porcelain -- #{file}") do |blame|
+ while head = blame.gets("\n\t") and s = blame.gets
+ next unless (gem = s.split(/\s+|#.*/)).size > 3
+ time = head[/^committer-time \K\d+/].to_i
+ next if (d = limit - time) <= 0
+ d /= SECONDS_IN_DAY
+ line = head[/\A\h+ \d+ \K\d+/].to_i
+ level = if d < days; 'warning'; else old += 1; 'error'; end
+ d += days
+ puts "::#{level} file=#{file},line=#{line},title=Older than #{d} days::#{gem[0]} #{gem[3]}"
+ end
+ end
+ abort "::error title=Too long-standing gems::The release comes soon." if december and old.nonzero?
+ shell: ruby {0}
+ env:
+ file: ${{ steps.logs.outputs.file }}
+ days: ${{ steps.logs.outputs.days }}
+
- name: Install libraries
uses: ./.github/actions/setup/ubuntu
if: ${{ steps.diff.outputs.gems }}
@@ -106,27 +174,14 @@ jobs:
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
if: ${{ steps.diff.outputs.gems }}
- - name: Commit
+ - name: Push
run: |
- git pull --ff-only origin ${GITHUB_REF#refs/heads/}
- message="Update bundled gems list"
- if [ -z "${gems}" ]; then
- git commit --message="${message} at ${GITHUB_SHA:0:30} [ci skip]"
- else
- git commit --message="${message} as of ${TODAY}"
- fi
git push origin ${GITHUB_REF#refs/heads/}
- env:
- TODAY: ${{ steps.bundled_gems.outputs.latest_date || env.TODAY }}
- EMAIL: svn-admin@ruby-lang.org
- GIT_AUTHOR_NAME: git
- GIT_COMMITTER_NAME: git
- gems: ${{ steps.diff.outputs.gems }}
if: >-
${{
github.repository == 'ruby/ruby' &&
!startsWith(github.event_name, 'pull') &&
- steps.diff.outputs.update
+ steps.commit.outcome == 'success'
}}
- uses: ./.github/actions/slack
diff --git a/.github/workflows/check_dependencies.yml b/.github/workflows/check_dependencies.yml
index fa670294e7..c5dec65e48 100644
--- a/.github/workflows/check_dependencies.yml
+++ b/.github/workflows/check_dependencies.yml
@@ -9,13 +9,6 @@ on:
- '**/.document'
- '.*.yml'
pull_request:
- paths-ignore:
- - 'doc/**'
- - '**/man/*'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '.*.yml'
merge_group:
concurrency:
@@ -27,25 +20,17 @@ permissions:
jobs:
update-deps:
+ name: Dependency checks
+
strategy:
matrix:
- os: [ubuntu-20.04]
+ os: [ubuntu-latest]
fail-fast: true
runs-on: ${{ matrix.os }}
- if: >-
- ${{!(false
- || contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
- || contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
- )}}
-
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/setup/ubuntu
if: ${{ contains(matrix.os, 'ubuntu') }}
@@ -55,17 +40,15 @@ jobs:
- uses: ./.github/actions/setup/directories
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
- ruby-version: '3.0'
+ ruby-version: '3.1'
bundler: none
- name: Run configure
run: ./configure -C --disable-install-doc --disable-rubygems --with-gcc 'optflags=-O0' 'debugflags=-save-temps=obj -g'
- - run: make all golf
-
- - run: ruby tool/update-deps --fix
+ - run: make fix-depends
- run: git diff --no-ext-diff --ignore-submodules --exit-code
diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml
index f26319f448..2a2bd1df53 100644
--- a/.github/workflows/check_misc.yml
+++ b/.github/workflows/check_misc.yml
@@ -18,24 +18,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
- token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
+ token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup/directories
with:
makeup: true
- # Skip overwriting MATZBOT_GITHUB_TOKEN
+ # Skip overwriting MATZBOT_AUTO_UPDATE_TOKEN
checkout: '' # false (ref: https://github.com/actions/runner/issues/2238)
- - name: Check if C-sources are US-ASCII
+ - name: Check for code styles
run: |
- grep -r -n --include='*.[chyS]' --include='*.asm' $'[^\t-~]' -- . && exit 1 || :
-
- - name: Check for trailing spaces
- run: |
- git grep -I -n $'[\t ]$' -- '*.rb' '*.[chy]' '*.rs' '*.yml' && exit 1 || :
- git grep -n $'^[\t ][\t ]*$' -- '*.md' && exit 1 || :
+ set -x
+ ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA"
+ env:
+ GITHUB_OLD_SHA: ${{ github.event.pull_request.base.sha }}
+ GITHUB_NEW_SHA: ${{ github.event.pull_request.merge_commit_sha }}
+ # Skip 'push' events because post_push.yml fixes them on push
+ if: ${{ github.repository == 'ruby/ruby' && startsWith(github.event_name, 'pull') }}
- name: Check for bash specific substitution in configure.ac
run: |
@@ -52,65 +53,74 @@ jobs:
exit $fail
working-directory: include
- - id: gems
- run: true
- if: ${{ github.ref == 'refs/heads/master' }}
-
- - name: Download previous gems list
+ - id: now
run: |
- data=default_gems.json
- mkdir -p .downloaded-cache
- ln -s .downloaded-cache/$data .
- curl -O -R -z ./$data https://stdgems.org/$data
- if: ${{ steps.gems.outcome == 'success' }}
+ date +"mon=%-m"%n"day=%-d" >> $GITHUB_OUTPUT
+ env:
+ TZ: Tokyo/Asia
- - name: Make default gems list
+ - id: deprecation
run: |
- #!ruby
- require 'rubygems'
- $:.unshift "lib"
- rgver = File.foreach("lib/rubygems.rb") do |line|
- break $1 if /^\s*VERSION\s*=\s*"([^"]+)"/ =~ line
- end
- gems = Dir.glob("{ext,lib}/**/*.gemspec").map do |f|
- spec = Gem::Specification.load(f)
- "#{spec.name} #{spec.version}"
- end.sort
- File.open("gems/default_gems", "w") do |f|
- f.puts "RubyGems #{rgver}"
- f.puts gems
- end
- shell: ruby --disable=gems {0}
- if: ${{ steps.gems.outcome == 'success' }}
-
- - name: Maintain updated gems list in NEWS
+ eval $(sed -n 's/^#define RUBY_API_VERSION_\(MAJOR\|MINOR\) /\1=/p' include/ruby/version.h)
+ if git --no-pager grep --color -o 'rb_warn_deprecated_to_remove_at('$MAJOR'\.'$MINOR',.*' -- '*.c' >&2; then
+ false
+ else
+ true
+ fi
+ continue-on-error: ${{ steps.now.outputs.mon < 12 }}
+
+ - name: Check if to generate documents
+ id: rdoc
run: |
- ruby tool/update-NEWS-gemlist.rb default
- if: ${{ steps.gems.outcome == 'success' }}
+ set -- $(sed 's/#.*//;/^rdoc /!d' gems/bundled_gems)
+ { echo version=$2; echo ref=$4; } >> $GITHUB_OUTPUT
+ echo RDOC='ruby -W0 --disable-gems tool/rdoc-srcdir -q' >> $GITHUB_ENV
- - name: Check diffs
- id: diff
+ - name: Checkout rdoc
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ repository: ruby/rdoc
+ ref: ${{ steps.rdoc.outputs.ref }}
+ path: .bundle/gems/rdoc-${{ steps.rdoc.outputs.version }}
+ if: ${{ steps.rdoc.outputs.ref != '' }}
+
+ - name: Generate rdoc
+ run: |
+ set -x
+ gempath=$(ruby -e 'print Gem.user_dir, "/bin"')
+ PATH=$gempath:$PATH
+ gem install --user bundler
+ bundle config --local path vendor/bundle
+ bundle install --jobs 4
+ bundle exec rake generate
+ working-directory: .bundle/gems/rdoc-${{ steps.rdoc.outputs.version }}
+ if: ${{ steps.rdoc.outputs.ref != '' }}
+
+ - name: Core docs coverage
run: |
- git diff --color --no-ext-diff --ignore-submodules --exit-code NEWS.md ||
- echo update=true >> $GITHUB_OUTPUT
- if: ${{ steps.gems.outcome == 'success' }}
+ $RDOC -C -x ^ext -x ^lib .
- - name: Commit
+ - name: Generate docs
+ id: docs
run: |
- git pull --ff-only origin ${GITHUB_REF#refs/heads/}
- git commit --message="Update default gems list at ${GITHUB_SHA:0:30} [ci skip]" NEWS.md
- git push origin ${GITHUB_REF#refs/heads/}
- env:
- EMAIL: svn-admin@ruby-lang.org
- GIT_AUTHOR_NAME: git
- GIT_COMMITTER_NAME: git
+ $RDOC --op html .
+ echo htmlout=ruby-html-${GITHUB_SHA:0:10} >> $GITHUB_OUTPUT
+ # Generate only when document commit/PR
if: >-
- ${{
- github.repository == 'ruby/ruby' &&
- !startsWith(github.event_name, 'pull') &&
- steps.diff.outputs.update
+ ${{false
+ || contains(github.event.head_commit.message, '[ruby/rdoc]')
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
}}
+ - name: Upload docs
+ uses: actions/upload-artifact@v6.0.0
+ with:
+ path: html
+ name: ${{ steps.docs.outputs.htmlout }}
+ if: ${{ steps.docs.outcome == 'success' }}
+
- uses: ./.github/actions/slack
with:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index f733234906..a92c93b476 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -32,7 +32,7 @@ permissions: # added using https://github.com/step-security/secure-workflows
jobs:
analyze:
name: Analyze
- runs-on: ${{ matrix.os }}
+ runs-on: ubuntu-latest
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
@@ -41,11 +41,9 @@ jobs:
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
env:
@@ -56,14 +54,11 @@ jobs:
matrix:
include:
- language: cpp
- os: ubuntu-latest
- # ruby analysis used large memory. We need to use a larger runner.
- language: ruby
- os: ${{ github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'ubuntu-latest' }}
steps:
- name: Checkout repository
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install libraries
if: ${{ contains(matrix.os, 'macos') }}
@@ -80,15 +75,17 @@ jobs:
run: sudo rm /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb
- name: Initialize CodeQL
- uses: github/codeql-action/init@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
+ uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
languages: ${{ matrix.language }}
+ trap-caching: false
+ debug: true
- name: Autobuild
- uses: github/codeql-action/autobuild@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
+ uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
+ uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
category: '/language:${{ matrix.language }}'
upload: False
@@ -118,7 +115,7 @@ jobs:
continue-on-error: true
- name: Upload SARIF
- uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
+ uses: github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
continue-on-error: true
diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml
index 85769bd879..8c0ca54e0b 100644
--- a/.github/workflows/compilers.yml
+++ b/.github/workflows/compilers.yml
@@ -24,281 +24,311 @@ concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
-# GitHub actions does not support YAML anchors. This creative use of
-# environment variables (plus the "echo $GITHUB_ENV" hack) is to reroute that
-# restriction.
-env:
- default_cc: clang-18
- append_cc: ''
-
- # -O1 is faster than -O3 in our tests... Majority of time are consumed trying
- # to optimize binaries. Also GitHub Actions run on relatively modern CPUs
- # compared to, say, GCC 4 or Clang 3. We don't specify `-march=native`
- # because compilers tend not understand what the CPU is.
- optflags: '-O1'
-
- # -g0 disables backtraces when SEGV. Do not set that.
- debugflags: '-ggdb3'
-
- default_configure: >-
- --enable-debug-env
- --disable-install-doc
- --with-ext=-test-/cxxanyargs,+
- append_configure: >-
- --without-valgrind
- --without-jemalloc
- --without-gmp
-
- CONFIGURE_TTY: never
- GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
- RUBY_DEBUG: ci rgengc
- RUBY_TESTOPTS: >-
- -q
- --color=always
- --tty=no
-
permissions:
contents: read
+# Each job is split so that they roughly take 30min to run through.
jobs:
- compile:
- strategy:
- fail-fast: false
- matrix:
- env:
- - {}
- entry:
- - { name: gcc-13, env: { default_cc: gcc-13 } }
- - { name: gcc-12, env: { default_cc: gcc-12 } }
- - { name: gcc-11, env: { default_cc: gcc-11 } }
- - { name: gcc-10, env: { default_cc: gcc-10 } }
- - { name: gcc-9, env: { default_cc: gcc-9 } }
- - { name: gcc-8, env: { default_cc: gcc-8 } }
- - { name: gcc-7, env: { default_cc: gcc-7 } }
- - name: 'gcc-13 LTO'
- container: gcc-13
- env:
- default_cc: 'gcc-13 -flto=auto -ffat-lto-objects -Werror=lto-type-mismatch'
- optflags: '-O2'
- shared: disable
- # check: true
- - { name: clang-19, env: { default_cc: clang-19 } }
- - { name: clang-18, env: { default_cc: clang-18 } }
- - { name: clang-17, env: { default_cc: clang-17 } }
- - { name: clang-16, env: { default_cc: clang-16 } }
- - { name: clang-15, env: { default_cc: clang-15 } }
- - { name: clang-14, env: { default_cc: clang-14 } }
- - { name: clang-13, env: { default_cc: clang-13 } }
- - { name: clang-12, env: { default_cc: clang-12 } }
- - { name: clang-11, env: { default_cc: clang-11 } }
- - { name: clang-10, env: { default_cc: clang-10 } }
- # llvm-objcopy<=9 doesn't have --wildcard. It compiles, but leaves Rust symbols in libyjit.o.
- - { name: clang-9, env: { default_cc: clang-9, append_configure: '--disable-yjit' } }
- - { name: clang-8, env: { default_cc: clang-8, append_configure: '--disable-yjit' } }
- - { name: clang-7, env: { default_cc: clang-7, append_configure: '--disable-yjit' } }
- - { name: clang-6.0, env: { default_cc: clang-6.0, append_configure: '--disable-yjit' } }
- - name: 'clang-16 LTO'
- container: clang-16
- env:
- default_cc: 'clang-16 -flto=auto'
- optflags: '-O2'
- shared: disable
- # check: true
-
- - { name: ext/Setup, static-exts: 'etc,json/*,*/escape' }
-
-# - { name: aarch64-linux-gnu, crosshost: aarch64-linux-gnu, container: crossbuild-essential-arm64 }
-# - { name: arm-linux-gnueabi, crosshost: arm-linux-gnueabi }
-# - { name: arm-linux-gnueabihf, crosshost: arm-linux-gnueabihf }
-# - { name: i686-w64-mingw32, crosshost: i686-w64-mingw32 }
-# - { name: powerpc-linux-gnu, crosshost: powerpc-linux-gnu }
-# - { name: powerpc64le-linux-gnu, crosshost: powerpc64le-linux-gnu, container: crossbuild-essential-ppc64el }
-# - { name: s390x-linux-gnu, crosshost: s390x-linux-gnu, container: crossbuild-essential-s390x }
-# - { name: x86_64-w64-mingw32, crosshost: x86_64-w64-mingw32, container: mingw-w64 }
-
- # -Wno-strict-prototypes is necessary with current clang-15 since
- # older autoconf generate functions without prototype and -pedantic
- # now implies strict-prototypes. Disabling the error but leaving the
- # warning generates a lot of noise from use of ANYARGS in
- # rb_define_method() and friends.
- # See: https://github.com/llvm/llvm-project/commit/11da1b53d8cd3507959022cd790d5a7ad4573d94
- - { name: c99, env: { CFLAGS: '-std=c99 -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' } }
-# - { name: c11, env: { CFLAGS: '-std=c11 -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' } }
-# - { name: c17, env: { CFLAGS: '-std=c17 -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' } }
- - { name: c23, env: { CFLAGS: '-std=c2x -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' } }
- - { name: c++98, env: { CXXFLAGS: '-std=c++98 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
-# - { name: c++11, env: { CXXFLAGS: '-std=c++11 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
-# - { name: c++14, env: { CXXFLAGS: '-std=c++14 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
-# - { name: c++17, env: { CXXFLAGS: '-std=c++17 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
-# - { name: c++20, env: { CXXFLAGS: '-std=c++20 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
-# - { name: c++23, env: { CXXFLAGS: '-std=c++23 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
- - { name: c++26, env: { CXXFLAGS: '-std=c++26 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' } }
-
- - { name: '-O0', env: { optflags: '-O0 -march=x86-64 -mtune=generic' } }
-# - { name: '-O3', env: { optflags: '-O3 -march=x86-64 -mtune=generic' }, check: true }
-
- - { name: gmp, env: { append_configure: '--with-gmp' }, check: true }
- - { name: jemalloc, env: { append_configure: '--with-jemalloc' } }
- - { name: valgrind, env: { append_configure: '--with-valgrind' } }
- - { name: 'coroutine=ucontext', env: { append_configure: '--with-coroutine=ucontext' } }
- - { name: 'coroutine=pthread', env: { append_configure: '--with-coroutine=pthread' } }
- - { name: disable-jit, env: { append_configure: '--disable-yjit --disable-rjit' } }
- - { name: disable-dln, env: { append_configure: '--disable-dln' } }
- - { name: enable-mkmf-verbose, env: { append_configure: '--enable-mkmf-verbose' } }
- - { name: disable-rubygems, env: { append_configure: '--disable-rubygems' } }
- - { name: RUBY_DEVEL, env: { append_configure: '--enable-devel' } }
-
- - { name: OPT_THREADED_CODE=0, env: { cppflags: '-DOPT_THREADED_CODE=0' } }
- - { name: OPT_THREADED_CODE=1, env: { cppflags: '-DOPT_THREADED_CODE=1' } }
- - { name: OPT_THREADED_CODE=2, env: { cppflags: '-DOPT_THREADED_CODE=2' } }
-
- - { name: NDEBUG, env: { cppflags: '-DNDEBUG' } }
- - { name: RUBY_DEBUG, env: { cppflags: '-DRUBY_DEBUG' } }
-# - { name: ARRAY_DEBUG, env: { cppflags: '-DARRAY_DEBUG' } }
-# - { name: BIGNUM_DEBUG, env: { cppflags: '-DBIGNUM_DEBUG' } }
-# - { name: CCAN_LIST_DEBUG, env: { cppflags: '-DCCAN_LIST_DEBUG' } }
-# - { name: CPDEBUG=-1, env: { cppflags: '-DCPDEBUG=-1' } }
-# - { name: ENC_DEBUG, env: { cppflags: '-DENC_DEBUG' } }
-# - { name: GC_DEBUG, env: { cppflags: '-DGC_DEBUG' } }
-# - { name: HASH_DEBUG, env: { cppflags: '-DHASH_DEBUG' } }
-# - { name: ID_TABLE_DEBUG, env: { cppflags: '-DID_TABLE_DEBUG' } }
-# - { name: RGENGC_DEBUG=-1, env: { cppflags: '-DRGENGC_DEBUG=-1' } }
-# - { name: SYMBOL_DEBUG, env: { cppflags: '-DSYMBOL_DEBUG' } }
-
-# - { name: RGENGC_CHECK_MODE, env: { cppflags: '-DRGENGC_CHECK_MODE' } }
-# - { name: VM_CHECK_MODE, env: { cppflags: '-DVM_CHECK_MODE' } }
-
-# - { name: USE_EMBED_CI=0, env: { cppflags: '-DUSE_EMBED_CI=0' } }
- - name: USE_FLONUM=0
- env:
- cppflags: '-DUSE_FLONUM=0'
- # yjit requires FLONUM for the pointer tagging scheme
- append_configure: '--disable-yjit'
-# - { name: USE_GC_MALLOC_OBJ_INFO_DETAILS, env: { cppflags: '-DUSE_GC_MALLOC_OBJ_INFO_DETAILS' } }
-# - { name: USE_LAZY_LOAD, env: { cppflags: '-DUSE_LAZY_LOAD' } }
-# - { name: USE_SYMBOL_GC=0, env: { cppflags: '-DUSE_SYMBOL_GC=0' } }
-# - { name: USE_THREAD_CACHE=0, env: { cppflags: '-DUSE_THREAD_CACHE=0' } }
- - { name: USE_RUBY_DEBUG_LOG=1, env: { cppflags: '-DUSE_RUBY_DEBUG_LOG=1' } }
-# - { name: USE_DEBUG_COUNTER, env: { cppflags: '-DUSE_DEBUG_COUNTER=1', RUBY_DEBUG_COUNTER_DISABLE: '1' } }
- - { name: SHARABLE_MIDDLE_SUBSTRING, env: { cppflags: '-DSHARABLE_MIDDLE_SUBSTRING=1' } }
-
-# - { name: DEBUG_FIND_TIME_NUMGUESS, env: { cppflags: '-DDEBUG_FIND_TIME_NUMGUESS' } }
-# - { name: DEBUG_INTEGER_PACK, env: { cppflags: '-DDEBUG_INTEGER_PACK' } }
-# - { name: ENABLE_PATH_CHECK, env: { cppflags: '-DENABLE_PATH_CHECK' } }
-
-# - { name: GC_DEBUG_STRESS_TO_CLASS, env: { cppflags: '-DGC_DEBUG_STRESS_TO_CLASS' } }
-# - { name: GC_ENABLE_LAZY_SWEEP=0, env: { cppflags: '-DGC_ENABLE_LAZY_SWEEP=0' } }
-# - { name: GC_PROFILE_DETAIL_MEMOTY, env: { cppflags: '-DGC_PROFILE_DETAIL_MEMOTY' } }
-# - { name: GC_PROFILE_MORE_DETAIL, env: { cppflags: '-DGC_PROFILE_MORE_DETAIL' } }
-
-# - { name: CALC_EXACT_MALLOC_SIZE, env: { cppflags: '-DCALC_EXACT_MALLOC_SIZE' } }
-# - { name: MALLOC_ALLOCATED_SIZE_CHECK, env: { cppflags: '-DMALLOC_ALLOCATED_SIZE_CHECK' } }
-
-# - { name: IBF_ISEQ_ENABLE_LOCAL_BUFFER, env: { cppflags: '-DIBF_ISEQ_ENABLE_LOCAL_BUFFER' } }
-
-# - { name: RGENGC_ESTIMATE_OLDMALLOC, env: { cppflags: '-DRGENGC_ESTIMATE_OLDMALLOC' } }
-# - { name: RGENGC_FORCE_MAJOR_GC, env: { cppflags: '-DRGENGC_FORCE_MAJOR_GC' } }
-# - { name: RGENGC_OBJ_INFO, env: { cppflags: '-DRGENGC_OBJ_INFO' } }
-# - { name: RGENGC_PROFILE, env: { cppflags: '-DRGENGC_PROFILE' } }
-
-# - { name: VM_DEBUG_BP_CHECK, env: { cppflags: '-DVM_DEBUG_BP_CHECK' } }
-# - { name: VM_DEBUG_VERIFY_METHOD_CACHE, env: { cppflags: '-DVM_DEBUG_VERIFY_METHOD_CACHE' } }
-
- - { name: enable-yjit, env: { append_configure: '--enable-yjit --disable-rjit' } }
- - { name: enable-rjit, env: { append_configure: '--enable-rjit --disable-yjit' } }
- - { name: YJIT_FORCE_ENABLE, env: { cppflags: '-DYJIT_FORCE_ENABLE' } }
-# - { name: RJIT_FORCE_ENABLE, env: { cppflags: '-DRJIT_FORCE_ENABLE' } }
- - { name: UNIVERSAL_PARSER, env: { cppflags: '-DUNIVERSAL_PARSER' } }
-
- name: ${{ matrix.entry.name }}
-
+ compile-if:
+ name: 'omnibus compilations, trigger'
runs-on: ubuntu-latest
-
- container:
- image: ghcr.io/ruby/ruby-ci-image:${{ matrix.entry.container || matrix.entry.env.default_cc || 'clang-18' }}
- options: --user root
-
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
-
- env: ${{ matrix.entry.env || matrix.env }}
-
steps:
- - run: id
+ - run: true
working-directory:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- with:
- sparse-checkout-cone-mode: false
- sparse-checkout: /.github
-
- - uses: ./.github/actions/setup/directories
+ compile1:
+ name: 'omnibus compilations, #1'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ # Set fetch-depth: 10 so that Launchable can receive commits information.
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - name: 'clang 18 LTO'
+ uses: './.github/actions/compilers'
with:
- srcdir: src
- builddir: build
- makeup: true
- clean: true
-
- - name: Run configure
- run: >
- ../src/configure -C ${default_configure} ${append_configure}
- --${{
- matrix.entry.crosshost && 'host' || 'with-gcc'
- }}=${{
- matrix.entry.crosshost || '"${default_cc}${append_cc:+ $append_cc}"'
- }}
- --${{ matrix.entry.shared || 'enable' }}-shared
-
- - name: Add to ext/Setup
- id: ext-setup
- run: |
- mkdir ext
- cd ext
- for ext in {${{ matrix.entry.static-exts }}}; do
- echo "${ext}"
- done >> Setup
- if: ${{ (matrix.entry.static-exts || '') != '' }}
-
- - name: Clean up ext/Setup
- uses: gacts/run-and-post-run@7aec950f3b114c4fcf6012070c3709ecff0eb6f8 # v1.4.0
+ tag: clang-18
+ with_gcc: 'clang-18 -flto=auto'
+ optflags: '-O2'
+ enable_shared: false
+ timeout-minutes: 30
+ - { uses: './.github/actions/compilers', name: '-O0', with: { optflags: '-O0 -march=x86-64 -mtune=generic' }, timeout-minutes: 5 }
+ # - { uses: './.github/actions/compilers', name: '-O3', with: { optflags: '-O3 -march=x86-64 -mtune=generic', check: true } }
+
+ compile2:
+ name: 'omnibus compilations, #2'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - name: 'GCC 15 LTO'
+ uses: './.github/actions/compilers'
with:
- shell: bash
- working-directory: build
- post: rm ext/Setup
- if: ${{ steps.ext-setup.outcome == 'success' }}
-
- - run: make showflags
-
- - run: make
-
- - run: make test
-
- - run: make install
- if: ${{ matrix.entry.check }}
-
- - run: make test-tool
- if: ${{ matrix.entry.check }}
-
- - run: make test-all TESTS='-- ruby -ext-'
- if: ${{ matrix.entry.check }}
-
- - run: make test-spec
- env:
- CHECK_LEAKS: true
- if: ${{ matrix.entry.check }}
-
+ tag: gcc-15
+ with_gcc: 'gcc-15 -flto=auto -ffat-lto-objects -Werror=lto-type-mismatch'
+ optflags: '-O2'
+ enable_shared: false
+ timeout-minutes: 10
+ - { uses: './.github/actions/compilers', name: 'ext/Setup', with: { static_exts: 'etc json/* */escape' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 15', with: { tag: 'gcc-15' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 14', with: { tag: 'gcc-14' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 13', with: { tag: 'gcc-13' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 12', with: { tag: 'gcc-12' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 11', with: { tag: 'gcc-11' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 10', with: { tag: 'gcc-10' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 9', with: { tag: 'gcc-9' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 8', with: { tag: 'gcc-8' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GCC 7', with: { tag: 'gcc-7' }, timeout-minutes: 5 }
+
+ compile3:
+ name: 'omnibus compilations, #3'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'clang 22', with: { tag: 'clang-22' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 21', with: { tag: 'clang-21' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 20', with: { tag: 'clang-20' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 19', with: { tag: 'clang-19' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 18', with: { tag: 'clang-18' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 17', with: { tag: 'clang-17' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 16', with: { tag: 'clang-16' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 15', with: { tag: 'clang-15' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 14', with: { tag: 'clang-14' }, timeout-minutes: 5 }
+
+ compile4:
+ name: 'omnibus compilations, #4'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'clang 13', with: { tag: 'clang-13' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 12', with: { tag: 'clang-12' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 11', with: { tag: 'clang-11' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 10', with: { tag: 'clang-10' }, timeout-minutes: 5 }
+ # llvm-objcopy<=9 doesn't have --wildcard. It compiles, but leaves Rust symbols in libyjit.o and fail `make test-leaked-globals`.
+ - { uses: './.github/actions/compilers', name: 'clang 9', with: { tag: 'clang-9', append_configure: '--disable-yjit --disable-zjit' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 8', with: { tag: 'clang-8', append_configure: '--disable-yjit --disable-zjit' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 7', with: { tag: 'clang-7', append_configure: '--disable-yjit --disable-zjit' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'clang 6', with: { tag: 'clang-6.0', append_configure: '--disable-yjit --disable-zjit' }, timeout-minutes: 5 }
+
+ compile5:
+ name: 'omnibus compilations, #5'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ # -Wno-strict-prototypes is necessary with current clang-15 since
+ # older autoconf generate functions without prototype and -pedantic
+ # now implies strict-prototypes. Disabling the error but leaving the
+ # warning generates a lot of noise from use of ANYARGS in
+ # rb_define_method() and friends.
+ # See: https://github.com/llvm/llvm-project/commit/11da1b53d8cd3507959022cd790d5a7ad4573d94
+ - { uses: './.github/actions/compilers', name: 'C99', with: { CFLAGS: '-std=c99 -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C11', with: { CFLAGS: '-std=c11 -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C17', with: { CFLAGS: '-std=c17 -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C23', with: { CFLAGS: '-std=c2x -Werror=pedantic -pedantic-errors -Wno-strict-prototypes' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C++98', with: { CXXFLAGS: '-std=c++98 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C++11', with: { CXXFLAGS: '-std=c++11 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C++14', with: { CXXFLAGS: '-std=c++14 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C++17', with: { CXXFLAGS: '-std=c++17 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+
+ compile6:
+ name: 'omnibus compilations, #6'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'C++20', with: { CXXFLAGS: '-std=c++20 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C++23', with: { CXXFLAGS: '-std=c++23 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'C++26', with: { CXXFLAGS: '-std=c++26 -Werror=pedantic -pedantic-errors -Wno-c++11-long-long' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'gmp', with: { append_configure: '--with-gmp', test_all: 'ruby/test_bignum.rb', test_spec: "/github/workspace/src/spec/ruby/core/integer" }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'jemalloc', with: { append_configure: '--with-jemalloc' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'valgrind', with: { append_configure: '--with-valgrind' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'coroutine=ucontext', with: { append_configure: '--with-coroutine=ucontext' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'coroutine=pthread', with: { append_configure: '--with-coroutine=pthread' }, timeout-minutes: 5 }
+
+ compile7:
+ name: 'omnibus compilations, #7'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'disable-jit', with: { append_configure: '--disable-yjit --disable-zjit' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'disable-yjit', with: { append_configure: '--disable-yjit' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'disable-zjit', with: { append_configure: '--disable-zjit' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'disable-dln', with: { append_configure: '--disable-dln' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'enable-mkmf-verbose', with: { append_configure: '--enable-mkmf-verbose' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'disable-rubygems', with: { append_configure: '--disable-rubygems' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'RUBY_DEVEL', with: { append_configure: '--enable-devel' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'OPT_THREADED_CODE=0', with: { cppflags: '-DOPT_THREADED_CODE=0' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'OPT_THREADED_CODE=1', with: { cppflags: '-DOPT_THREADED_CODE=1' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'OPT_THREADED_CODE=2', with: { cppflags: '-DOPT_THREADED_CODE=2' }, timeout-minutes: 5 }
+
+ compile8:
+ name: 'omnibus compilations, #8'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'NDEBUG', with: { cppflags: '-DNDEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'RUBY_DEBUG', with: { cppflags: '-DRUBY_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'ARRAY_DEBUG', with: { cppflags: '-DARRAY_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'BIGNUM_DEBUG', with: { cppflags: '-DBIGNUM_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'CCAN_LIST_DEBUG', with: { cppflags: '-DCCAN_LIST_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'CPDEBUG=-1', with: { cppflags: '-DCPDEBUG=-1' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'ENC_DEBUG', with: { cppflags: '-DENC_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GC_DEBUG', with: { cppflags: '-DGC_DEBUG' }, timeout-minutes: 5 }
+
+ compile9:
+ name: 'omnibus compilations, #9'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'HASH_DEBUG', with: { cppflags: '-DHASH_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'ID_TABLE_DEBUG', with: { cppflags: '-DID_TABLE_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'RGENGC_DEBUG=-1', with: { cppflags: '-DRGENGC_DEBUG=-1' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'SYMBOL_DEBUG', with: { cppflags: '-DSYMBOL_DEBUG' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'RGENGC_CHECK_MODE', with: { cppflags: '-DRGENGC_CHECK_MODE' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'VM_CHECK_MODE', with: { cppflags: '-DVM_CHECK_MODE' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'USE_EMBED_CI=0', with: { cppflags: '-DUSE_EMBED_CI=0' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'USE_FLONUM=0', with: { cppflags: '-DUSE_FLONUM=0', append_configure: '--disable-yjit --disable-zjit' }, timeout-minutes: 5 }
+
+ compileX:
+ name: 'omnibus compilations, #10'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'USE_LAZY_LOAD', with: { cppflags: '-DUSE_LAZY_LOAD' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'USE_SYMBOL_GC=0', with: { cppflags: '-DUSE_SYMBOL_GC=0' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'USE_THREAD_CACHE=0', with: { cppflags: '-DUSE_THREAD_CACHE=0' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'USE_RUBY_DEBUG_LOG=1', with: { cppflags: '-DUSE_RUBY_DEBUG_LOG=1' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'USE_DEBUG_COUNTER', with: { cppflags: '-DUSE_DEBUG_COUNTER=1' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'SHARABLE_MIDDLE_SUBSTRING', with: { cppflags: '-DSHARABLE_MIDDLE_SUBSTRING=1' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'DEBUG_FIND_TIME_NUMGUESS', with: { cppflags: '-DDEBUG_FIND_TIME_NUMGUESS' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'DEBUG_INTEGER_PACK', with: { cppflags: '-DDEBUG_INTEGER_PACK' }, timeout-minutes: 5 }
+
+ compileB:
+ name: 'omnibus compilations, #11'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'GC_DEBUG_STRESS_TO_CLASS', with: { cppflags: '-DGC_DEBUG_STRESS_TO_CLASS' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GC_ENABLE_LAZY_SWEEP=0', with: { cppflags: '-DGC_ENABLE_LAZY_SWEEP=0' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GC_PROFILE_DETAIL_MEMORY', with: { cppflags: '-DGC_PROFILE_DETAIL_MEMORY' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'GC_PROFILE_MORE_DETAIL', with: { cppflags: '-DGC_PROFILE_MORE_DETAIL' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'MALLOC_ALLOCATED_SIZE_CHECK', with: { cppflags: '-DMALLOC_ALLOCATED_SIZE_CHECK' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'RGENGC_ESTIMATE_OLDMALLOC', with: { cppflags: '-DRGENGC_ESTIMATE_OLDMALLOC' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'RGENGC_PROFILE', with: { cppflags: '-DRGENGC_PROFILE' }, timeout-minutes: 5 }
+
+ compileC:
+ name: 'omnibus compilations, #12'
+ runs-on: ubuntu-latest
+ needs: compile-if
+ if: ${{ needs.compile-if.result == 'success' }}
+ timeout-minutes: 60
+ services: { docuum: { image: 'stephanmisc/docuum', options: '--init', volumes: [ '/root', '/var/run/docker.sock:/var/run/docker.sock' ] } }
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
+ - { uses: './.github/actions/setup/directories', with: { srcdir: 'src', builddir: 'build', makeup: true, fetch-depth: 10 } }
+ - { uses: './.github/actions/compilers', name: 'VM_DEBUG_BP_CHECK', with: { cppflags: '-DVM_DEBUG_BP_CHECK' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'VM_DEBUG_VERIFY_METHOD_CACHE', with: { cppflags: '-DVM_DEBUG_VERIFY_METHOD_CACHE' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'YJIT_FORCE_ENABLE', with: { cppflags: '-DYJIT_FORCE_ENABLE' }, timeout-minutes: 5 }
+ - { uses: './.github/actions/compilers', name: 'UNIVERSAL_PARSER', with: { cppflags: '-DUNIVERSAL_PARSER' }, timeout-minutes: 5 }
+
+ compilemax:
+ name: 'omnibus compilations, result'
+ runs-on: ubuntu-latest
+ if: ${{ always() }}
+ needs:
+ - 'compile1'
+ - 'compile2'
+ - 'compile3'
+ - 'compile4'
+ - 'compile5'
+ - 'compile6'
+ - 'compile7'
+ - 'compile8'
+ - 'compile9'
+ - 'compileX'
+ - 'compileB'
+ - 'compileC'
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with: { sparse-checkout-cone-mode: false, sparse-checkout: /.github }
- uses: ./.github/actions/slack
with:
- label: ${{ matrix.entry.name }}
+ label: 'omnibus'
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
- if: ${{ failure() }}
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
+ - run: false
+ working-directory:
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
defaults:
run:
diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
new file mode 100644
index 0000000000..ac73991fe8
--- /dev/null
+++ b/.github/workflows/cygwin.yml
@@ -0,0 +1,71 @@
+name: Cygwin
+on:
+ push:
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ pull_request:
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ merge_group:
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ make:
+ runs-on: windows-2022
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - run: git config --global core.autocrlf input
+
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+
+ - name: Setup Cygwin
+ uses: cygwin/cygwin-install-action@master
+ with:
+ packages: ruby gcc-core make autoconf libtool libssl-devel libyaml-devel libffi-devel zlib-devel rubygems
+
+ - name: configure
+ run: |
+ ./autogen.sh
+ ./configure --disable-install-doc
+ shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o igncr -o pipefail {0}
+
+ - name: Extract bundled gems
+ run: |
+ make ruby -j5
+ make extract-gems
+ shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o igncr -o pipefail {0}
+
+ - name: make all
+ timeout-minutes: 30
+ run: make -j4 V=1
+ shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o igncr -o pipefail {0}
+
+ - uses: ./.github/actions/slack
+ with:
+ label: Cygwin
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
diff --git a/.github/workflows/default_gems_list.yml b/.github/workflows/default_gems_list.yml
new file mode 100644
index 0000000000..1c7e2195c8
--- /dev/null
+++ b/.github/workflows/default_gems_list.yml
@@ -0,0 +1,99 @@
+name: Update default gems list
+on: [push, pull_request, merge_group]
+
+env:
+ UPDATE_NEWS_ENABLED: true
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ update_default_gems_list:
+ name: Update default gems list
+
+ permissions:
+ contents: write # for Git to git push
+
+ runs-on: ubuntu-latest
+
+ if: ${{ github.repository == 'ruby/ruby' }}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
+
+ - id: gems
+ run: true
+ if: ${{ github.ref == 'refs/heads/master' }}
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ makeup: true
+ # Skip overwriting MATZBOT_AUTO_UPDATE_TOKEN
+ checkout: '' # false (ref: https://github.com/actions/runner/issues/2238)
+ if: ${{ steps.gems.outcome == 'success' }}
+
+ - name: Download previous gems list
+ run: |
+ data=default_gems.json
+ mkdir -p .downloaded-cache
+ ln -s .downloaded-cache/$data .
+ curl -O -R -z ./$data https://stdgems.org/$data
+ if: ${{ steps.gems.outcome == 'success' }}
+
+ - name: Make default gems list
+ run: |
+ #!ruby
+ require 'rubygems'
+ $:.unshift "lib"
+ rgver = File.foreach("lib/rubygems.rb") do |line|
+ break $1 if /^\s*VERSION\s*=\s*"([^"]+)"/ =~ line
+ end
+ gems = Dir.glob("{ext,lib}/**/*.gemspec").map do |f|
+ spec = Gem::Specification.load(f)
+ "#{spec.name} #{spec.version}"
+ end.sort
+ File.open("gems/default_gems", "w") do |f|
+ f.puts "RubyGems #{rgver}"
+ f.puts gems
+ end
+ shell: ruby --disable=gems {0}
+ if: ${{ steps.gems.outcome == 'success' }}
+
+ - name: Maintain updated gems list in NEWS
+ run: |
+ ruby tool/update-NEWS-gemlist.rb default
+ if: ${{ steps.gems.outcome == 'success' && env.UPDATE_NEWS_ENABLED == 'true' }}
+
+ - name: Check diffs
+ id: diff
+ run: |
+ git diff --color --no-ext-diff --ignore-submodules --exit-code NEWS.md ||
+ echo update=true >> $GITHUB_OUTPUT
+ if: ${{ steps.gems.outcome == 'success' }}
+
+ - name: Commit
+ run: |
+ git pull --ff-only origin ${GITHUB_REF#refs/heads/}
+ git commit --message="Update default gems list at ${GITHUB_SHA:0:30} [ci skip]" NEWS.md
+ git push origin ${GITHUB_REF#refs/heads/}
+ env:
+ EMAIL: svn-admin@ruby-lang.org
+ GIT_AUTHOR_NAME: git
+ GIT_COMMITTER_NAME: git
+ if: >-
+ ${{
+ github.repository == 'ruby/ruby' &&
+ !startsWith(github.event_name, 'pull') &&
+ steps.diff.outputs.update
+ }}
+
+ - uses: ./.github/actions/slack
+ with:
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
diff --git a/.github/workflows/dependabot_automerge.yml b/.github/workflows/dependabot_automerge.yml
index 80112a0af3..a95c7005c4 100644
--- a/.github/workflows/dependabot_automerge.yml
+++ b/.github/workflows/dependabot_automerge.yml
@@ -1,23 +1,25 @@
# from https://github.com/gofiber/swagger/blob/main/.github/workflows/dependabot_automerge.yml
name: Dependabot auto-merge
on:
- pull_request_target:
+ pull_request:
+
+permissions:
+ contents: write
+ pull-requests: write
jobs:
automerge:
runs-on: ubuntu-latest
-
- if: ${{ github.actor == 'dependabot[bot]' }}
-
+ if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'ruby/ruby'
steps:
- name: Dependabot metadata
- uses: dependabot/fetch-metadata@5e5f99653a5b510e8555840e80cbf1514ad4af38 # v2.1.0
+ uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0
id: metadata
- name: Wait for status checks
- uses: lewagon/wait-on-check-action@ccfb013c15c8afb7bf2b7c028fb74dc5a068cccc # v1.3.4
+ uses: lewagon/wait-on-check-action@3603e826ee561ea102b58accb5ea55a1a7482343 # v1.4.1
with:
- repo-token: ${{ secrets.MATZBOT_GITHUB_TOKEN }}
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
check-regexp: 'make \(check, .*\)'
wait-interval: 30
@@ -27,4 +29,4 @@ jobs:
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
- GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_TOKEN }}
+ GITHUB_TOKEN: ${{ secrets.MATZBOT_DEPENDABOT_MERGE_TOKEN }}
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 0000000000..16dbac1afa
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,12 @@
+name: "Pull Request Labeler"
+on:
+- pull_request_target
+
+jobs:
+ labeler:
+ permissions:
+ contents: read
+ pull-requests: write
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@v6
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index b565833e74..29adcab39a 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -26,33 +26,42 @@ jobs:
matrix:
include:
- test_task: check
+ os: macos-14
+ - test_task: check
+ os: macos-14
+ configure_args: '--with-gcc=gcc-14'
+ - test_task: check
+ os: macos-14
+ configure_args: '--with-jemalloc --with-opt-dir=$(brew --prefix jemalloc)'
+ - test_task: check
+ os: macos-14
+ configure_args: '--with-gmp'
- test_task: test-all
test_opts: --repeat-count=2
+ os: macos-14
- test_task: test-bundler-parallel
+ os: macos-14
- test_task: test-bundled-gems
+ os: macos-14
- test_task: check
- os: macos-12
- - test_task: check
- os: macos-13
+ os: macos-15
fail-fast: false
env:
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
- runs-on: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14')}}
+ runs-on: ${{ matrix.os }}
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
@@ -76,14 +85,28 @@ jobs:
sudo sysctl -w kern.coredump=1
sudo chmod -R +rwx /cores/
+ - name: Delete unused SDKs
+ # To free up disk space to not run out during the run
+ run: |
+ sudo rm -rf ~/.dotnet
+ sudo rm -rf /Library/Android
+ sudo rm -rf /Library/Developer/CoreSimulator
+ continue-on-error: true
+
- name: Run configure
- run: ../src/configure -C --disable-install-doc ${ruby_configure_args}
+ run: ../src/configure -C --disable-install-doc ${ruby_configure_args} ${{ matrix.configure_args }}
- run: make prepare-gems
if: ${{ matrix.test_task == 'test-bundled-gems' }}
- run: make
+ - run: make hello
+
+ - name: runirb
+ run: |
+ echo IRB::VERSION | make runirb RUNOPT="-- -f"
+
- name: Set test options for skipped tests
run: |
set -x
@@ -92,28 +115,37 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
- name: Set up Launchable
+ id: launchable
uses: ./.github/actions/launchable/setup
with:
- os: ${{ matrix.os || (github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14')}}
+ os: ${{ matrix.os }}
test-opts: ${{ matrix.test_opts }}
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
builddir: build
srcdir: src
continue-on-error: true
+ timeout-minutes: 3
- name: Set extra test options
- run: echo "TESTS=$TESTS ${{ matrix.test_opts }}" >> $GITHUB_ENV
+ run: |
+ echo "TESTS=$TESTS ${{ matrix.test_opts }}" >> $GITHUB_ENV
+ echo "RUBY_TEST_TIMEOUT_SCALE=10" >> $GITHUB_ENV # With --repeat-count=2, flaky test by timeout occurs frequently for some reason
if: matrix.test_opts
- name: make ${{ matrix.test_task }}
run: |
+ test -n "${LAUNCHABLE_STDOUT}" && exec 1> >(tee "${LAUNCHABLE_STDOUT}")
+ test -n "${LAUNCHABLE_STDERR}" && exec 2> >(tee "${LAUNCHABLE_STDERR}")
+
ulimit -c unlimited
make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"}
- timeout-minutes: 60
+ timeout-minutes: 90
env:
RUBY_TESTOPTS: '-q --tty=no'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
PRECHECK_BUNDLED_GEMS: 'no'
+ LAUNCHABLE_STDOUT: ${{ steps.launchable.outputs.stdout_report_path }}
+ LAUNCHABLE_STDERR: ${{ steps.launchable.outputs.stderr_report_path }}
- name: make skipped tests
run: |
@@ -125,6 +157,14 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
continue-on-error: ${{ matrix.continue-on-skipped_tests || false }}
+ - name: CAPI extensions
+ uses: ./.github/actions/capiext
+ with:
+ builddir: build
+ env:
+ RUBY_TESTOPTS: '-v --tty=no'
+ if: ${{ contains(matrix.extra_checks, 'capi') }}
+
- uses: ./.github/actions/slack
with:
label: ${{ matrix.os }} / ${{ matrix.test_task }}
diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml
index 7fd2eed66b..5c639ad48b 100644
--- a/.github/workflows/mingw.yml
+++ b/.github/workflows/mingw.yml
@@ -30,16 +30,30 @@ permissions:
#
jobs:
make:
- runs-on: windows-2022
+ runs-on: windows-${{ matrix.os }}
name: ${{ github.workflow }} (${{ matrix.msystem }})
env:
MSYSTEM: ${{ matrix.msystem }}
- MSYS2_ARCH: x86_64
- CHOST: 'x86_64-w64-mingw32'
- CFLAGS: '-march=x86-64 -mtune=generic -O3 -pipe'
- CXXFLAGS: '-march=x86-64 -mtune=generic -O3 -pipe'
+ MSYS2_ARCH: >-
+ ${{
+ contains(matrix.msystem, 'arm64') && 'aarch64' ||
+ contains(matrix.msystem, '64') && 'x86_64' || 'i686'
+ }}
+ MINGW_PACKAGE_PREFIX: >-
+ mingw-w${{
+ endsWith(matrix.msystem, '64') && '64' || '32'
+ }}-${{
+ startsWith(matrix.msystem, 'clang') && 'clang' ||
+ startsWith(matrix.msystem, 'ucrt') && 'ucrt' ||
+ 'mingw'
+ }}-${{
+ contains(matrix.msystem, 'arm64') && 'aarch64' ||
+ endsWith(matrix.msystem, '64') && 'x86_64' || 'i686'
+ }}
+ CFLAGS: '-mtune=generic -O3 -pipe'
+ CXXFLAGS: '-mtune=generic -O3 -pipe'
CPPFLAGS: '-D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048'
LDFLAGS: '-pipe'
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
@@ -48,56 +62,111 @@ jobs:
matrix:
include:
# To mitigate flakiness of MinGW CI, we test only one runtime that newer MSYS2 uses.
+ # Ruby 3.2 is the first Windows Ruby to use OpenSSL 3.x
- msystem: 'UCRT64'
- baseruby: '3.0'
+ os: 2022
test_task: 'check'
test-all-opts: '--name=!/TestObjSpace#test_reachable_objects_during_iteration/'
+ - msystem: 'CLANGARM64'
+ os: 11-arm
+ test_task: 'check'
fail-fast: false
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - name: Set up Ruby & MSYS2
- uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: msys2/setup-msys2@4f806de0a5a7294ffabaff804b38a9b435a73bda # v2.30.0
+ id: msys2
with:
- ruby-version: ${{ matrix.baseruby }}
-
- - name: where check
- run: |
- # show where
- mv /c/Windows/System32/libcrypto-1_1-x64.dll /c/Windows/System32/libcrypto-1_1-x64.dll_
- mv /c/Windows/System32/libssl-1_1-x64.dll /c/Windows/System32/libssl-1_1-x64.dll_
- result=true
- for e in gcc.exe ragel.exe make.exe libcrypto-1_1-x64.dll libssl-1_1-x64.dll; do
- echo ::group::$'\033[93m'$e$'\033[m'
- where $e || result=false
- echo ::endgroup::
- done
- $result
+ msystem: ${{ matrix.msystem }}
+ update: true
+ install: >-
+ git
+ make
+ ruby
+ autoconf
+ ${{ env.MINGW_PACKAGE_PREFIX }}-gcc
+ ${{ env.MINGW_PACKAGE_PREFIX }}-ragel
+ ${{ env.MINGW_PACKAGE_PREFIX }}-openssl
+ ${{ env.MINGW_PACKAGE_PREFIX }}-libyaml
+ ${{ env.MINGW_PACKAGE_PREFIX }}-libffi
+
+ - name: Set up env
+ id: setup-env
working-directory:
-
- - name: version check
run: |
- # show version
- result=true
- for e in gcc ragel make "openssl version"; do
- case "$e" in *" "*) ;; *) e="$e --version";; esac
- echo ::group::$'\033[93m'$e$'\033[m'
- $e || result=false
- echo ::endgroup::
- done
- $result
+ $msys2 = ${env:MSYS2_LOCATION}
+ $msystem = ${env:MSYSTEM}.ToLower()
+ echo $msys2\usr\bin $msys2\$msystem\bin |
+ Tee-Object ${env:GITHUB_PATH} -Append -Encoding utf-8
+
+ # Use the fast device for the temporary directory.
+ # %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
+ # https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
+ $tmp = ${env:RUNNER_TEMP}
+ echo HOME=$home TMP=$tmp TEMP=$tmp TMPDIR=$tmp |
+ Tee-Object ${env:GITHUB_ENV} -Append -Encoding utf-8
+ shell: pwsh # cmd.exe does not strip spaces before `|`.
+ env:
+ MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
+ MSYSTEM: ${{ matrix.msystem }}
+
+ - name: Remove Strawberry Perl pkg-config
working-directory:
+ # `pkg-config.bat` included in Strawberry Perl is written in
+ # Perl and doesn't work when another msys2 `perl` precede its
+ # own `perl`.
+ #
+ # ```
+ # Can't find C:\Strawberry\perl\bin\pkg-config.bat on PATH, '.' not in PATH.
+ # ```
+ run: |
+ Get-Command pkg-config.bat | % { ren $_.path ($_.path + "~") }
+ shell: pwsh
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - name: Misc system & package info
+ working-directory:
+ run: |
+ group() { echo ::group::$'\e[94;1m'"$*"$'\e[m'; }
+ endgroup() { echo ::endgroup::; }
+
+ group Path
+ cygpath -wa / . $(type -p cygpath bash sh)
+ endgroup
+
+ I() {
+ group $1
+ run Where type -pa $1 && { [ $# -eq 1 ] || run Version "$@"; } ||
+ failed+=($1)
+ endgroup
+ }
+ run() { local w m=$1; shift; w="$("$@")" && show "$m" && indent "$w"; }
+ indent() { [ -z "$1" ] || echo "$1" | /bin/sed '/^$/!s/^/ /'; }
+ show() { echo $'\e[96m'"$*"$'\e[m'; }
+
+ failed=()
+
+ I gcc.exe --version
+ I ragel.exe --version
+ I make.exe --version
+ I openssl.exe version
+ I libcrypto-3-x64.dll
+ I libssl-3-x64.dll
+
+ group Packages
+ pacman -Qs $MINGW_PACKAGE_PREFIX-* | /bin/sed -n "s,local/$MINGW_PACKAGE_PREFIX-,,p"
+ endgroup
+
+ [ ${#failed[@]} -eq 0 ]
+ shell: sh
+
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
@@ -107,23 +176,38 @@ jobs:
srcdir: src
builddir: build
makeup: true
+ # Set fetch-depth: 10 so that Launchable can receive commits information.
+ fetch-depth: 10
- name: configure
run: >
../src/configure --disable-install-doc --prefix=/.
--build=$CHOST --host=$CHOST --target=$CHOST
+ shell: sh
+ env:
+ CHOST: ${{ env.MSYS2_ARCH }}-w64-mingw32
- name: make all
timeout-minutes: 30
- run: make
+ run: make -j4
- name: make install
run: make DESTDIR=../install install-nodoc
+ - name: Set up Launchable
+ uses: ./.github/actions/launchable/setup
+ with:
+ os: windows-2022
+ launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
+ builddir: build
+ srcdir: src
+ test-tasks: '["test", "test-all", "test-spec"]'
+ continue-on-error: true
+ timeout-minutes: 3
+
- name: test
timeout-minutes: 30
- run: make test
- shell: cmd
+ run: make test test-tool
env:
GNUMAKEFLAGS: ''
RUBY_TESTOPTS: '-v --tty=no'
@@ -131,13 +215,13 @@ jobs:
- name: test-all
timeout-minutes: 45
- shell: cmd
run: |
make ${{ StartsWith(matrix.test_task, 'test/') && matrix.test_task || 'test-all' }}
env:
RUBY_TESTOPTS: >-
- --retry --job-status=normal --show-skip --timeout-scale=1.5
+ --retry --job-status=normal --show-skip --timeout-scale=1.5 -j4
${{ matrix.test-all-opts }}
+ ${{ env.TESTS }}
BUNDLER_VERSION:
if: ${{ matrix.test_task == 'check' || matrix.test_task == 'test-all' || StartsWith(matrix.test_task, 'test/') }}
@@ -145,7 +229,6 @@ jobs:
timeout-minutes: 10
run: |
make ${{ StartsWith(matrix.test_task, 'spec/') && matrix.test_task || 'test-spec' }}
- shell: cmd
if: ${{ matrix.test_task == 'check' || matrix.test_task == 'test-spec' || StartsWith(matrix.test_task, 'spec/') }}
- uses: ./src/.github/actions/slack
@@ -157,4 +240,4 @@ jobs:
defaults:
run:
working-directory: build
- shell: sh
+ shell: cmd
diff --git a/.github/workflows/modgc.yml b/.github/workflows/modgc.yml
new file mode 100644
index 0000000000..1d14934df8
--- /dev/null
+++ b/.github/workflows/modgc.yml
@@ -0,0 +1,176 @@
+name: ModGC
+on:
+ push:
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ pull_request:
+ # Do not use paths-ignore for required status checks
+ # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
+ merge_group:
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ check:
+ strategy:
+ matrix:
+ gc:
+ - name: default
+ - name: mmtk
+ mmtk_build: release
+ os: [macos-latest, ubuntu-latest]
+ include:
+ - test_task: check
+ fail-fast: false
+
+ env:
+ GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
+ RUBY_DEBUG: ci
+
+ runs-on: ${{ matrix.os }}
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ sparse-checkout-cone-mode: false
+ sparse-checkout: /.github
+
+ - name: Install libraries (macOS)
+ uses: ./.github/actions/setup/macos
+ if: ${{ contains(matrix.os, 'macos') }}
+
+ - name: Install libraries (Ubuntu)
+ uses: ./.github/actions/setup/ubuntu
+ if: ${{ contains(matrix.os, 'ubuntu') }}
+
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
+ with:
+ ruby-version: '3.1'
+ bundler: none
+ if: ${{ contains(matrix.os, 'ubuntu') }}
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+ clean: true
+ dummy-files: false
+ # Set fetch-depth: 10 so that Launchable can receive commits information.
+ fetch-depth: 10
+
+ - name: make sure that kern.coredump=1
+ run: |
+ sysctl -n kern.coredump
+ sudo sysctl -w kern.coredump=1
+ sudo chmod -R +rwx /cores/
+ if: ${{ contains(matrix.os, 'macos') }}
+
+ - name: Delete unused SDKs
+ # To free up disk space to not run out during the run
+ run: |
+ sudo rm -rf ~/.dotnet
+ sudo rm -rf /Library/Android
+ sudo rm -rf /Library/Developer/CoreSimulator
+ continue-on-error: true
+ if: ${{ contains(matrix.os, 'macos') }}
+
+ - name: Setup Ruby GC Directory
+ run: |
+ echo "MODULAR_GC_DIR=$HOME/ruby_gc" >> $GITHUB_ENV
+
+ - name: Run configure
+ env:
+ arch: ${{ matrix.arch }}
+ run: >-
+ $SETARCH ../src/configure -C --disable-install-doc --with-modular-gc=${{ env.MODULAR_GC_DIR }}
+ ${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE}
+
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Set MMTk environment variables
+ run: |
+ echo 'EXCLUDES=../src/test/.excludes-mmtk' >> $GITHUB_ENV
+ echo 'MSPECOPT=-B../src/spec/mmtk.mspec' >> $GITHUB_ENV
+ if: ${{ matrix.gc.name == 'mmtk' }}
+
+ - run: $SETARCH make
+
+ - name: Build Modular GC
+ run: |
+ echo "RUBY_GC_LIBRARY=${{ matrix.gc.name }}" >> $GITHUB_ENV
+ make install-modular-gc MODULAR_GC=${{ matrix.gc.name }} MMTK_BUILD=${{ matrix.gc.mmtk_build }}
+ make distclean-modular-gc MODULAR_GC=${{ matrix.gc.name }}
+
+ - run: $SETARCH make hello
+
+ - name: Set test options for skipped tests
+ run: |
+ set -x
+ TESTS="$(echo "${{ matrix.skipped_tests }}" | sed 's| |$$/ -n!/|g;s|^|-n!/|;s|$|$$/|')"
+ echo "TESTS=${TESTS}" >> $GITHUB_ENV
+ if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
+
+ - name: Set up Launchable
+ id: launchable
+ uses: ./.github/actions/launchable/setup
+ with:
+ os: ${{ matrix.os || 'ubuntu-22.04' }}
+ test-opts: ${{ matrix.configure }}
+ launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
+ builddir: build
+ srcdir: src
+ continue-on-error: true
+ timeout-minutes: 3
+
+ - name: make ${{ matrix.test_task }}
+ run: |
+ test -n "${LAUNCHABLE_STDOUT}" && exec 1> >(tee "${LAUNCHABLE_STDOUT}")
+ test -n "${LAUNCHABLE_STDERR}" && exec 2> >(tee "${LAUNCHABLE_STDERR}")
+
+ $SETARCH make -s ${{ matrix.test_task }} \
+ ${TESTS:+TESTS="$TESTS"} \
+ ${{ !contains(matrix.test_task, 'bundle') && 'RUBYOPT=-w' || '' }}
+ timeout-minutes: ${{ matrix.gc.timeout || 40 }}
+ env:
+ RUBY_TESTOPTS: '-q --tty=no'
+ TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
+ PRECHECK_BUNDLED_GEMS: 'no'
+ LAUNCHABLE_STDOUT: ${{ steps.launchable.outputs.stdout_report_path }}
+ LAUNCHABLE_STDERR: ${{ steps.launchable.outputs.stderr_report_path }}
+
+ - name: make skipped tests
+ run: |
+ $SETARCH make -s test-all TESTS="${TESTS//-n!\//-n/}"
+ env:
+ GNUMAKEFLAGS: ''
+ RUBY_TESTOPTS: '-v --tty=no'
+ if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
+ continue-on-error: ${{ matrix.continue-on-skipped_tests || false }}
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ${{ matrix.test_task }} ${{ matrix.configure }}${{ matrix.arch }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/parse_y.yml b/.github/workflows/parse_y.yml
new file mode 100644
index 0000000000..87facc8a55
--- /dev/null
+++ b/.github/workflows/parse_y.yml
@@ -0,0 +1,100 @@
+name: parse.y
+on:
+ push:
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ pull_request:
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ merge_group:
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ make:
+ strategy:
+ matrix:
+ include:
+ - test_task: check
+ - test_task: test-bundler-parallel
+ - test_task: test-bundled-gems
+ fail-fast: false
+
+ env:
+ GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
+ RUBY_DEBUG: ci
+ SETARCH: ${{ matrix.arch && format('setarch {0}', matrix.arch) }}
+
+ runs-on: ubuntu-22.04
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ sparse-checkout-cone-mode: false
+ sparse-checkout: /.github
+
+ - uses: ./.github/actions/setup/ubuntu
+
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
+ with:
+ ruby-version: '3.1'
+ bundler: none
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+ clean: true
+ dummy-files: ${{ matrix.test_task == 'check' }}
+
+ - name: Run configure
+ run: ../src/configure -C --disable-install-doc cppflags=-DRUBY_DEBUG --with-parser=parse.y
+
+ - run: make
+
+ - run: make TESTRUN_SCRIPT='-renvutil -v -e "exit EnvUtil.current_parser == %[parse.y]"' run
+ env:
+ RUNOPT0: -I$(tooldir)/lib
+
+ - name: make ${{ matrix.test_task }}
+ run: make -s ${{ matrix.test_task }} RUN_OPTS="$RUN_OPTS" SPECOPTS="$SPECOPTS"
+ env:
+ RUBY_TESTOPTS: ${{ matrix.testopts }}
+ EXCLUDES: '../src/test/.excludes-parsey'
+ RUN_OPTS: ${{ matrix.run_opts || '--parser=parse.y' }}
+ SPECOPTS: ${{ matrix.specopts || '-T --parser=parse.y' }}
+ TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ${{ matrix.run_opts }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/post_push.yml b/.github/workflows/post_push.yml
new file mode 100644
index 0000000000..318444c0a2
--- /dev/null
+++ b/.github/workflows/post_push.yml
@@ -0,0 +1,85 @@
+name: Post-push
+on:
+ push:
+ branches:
+ - master
+ - 'ruby_*_*'
+jobs:
+ hooks:
+ name: Post-push hooks
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'ruby/ruby' }}
+ steps:
+ - name: Sync git.ruby-lang.org
+ run: |
+ mkdir -p ~/.ssh
+ (umask 066; printenv RUBY_GIT_SYNC_PRIVATE_KEY > ~/.ssh/id_ed25519)
+ ssh-keyscan -t ed25519 git.ruby-lang.org >> ~/.ssh/known_hosts
+ ssh -i ~/.ssh/id_ed25519 git-sync@git.ruby-lang.org "sudo -u git /home/git/git.ruby-lang.org/bin/update-ruby.sh $GITHUB_REF"
+ env:
+ GITHUB_REF: ${{ github.ref }}
+ RUBY_GIT_SYNC_PRIVATE_KEY: ${{ secrets.RUBY_GIT_SYNC_PRIVATE_KEY }}
+ if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }}
+
+ - name: Fetch changesets on bugs.ruby-lang.org
+ run: |
+ curl "https://bugs.ruby-lang.org/sys/fetch_changesets?key=${REDMINE_SYS_API_KEY}" -s --fail-with-body -w '* status: %{http_code}\n'
+ env:
+ REDMINE_SYS_API_KEY: ${{ secrets.REDMINE_SYS_API_KEY }}
+ if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }}
+
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ fetch-depth: 500 # for notify-slack-commits
+ token: ${{ secrets.MATZBOT_AUTO_UPDATE_TOKEN }}
+
+ - name: Notify commit to Slack
+ run: ruby tool/notify-slack-commits.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master
+ env:
+ GITHUB_OLD_SHA: ${{ github.event.before }}
+ GITHUB_NEW_SHA: ${{ github.event.after }}
+ SLACK_WEBHOOK_URL_ALERTS: ${{ secrets.SLACK_WEBHOOK_URL_ALERTS }}
+ SLACK_WEBHOOK_URL_COMMITS: ${{ secrets.SLACK_WEBHOOK_URL_COMMITS }}
+ SLACK_WEBHOOK_URL_RUBY_JP: ${{ secrets.SLACK_WEBHOOK_URL_RUBY_JP }}
+ if: ${{ github.ref == 'refs/heads/master' }}
+
+ - name: Notify commit to ruby-cvs
+ run: |
+ SENDMAIL="ssh -i ${HOME}/.ssh/id_ed25519 git-sync@git.ruby-lang.org /usr/sbin/sendmail" \
+ ruby tool/commit-email.rb . ruby-cvs@g.ruby-lang.org \
+ "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" "$GITHUB_REF" \
+ --viewer-uri "https://github.com/ruby/ruby/commit/" \
+ --error-to cvs-admin@ruby-lang.org
+ env:
+ GITHUB_OLD_SHA: ${{ github.event.before }}
+ GITHUB_NEW_SHA: ${{ github.event.after }}
+ GITHUB_REF: ${{ github.ref }}
+ if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }}
+
+ - name: Auto-correct code styles
+ run: |
+ set -x
+ ruby tool/auto-style.rb "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master
+ env:
+ GITHUB_OLD_SHA: ${{ github.event.before }}
+ GITHUB_NEW_SHA: ${{ github.event.after }}
+ GIT_AUTHOR_NAME: git
+ GIT_COMMITTER_NAME: git
+ EMAIL: svn-admin@ruby-lang.org
+ if: ${{ github.ref == 'refs/heads/master' }}
+
+ - name: Push PR notes to GitHub
+ run: ruby tool/notes-github-pr.rb "$(pwd)/.git" "$GITHUB_OLD_SHA" "$GITHUB_NEW_SHA" refs/heads/master
+ env:
+ GITHUB_OLD_SHA: ${{ github.event.before }}
+ GITHUB_NEW_SHA: ${{ github.event.after }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GIT_AUTHOR_NAME: git
+ GIT_COMMITTER_NAME: git
+ EMAIL: svn-admin@ruby-lang.org
+ if: ${{ github.ref == 'refs/heads/master' }}
+
+ - uses: ./.github/actions/slack
+ with:
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
diff --git a/.github/workflows/pr-playground.yml b/.github/workflows/pr-playground.yml
index cc06006142..f3c0556429 100644
--- a/.github/workflows/pr-playground.yml
+++ b/.github/workflows/pr-playground.yml
@@ -25,7 +25,7 @@ jobs:
&& github.event.workflow_run.event == 'pull_request')
}}
steps:
- - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
+ - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
diff --git a/.github/workflows/prism.yml b/.github/workflows/prism.yml
deleted file mode 100644
index 56d7298193..0000000000
--- a/.github/workflows/prism.yml
+++ /dev/null
@@ -1,114 +0,0 @@
-name: Prism
-on:
- push:
- paths-ignore:
- - 'doc/**'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '**.[1-8]'
- - '**.ronn'
- - '.*.yml'
- pull_request:
- paths-ignore:
- - 'doc/**'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '**.[1-8]'
- - '**.ronn'
- - '.*.yml'
- merge_group:
-
-concurrency:
- group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
- cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
-
-permissions:
- contents: read
-
-jobs:
- make:
- strategy:
- matrix:
- # main variables included in the job name
- test_task: [check]
- run_opts: ['--parser=prism']
- arch: ['']
- fail-fast: false
-
- env:
- GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
- RUBY_DEBUG: ci
- SETARCH: ${{ matrix.arch && format('setarch {0}', matrix.arch) }}
-
- runs-on: ubuntu-22.04
-
- if: >-
- ${{!(false
- || contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
- || contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
- )}}
-
- steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- with:
- sparse-checkout-cone-mode: false
- sparse-checkout: /.github
-
- - uses: ./.github/actions/setup/ubuntu
-
- - uses: ./.github/actions/setup/directories
- with:
- srcdir: src
- builddir: build
- makeup: true
-
- - name: Run configure
- env:
- arch: ${{ matrix.arch }}
- run: >-
- $SETARCH ../src/configure -C --disable-install-doc cppflags=-DRUBY_DEBUG
- ${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE}
-
- - run: $SETARCH make
-
- - name: make test
- run: |
- $SETARCH make -s test RUN_OPTS="$RUN_OPTS"
- timeout-minutes: 30
- env:
- GNUMAKEFLAGS: ''
- RUBY_TESTOPTS: '-v --tty=no'
- RUN_OPTS: ${{ matrix.run_opts }}
-
- - name: make test-all
- run: |
- $SETARCH make -s test-all RUN_OPTS="$RUN_OPTS"
- timeout-minutes: 40
- env:
- GNUMAKEFLAGS: ''
- RUBY_TESTOPTS: '-q --tty=no --excludes-dir="../src/test/.excludes-prism" --exclude="error_highlight/test_error_highlight.rb"'
- RUN_OPTS: ${{ matrix.run_opts }}
-
- - name: make test-spec
- run: |
- $SETARCH make -s test-spec SPECOPTS="$SPECOPTS"
- timeout-minutes: 10
- env:
- GNUMAKEFLAGS: ''
- SPECOPTS: "-T -W:no-experimental -T --parser=prism"
-
- - uses: ./.github/actions/slack
- with:
- label: ${{ matrix.run_opts }}
- SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
- if: ${{ failure() }}
-
-defaults:
- run:
- working-directory: build
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000000..3caeee9a3b
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,107 @@
+name: Publish Ruby packages
+
+on:
+ repository_dispatch:
+ types:
+ - release
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'Version of the Ruby package to release'
+ required: true
+ default: '3.3.4'
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v6.0.1
+
+ - uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 3.3.4
+
+ - name: Store Ruby version
+ run: |
+ echo "RUBY_VERSION=${{ github.event.client_payload.version || github.event.inputs.version }}" >> $GITHUB_ENV
+
+ - name: Store ABI version
+ run: echo "ABI_VERSION=$(echo ${{ env.RUBY_VERSION }} | cut -d '.' -f 1-2)" >> $GITHUB_ENV
+
+ - name: Copy draft package `/tmp` to `/pub` directory
+ run: tool/release.sh ${{ env.RUBY_VERSION }}
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.FTP_R_L_O_AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.FTP_R_L_O_AWS_SECRET_ACCESS_KEY }}
+ AWS_DEFAULT_REGION: us-west-2
+
+ - name: Purge URLs of release package
+ run: |
+ curl -X POST \
+ -H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
+ https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.gz
+ curl -X POST \
+ -H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
+ https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.xz
+ curl -X POST \
+ -H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
+ https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.zip
+
+ - name: Create a release on GitHub
+ run: |
+ RELEASE_TAG=$(ruby tool/ruby-version.rb tag "${{ env.RUBY_VERSION }}")
+ echo $RELEASE_TAG
+ PREVIOUS_RELEASE_TAG=$(ruby tool/ruby-version.rb previous-tag "${{ env.RUBY_VERSION }}")
+ echo $PREVIOUS_RELEASE_TAG
+ tool/gen-github-release.rb $PREVIOUS_RELEASE_TAG $RELEASE_TAG --no-dry-run
+ env:
+ GITHUB_TOKEN: ${{ secrets.MATZBOT_AUTO_UPDATE_TOKEN }}
+
+ - name: Update versions index
+ run: |
+ curl -L -X POST \
+ -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
+ -H "Accept: application/vnd.github+json" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ https://api.github.com/repos/ruby/actions/dispatches \
+ -d '{"event_type": "update_index"}'
+
+ - name: Build and push Docker images
+ run: |
+ curl -L -X POST \
+ -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
+ -H "Accept: application/vnd.github+json" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ https://api.github.com/repos/ruby/docker-images/actions/workflows/build.yml/dispatches \
+ -d '{"ref": "master", "inputs": {"ruby_version": "${{ env.RUBY_VERSION }}"}}'
+
+ - name: Build snapcraft packages
+ run: |
+ curl -L -X POST \
+ -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
+ -H "Accept: application/vnd.github+json" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ https://api.github.com/repos/ruby/snap.ruby/dispatches \
+ -d '{"event_type": "build", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}"}}'
+
+ - name: Store the latest LTS version of OpenSSL
+ run: |
+ echo "OPENSSL_VERSION=`curl -s https://api.github.com/repos/openssl/openssl/releases | jq -r '.[].tag_name | select(startswith("openssl-3.0"))' | sort -Vr | head -n1 | cut -d'-' -f2`" >> $GITHUB_ENV
+
+ - name: Update ruby-build definition
+ run: |
+ curl -L -X POST \
+ -H "Authorization: Bearer ${{ secrets.RUBY_BUILD_WORKFLOW_TOKEN }}" \
+ -H "Accept: application/vnd.github+json" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ https://api.github.com/repos/rbenv/ruby-build/dispatches \
+ -d '{"event_type": "update-ruby", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}", "openssl_version": "${{ env.OPENSSL_VERSION }}"}}'
+
+ - name: Update all-ruby definition
+ run: |
+ curl -L -X POST \
+ -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
+ -H "Accept: application/vnd.github+json" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ https://api.github.com/repos/ruby/all-ruby/dispatches \
+ -d '{"event_type": "update"}'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000000..5d4474d978
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,18 @@
+name: Start release workflow
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ notify:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Build release package
+ run: |
+ curl -L -X POST \
+ -H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
+ -H "Accept: application/vnd.github+json" \
+ -H "X-GitHub-Api-Version: 2022-11-28" \
+ https://api.github.com/repos/ruby/actions/dispatches \
+ -d '{"event_type": "${{ github.ref }}"}'
diff --git a/.github/workflows/rjit-bindgen.yml b/.github/workflows/rjit-bindgen.yml
deleted file mode 100644
index 78b65e937a..0000000000
--- a/.github/workflows/rjit-bindgen.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-name: RJIT bindgen
-on:
- push:
- paths-ignore:
- - 'doc/**'
- - '**/man/*'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '.*.yml'
- pull_request:
- paths-ignore:
- - 'doc/**'
- - '**/man/*'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '.*.yml'
- merge_group:
-
-concurrency:
- group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
- cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
-
-permissions:
- contents: read
-
-jobs:
- make:
- strategy:
- matrix:
- include:
- - task: rjit-bindgen
- fail-fast: false
-
- runs-on: ubuntu-20.04
-
- if: >-
- ${{!(false
- || contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
- || contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
- )}}
-
- steps:
- - name: Set up Ruby
- uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
- with:
- ruby-version: '3.1'
-
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- with:
- sparse-checkout-cone-mode: false
- sparse-checkout: /.github
-
- - uses: ./.github/actions/setup/ubuntu
-
- - uses: ./.github/actions/setup/directories
- with:
- srcdir: src
- builddir: build
- makeup: true
-
- - name: Run configure
- run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install --enable-yjit=dev_nodebug
-
- - run: make
-
- - run: make install
-
- - run: make ${{ matrix.task }}
-
- - run: git diff --exit-code
- working-directory: src
-
- - uses: ./.github/actions/slack
- with:
- SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
- if: ${{ failure() }}
-
-defaults:
- run:
- working-directory: build
diff --git a/.github/workflows/rjit.yml b/.github/workflows/rjit.yml
deleted file mode 100644
index 21e697315b..0000000000
--- a/.github/workflows/rjit.yml
+++ /dev/null
@@ -1,114 +0,0 @@
-name: RJIT
-on:
- push:
- paths-ignore:
- - 'doc/**'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '**.[1-8]'
- - '**.ronn'
- - '.*.yml'
- pull_request:
- paths-ignore:
- - 'doc/**'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '**.[1-8]'
- - '**.ronn'
- - '.*.yml'
- merge_group:
-
-concurrency:
- group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
- cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
-
-permissions:
- contents: read
-
-jobs:
- make:
- strategy:
- matrix:
- # main variables included in the job name
- test_task: [check]
- run_opts: ['--rjit-call-threshold=1']
- arch: ['']
- fail-fast: false
-
- env:
- GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
- RUBY_DEBUG: ci
- SETARCH: ${{ matrix.arch && format('setarch {0}', matrix.arch) }}
-
- runs-on: ubuntu-22.04
-
- if: >-
- ${{!(false
- || contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
- || contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
- )}}
-
- steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- with:
- sparse-checkout-cone-mode: false
- sparse-checkout: /.github
-
- - uses: ./.github/actions/setup/ubuntu
-
- - uses: ./.github/actions/setup/directories
- with:
- srcdir: src
- builddir: build
- makeup: true
-
- - name: Run configure
- env:
- arch: ${{ matrix.arch }}
- run: >-
- $SETARCH ../src/configure -C --disable-install-doc cppflags=-DRUBY_DEBUG
- ${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE}
-
- - run: $SETARCH make
-
- - name: make test
- run: |
- $SETARCH make -s test RUN_OPTS="$RUN_OPTS"
- timeout-minutes: 30
- env:
- GNUMAKEFLAGS: ''
- RUBY_TESTOPTS: '--tty=no'
- RUN_OPTS: ${{ matrix.run_opts }}
-
- - name: make test-all
- run: |
- $SETARCH make -s test-all RUN_OPTS="$RUN_OPTS"
- timeout-minutes: 40
- env:
- GNUMAKEFLAGS: ''
- RUBY_TESTOPTS: '-q --tty=no'
- RUN_OPTS: ${{ matrix.run_opts }}
-
- - name: make test-spec
- run: |
- $SETARCH make -s test-spec RUN_OPTS="$RUN_OPTS"
- timeout-minutes: 10
- env:
- GNUMAKEFLAGS: ''
- RUN_OPTS: ${{ matrix.run_opts }}
-
- - uses: ./.github/actions/slack
- with:
- label: ${{ matrix.run_opts }}
- SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
- if: ${{ failure() }}
-
-defaults:
- run:
- working-directory: build
diff --git a/.github/workflows/rust-warnings.yml b/.github/workflows/rust-warnings.yml
new file mode 100644
index 0000000000..a2e3208e52
--- /dev/null
+++ b/.github/workflows/rust-warnings.yml
@@ -0,0 +1,60 @@
+# Surface Rust warnings on PRs that touch any Rust code.
+# Not a required check so we never block people over new warnings
+# that might come from a new Rust version being released.
+name: Rust warnings
+on:
+ pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
+ paths:
+ - '**.rs'
+ - '!**.inc.rs'
+ merge_group:
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ rust-warnings:
+ env:
+ GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
+
+ runs-on: ubuntu-24.04
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+
+ - name: Install Rust
+ run: rustup default beta
+
+ - name: Rust warnings
+ shell: bash
+ run: |
+ set -eu
+ cargo check --quiet --all-features --message-format=json \
+ | jq -r 'select(.message.level | IN("warning", "error")) | .message.rendered' \
+ | tee messages.txt
+ (exit "${PIPESTATUS[0]}") && ! grep --quiet '[^[:space:]]' messages.txt
+
+ - name: "📜 `rustdoc` warnings"
+ shell: bash
+ run: |
+ set -eu
+ cargo doc --document-private-items --all --no-deps --message-format=json \
+ | jq -r 'select(.message.level | IN("warning", "error")) | .message.rendered' \
+ | tee messages.txt
+ (exit "${PIPESTATUS[0]}") && ! grep --quiet '[^[:space:]]' messages.txt
diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml
index 51423a84f9..c607098997 100644
--- a/.github/workflows/scorecards.yml
+++ b/.github/workflows/scorecards.yml
@@ -2,7 +2,7 @@
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.
-name: Scorecards supply-chain security
+name: Scorecard supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
@@ -10,7 +10,7 @@ on:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- - cron: '22 4 * * 2'
+ - cron: '39 3 * * 5'
# push:
# branches: [ "master" ]
@@ -19,8 +19,10 @@ permissions: read-all
jobs:
analysis:
- name: Scorecards analysis
+ name: Scorecard analysis
runs-on: ubuntu-latest
+ # `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
+ if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
@@ -31,21 +33,21 @@ jobs:
# actions: read
steps:
- - name: 'Checkout code'
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - name: "Checkout code"
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- - name: 'Run analysis'
- uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
+ - name: "Run analysis"
+ uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
- # (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
+ # (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
- # - you are installing Scorecards on a *private* repository
- # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
- repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
+ # - you are installing Scorecard on a *private* repository
+ # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
+ # repo_token: ${{ secrets.SCORECARD_TOKEN }}
# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
@@ -56,17 +58,21 @@ jobs:
# of the value entered here.
publish_results: true
+ # (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
+ # file_mode: git
+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- # - name: "Upload artifact"
- # uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
- # with:
- # name: SARIF file
- # path: results.sarif
- # retention-days: 5
+ - name: "Upload artifact"
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
+ with:
+ name: SARIF file
+ path: results.sarif
+ retention-days: 5
- # Upload the results to GitHub's code scanning dashboard.
- - name: 'Upload to code-scanning'
- uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v2.1.27
+ # Upload the results to GitHub's code scanning dashboard (optional).
+ # Commenting out will disable upload of results to your repo's Code Scanning dashboard
+ - name: "Upload to code-scanning"
+ uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: results.sarif
diff --git a/.github/workflows/spec_guards.yml b/.github/workflows/spec_guards.yml
index 45cedf8df1..cf4661555c 100644
--- a/.github/workflows/spec_guards.yml
+++ b/.github/workflows/spec_guards.yml
@@ -3,10 +3,12 @@ name: Rubyspec Version Guards Check
on:
push:
paths:
+ - '.github/workflows/spec_guards.yml'
- 'spec/**'
- '!spec/*.md'
pull_request:
paths:
+ - '.github/workflows/spec_guards.yml'
- 'spec/**'
- '!spec/*.md'
merge_group:
@@ -22,16 +24,14 @@ jobs:
rubyspec:
name: Rubyspec
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
strategy:
@@ -39,15 +39,16 @@ jobs:
# Specs from ruby/spec should still run on all supported Ruby versions.
# This also ensures the needed ruby_version_is guards are there, see spec/README.md.
ruby:
- - ruby-3.0
- - ruby-3.1
- ruby-3.2
- ruby-3.3
+ - ruby-3.4
+ - ruby-4.0
+ fail-fast: false
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
ruby-version: ${{ matrix.ruby }}
bundler: none
diff --git a/.github/workflows/sync_default_gems.yml b/.github/workflows/sync_default_gems.yml
new file mode 100644
index 0000000000..9ff97d5a4e
--- /dev/null
+++ b/.github/workflows/sync_default_gems.yml
@@ -0,0 +1,77 @@
+name: Sync default gems
+
+env:
+ DEFAULT_GEM_SYNC_ENABLED: true
+
+on:
+ workflow_dispatch:
+ inputs:
+ gem:
+ required: true
+ description: 'Name of the gem to be synchronized'
+ type: string
+ before:
+ required: true
+ description: 'Gem commit SHA before sync'
+ type: string
+ after:
+ required: true
+ description: 'Gem commit SHA after sync'
+ type: string
+
+jobs:
+ sync_default_gems:
+ name: Sync default gem ${{ github.event.inputs.gem }}
+
+ permissions:
+ contents: write # for Git to git push
+
+ runs-on: ubuntu-latest
+
+ if: ${{ github.repository == 'ruby/ruby' }}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ name: Check out ruby/ruby
+ with:
+ token: ${{ github.repository == 'ruby/ruby' && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
+
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
+ with:
+ ruby-version: '3.4'
+ bundler: none
+
+ - name: Run tool/sync_default_gems.rb
+ id: sync
+ run: |
+ ruby_before=$(git rev-parse HEAD)
+ set -x
+ ruby tool/sync_default_gems.rb "${gem_name}" "${gem_before}..${gem_after}"
+ if [[ "$(git rev-parse HEAD)" != "$ruby_before" ]]; then
+ echo update=true >> $GITHUB_OUTPUT
+ fi
+ env:
+ gem_name: ${{ github.event.inputs.gem }}
+ gem_before: ${{ github.event.inputs.before }}
+ gem_after: ${{ github.event.inputs.after }}
+ EMAIL: svn-admin@ruby-lang.org
+ GIT_AUTHOR_NAME: git
+ GIT_COMMITTER_NAME: git
+
+ - name: Push
+ run: |
+ git pull --rebase origin ${GITHUB_REF#refs/heads/}
+ git push origin ${GITHUB_REF#refs/heads/}
+ if: ${{ steps.sync.outputs.update && env.DEFAULT_GEM_SYNC_ENABLED == 'true' }}
+ env:
+ EMAIL: svn-admin@ruby-lang.org
+ GIT_AUTHOR_NAME: git
+ GIT_COMMITTER_NAME: git
+
+ - uses: ./.github/actions/slack
+ with:
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ label: "${{ github.event.inputs.gem }} (<https://github.com/${{ github.event.inputs.gem == 'rubygems' && 'rubygems' || 'ruby' }}/${{ github.event.inputs.gem }}/compare/${{ github.event.inputs.before }}...${{ github.event.inputs.after }}|diff>)"
+ event_name: workflow_dispatch
+ extra_channel_id: C05FPKAU743 # alerts-sync
+ if: ${{ failure() }}
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index c1875ea47e..88c19b6fe6 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -24,6 +24,7 @@ jobs:
make:
strategy:
matrix:
+ # We enumerate every job in matrix.include to save build time
include:
- test_task: check
configure: 'cppflags=-DVM_CHECK_MODE'
@@ -33,15 +34,18 @@ jobs:
configure: '--disable-yjit'
- test_task: check
configure: '--enable-shared --enable-load-relative'
- - test_task: check
- configure: '--with-shared-gc'
- test_task: test-bundler-parallel
+ timeout: 50
- test_task: test-bundled-gems
- test_task: check
- os: ubuntu-20.04
+ os: ubuntu-24.04
+ extra_checks: [capi]
+ # ubuntu-24.04-arm jobs don't start on ruby/ruby as of 2025-10-29
+ #- test_task: check
+ # os: ubuntu-24.04-arm
fail-fast: false
- env:
+ env: &make-env
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
RUBY_DEBUG: ci
@@ -50,15 +54,13 @@ jobs:
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
- steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ steps: &make-steps
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
@@ -67,10 +69,13 @@ jobs:
with:
arch: ${{ matrix.arch }}
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
- ruby-version: '3.0'
+ ruby-version: '3.1'
bundler: none
+ if: >-
+ ${{ !endsWith(matrix.os, 'arm')
+ && !endsWith(matrix.os, 'ppc64le') && !endsWith(matrix.os, 's390x') }}
- uses: ./.github/actions/setup/directories
with:
@@ -95,6 +100,12 @@ jobs:
- run: $SETARCH make
+ - run: $SETARCH make hello
+
+ - name: runirb
+ run: |
+ echo IRB::VERSION | $SETARCH make runirb RUNOPT="-- -f"
+
- name: Set test options for skipped tests
run: |
set -x
@@ -103,6 +114,7 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
- name: Set up Launchable
+ id: launchable
uses: ./.github/actions/launchable/setup
with:
os: ${{ matrix.os || 'ubuntu-22.04' }}
@@ -111,17 +123,30 @@ jobs:
builddir: build
srcdir: src
continue-on-error: true
+ timeout-minutes: 3
+
+ # Avoid possible test failures with the zlib applying the following patch
+ # on s390x CPU architecture.
+ # https://github.com/madler/zlib/pull/410
+ - name: Disable DFLTCC
+ run: echo "DFLTCC=0" >> $GITHUB_ENV
+ if: ${{ endsWith(matrix.os, 's390x') }}
- name: make ${{ matrix.test_task }}
- run: >-
- $SETARCH make -s ${{ matrix.test_task }}
- ${TESTS:+TESTS="$TESTS"}
+ run: |
+ test -n "${LAUNCHABLE_STDOUT}" && exec 1> >(tee "${LAUNCHABLE_STDOUT}")
+ test -n "${LAUNCHABLE_STDERR}" && exec 2> >(tee "${LAUNCHABLE_STDERR}")
+
+ $SETARCH make -s ${{ matrix.test_task }} \
+ ${TESTS:+TESTS="$TESTS"} \
${{ !contains(matrix.test_task, 'bundle') && 'RUBYOPT=-w' || '' }}
- timeout-minutes: 40
+ timeout-minutes: ${{ matrix.timeout || 40 }}
env:
RUBY_TESTOPTS: '-q --tty=no'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
PRECHECK_BUNDLED_GEMS: 'no'
+ LAUNCHABLE_STDOUT: ${{ steps.launchable.outputs.stdout_report_path }}
+ LAUNCHABLE_STDERR: ${{ steps.launchable.outputs.stderr_report_path }}
- name: make skipped tests
run: |
@@ -132,9 +157,100 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
continue-on-error: ${{ matrix.continue-on-skipped_tests || false }}
+ - name: test-pc
+ run: |
+ DESTDIR=${RUNNER_TEMP-${TMPDIR-/tmp}}/installed
+ $SETARCH make test-pc "DESTDIR=$DESTDIR"
+
+ - name: CAPI extensions
+ uses: ./.github/actions/capiext
+ with:
+ builddir: build
+ make: '$SETARCH make'
+ env:
+ RUBY_TESTOPTS: '-v --tty=no'
+ if: ${{ contains(matrix.extra_checks, 'capi') }}
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ${{ matrix.test_task }} ${{ matrix.configure }}${{ matrix.arch }}${{ matrix.os }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+ make-ibm:
+ strategy:
+ matrix:
+ include:
+ - test_task: check
+ os: ubuntu-24.04-ppc64le
+ - test_task: check
+ os: ubuntu-24.04-s390x
+ fail-fast: false
+
+ env: *make-env
+
+ runs-on: ${{ matrix.os }}
+
+ if: >-
+ ${{github.repository == 'ruby/ruby'
+ && !(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps: *make-steps
+
+ # Separated from `make` job to avoid making it a required status check
+ ruby-bench:
+ strategy:
+ matrix:
+ include:
+ # Using the same setup as ZJIT jobs
+ - bench_opts: '--warmup=1 --bench=1 --excludes=lobsters'
+
+ runs-on: ubuntu-24.04
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+
+ - uses: ./.github/actions/setup/ubuntu
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+
+ - name: Run configure
+ run: ../src/configure -C --disable-install-doc --prefix="$(pwd)/install"
+
+ - run: make install
+
+ - name: Checkout ruby-bench
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ repository: ruby/ruby-bench
+ path: ruby-bench
+
+ # If you want to skip failing benchmark, consider using `--excludes`.
+ # e.g. `bench_opts: '--warmup=1 --bench=1 --excludes=railsbench,lobsters'`
+ - name: Run ruby-bench
+ run: ruby run_benchmarks.rb -e "ruby::../build/install/bin/ruby" ${{ matrix.bench_opts }}
+ working-directory: ruby-bench
+
- uses: ./.github/actions/slack
with:
- label: ${{ matrix.test_task }} ${{ matrix.configure }}${{ matrix.arch }}
+ label: ruby-bench ${{ matrix.bench_opts }} ${{ matrix.ruby_opts }}
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}
diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml
index 0f01b7f6aa..0d2a6f0545 100644
--- a/.github/workflows/wasm.yml
+++ b/.github/workflows/wasm.yml
@@ -43,25 +43,23 @@ jobs:
env:
RUBY_TESTOPTS: '-q --tty=no'
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
- WASI_SDK_VERSION_MAJOR: 20
+ WASI_SDK_VERSION_MAJOR: 25
WASI_SDK_VERSION_MINOR: 0
BINARYEN_VERSION: 113
WASMTIME_VERSION: v15.0.0
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
@@ -78,7 +76,7 @@ jobs:
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y ruby make autoconf git wget
- wasi_sdk_deb="wasi-sdk_${WASI_SDK_VERSION_MAJOR}.${WASI_SDK_VERSION_MINOR}_amd64.deb"
+ wasi_sdk_deb="wasi-sdk-${WASI_SDK_VERSION_MAJOR}.${WASI_SDK_VERSION_MINOR}-x86_64-linux.deb"
wget "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION_MAJOR}/${wasi_sdk_deb}"
sudo dpkg -i "$wasi_sdk_deb"
rm -f "$wasi_sdk_deb"
@@ -100,9 +98,9 @@ jobs:
run: |
echo "WASI_SDK_PATH=/opt/wasi-sdk" >> $GITHUB_ENV
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
- ruby-version: '3.0'
+ ruby-version: '3.1'
bundler: none
- name: Build baseruby
@@ -114,6 +112,12 @@ jobs:
make
make install
+ - name: Download config.guess with wasi version
+ run: |
+ rm tool/config.guess tool/config.sub
+ ruby tool/downloader.rb -d tool -e gnu config.guess config.sub
+ working-directory: src
+
- name: Run configure
run: |
../src/configure \
@@ -136,7 +140,7 @@ jobs:
- run: tar cfz ../install.tar.gz -C ../install .
- name: Upload artifacts
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ruby-wasm-install
path: ${{ github.workspace }}/install.tar.gz
@@ -164,7 +168,7 @@ jobs:
- name: Save Pull Request number
if: ${{ github.event_name == 'pull_request' }}
run: echo "${{ github.event.pull_request.number }}" >> ${{ github.workspace }}/github-pr-info.txt
- - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
+ - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ github.event_name == 'pull_request' }}
with:
name: github-pr-info
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index ee9038004d..1d44a5482c 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -9,13 +9,8 @@ on:
- '**/.document'
- '.*.yml'
pull_request:
- paths-ignore:
- - 'doc/**'
- - '**/man/*'
- - '**.md'
- - '**.rdoc'
- - '**/.document'
- - '.*.yml'
+ # Do not use paths-ignore for required status checks
+ # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
merge_group:
concurrency:
@@ -30,126 +25,105 @@ jobs:
strategy:
matrix:
include:
- - vc: 2015
- vs: 2019
- vcvars: '10.0.14393.0 -vcvars_ver=14.0' # The oldest Windows 10 SDK w/ VC++ 2015 toolset (v140)
- - vs: 2019
- - vs: 2022
+ - os: 2022
+ vc: 2022
+ test_task: check
+ - os: 2025
+ vc: 2022
+ test_task: check
+ - os: 11-arm
+ test_task: 'btest test-basic test-tool' # check and test-spec are broken yet.
+ target: arm64
+ - os: 2025
+ vc: 2022
+ test_task: test-bundled-gems
fail-fast: false
- runs-on: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
+ runs-on: windows-${{ matrix.os }}
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
- name: VisualStudio ${{ matrix.vc || matrix.vs }}
+ name: Windows ${{ matrix.os }}/Visual C++ ${{ matrix.vc }} (${{ matrix.test_task }})
env:
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
- OS_VER: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
- # FIXME: This is a workaround for the vcpkg's issue present as of openssl 3.1.1
- # where OpenSSL's default modules directory is incorrectly set to C:\vcpkg\packages\openssl_x64-windows\bin
- # cf. https://github.com/ruby/openssl/pull/635#issuecomment-1596833720
- OPENSSL_MODULES: C:\vcpkg\installed\x64-windows\bin
+ VCPKG_DEFAULT_TRIPLET: ${{ matrix.target || 'x64' }}-windows
steps:
- run: md build
working-directory:
- - name: find tools
- id: find-tools
- run: |
- ::- find needed tools
- set NEEDS=
- for %%I in (%NEEDED_TOOLS%) do if "%%~$PATH:I" == "" (
- call set NEEDS=%%NEEDS%% %%~nI
- ) else (
- echo %%I: %%~$PATH:I
- )
- echo.needs=%NEEDS%>>%GITHUB_OUTPUT%
- if "%NEEDS%" == "" (
- echo [debug] All needed tools found
- ) else (
- echo [warning^]Needs%NEEDS%
- )
- env:
- NEEDED_TOOLS: >-
- patch.exe
-
- - uses: msys2/setup-msys2@d40200dc2db4c351366b048a9565ad82919e1c24 # v2
- id: setup-msys2
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
- update: true
- install: >-
- ${{ steps.find-tools.outputs.needs }}
- if: ${{ steps.find-tools.outputs.needs != '' }}
-
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
- with:
- ruby-version: '3.0'
+ # windows-11-arm has only 3.4.1, 3.4.2, 3.4.3, head
+ ruby-version: ${{ !endsWith(matrix.os, 'arm') && '3.1' || '3.4' }}
bundler: none
windows-toolchain: none
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
- path: C:\vcpkg\downloads
- key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-
- ${{ runner.os }}-vcpkg-download-
+ sparse-checkout-cone-mode: false
+ sparse-checkout: /.github
- - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
+ - uses: ./.github/actions/setup/directories
with:
- path: C:\vcpkg\installed
- key: ${{ runner.os }}-vcpkg-installed-${{ env.OS_VER }}-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-vcpkg-installed-${{ env.OS_VER }}-
- ${{ runner.os }}-vcpkg-installed-
-
- - name: Install libraries with vcpkg
- run: |
- vcpkg --triplet x64-windows install gmp libffi libyaml openssl zlib
+ srcdir: src
+ builddir: build
+ make-command: nmake
+ clean: true
- - name: Install libraries with scoop
+ - name: Install tools with scoop
run: |
- iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
+ iwr -useb get.scoop.sh | iex
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
+ scoop install vcpkg uutils-coreutils
shell: pwsh
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - name: Restore vcpkg artifact
+ id: restore-vcpkg
+ uses: actions/cache/restore@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
- sparse-checkout-cone-mode: false
- sparse-checkout: /.github
+ path: src\vcpkg_installed
+ key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }}
- - uses: ./.github/actions/setup/directories
+ - name: Install libraries with vcpkg
+ run: |
+ vcpkg install --vcpkg-root=%USERPROFILE%\scoop\apps\vcpkg\current
+ working-directory: src
+ if: ${{ ! steps.restore-vcpkg.outputs.cache-hit }}
+
+ - name: Save vcpkg artifact
+ uses: actions/cache/save@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
- srcdir: src
- builddir: build
+ path: src\vcpkg_installed
+ key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }}
+ if: ${{ ! steps.restore-vcpkg.outputs.cache-hit && (github.ref_name == 'master' || startsWith(github.ref_name, 'ruby_')) }}
- name: setup env
# Available Ruby versions: https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#ruby
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
run: |
- set VS=${{ matrix.vs }}
- set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
- if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
- set | C:\msys64\usr\bin\sort > old.env
- call %VCVARS% ${{ matrix.vcvars || '' }}
+ ::- Set up VC ${{ matrix.vc }}
+ set | sort > old.env
+ call ..\src\win32\vssetup.cmd ^
+ -arch=${{ matrix.target || 'amd64' }} ^
+ ${{ matrix.vcvars && '-vcvars_ver=' || '' }}${{ matrix.vcvars }}
nmake -f nul
- set TMP=%USERPROFILE%\AppData\Local\Temp
- set TEMP=%USERPROFILE%\AppData\Local\Temp
+ set TMP=%RUNNER_TEMP%
+ set TEMP=%RUNNER_TEMP%
set MAKEFLAGS=l
set /a TEST_JOBS=(15 * %NUMBER_OF_PROCESSORS% / 10) > nul
- set | C:\msys64\usr\bin\sort > new.env
- C:\msys64\usr\bin\comm -13 old.env new.env >> %GITHUB_ENV%
+ set RUBY_OPT_DIR=%GITHUB_WORKSPACE:\=/%/src/vcpkg_installed/%VCPKG_DEFAULT_TRIPLET%
+ set | sort > new.env
+ comm -13 old.env new.env >> %GITHUB_ENV%
del *.env
- name: baseruby version
@@ -158,24 +132,18 @@ jobs:
- name: compiler version
run: cl
- - name: link libraries
- run: |
- for %%I in (C:\vcpkg\installed\x64-windows\bin\*.dll) do (
- if not %%~nI == readline mklink %%~nxI %%I
- )
- # We use OpenSSL instealled by vcpkg instead
- - name: disable system OpenSSL
- run: |
- for %%I in (libcrypto-1_1-x64 libssl-1_1-x64) do (
- ren c:\Windows\System32\%%I.dll %%I.dll_
- )
- # windows-2019 image doesn't have OpenSSL as of 2023/9/14
- if: ${{ matrix.vs != 2019 }}
+ - name: volume info
+ run: Get-Volume
+ shell: pwsh
+ # TODO: We should use `../src` instead of `D:/a/ruby/ruby/src`
- name: Configure
run: >-
../src/win32/configure.bat --disable-install-doc
- --with-opt-dir=C:/vcpkg/installed/x64-windows
+ --with-opt-dir=%RUBY_OPT_DIR%
+ --with-gmp
+
+ - run: nmake prepare-vcpkg
- run: nmake incs
@@ -185,25 +153,48 @@ jobs:
# But not for this Visual Studio workflow. So here we extract gems before building.
- run: nmake extract-gems
- - run: nmake
+ # windows-11-arm runner cannot run `ruby tool/file2lastrev.rb --revision.h --output=revision.h`
+ - name: make revision.h
+ run: |
+ win32\lastrev.bat | win32\ifchange.bat --timestamp=.revision.time revision.h -
+ type revision.h
+ working-directory: src
- - run: nmake test
- timeout-minutes: 5
+ - run: nmake
- - run: nmake test-spec
- timeout-minutes: 10
+ - name: Set up Launchable
+ uses: ./.github/actions/launchable/setup
+ with:
+ os: windows-${{ matrix.os }}
+ launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
+ builddir: build
+ srcdir: src
+ test-task: ${{ matrix.test_task || 'check' }}
+ continue-on-error: true
+ if: ${{ matrix.test_task != 'test-bundled-gems' }}
+ timeout-minutes: 3
- - run: nmake test-all
+ - run: nmake ${{ matrix.test_task || 'check' }}
env:
- RUBY_TESTOPTS: -j${{ env.TEST_JOBS || 4 }} --job-status=normal
- timeout-minutes: 60
+ RUBY_TESTOPTS: -j${{ env.TEST_JOBS || 4 }}
+ timeout-minutes: 70
- uses: ./.github/actions/slack
with:
- label: VS${{ matrix.vc || matrix.vs }} / ${{ matrix.test_task || 'check' }}
+ label: Windows ${{ matrix.os }} / VC ${{ matrix.vc }} / ${{ matrix.test_task || 'check' }}
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}
+ result:
+ if: ${{ always() }}
+ name: ${{ github.workflow }} result
+ runs-on: windows-latest
+ needs: [make]
+ steps:
+ - run: exit 1
+ working-directory:
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
+
defaults:
run:
working-directory: build
diff --git a/.github/workflows/wsl.yml b/.github/workflows/wsl.yml
new file mode 100644
index 0000000000..640f18ce42
--- /dev/null
+++ b/.github/workflows/wsl.yml
@@ -0,0 +1,70 @@
+name: Ubuntu on WSL
+
+on:
+ push:
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ pull_request:
+ # Do not use paths-ignore for required status checks
+ # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
+ merge_group:
+
+jobs:
+ wsl:
+ runs-on: windows-2025
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - name: Install or update WSL
+ uses: Ubuntu/WSL/.github/actions/wsl-install@main
+ with:
+ distro: Ubuntu-24.04
+
+ - name: Install dependencies
+ uses: Ubuntu/WSL/.github/actions/wsl-bash@main
+ with:
+ distro: Ubuntu-24.04
+ working-dir: /tmp/github/
+ exec: |
+ DEBIAN_FRONTEND=noninteractive sudo apt update
+ DEBIAN_FRONTEND=noninteractive sudo apt install -y ruby build-essential autoconf libssl-dev libyaml-dev zlib1g-dev libgmp-dev libffi-dev
+
+ - name: Check out the repository
+ uses: Ubuntu/WSL/.github/actions/wsl-checkout@main
+ with:
+ distro: Ubuntu-24.04
+ working-dir: /tmp/github/
+ submodules: true
+
+ - name: Build
+ uses: Ubuntu/WSL/.github/actions/wsl-bash@main
+ with:
+ distro: Ubuntu-24.04
+ working-dir: /tmp/github/
+ exec: |
+ ./autogen.sh
+ ./configure --disable-install-doc
+ make ruby -j4
+ make extract-gems
+ make -j4
+
+ - name: Test
+ uses: Ubuntu/WSL/.github/actions/wsl-bash@main
+ with:
+ distro: Ubuntu-24.04
+ working-dir: /tmp/github/
+ exec: |
+ ./ruby -v
+ # make check TESTS="-j4" MSPECOPT="-j"
diff --git a/.github/workflows/yjit-macos.yml b/.github/workflows/yjit-macos.yml
index 9660572e99..a59b4d6508 100644
--- a/.github/workflows/yjit-macos.yml
+++ b/.github/workflows/yjit-macos.yml
@@ -1,6 +1,8 @@
-name: YJIT macOS Arm64
+name: YJIT macOS
on:
push:
+ branches:
+ - master
paths-ignore:
- 'doc/**'
- '**/man/*'
@@ -9,6 +11,10 @@ on:
- '**/.document'
- '.*.yml'
pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
# Do not use paths-ignore for required status checks
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
merge_group:
@@ -24,20 +30,18 @@ jobs:
cargo:
name: cargo test
- runs-on: ${{ github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14' }}
+ runs-on: macos-14
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- run: RUST_BACKTRACE=1 cargo test
working-directory: yjit
@@ -68,20 +72,18 @@ jobs:
RUN_OPTS: ${{ matrix.yjit_opts }}
SPECOPTS: ${{ matrix.specopts }}
- runs-on: ${{ github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14' }}
+ runs-on: macos-14
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
@@ -106,8 +108,17 @@ jobs:
- run: make
- - name: Enable YJIT through ENV
- run: echo "RUBY_YJIT_ENABLE=1" >> $GITHUB_ENV
+ - name: Verify that --yjit-dump-disasm works
+ run: |
+ ./miniruby --yjit-call-threshold=1 --yjit-dump-disasm -e0 | \
+ wc -l | \
+ ruby -ne 'raise "Disassembly seems broken in dev build (output has too few lines)" unless $_.to_i > 10'
+ if: ${{ contains(matrix.configure, 'jit=dev') }}
+
+ - name: Set ENV for YJIT
+ run: |
+ echo "RUBY_YJIT_ENABLE=1" >> $GITHUB_ENV
+ echo "RUBY_CRASH_REPORT=$(pwd)/rb_crash_%p.txt" >> $GITHUB_ENV
- name: Set test options for skipped tests
run: |
@@ -117,26 +128,35 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
- name: Set up Launchable
+ id: launchable
uses: ./.github/actions/launchable/setup
with:
- os: ${{ github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14' }}
+ os: macos-14
test-opts: ${{ matrix.configure }}
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
builddir: build
srcdir: src
+ is-yjit: true
continue-on-error: true
+ timeout-minutes: 3
- name: make ${{ matrix.test_task }}
- run: >-
- make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"}
- RUN_OPTS="$RUN_OPTS"
- SPECOPTS="$SPECOPTS"
+ run: |
+ test -n "${LAUNCHABLE_STDOUT}" && exec 1> >(tee "${LAUNCHABLE_STDOUT}")
+ test -n "${LAUNCHABLE_STDERR}" && exec 2> >(tee "${LAUNCHABLE_STDERR}")
+
+ set -x
+ make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"} \
+ RUN_OPTS="$RUN_OPTS" \
+ SPECOPTS="$SPECOPTS"
timeout-minutes: 60
env:
RUBY_TESTOPTS: '-q --tty=no'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
SYNTAX_SUGGEST_TIMEOUT: '5'
PRECHECK_BUNDLED_GEMS: 'no'
+ LAUNCHABLE_STDOUT: ${{ steps.launchable.outputs.stdout_report_path }}
+ LAUNCHABLE_STDERR: ${{ steps.launchable.outputs.stderr_report_path }}
continue-on-error: ${{ matrix.continue-on-test_task || false }}
- name: make skipped tests
@@ -149,6 +169,13 @@ jobs:
if: ${{ matrix.test_task == 'check' && matrix.skipped_tests }}
continue-on-error: ${{ matrix.continue-on-skipped_tests || false }}
+ - name: Dump crash logs
+ if: ${{ failure() }}
+ continue-on-error: true
+ run: |
+ tail --verbose --lines=+1 rb_crash_*.txt
+ exit 1
+
- uses: ./.github/actions/slack
with:
label: ${{ matrix.test_task }} ${{ matrix.configure }} ${{ matrix.yjit_opts }}
@@ -158,10 +185,11 @@ jobs:
result:
if: ${{ always() }}
name: ${{ github.workflow }} result
- runs-on: ${{ github.repository == 'ruby/ruby' && 'macos-arm-oss' || 'macos-14' }}
+ runs-on: macos-14
needs: [make]
steps:
- - run: exit 1
+ - name: ${{ github.workflow }} jobs have failed
+ run: exit 1
working-directory:
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
diff --git a/.github/workflows/yjit-ubuntu.yml b/.github/workflows/yjit-ubuntu.yml
index 328737fd4a..150f0b3275 100644
--- a/.github/workflows/yjit-ubuntu.yml
+++ b/.github/workflows/yjit-ubuntu.yml
@@ -25,18 +25,18 @@ jobs:
name: cargo test
# GitHub Action's image seems to already contain a Rust 1.58.0.
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
# For now we can't run cargo test --offline because it complains about the
# capstone dependency, even though the dependency is optional
@@ -57,18 +57,18 @@ jobs:
name: cargo clippy
# GitHub Action's image seems to already contain a Rust 1.58.0.
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
# Check that we don't have linting errors in release mode, too
- run: cargo clippy --all-targets --all-features
@@ -81,7 +81,9 @@ jobs:
include:
- test_task: 'yjit-bindgen'
hint: 'To fix: use patch in logs'
- configure: '--with-gcc=clang-12 --enable-yjit=dev'
+ # Build with YJIT+ZJIT for output that works in the most number of configurations
+ configure: '--with-gcc=clang-14 --enable-yjit=dev --enable-zjit'
+ libclang_path: '/usr/lib/llvm-14/lib/libclang.so.1'
- test_task: 'check'
# YJIT should be automatically built in release mode on x86-64 Linux with rustc present
@@ -100,43 +102,35 @@ jobs:
- test_task: 'test-bundled-gems'
configure: '--enable-yjit=dev'
- - test_task: 'yjit-bench'
- configure: '--enable-yjit=dev'
- yjit_bench_opts: '--yjit-stats'
- continue-on-test_task: true
-
env:
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
RUN_OPTS: ${{ matrix.yjit_opts }}
YJIT_BENCH_OPTS: ${{ matrix.yjit_bench_opts }}
SPECOPTS: ${{ matrix.specopts }}
RUBY_DEBUG: ci
- BUNDLE_JOBS: 8 # for yjit-bench
RUST_BACKTRACE: 1
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
- || contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
- || contains(github.event.pull_request.title, 'Document')
- || contains(github.event.pull_request.labels.*.name, 'Document')
- || (github.event_name == 'push' && github.actor == 'dependabot[bot]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
- uses: ./.github/actions/setup/ubuntu
- - uses: ruby/setup-ruby@d5fb7a202fc07872cb44f00ba8e6197b70cb0c55 # v1.179.0
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
- ruby-version: '3.0'
+ ruby-version: '3.1'
bundler: none
- uses: ./.github/actions/setup/directories
@@ -152,6 +146,12 @@ jobs:
if: ${{ matrix.rust_version }}
run: rustup install ${{ matrix.rust_version }} --profile minimal
+ - name: Remove cargo
+ # Since this tests a `rustc` build for release, remove `cargo` to ensure
+ # that only `rustc` is used.
+ if: ${{ contains(matrix.configure, 'rustc') }}
+ run: sudo rm $(which -a cargo | uniq)
+
- name: Run configure
run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install ${{ matrix.configure }}
@@ -162,28 +162,44 @@ jobs:
- run: make
- - name: Enable YJIT through ENV
- run: echo "RUBY_YJIT_ENABLE=1" >> $GITHUB_ENV
+ - name: Verify that --yjit-dump-disasm works
+ run: |
+ ./miniruby --yjit-call-threshold=1 --yjit-dump-disasm -e0 | \
+ wc -l | \
+ ruby -ne 'raise "Disassembly seems broken in dev build (output has too few lines)" unless $_.to_i > 10'
+ if: ${{ contains(matrix.configure, 'jit=dev') }}
+
+ - name: Set ENV for YJIT
+ run: |
+ echo "RUBY_YJIT_ENABLE=1" >> $GITHUB_ENV
+ echo "RUBY_CRASH_REPORT=$(pwd)/rb_crash_%p.txt" >> $GITHUB_ENV
# Check that the binary was built with YJIT
- name: Check YJIT enabled
run: ./miniruby --yjit -v | grep "+YJIT"
- name: Set up Launchable
+ id: launchable
uses: ./.github/actions/launchable/setup
with:
- os: ubuntu-20.04
+ os: ubuntu-22.04
test-opts: ${{ matrix.configure }}
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
builddir: build
srcdir: src
+ is-yjit: true
continue-on-error: true
+ timeout-minutes: 3
- name: make ${{ matrix.test_task }}
- run: >-
- make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"}
- RUN_OPTS="$RUN_OPTS" MSPECOPT=--debug SPECOPTS="$SPECOPTS"
- YJIT_BENCH_OPTS="$YJIT_BENCH_OPTS" YJIT_BINDGEN_DIFF_OPTS="$YJIT_BINDGEN_DIFF_OPTS"
+ run: |
+ test -n "${LAUNCHABLE_STDOUT}" && exec 1> >(tee "${LAUNCHABLE_STDOUT}")
+ test -n "${LAUNCHABLE_STDERR}" && exec 2> >(tee "${LAUNCHABLE_STDERR}")
+
+ set -x
+ make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"} \
+ RUN_OPTS="$RUN_OPTS" MSPECOPT=--debug SPECOPTS="$SPECOPTS" \
+ YJIT_BENCH_OPTS="$YJIT_BENCH_OPTS" YJIT_BINDGEN_DIFF_OPTS="$YJIT_BINDGEN_DIFF_OPTS"
timeout-minutes: 90
env:
RUBY_TESTOPTS: '-q --tty=no'
@@ -191,14 +207,17 @@ jobs:
PRECHECK_BUNDLED_GEMS: 'no'
SYNTAX_SUGGEST_TIMEOUT: '5'
YJIT_BINDGEN_DIFF_OPTS: '--exit-code'
+ LIBCLANG_PATH: ${{ matrix.libclang_path }}
+ LAUNCHABLE_STDOUT: ${{ steps.launchable.outputs.stdout_report_path }}
+ LAUNCHABLE_STDERR: ${{ steps.launchable.outputs.stderr_report_path }}
continue-on-error: ${{ matrix.continue-on-test_task || false }}
- - name: Show ${{ github.event.pull_request.base.ref }} GitHub URL for yjit-bench comparison
- run: echo "https://github.com/${BASE_REPO}/commit/${BASE_SHA}"
- env:
- BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }}
- BASE_SHA: ${{ github.event.pull_request.base.sha }}
- if: ${{ matrix.test_task == 'yjit-bench' && startsWith(github.event_name, 'pull') }}
+ - name: Dump crash logs
+ if: ${{ failure() }}
+ continue-on-error: true
+ run: |
+ tail --verbose --lines=+1 rb_crash_*.txt
+ exit 1
- uses: ./.github/actions/slack
with:
diff --git a/.github/workflows/zjit-macos.yml b/.github/workflows/zjit-macos.yml
new file mode 100644
index 0000000000..a638907811
--- /dev/null
+++ b/.github/workflows/zjit-macos.yml
@@ -0,0 +1,214 @@
+name: ZJIT macOS
+on:
+ push:
+ branches:
+ - master
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
+ # Do not use paths-ignore for required status checks
+ # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
+ merge_group:
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ make:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - test_task: 'check'
+ run_opts: '--zjit-call-threshold=1'
+ specopts: '-T --zjit-call-threshold=1'
+ configure: '--enable-zjit=dev'
+
+ - test_task: 'check'
+ run_opts: '--zjit-disable-hir-opt --zjit-call-threshold=1'
+ specopts: '-T --zjit-disable-hir-opt -T --zjit-call-threshold=1'
+ configure: '--enable-zjit=dev'
+
+ - test_task: 'zjit-check' # zjit-test + quick feedback of test_zjit.rb
+ configure: '--enable-yjit=dev --enable-zjit'
+ rust_version: "1.85.0"
+
+ - test_task: 'ruby'
+ hint: 'combo build test'
+ configure: '--enable-yjit --enable-zjit'
+
+ env:
+ GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
+ RUN_OPTS: ${{ matrix.run_opts }}
+ SPECOPTS: ${{ matrix.specopts }}
+ TESTOPTS: ${{ matrix.testopts }}
+ ZJIT_RB_BUG: 1
+
+ runs-on: macos-14
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ sparse-checkout-cone-mode: false
+ sparse-checkout: /.github
+
+ - name: Install libraries
+ uses: ./.github/actions/setup/macos
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+ dummy-files: ${{ matrix.test_task == 'check' }}
+ # Set fetch-depth: 10 so that Launchable can receive commits information.
+ fetch-depth: 10
+
+ - name: Install Rust
+ if: ${{ matrix.rust_version }}
+ run: |
+ rustup install ${{ matrix.rust_version }} --profile minimal
+ rustup default ${{ matrix.rust_version }}
+
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: nextest@0.9
+ if: ${{ matrix.test_task == 'zjit-check' }}
+
+ - name: Run configure
+ run: ../src/configure -C --disable-install-doc ${{ matrix.configure }}
+
+ - run: make
+
+ - name: Verify that --zjit-dump-disasm works
+ run: |
+ ./miniruby --zjit-call-threshold=1 --zjit-dump-disasm -e0 | \
+ wc -l | \
+ ruby -ne 'raise "Disassembly seems broken in dev build (output has too few lines)" unless $_.to_i > 10'
+ if: ${{ contains(matrix.configure, 'jit=dev') }}
+
+ - name: Set ENV for ZJIT
+ run: |
+ echo "RUBY_CRASH_REPORT=$(pwd)/rb_crash_%p.txt" >> $GITHUB_ENV
+
+ - name: make ${{ matrix.test_task }}
+ run: |
+ set -x
+ make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"} \
+ RUN_OPTS="$RUN_OPTS" \
+ SPECOPTS="$SPECOPTS" \
+ TESTOPTS="$TESTOPTS"
+ timeout-minutes: 60
+ env:
+ RUBY_TESTOPTS: '-q --tty=no'
+ EXCLUDES: '../src/test/.excludes-zjit'
+ TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
+ SYNTAX_SUGGEST_TIMEOUT: '5'
+ PRECHECK_BUNDLED_GEMS: 'no'
+ continue-on-error: ${{ matrix.continue-on-test_task || false }}
+
+ - name: Dump crash logs
+ if: ${{ failure() }}
+ continue-on-error: true
+ run: |
+ tail --verbose --lines=+1 rb_crash_*.txt
+ exit 1
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ${{ matrix.test_task }} ${{ matrix.configure }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+ result:
+ if: ${{ always() }}
+ name: ${{ github.workflow }} result
+ runs-on: macos-14
+ needs: [make]
+ steps:
+ - run: exit 1
+ working-directory:
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
+
+ # Separated from `make` job to avoid making it a required status check for now
+ ruby-bench:
+ strategy:
+ matrix:
+ include:
+ # Test --call-threshold=2 with 2 iterations in total
+ - ruby_opts: '--zjit-call-threshold=2'
+ bench_opts: '--warmup=1 --bench=1 --excludes=lobsters'
+ configure: '--enable-zjit=dev_nodebug' # --enable-zjit=dev is too slow
+
+ runs-on: macos-14
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+
+ - uses: ./.github/actions/setup/macos
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+
+ - name: Run configure
+ run: ../src/configure -C --disable-install-doc --prefix="$(pwd)/install" ${{ matrix.configure }}
+
+ - run: make install
+
+ # setup/directories set MAKEFLAGS=-j4 for macOS, which randomly fails sqlite3.gem builds
+ - name: Unset MAKEFLAGS
+ run: echo "MAKEFLAGS=" >> "$GITHUB_ENV"
+
+ - name: Checkout ruby-bench
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ repository: ruby/ruby-bench
+ path: ruby-bench
+
+ # If you want to skip failing benchmark, consider using `--excludes`.
+ # e.g. `bench_opts: '--warmup=1 --bench=1 --excludes=railsbench,lobsters'`
+ - name: Run ruby-bench
+ run: ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
+ working-directory: ruby-bench
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ruby-bench ${{ matrix.bench_opts }} ${{ matrix.ruby_opts }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/zjit-ubuntu.yml b/.github/workflows/zjit-ubuntu.yml
new file mode 100644
index 0000000000..28bfec963e
--- /dev/null
+++ b/.github/workflows/zjit-ubuntu.yml
@@ -0,0 +1,267 @@
+name: ZJIT Ubuntu
+on:
+ push:
+ branches:
+ - master
+ paths-ignore:
+ - 'doc/**'
+ - '**/man/*'
+ - '**.md'
+ - '**.rdoc'
+ - '**/.document'
+ - '.*.yml'
+ pull_request:
+ types:
+ - opened
+ - synchronize
+ - reopened
+ # Do not use paths-ignore for required status checks
+ # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
+ merge_group:
+
+concurrency:
+ group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
+ cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
+
+permissions:
+ contents: read
+
+jobs:
+ lint:
+ name: cargo clippy
+
+ runs-on: ubuntu-22.04
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+
+ - run: cargo clippy --all-targets --all-features
+ working-directory: zjit
+
+ make:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - test_task: 'check'
+ run_opts: '--zjit-call-threshold=1'
+ specopts: '-T --zjit-call-threshold=1'
+ configure: '--enable-zjit=dev'
+
+ - test_task: 'check'
+ run_opts: '--zjit-disable-hir-opt --zjit-call-threshold=1'
+ specopts: '-T --zjit-disable-hir-opt -T --zjit-call-threshold=1'
+ configure: '--enable-zjit=dev'
+
+ # The optimizer benefits from at least 1 iteration of profiling. Also, many
+ # regression tests in bootstraptest/test_yjit.rb assume call-threshold=2.
+ - test_task: 'btest'
+ run_opts: '--zjit-call-threshold=2'
+ configure: '--enable-zjit=dev'
+
+ - test_task: 'zjit-check' # zjit-test + quick feedback of test_zjit.rb
+ configure: '--enable-yjit --enable-zjit=dev'
+ rust_version: '1.85.0'
+
+ - test_task: 'zjit-bindgen'
+ hint: 'To fix: use patch in logs'
+ # Build with YJIT+ZJIT for output that works in the most number of configurations
+ configure: '--enable-zjit=dev --enable-yjit --with-gcc=clang-16'
+ clang_path: '/usr/bin/clang-16'
+ runs-on: 'ubuntu-24.04' # for clang-16
+
+ - test_task: 'test-bundled-gems'
+ configure: '--enable-zjit=dev'
+ run_opts: '--zjit-call-threshold=1'
+
+ env:
+ GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
+ RUN_OPTS: ${{ matrix.run_opts }}
+ YJIT_BENCH_OPTS: ${{ matrix.yjit_bench_opts }}
+ SPECOPTS: ${{ matrix.specopts }}
+ TESTOPTS: ${{ matrix.testopts }}
+ RUBY_DEBUG: ci
+ BUNDLE_JOBS: 8 # for yjit-bench
+ RUST_BACKTRACE: 1
+ ZJIT_RB_BUG: 1
+
+ runs-on: ${{ matrix.runs-on || 'ubuntu-22.04' }}
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ sparse-checkout-cone-mode: false
+ sparse-checkout: /.github
+
+ - uses: ./.github/actions/setup/ubuntu
+
+ - uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
+ with:
+ ruby-version: '3.1'
+ bundler: none
+
+ - uses: taiki-e/install-action@v2
+ with:
+ tool: nextest@0.9
+ if: ${{ matrix.test_task == 'zjit-check' }}
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+ dummy-files: ${{ matrix.test_task == 'check' }}
+ # Set fetch-depth: 10 so that Launchable can receive commits information.
+ fetch-depth: 10
+
+ - name: Install Rust
+ if: ${{ matrix.rust_version }}
+ run: |
+ rustup install ${{ matrix.rust_version }} --profile minimal
+ rustup default ${{ matrix.rust_version }}
+
+ - name: Install rustfmt
+ if: ${{ matrix.test_task == 'zjit-bindgen' }}
+ run: rustup component add rustfmt
+
+ - name: Run configure
+ run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install ${{ matrix.configure }}
+
+ - run: make incs
+
+ - run: make prepare-gems
+ if: ${{ matrix.test_task == 'test-bundled-gems' }}
+
+ - run: make
+
+ - name: Verify that --zjit-dump-disasm works
+ run: |
+ ./miniruby --zjit-call-threshold=1 --zjit-dump-disasm -e0 | \
+ wc -l | \
+ ruby -ne 'raise "Disassembly seems broken in dev build (output has too few lines)" unless $_.to_i > 10'
+ if: ${{ contains(matrix.configure, 'jit=dev') }}
+
+ # Check that the binary was built with ZJIT
+ - name: Check ZJIT enabled
+ run: ./miniruby --zjit -v | grep "+ZJIT"
+ if: ${{ matrix.configure != '--disable-zjit' }}
+
+ - name: Set ENV for ZJIT
+ run: |
+ echo "RUBY_CRASH_REPORT=$(pwd)/rb_crash_%p.txt" >> $GITHUB_ENV
+
+ - name: make ${{ matrix.test_task }}
+ run: |
+ set -x
+ make -s ${{ matrix.test_task }} ${TESTS:+TESTS="$TESTS"} \
+ RUN_OPTS="$RUN_OPTS" MSPECOPT=--debug SPECOPTS="$SPECOPTS" \
+ TESTOPTS="$TESTOPTS" \
+ ZJIT_BINDGEN_DIFF_OPTS="$ZJIT_BINDGEN_DIFF_OPTS"
+ timeout-minutes: 90
+ env:
+ RUBY_TESTOPTS: '-q --tty=no'
+ EXCLUDES: '../src/test/.excludes-zjit'
+ TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
+ PRECHECK_BUNDLED_GEMS: 'no'
+ SYNTAX_SUGGEST_TIMEOUT: '5'
+ ZJIT_BINDGEN_DIFF_OPTS: '--exit-code'
+ CLANG_PATH: ${{ matrix.clang_path }}
+ continue-on-error: ${{ matrix.continue-on-test_task || false }}
+
+ - name: Dump crash logs
+ if: ${{ failure() }}
+ continue-on-error: true
+ run: |
+ tail --verbose --lines=+1 rb_crash_*.txt
+ exit 1
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ${{ matrix.test_task }} ${{ matrix.configure }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+ result:
+ if: ${{ always() }}
+ name: ${{ github.workflow }} result
+ runs-on: ubuntu-22.04
+ needs: [make]
+ steps:
+ - name: ${{ github.workflow }} jobs have failed
+ run: exit 1
+ working-directory:
+ if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
+
+ # Separated from `make` job to avoid making it a required status check for now
+ ruby-bench:
+ strategy:
+ matrix:
+ include:
+ # Test --call-threshold=2 with 2 iterations in total
+ - ruby_opts: '--zjit-call-threshold=2'
+ bench_opts: '--warmup=1 --bench=1 --excludes=lobsters'
+ configure: '--enable-zjit=dev_nodebug' # --enable-zjit=dev is too slow
+
+ runs-on: ubuntu-24.04
+
+ if: >-
+ ${{!(false
+ || contains(github.event.head_commit.message, '[DOC]')
+ || contains(github.event.pull_request.title, '[DOC]')
+ || contains(github.event.pull_request.labels.*.name, 'Documentation')
+ || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
+ )}}
+
+ steps:
+ - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+
+ - uses: ./.github/actions/setup/ubuntu
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ srcdir: src
+ builddir: build
+ makeup: true
+
+ - name: Run configure
+ run: ../src/configure -C --disable-install-doc --prefix="$(pwd)/install" ${{ matrix.configure }}
+
+ - run: make install
+
+ - name: Checkout ruby-bench
+ uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ repository: ruby/ruby-bench
+ path: ruby-bench
+
+ # If you want to skip failing benchmark, consider using `--excludes`.
+ # e.g. `bench_opts: '--warmup=1 --bench=1 --excludes=railsbench,lobsters'`
+ - name: Run ruby-bench
+ run: ruby run_benchmarks.rb -e "zjit::../build/install/bin/ruby ${{ matrix.ruby_opts }}" ${{ matrix.bench_opts }}
+ working-directory: ruby-bench
+
+ - uses: ./.github/actions/slack
+ with:
+ label: ruby-bench ${{ matrix.bench_opts }} ${{ matrix.ruby_opts }}
+ SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
+ if: ${{ failure() }}
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.gitignore b/.gitignore
index b6beba3b3e..6cf5fb5f32 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@
*.pch
*.pdb
*.rbinc
+*.rbbin
*.rej
*.s
*.sav
@@ -144,7 +145,6 @@ lcov*.info
/verconf.h
/verconf.mk
/web
-/yasmdata.rb
# /bin/
@@ -234,7 +234,6 @@ lcov*.info
# for `make test-bundler`
/.rspec_status
-/tool/bundler/*.lock
# /tool/
/tool/config.guess
@@ -243,17 +242,14 @@ lcov*.info
# /win32/
/win32/*.ico
-# RJIT
-/include/ruby-*/*/rb_rjit_min_header-*.h
-/lib/ruby_vm/rjit/instruction.rb
-/lib/ruby_vm/rjit/instruction.rb
-/rjit_config.h
-/rb_rjit_header.h*
# YJIT
/yjit-bench
/yjit_exit_locations.dump
+# Rust
+/target
+
# /wasm/
/wasm/tests/*.wasm
@@ -276,6 +272,7 @@ lcov*.info
/prism/prettyprint.c
/prism/serialize.c
/prism/token_type.c
+/prism/srcs.mk
# tool/update-NEWS-gemlist.rb
/bundled_gems.json
diff --git a/.rdoc_options b/.rdoc_options
index 4dfbfa140c..89265cafd4 100644
--- a/.rdoc_options
+++ b/.rdoc_options
@@ -2,8 +2,38 @@
page_dir: doc
charset: UTF-8
encoding: UTF-8
-main_page: README.md
+main_page: index.md
title: Documentation for Ruby development version
visibility: :private
rdoc_include:
- doc
+
+exclude:
+- \.gemspec\z
+- lib/set/subclass_compatible.rb
+
+autolink_excluded_words:
+- Box
+- Class
+- Method
+- Module
+- Process
+- RDoc
+- Ruby
+- Set
+- ZJIT
+- YJIT
+
+canonical_root: https://docs.ruby-lang.org/en/master
+
+footer_content:
+ Ruby:
+ Documentation: index.html
+ Official Website: https://www.ruby-lang.org/
+ Playground: https://ruby.github.io/play-ruby/
+ Resources:
+ GitHub: https://github.com/ruby/ruby
+ Issue Tracker: https://bugs.ruby-lang.org/projects/ruby-master/issues
+ RubyGems: https://rubygems.org/
+ Community:
+ X: https://x.com/rubylangorg
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 06de3dd493..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- YAML -*-
-# Copyright (C) 2011 Urabe, Shyouhei. All rights reserved.
-#
-# This file is a part of the programming language Ruby. Permission is hereby
-# granted, to either redistribute or modify this file, provided that the
-# conditions mentioned in the file COPYING are met. Consult the file for
-# details.
-
-# When you see Travis CI issues, or you are interested in understanding how to
-# manage, please check the link below.
-# https://github.com/ruby/ruby/wiki/CI-Servers#travis-ci
-
-# We enable Travis on the specific branches or forked repositories here.
-if: >-
- (repo != ruby/ruby OR branch = master OR branch =~ /^ruby_\d_\d$/)
- AND (commit_message !~ /\[DOC\]/)
-
-language: c
-
-os: linux
-
-dist: jammy
-
-git:
- quiet: true
-
-env:
- global:
- - NPROC="$(nproc)"
- - JOBS="-j${NPROC}"
- # SETARCH are overridden when necessary. See below.
- - SETARCH=
- # https://github.com/travis-ci/travis-build/blob/e411371dda21430a60f61b8f3f57943d2fe4d344/lib/travis/build/bash/travis_apt_get_options.bash#L7
- - travis_apt_get_options='--allow-downgrades --allow-remove-essential --allow-change-held-packages'
- - travis_apt_get_options="-yq --no-install-suggests --no-install-recommends $travis_apt_get_options"
- # -g0 disables backtraces when SEGV. Do not set that.
- - debugflags=-ggdb3
- - RUBY_TESTOPTS="$JOBS -q --tty=no"
-
-.org.ruby-lang.ci.matrix-definitions:
- - &gcc-11
- compiler: gcc-11
- before_install:
- - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
- - >-
- tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install
- gcc-11
- g++-11
- libffi-dev
- libncurses-dev
- libncursesw5-dev
- libreadline-dev
- libssl-dev
- libyaml-dev
- openssl
- zlib1g-dev
- - gcc-11 --version
- - &arm64-linux
- name: arm64-linux
- arch: arm64
- <<: *gcc-11
- - &ppc64le-linux
- name: ppc64le-linux
- arch: ppc64le
- <<: *gcc-11
- - &s390x-linux
- name: s390x-linux
- arch: s390x
- <<: *gcc-11
- env:
- # Avoid possible test failures with the zlib applying the following patch
- # on s390x CPU architecture.
- # https://github.com/madler/zlib/pull/410
- - DFLTCC=0
- - &arm32-linux
- name: arm32-linux
- arch: arm64
- # https://packages.ubuntu.com/jammy/crossbuild-essential-armhf
- compiler: arm-linux-gnueabihf-gcc
- env:
- - SETARCH='setarch linux32 --verbose --32bit'
- # Still keep the -O1 for only arm32, while we want to test with the
- # default optflags -O3.
- # Because bootstraptest/test_ractor.rb fails with segfualt with the
- # default -O3.
- # https://bugs.ruby-lang.org/issues/19981
- - optflags=-O1
- before_install:
- - sudo dpkg --add-architecture armhf
- - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
- - >-
- tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install
- crossbuild-essential-armhf
- libc6:armhf
- libstdc++-10-dev:armhf
- libffi-dev:armhf
- libncurses-dev:armhf
- libncursesw5-dev:armhf
- libreadline-dev:armhf
- libssl-dev:armhf
- libyaml-dev:armhf
- linux-libc-dev:armhf
- zlib1g-dev:armhf
-
-matrix:
- include:
- - <<: *arm64-linux
- - <<: *ppc64le-linux
- - <<: *s390x-linux
- # FIXME: lib/rubygems/util.rb:104 glob_files_in_dir -
- # <internal:dir>:411:in glob: File name too long - (Errno::ENAMETOOLONG)
- # https://github.com/rubygems/rubygems/issues/7132
- - <<: *arm32-linux
- allow_failures:
- # Allow failures for the unstable jobs.
- # - name: arm64-linux
- - name: ppc64le-linux
- - name: s390x-linux
- # The 2nd arm64 pipeline may be unstable.
- # - name: arm32-linux
- fast_finish: true
-
-before_script:
- - lscpu
- - ./autogen.sh
- - mkdir build
- - cd build
- - $SETARCH ../configure -C --disable-install-doc --prefix=$(pwd)/install
- - $SETARCH make -s $JOBS
- - make -s $JOBS install
- # Useful info to report issues to the Ruby.
- - $SETARCH $(pwd)/install/bin/ruby -v
- # Useful info To report issues to the RubyGems.
- - $SETARCH $(pwd)/install/bin/gem env
-
-script:
- - $SETARCH make -s test
- - ../tool/travis_wait.sh $SETARCH make -s test-all RUBYOPT="-w"
- - ../tool/travis_wait.sh $SETARCH make -s test-spec
-
-# We want to be notified when something happens.
-notifications:
- webhooks:
- urls:
- # ruby-lang slack: ruby/simpler-alerts-bot (travis)
- - secure: mRsoS/UbqDkKkW5p3AEqM27d4SZnV6Gsylo3bm8T/deltQzTsGzZwrm7OIBXZv0UFZdE68XmPlyHfZFLSP2V9QZ7apXMf9/vw0GtcSe1gchtnjpAPF6lYBn7nMCbVPPx9cS0dwL927fjdRM1vj7IKZ2bk4F0lAJ25R25S6teqdk=
- on_success: never
- on_failure: always
- email:
- recipients:
- - jaruga@ruby-lang.org
- on_success: never
- on_failure: always
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 13df6087ca..35e79dd3b9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1 +1 @@
-See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing_md.html), which includes setup and build instructions.
+See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing/contributing_md.html), which includes setup and build instructions.
diff --git a/COPYING b/COPYING
index 48e5a96de7..428ce03ed7 100644
--- a/COPYING
+++ b/COPYING
@@ -1,3 +1,5 @@
+{日本語}[rdoc-ref:COPYING.ja]
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the
2-clause BSDL (see the file BSDL), or the conditions below:
diff --git a/COPYING.ja b/COPYING.ja
index 230376bc60..5de2dbcc8f 100644
--- a/COPYING.ja
+++ b/COPYING.ja
@@ -1,3 +1,5 @@
+{English}[rdoc-ref:COPYING]
+
本プログラムはフリーソフトウェアです.2-clause BSDL
または以下に示す条件で本プログラムを再配布できます
2-clause BSDLについてはBSDLファイルを参照して下さい.
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000000..9a4b2ebbba
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,193 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "capstone"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "015ef5d5ca1743e3f94af9509ba6bd2886523cfee46e48d15c2ef5216fd4ac9a"
+dependencies = [
+ "capstone-sys",
+ "libc",
+]
+
+[[package]]
+name = "capstone-sys"
+version = "0.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2267cb8d16a1e4197863ec4284ffd1aec26fe7e57c58af46b02590a0235809a0"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
+name = "cc"
+version = "1.2.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "525046617d8376e3db1deffb079e91cef90a89fc3ca5c185bbf8c9ecdd15cd5c"
+dependencies = [
+ "shlex",
+]
+
+[[package]]
+name = "console"
+version = "0.15.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
+dependencies = [
+ "encode_unicode",
+ "lazy_static",
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "encode_unicode"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+
+[[package]]
+name = "insta"
+version = "1.43.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "154934ea70c58054b556dd430b99a98c2a7ff5309ac9891597e339b5c28f4371"
+dependencies = [
+ "console",
+ "once_cell",
+ "similar",
+]
+
+[[package]]
+name = "jit"
+version = "0.1.0"
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "libc"
+version = "0.2.171"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
+
+[[package]]
+name = "once_cell"
+version = "1.21.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+
+[[package]]
+name = "ruby"
+version = "0.0.0"
+dependencies = [
+ "yjit",
+ "zjit",
+]
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "similar"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "yjit"
+version = "0.1.0"
+dependencies = [
+ "capstone",
+ "jit",
+]
+
+[[package]]
+name = "zjit"
+version = "0.0.1"
+dependencies = [
+ "capstone",
+ "insta",
+ "jit",
+]
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000000..521129d92d
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,60 @@
+# This is the root Cargo [workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html)
+# and the root package for all the rust code that are statically linked into ruby. Rust tooling
+# limitations means all Rust code need to share a single archive library (staticlib) at the
+# integration point with non-rust code. (See rustlang/rust#44322 and #104707 for a taste of
+# the linking challenges.)
+#
+# Do not add required dependencies. This is a policy that helps downstream consumers and give
+# us tight control over what we ship. All of the optional dependencies are used exclusively
+# during development.
+#
+# Release builds avoid Cargo entirely because offline builds can fail even when none of the
+# optional dependencies are built (rust-lang/cargo#10352).
+
+[workspace]
+members = ["zjit", "yjit", "jit"]
+
+[package]
+name = "ruby"
+version = "0.0.0"
+edition = "2024"
+rust-version = "1.85.0"
+publish = false # Don't publish to crates.io
+
+[dependencies]
+yjit = { path = "yjit", optional = true }
+zjit = { path = "zjit", optional = true }
+
+[lib]
+crate-type = ["staticlib"]
+path = "ruby.rs"
+
+[features]
+disasm = ["yjit?/disasm", "zjit?/disasm"]
+runtime_checks = ["yjit?/runtime_checks", "zjit?/runtime_checks"]
+yjit = [ "dep:yjit" ]
+zjit = [ "dep:zjit" ]
+
+[profile.dev]
+opt-level = 0
+debug = true
+debug-assertions = true
+overflow-checks = true
+
+[profile.dev_nodebug]
+inherits = "dev"
+
+[profile.stats]
+inherits = "release"
+
+[profile.release]
+# NOTE: --enable-yjit and zjit builds use `rustc` without going through Cargo. You
+# might want to update the `rustc` invocation if you change this profile.
+opt-level = 3
+# The extra robustness that comes from checking for arithmetic overflow is
+# worth the performance cost for the compiler.
+overflow-checks = true
+# Generate debug info
+debug = true
+# Use ThinLTO. Much smaller output for a small amount of build time increase.
+lto = "thin"
diff --git a/LEGAL b/LEGAL
index 162ba78483..2777aa2c14 100644
--- a/LEGAL
+++ b/LEGAL
@@ -702,30 +702,22 @@ mentioned below.
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-[ext/json/generator/generator.c]
+[ext/json/vendor/fpconv.c]
- The file contains the following copyright notice.
+ This file is under the {Boost Software License}[rdoc-ref:@Boost+Software+License+1.0].
- >>>
- Copyright 2001-2004:: Unicode, Inc.
-
- Disclaimer::
+[ext/json/vendor/jeaiii-ltoa.h]
- This source code is provided as is by Unicode, Inc. No claims are
- made as to fitness for any particular purpose. No warranties of any
- kind are expressed or implied. The recipient agrees to determine
- applicability of information provided. If this file has been
- purchased on magnetic or optical media from Unicode, Inc., the
- sole remedy for any claim will be exchange of defective media
- within 90 days of receipt.
+ >>>
+ Copyright (c) 2024,2025 Enrico Thierbach - https://github.com/radiospiel
+ Copyright (c) 2022 James Edward Anhalt III - https://github.com/jeaiii/itoa
- Limitations on Rights to Redistribute This Code::
+ {MIT License}[rdoc-ref:@MIT+License]
- Unicode, Inc. hereby grants the right to freely use the information
- supplied in this file in the creation of products supporting the
- Unicode Standard, and to make copies of this file in any form
- for internal or external distribution as long as this notice
- remains attached.
+[ext/json/vendor/ryu.h]
+ This file is adapted from the Ryu algorithm by Ulf Adams https://github.com/ulfjack/ryu.
+ It is dual-licensed under {Apache License 2.0}[rdoc-ref:@Apache+License+2.0] OR
+ {Boost Software License 1.0}[rdoc-ref:@Boost+Software+License+1.0].
[ext/psych]
[test/psych]
@@ -1073,3 +1065,236 @@ mentioned below.
From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
paragraph 3 above is now null and void.
+
+== Boost Software License 1.0
+
+>>>
+ Boost Software License - Version 1.0 - August 17th, 2003
+
+ Permission is hereby granted, free of charge, to any person or organization
+ obtaining a copy of the software and accompanying documentation covered by
+ this license (the "Software") to use, reproduce, display, distribute,
+ execute, and transmit the Software, and to prepare derivative works of the
+ Software, and to permit third-parties to whom the Software is furnished to
+ do so, all subject to the following:
+
+ The copyright notices in the Software and this entire statement, including
+ the above license grant, this restriction and the following disclaimer,
+ must be included in all copies of the Software, in whole or in part, and
+ all derivative works of the Software, unless such copies or derivative
+ works are solely in the form of machine-executable object code generated by
+ a source language processor.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+== Apache License 2.0
+
+>>>
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ a. You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ b. You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ c. You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ d. If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ >>>
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/NEWS.md b/NEWS.md
index ac77cfae9d..2b021e7cdd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,154 +1,87 @@
-# NEWS for Ruby 3.4.0
+# NEWS for Ruby 4.1.0
This document is a list of user-visible feature changes
-since the **3.3.0** release, except for bug fixes.
+since the **4.0.0** release, except for bug fixes.
Note that each entry is kept to a minimum, see links for details.
## Language changes
-* String literals in files without a `frozen_string_literal` comment now emit a deprecation warning
- when they are mutated.
- These warnings can be enabled with `-W:deprecated` or by setting `Warning[:deprecated] = true`.
- To disable this change, you can run Ruby with the `--disable-frozen-string-literal`
- command line argument. [[Feature #20205]]
+## Core classes updates
-* `it` is added to reference a block parameter. [[Feature #18980]]
+Note: We're only listing outstanding class updates.
-* Keyword splatting `nil` when calling methods is now supported.
- `**nil` is treated similarly to `**{}`, passing no keywords,
- and not calling any conversion methods. [[Bug #20064]]
+* Method
-* Block passing is no longer allowed in index assignment
- (e.g. `a[0, &b] = 1`). [[Bug #19918]]
+ * `Method#source_location`, `Proc#source_location`, and
+ `UnboundMethod#source_location` now return extended location
+ information with 5 elements: `[path, start_line, start_column,
+ end_line, end_column]`. The previous 2-element format `[path,
+ line]` can still be obtained by calling `.take(2)` on the result.
+ [[Feature #6012]]
-* Keyword arguments are no longer allowed in index assignment
- (e.g. `a[0, kw: 1] = 2`). [[Bug #20218]]
+* Set
-## Core classes updates
+ * A deprecated behavior, `Set#to_set`, `Range#to_set`, and
+ `Enumerable#to_set` accepting arguments, was removed. [[Feature #21390]]
-Note: We're only listing outstanding class updates.
+## Stdlib updates
-* Exception
+### The following bundled gems are added.
- * Exception#set_backtrace now accepts arrays of `Thread::Backtrace::Location`.
- `Kernel#raise`, `Thread#raise` and `Fiber#raise` also accept this new format. [[Feature #13557]]
-* Range
+We only list stdlib changes that are notable feature changes.
- * Range#size now raises TypeError if the range is not iterable. [[Misc #18984]]
+Other changes are listed in the following sections. We also listed release
+history from the previous bundled version that is Ruby 3.4.0 if it has GitHub
+releases.
-## Stdlib updates
+### The following bundled gem is promoted from default gems.
-* Tempfile
-
- * The keyword argument `anonymous: true` is implemented for `Tempfile.create`.
- `Tempfile.create(anonymous: true)` removes the created temporary file immediately.
- So applications don't need to remove the file.
- [[Feature #20497]]
-
-The following default gems are updated.
-
-* RubyGems 3.6.0.dev
-* bundler 2.6.0.dev
-* erb 4.0.4
-* fiddle 1.1.3
-* io-console 0.7.2
-* irb 1.13.1
-* json 2.7.2
-* net-http 0.4.1
-* optparse 0.5.0
-* prism 0.30.0
-* rdoc 6.7.0
-* reline 0.5.8
-* resolv 0.4.0
-* stringio 3.1.1
-* strscan 3.1.1
-
-The following bundled gems are updated.
-
-* minitest 5.23.1
-* rake 13.2.1
-* test-unit 3.6.2
-* rexml 3.2.8
-* net-ftp 0.3.5
-* net-imap 0.4.12
-* net-smtp 0.5.0
-* rbs 3.4.4
-* typeprof 0.21.11
-* debug 1.9.2
-* racc 1.8.0
-
-The following bundled gems are promoted from default gems.
-
-* mutex_m 0.2.0
-* getoptlong 0.2.1
-* base64 0.2.0
-* bigdecimal 3.1.8
-* observer 0.1.2
-* abbrev 0.1.2
-* resolv-replace 0.1.1
-* rinda 0.2.0
-* drb 2.2.1
-* nkf 0.2.0
-* syslog 0.1.2
-* csv 3.3.0
-
-See GitHub releases like [GitHub Releases of Logger](https://github.com/ruby/logger/releases) or changelog for details of the default gems or bundled gems.
+* tsort 0.2.0
-## Supported platforms
+### The following default gem is added.
-## Compatibility issues
+### The following default gems are updated.
+
+* RubyGems 4.1.0.dev
+* bundler 4.1.0.dev
+* prism 1.8.0
+* stringio 3.2.1.dev
+* strscan 3.1.7.dev
-* Error messages and backtrace displays have been changed.
- * Use a single quote instead of a backtick as a opening quote. [[Feature #16495]]
- * Display a class name before a method name (only when the class has a permanent name). [[Feature #19117]]
- * `Kernel#caller`, `Thread::Backtrace::Location`'s methods, etc. are also changed accordingly.
- ```
- Old:
- test.rb:1:in `foo': undefined method `time' for an instance of Integer
- from test.rb:2:in `<main>'
+### The following bundled gems are updated.
- New:
- test.rb:1:in 'Object#foo': undefined method 'time' for an instance of Integer
- from test.rb:2:in `<main>'
- ```
+* minitest 6.0.1
+* test-unit 3.7.7
+* rss 0.3.2
+* net-imap 0.6.2
+* rbs 3.10.2
+* typeprof 0.31.1
+* debug 1.11.1
+* mutex_m 0.3.0
+* resolv-replace 0.2.0
+* rdoc 7.1.0
+
+### RubyGems and Bundler
+
+Ruby 4.0 bundled RubyGems and Bundler version 4. see the following links for details.
+
+## Supported platforms
+
+## Compatibility issues
## Stdlib compatibility issues
## C API updates
-* `rb_newobj` and `rb_newobj_of` (and corresponding macros `RB_NEWOBJ`, `RB_NEWOBJ_OF`, `NEWOBJ`, `NEWOBJ_OF`) have been removed. [[Feature #20265]]
-* Removed deprecated function `rb_gc_force_recycle`. [[Feature #18290]]
-
## Implementation improvements
-* `Array#each` is rewritten in Ruby for better performance [[Feature #20182]].
+### Ractor
+
+A lot of work has gone into making Ractors more stable, performant, and usable. These improvements bring Ractor implementation closer to leaving experimental status.
## JIT
-## Miscellaneous changes
-
-* Passing a block to a method which doesn't use the passed block will show
- a warning on verbose mode (`-w`).
- [[Feature #15554]]
-
-* Redefining some core methods that are specially optimized by the interpreter
- and JIT like `String.freeze` or `Integer#+` now emits a performance class
- warning (`-W:performance` or `Warning[:performance] = true`).
- [[Feature #20429]]
-
-[Feature #13557]: https://bugs.ruby-lang.org/issues/13557
-[Feature #15554]: https://bugs.ruby-lang.org/issues/15554
-[Feature #16495]: https://bugs.ruby-lang.org/issues/16495
-[Feature #18290]: https://bugs.ruby-lang.org/issues/18290
-[Feature #18980]: https://bugs.ruby-lang.org/issues/18980
-[Misc #18984]: https://bugs.ruby-lang.org/issues/18984
-[Feature #19117]: https://bugs.ruby-lang.org/issues/19117
-[Bug #19918]: https://bugs.ruby-lang.org/issues/19918
-[Bug #20064]: https://bugs.ruby-lang.org/issues/20064
-[Feature #20182]: https://bugs.ruby-lang.org/issues/20182
-[Feature #20205]: https://bugs.ruby-lang.org/issues/20205
-[Bug #20218]: https://bugs.ruby-lang.org/issues/20218
-[Feature #20265]: https://bugs.ruby-lang.org/issues/20265
-[Feature #20429]: https://bugs.ruby-lang.org/issues/20429
+[Feature #6012]: https://bugs.ruby-lang.org/issues/6012
+[Feature #21390]: https://bugs.ruby-lang.org/issues/21390
diff --git a/README.ja.md b/README.ja.md
index 49cf72b5fd..9bbc3a83a5 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -1,10 +1,11 @@
[![Actions Status: MinGW](https://github.com/ruby/ruby/workflows/MinGW/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"MinGW")
-[![Actions Status: RJIT](https://github.com/ruby/ruby/workflows/RJIT/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"RJIT")
[![Actions Status: Ubuntu](https://github.com/ruby/ruby/workflows/Ubuntu/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"Ubuntu")
[![Actions Status: Windows](https://github.com/ruby/ruby/workflows/Windows/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"Windows")
[![AppVeyor status](https://ci.appveyor.com/api/projects/status/0sy8rrxut4o0k960/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/ruby/branch/master)
[![Travis Status](https://app.travis-ci.com/ruby/ruby.svg?branch=master)](https://app.travis-ci.com/ruby/ruby)
+[English](rdoc-ref:README.md)
+
# Rubyとは
Rubyはシンプルかつ強力なオブジェクト指向スクリプト言語です. Rubyは純粋なオブジェクト指向言語として設計されているので,
@@ -40,11 +41,15 @@ https://www.ruby-lang.org/ja/downloads/
ミラーをGitHubに公開しています. 以下のコマンドでリポジトリを取得できます.
- $ git clone https://github.com/ruby/ruby.git
+```console
+$ git clone https://github.com/ruby/ruby.git
+```
他のブランチの一覧は次のコマンドで見られます.
- $ git ls-remote https://github.com/ruby/ruby.git
+```console
+$ git ls-remote https://github.com/ruby/ruby.git
+```
Rubyリポジトリの本来のmasterは https://git.ruby-lang.org/ruby.git にあります.
コミッタはこちらを使います.
diff --git a/README.md b/README.md
index eb24a73ee3..02435b419e 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,10 @@
[![Actions Status: MinGW](https://github.com/ruby/ruby/workflows/MinGW/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"MinGW")
-[![Actions Status: RJIT](https://github.com/ruby/ruby/workflows/RJIT/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"RJIT")
[![Actions Status: Ubuntu](https://github.com/ruby/ruby/workflows/Ubuntu/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"Ubuntu")
[![Actions Status: Windows](https://github.com/ruby/ruby/workflows/Windows/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"Windows")
[![Travis Status](https://app.travis-ci.com/ruby/ruby.svg?branch=master)](https://app.travis-ci.com/ruby/ruby)
+[日本語](rdoc-ref:README.ja.md)
+
# What is Ruby?
Ruby is an interpreted object-oriented programming language often
@@ -86,7 +87,7 @@ Bugs should be reported at https://bugs.ruby-lang.org. Read ["Reporting Issues"]
## Contributing
-See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing_md.html), which includes setup and build instructions.
+See ["Contributing to Ruby"](https://docs.ruby-lang.org/en/master/contributing/contributing_md.html), which includes setup and build instructions.
## The Author
diff --git a/addr2line.c b/addr2line.c
index 02a3e617a6..19a6a425c1 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -56,11 +56,11 @@
# ifdef _AIX
#pragma alloca
# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
+# ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca();
# endif
# endif /* AIX */
-# endif /* HAVE_ALLOCA_H */
+# endif /* HAVE_ALLOCA_H */
# ifndef UNREACHABLE
# define UNREACHABLE __builtin_unreachable()
# endif
@@ -220,13 +220,13 @@ uleb128(const char **p)
unsigned long r = 0;
int s = 0;
for (;;) {
- unsigned char b = (unsigned char)*(*p)++;
- if (b < 0x80) {
- r += (unsigned long)b << s;
- break;
- }
- r += (b & 0x7f) << s;
- s += 7;
+ unsigned char b = (unsigned char)*(*p)++;
+ if (b < 0x80) {
+ r += (unsigned long)b << s;
+ break;
+ }
+ r += (b & 0x7f) << s;
+ s += 7;
}
return r;
}
@@ -237,18 +237,18 @@ sleb128(const char **p)
long r = 0;
int s = 0;
for (;;) {
- unsigned char b = (unsigned char)*(*p)++;
- if (b < 0x80) {
- if (b & 0x40) {
- r -= (0x80 - b) << s;
- }
- else {
- r += (b & 0x3f) << s;
- }
- break;
- }
- r += (b & 0x7f) << s;
- s += 7;
+ unsigned char b = (unsigned char)*(*p)++;
+ if (b < 0x80) {
+ if (b & 0x40) {
+ r -= (0x80 - b) << s;
+ }
+ else {
+ r += (b & 0x3f) << s;
+ }
+ break;
+ }
+ r += (b & 0x7f) << s;
+ s += 7;
}
return r;
}
@@ -257,16 +257,16 @@ static const char *
get_nth_dirname(unsigned long dir, const char *p, FILE *errout)
{
if (!dir--) {
- return "";
+ return "";
}
while (dir--) {
- while (*p) p++;
- p++;
- if (!*p) {
- kprintf("Unexpected directory number %lu in %s\n",
- dir, binary_filename);
- return "";
- }
+ while (*p) p++;
+ p++;
+ if (!*p) {
+ kprintf("Unexpected directory number %lu in %s\n",
+ dir, binary_filename);
+ return "";
+ }
}
return p;
}
@@ -296,9 +296,11 @@ fill_filename(int file, uint8_t format, uint16_t version, const char *include_di
for (i = 1; i <= file; i++) {
filename = p;
if (!*p) {
+#ifndef __APPLE__
/* Need to output binary file name? */
kprintf("Unexpected file number %d in %s at %tx\n",
file, binary_filename, filenames - obj->mapped);
+#endif
return;
}
while (*p) p++;
@@ -319,19 +321,19 @@ fill_filename(int file, uint8_t format, uint16_t version, const char *include_di
static void
fill_line(int num_traces, void **traces, uintptr_t addr, int file, int line,
- uint8_t format, uint16_t version, const char *include_directories, const char *filenames,
- obj_info_t *obj, line_info_t *lines, int offset, FILE *errout)
+ uint8_t format, uint16_t version, const char *include_directories, const char *filenames,
+ obj_info_t *obj, line_info_t *lines, int offset, FILE *errout)
{
int i;
addr += obj->base_addr - obj->vmaddr;
for (i = offset; i < num_traces; i++) {
- uintptr_t a = (uintptr_t)traces[i];
- /* We assume one line code doesn't result >100 bytes of native code.
+ uintptr_t a = (uintptr_t)traces[i];
+ /* We assume one line code doesn't result >100 bytes of native code.
We may want more reliable way eventually... */
- if (addr < a && a < addr + 100) {
- fill_filename(file, format, version, include_directories, filenames, &lines[i], obj, errout);
- lines[i].line = line;
- }
+ if (addr < a && a < addr + 100) {
+ fill_filename(file, format, version, include_directories, filenames, &lines[i], obj, errout);
+ lines[i].line = line;
+ }
}
}
@@ -362,8 +364,8 @@ parse_debug_line_header(obj_info_t *obj, const char **pp, struct LineNumberProgr
header->format = 4;
if (header->unit_length == 0xffffffff) {
- header->unit_length = *(uint64_t *)p;
- p += sizeof(uint64_t);
+ header->unit_length = *(uint64_t *)p;
+ p += sizeof(uint64_t);
header->format = 8;
}
@@ -427,7 +429,7 @@ parse_debug_line_header(obj_info_t *obj, const char **pp, struct LineNumberProgr
static int
parse_debug_line_cu(int num_traces, void **traces, const char **debug_line,
- obj_info_t *obj, line_info_t *lines, int offset, FILE *errout)
+ obj_info_t *obj, line_info_t *lines, int offset, FILE *errout)
{
const char *p = (const char *)*debug_line;
struct LineNumberProgramHeader header;
@@ -448,105 +450,105 @@ parse_debug_line_cu(int num_traces, void **traces, const char **debug_line,
return -1;
is_stmt = header.default_is_stmt;
-#define FILL_LINE() \
- do { \
- fill_line(num_traces, traces, addr, file, line, \
+#define FILL_LINE() \
+ do { \
+ fill_line(num_traces, traces, addr, file, line, \
header.format, \
header.version, \
header.include_directories, \
header.filenames, \
- obj, lines, offset, errout); \
- /*basic_block = prologue_end = epilogue_begin = 0;*/ \
+ obj, lines, offset, errout); \
+ /*basic_block = prologue_end = epilogue_begin = 0;*/ \
} while (0)
while (p < header.cu_end) {
- unsigned long a;
- unsigned char op = *p++;
- switch (op) {
- case DW_LNS_copy:
- FILL_LINE();
- break;
- case DW_LNS_advance_pc:
- a = uleb128(&p) * header.minimum_instruction_length;
- addr += a;
- break;
- case DW_LNS_advance_line: {
- long a = sleb128(&p);
- line += a;
- break;
- }
- case DW_LNS_set_file:
- file = (unsigned int)uleb128(&p);
- break;
- case DW_LNS_set_column:
- /*column = (unsigned int)*/(void)uleb128(&p);
- break;
- case DW_LNS_negate_stmt:
- is_stmt = !is_stmt;
- break;
- case DW_LNS_set_basic_block:
- /*basic_block = 1; */
- break;
- case DW_LNS_const_add_pc:
- a = ((255UL - header.opcode_base) / header.line_range) *
- header.minimum_instruction_length;
- addr += a;
- break;
- case DW_LNS_fixed_advance_pc:
- a = *(uint16_t *)p;
- p += sizeof(uint16_t);
- addr += a;
- break;
- case DW_LNS_set_prologue_end:
- /* prologue_end = 1; */
- break;
- case DW_LNS_set_epilogue_begin:
- /* epilogue_begin = 1; */
- break;
- case DW_LNS_set_isa:
- /* isa = (unsigned int)*/(void)uleb128(&p);
- break;
- case 0:
- a = uleb128(&p);
- op = *p++;
- switch (op) {
- case DW_LNE_end_sequence:
- /* end_sequence = 1; */
- FILL_LINE();
- addr = 0;
- file = 1;
- line = 1;
- /* column = 0; */
- is_stmt = header.default_is_stmt;
- /* end_sequence = 0; */
- /* isa = 0; */
- break;
- case DW_LNE_set_address:
- addr = *(unsigned long *)p;
- p += sizeof(unsigned long);
- break;
- case DW_LNE_define_file:
- kprintf("Unsupported operation in %s\n",
- binary_filename);
- break;
- case DW_LNE_set_discriminator:
- /* TODO:currently ignore */
- uleb128(&p);
- break;
- default:
- kprintf("Unknown extended opcode: %d in %s\n",
- op, binary_filename);
- }
- break;
- default: {
+ unsigned long a;
+ unsigned char op = *p++;
+ switch (op) {
+ case DW_LNS_copy:
+ FILL_LINE();
+ break;
+ case DW_LNS_advance_pc:
+ a = uleb128(&p) * header.minimum_instruction_length;
+ addr += a;
+ break;
+ case DW_LNS_advance_line: {
+ long a = sleb128(&p);
+ line += a;
+ break;
+ }
+ case DW_LNS_set_file:
+ file = (unsigned int)uleb128(&p);
+ break;
+ case DW_LNS_set_column:
+ /*column = (unsigned int)*/(void)uleb128(&p);
+ break;
+ case DW_LNS_negate_stmt:
+ is_stmt = !is_stmt;
+ break;
+ case DW_LNS_set_basic_block:
+ /*basic_block = 1; */
+ break;
+ case DW_LNS_const_add_pc:
+ a = ((255UL - header.opcode_base) / header.line_range) *
+ header.minimum_instruction_length;
+ addr += a;
+ break;
+ case DW_LNS_fixed_advance_pc:
+ a = *(uint16_t *)p;
+ p += sizeof(uint16_t);
+ addr += a;
+ break;
+ case DW_LNS_set_prologue_end:
+ /* prologue_end = 1; */
+ break;
+ case DW_LNS_set_epilogue_begin:
+ /* epilogue_begin = 1; */
+ break;
+ case DW_LNS_set_isa:
+ /* isa = (unsigned int)*/(void)uleb128(&p);
+ break;
+ case 0:
+ a = uleb128(&p);
+ op = *p++;
+ switch (op) {
+ case DW_LNE_end_sequence:
+ /* end_sequence = 1; */
+ FILL_LINE();
+ addr = 0;
+ file = 1;
+ line = 1;
+ /* column = 0; */
+ is_stmt = header.default_is_stmt;
+ /* end_sequence = 0; */
+ /* isa = 0; */
+ break;
+ case DW_LNE_set_address:
+ addr = *(unsigned long *)p;
+ p += sizeof(unsigned long);
+ break;
+ case DW_LNE_define_file:
+ kprintf("Unsupported operation in %s\n",
+ binary_filename);
+ break;
+ case DW_LNE_set_discriminator:
+ /* TODO:currently ignore */
+ uleb128(&p);
+ break;
+ default:
+ kprintf("Unknown extended opcode: %d in %s\n",
+ op, binary_filename);
+ }
+ break;
+ default: {
uint8_t adjusted_opcode = op - header.opcode_base;
uint8_t operation_advance = adjusted_opcode / header.line_range;
/* NOTE: this code doesn't support VLIW */
addr += operation_advance * header.minimum_instruction_length;
line += header.line_base + (adjusted_opcode % header.line_range);
- FILL_LINE();
- }
- }
+ FILL_LINE();
+ }
+ }
}
*debug_line = (char *)p;
return 0;
@@ -554,17 +556,17 @@ parse_debug_line_cu(int num_traces, void **traces, const char **debug_line,
static int
parse_debug_line(int num_traces, void **traces,
- const char *debug_line, unsigned long size,
- obj_info_t *obj, line_info_t *lines, int offset, FILE *errout)
+ const char *debug_line, unsigned long size,
+ obj_info_t *obj, line_info_t *lines, int offset, FILE *errout)
{
const char *debug_line_end = debug_line + size;
while (debug_line < debug_line_end) {
- if (parse_debug_line_cu(num_traces, traces, &debug_line, obj, lines, offset, errout))
- return -1;
+ if (parse_debug_line_cu(num_traces, traces, &debug_line, obj, lines, offset, errout))
+ return -1;
}
if (debug_line != debug_line_end) {
- kprintf("Unexpected size of .debug_line in %s\n",
- binary_filename);
+ kprintf("Unexpected size of .debug_line in %s\n",
+ binary_filename);
}
return 0;
}
@@ -572,7 +574,7 @@ parse_debug_line(int num_traces, void **traces,
/* read file and fill lines */
static uintptr_t
fill_lines(int num_traces, void **traces, int check_debuglink,
- obj_info_t **objp, line_info_t *lines, int offset, FILE *errout);
+ obj_info_t **objp, line_info_t *lines, int offset, FILE *errout);
static void
append_obj(obj_info_t **objp)
@@ -600,7 +602,7 @@ append_obj(obj_info_t **objp)
// check the path pattern of "/usr/lib/debug/usr/bin/ruby.debug"
static void
follow_debuglink(const char *debuglink, int num_traces, void **traces,
- obj_info_t **objp, line_info_t *lines, int offset, FILE *errout)
+ obj_info_t **objp, line_info_t *lines, int offset, FILE *errout)
{
static const char global_debug_dir[] = "/usr/lib/debug";
const size_t global_debug_dir_len = sizeof(global_debug_dir) - 1;
@@ -610,13 +612,13 @@ follow_debuglink(const char *debuglink, int num_traces, void **traces,
p = strrchr(binary_filename, '/');
if (!p) {
- return;
+ return;
}
p[1] = '\0';
len = strlen(binary_filename);
if (len >= PATH_MAX - global_debug_dir_len)
- len = PATH_MAX - global_debug_dir_len - 1;
+ len = PATH_MAX - global_debug_dir_len - 1;
memmove(binary_filename + global_debug_dir_len, binary_filename, len);
memcpy(binary_filename, global_debug_dir, global_debug_dir_len);
len += global_debug_dir_len;
@@ -635,12 +637,13 @@ follow_debuglink_build_id(const char *build_id, size_t build_id_size, int num_tr
obj_info_t **objp, line_info_t *lines, int offset, FILE *errout)
{
static const char global_debug_dir[] = "/usr/lib/debug/.build-id/";
+ static const char debug_suffix[] = ".debug";
const size_t global_debug_dir_len = sizeof(global_debug_dir) - 1;
char *p;
obj_info_t *o1 = *objp, *o2;
size_t i;
- if (PATH_MAX < global_debug_dir_len + 1 + build_id_size * 2 + 6) return;
+ if (PATH_MAX < global_debug_dir_len + build_id_size * 2 + sizeof(debug_suffix)) return;
memcpy(binary_filename, global_debug_dir, global_debug_dir_len);
p = binary_filename + global_debug_dir_len;
@@ -651,7 +654,7 @@ follow_debuglink_build_id(const char *build_id, size_t build_id_size, int num_tr
*p++ = tbl[n % 16];
if (i == 0) *p++ = '/';
}
- strcpy(p, ".debug");
+ memcpy(p, debug_suffix, sizeof(debug_suffix));
append_obj(objp);
o2 = *objp;
@@ -2029,14 +2032,14 @@ uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr)
int ret = 0;
if (chdr->ch_type != ELFCOMPRESS_ZLIB) {
- /* unsupported compression type */
- return 0;
+ /* unsupported compression type */
+ return 0;
}
*ptr = malloc(destsize);
if (!*ptr) return 0;
ret = uncompress((Bytef *)*ptr, &destsize,
- (const Bytef*)chdr + sizeof(ElfW(Chdr)),
+ (const Bytef*)chdr + sizeof(ElfW(Chdr)),
shdr->sh_size - sizeof(ElfW(Chdr)));
if (ret != Z_OK) goto fail;
return destsize;
@@ -2051,7 +2054,7 @@ fail:
/* read file and fill lines */
static uintptr_t
fill_lines(int num_traces, void **traces, int check_debuglink,
- obj_info_t **objp, line_info_t *lines, int offset, FILE *errout)
+ obj_info_t **objp, line_info_t *lines, int offset, FILE *errout)
{
int i, j;
char *shstr;
@@ -2069,40 +2072,40 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
fd = open(binary_filename, O_RDONLY);
if (fd < 0) {
- goto fail;
+ goto fail;
}
filesize = lseek(fd, 0, SEEK_END);
if (filesize < 0) {
- int e = errno;
- close(fd);
- kprintf("lseek: %s\n", strerror(e));
- goto fail;
+ int e = errno;
+ close(fd);
+ kprintf("lseek: %s\n", strerror(e));
+ goto fail;
}
#if SIZEOF_OFF_T > SIZEOF_SIZE_T
if (filesize > (off_t)SIZE_MAX) {
- close(fd);
- kprintf("Too large file %s\n", binary_filename);
- goto fail;
+ close(fd);
+ kprintf("Too large file %s\n", binary_filename);
+ goto fail;
}
#endif
lseek(fd, 0, SEEK_SET);
/* async-signal unsafe */
file = (char *)mmap(NULL, (size_t)filesize, PROT_READ, MAP_SHARED, fd, 0);
if (file == MAP_FAILED) {
- int e = errno;
- close(fd);
- kprintf("mmap: %s\n", strerror(e));
- goto fail;
+ int e = errno;
+ close(fd);
+ kprintf("mmap: %s\n", strerror(e));
+ goto fail;
}
close(fd);
ehdr = (ElfW(Ehdr) *)file;
if (memcmp(ehdr->e_ident, "\177ELF", 4) != 0) {
- /*
- * Huh? Maybe filename was overridden by setproctitle() and
- * it match non-elf file.
- */
- goto fail;
+ /*
+ * Huh? Maybe filename was overridden by setproctitle() and
+ * it match non-elf file.
+ */
+ goto fail;
}
obj->mapped = file;
obj->mapped_size = (size_t)filesize;
@@ -2114,32 +2117,32 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
for (i = 0; i < ehdr->e_shnum; i++) {
char *section_name = shstr + shdr[i].sh_name;
- switch (shdr[i].sh_type) {
- case SHT_STRTAB:
- if (!strcmp(section_name, ".strtab")) {
- strtab_shdr = shdr + i;
- }
- else if (!strcmp(section_name, ".dynstr")) {
- dynstr_shdr = shdr + i;
- }
- break;
- case SHT_SYMTAB:
- /* if (!strcmp(section_name, ".symtab")) */
- symtab_shdr = shdr + i;
- break;
- case SHT_DYNSYM:
- /* if (!strcmp(section_name, ".dynsym")) */
- dynsym_shdr = shdr + i;
- break;
+ switch (shdr[i].sh_type) {
+ case SHT_STRTAB:
+ if (!strcmp(section_name, ".strtab")) {
+ strtab_shdr = shdr + i;
+ }
+ else if (!strcmp(section_name, ".dynstr")) {
+ dynstr_shdr = shdr + i;
+ }
+ break;
+ case SHT_SYMTAB:
+ /* if (!strcmp(section_name, ".symtab")) */
+ symtab_shdr = shdr + i;
+ break;
+ case SHT_DYNSYM:
+ /* if (!strcmp(section_name, ".dynsym")) */
+ dynsym_shdr = shdr + i;
+ break;
case SHT_NOTE:
if (!strcmp(section_name, ".note.gnu.build-id")) {
note_gnu_build_id = shdr + i;
}
break;
- case SHT_PROGBITS:
- if (!strcmp(section_name, ".gnu_debuglink")) {
- gnu_debuglink_shdr = shdr + i;
- }
+ case SHT_PROGBITS:
+ if (!strcmp(section_name, ".gnu_debuglink")) {
+ gnu_debuglink_shdr = shdr + i;
+ }
else {
const char *debug_section_names[] = {
".debug_abbrev",
@@ -2169,17 +2172,16 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
break;
}
}
- break;
- }
+ break;
+ }
}
- if (offset == -1) {
- /* main executable */
- offset = 0;
- if (dynsym_shdr && dynstr_shdr) {
- char *strtab = file + dynstr_shdr->sh_offset;
- ElfW(Sym) *symtab = (ElfW(Sym) *)(file + dynsym_shdr->sh_offset);
- int symtab_count = (int)(dynsym_shdr->sh_size / sizeof(ElfW(Sym)));
+ if (offset == 0) {
+ /* main executable */
+ if (dynsym_shdr && dynstr_shdr) {
+ char *strtab = file + dynstr_shdr->sh_offset;
+ ElfW(Sym) *symtab = (ElfW(Sym) *)(file + dynsym_shdr->sh_offset);
+ int symtab_count = (int)(dynsym_shdr->sh_size / sizeof(ElfW(Sym)));
void *handle = dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
if (handle) {
for (j = 0; j < symtab_count; j++) {
@@ -2196,14 +2198,14 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
}
dlclose(handle);
}
- if (ehdr->e_type == ET_EXEC) {
- obj->base_addr = 0;
- }
- else {
- /* PIE (position-independent executable) */
- obj->base_addr = dladdr_fbase;
- }
- }
+ if (ehdr->e_type == ET_EXEC) {
+ obj->base_addr = 0;
+ }
+ else {
+ /* PIE (position-independent executable) */
+ obj->base_addr = dladdr_fbase;
+ }
+ }
}
if (obj->debug_info.ptr && obj->debug_abbrev.ptr) {
@@ -2249,21 +2251,21 @@ use_symtab:
}
if (!obj->debug_line.ptr) {
- /* This file doesn't have .debug_line section,
- let's check .gnu_debuglink section instead. */
- if (gnu_debuglink_shdr && check_debuglink) {
- follow_debuglink(file + gnu_debuglink_shdr->sh_offset,
- num_traces, traces,
- objp, lines, offset, errout);
- }
+ /* This file doesn't have .debug_line section,
+ let's check .gnu_debuglink section instead. */
+ if (gnu_debuglink_shdr && check_debuglink) {
+ follow_debuglink(file + gnu_debuglink_shdr->sh_offset,
+ num_traces, traces,
+ objp, lines, offset, errout);
+ }
if (note_gnu_build_id && check_debuglink) {
ElfW(Nhdr) *nhdr = (ElfW(Nhdr)*) (file + note_gnu_build_id->sh_offset);
const char *build_id = (char *)(nhdr + 1) + nhdr->n_namesz;
follow_debuglink_build_id(build_id, nhdr->n_descsz,
- num_traces, traces,
+ num_traces, traces,
objp, lines, offset, errout);
}
- goto finish;
+ goto finish;
}
if (parse_debug_line(num_traces, traces,
@@ -2426,7 +2428,17 @@ found_mach_header:
for (int j=0; j < DWARF_SECTION_COUNT; j++) {
struct dwarf_section *s = obj_dwarf_section_at(obj, j);
- if (strcmp(sect->sectname, debug_section_names[j]) != 0)
+ if (strcmp(sect->sectname, debug_section_names[j]) != 0
+#ifdef __APPLE__
+ /* macOS clang 16 generates DWARF5, which have Mach-O
+ * section names that are limited to 16 characters,
+ * which causes sections with long names to be truncated
+ * and not match above.
+ * See: https://wiki.dwarfstd.org/Best_Practices.md#Mach-2d-O
+ */
+ && strncmp(sect->sectname, debug_section_names[j], 16) != 0
+#endif
+ )
continue;
s->ptr = file + sect->offset;
@@ -2533,8 +2545,8 @@ main_exe_path(FILE *errout)
size_t len = PATH_MAX;
int err = sysctl(mib, 4, binary_filename, &len, NULL, 0);
if (err) {
- kprintf("Can't get the path of ruby");
- return -1;
+ kprintf("Can't get the path of ruby");
+ return -1;
}
len--; /* sysctl sets strlen+1 */
return len;
@@ -2616,79 +2628,79 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces, FILE *errout)
char *main_path = NULL; /* used on printing backtrace */
ssize_t len;
if ((len = main_exe_path(errout)) > 0) {
- main_path = (char *)alloca(len + 1);
- if (main_path) {
- uintptr_t addr;
- memcpy(main_path, binary_filename, len+1);
- append_obj(&obj);
- obj->path = main_path;
- addr = fill_lines(num_traces, traces, 1, &obj, lines, -1, errout);
- if (addr != (uintptr_t)-1) {
- dladdr_fbases[0] = (void *)addr;
- }
- }
+ main_path = (char *)alloca(len + 1);
+ if (main_path) {
+ uintptr_t addr;
+ memcpy(main_path, binary_filename, len+1);
+ append_obj(&obj);
+ obj->path = main_path;
+ addr = fill_lines(num_traces, traces, 1, &obj, lines, 0, errout);
+ if (addr != (uintptr_t)-1) {
+ dladdr_fbases[0] = (void *)addr;
+ }
+ }
}
#endif
/* fill source lines by reading dwarf */
for (i = 0; i < num_traces; i++) {
- Dl_info info;
- if (lines[i].line) continue;
- if (dladdr(traces[i], &info)) {
- const char *path;
- void **p;
-
- /* skip symbols which is in already checked objects */
- /* if the binary is strip-ed, this may effect */
- for (p=dladdr_fbases; *p; p++) {
- if (*p == info.dli_fbase) {
- if (info.dli_fname) lines[i].path = info.dli_fname;
- if (info.dli_sname) lines[i].sname = info.dli_sname;
- goto next_line;
- }
- }
- *p = info.dli_fbase;
-
- append_obj(&obj);
- obj->base_addr = (uintptr_t)info.dli_fbase;
- path = info.dli_fname;
- obj->path = path;
- if (path) lines[i].path = path;
+ Dl_info info;
+ if (lines[i].line) continue;
+ if (dladdr(traces[i], &info)) {
+ const char *path;
+ void **p;
+
+ /* skip symbols which is in already checked objects */
+ /* if the binary is strip-ed, this may effect */
+ for (p=dladdr_fbases; *p; p++) {
+ if (*p == info.dli_fbase) {
+ if (info.dli_fname) lines[i].path = info.dli_fname;
+ if (info.dli_sname) lines[i].sname = info.dli_sname;
+ goto next_line;
+ }
+ }
+ *p = info.dli_fbase;
+
+ append_obj(&obj);
+ obj->base_addr = (uintptr_t)info.dli_fbase;
+ path = info.dli_fname;
+ obj->path = path;
+ if (path) lines[i].path = path;
if (info.dli_sname) {
lines[i].sname = info.dli_sname;
lines[i].saddr = (uintptr_t)info.dli_saddr;
}
- strlcpy(binary_filename, path, PATH_MAX);
- if (fill_lines(num_traces, traces, 1, &obj, lines, i, errout) == (uintptr_t)-1)
- break;
- }
+ strlcpy(binary_filename, path, PATH_MAX);
+ if (fill_lines(num_traces, traces, 1, &obj, lines, i, errout) == (uintptr_t)-1)
+ break;
+ }
next_line:
- continue;
+ continue;
}
/* output */
for (i = 0; i < num_traces; i++) {
print_line(&lines[i], traces[i], errout);
- /* FreeBSD's backtrace may show _start and so on */
- if (lines[i].sname && strcmp("main", lines[i].sname) == 0)
- break;
+ /* FreeBSD's backtrace may show _start and so on */
+ if (lines[i].sname && strcmp("main", lines[i].sname) == 0)
+ break;
}
/* free */
while (obj) {
- obj_info_t *o = obj;
+ obj_info_t *o = obj;
for (i=0; i < DWARF_SECTION_COUNT; i++) {
struct dwarf_section *s = obj_dwarf_section_at(obj, i);
if (s->flags & SHF_COMPRESSED) {
free(s->ptr);
}
}
- if (obj->mapped_size) {
- munmap(obj->mapped, obj->mapped_size);
- }
- obj = o->next;
- free(o);
+ if (obj->mapped_size) {
+ munmap(obj->mapped, obj->mapped_size);
+ }
+ obj = o->next;
+ free(o);
}
for (i = 0; i < num_traces; i++) {
line_info_t *line = lines[i].next;
diff --git a/array.c b/array.c
index dab933776f..b471823876 100644
--- a/array.c
+++ b/array.c
@@ -27,7 +27,9 @@
#include "probes.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
+#include "ruby/thread.h"
#include "ruby/util.h"
+#include "ruby/ractor.h"
#include "vm_core.h"
#include "builtin.h"
@@ -38,15 +40,16 @@
#include "ruby_assert.h"
VALUE rb_cArray;
+VALUE rb_cArray_empty_frozen;
/* Flags of RArray
*
+ * 0: RARRAY_SHARED_FLAG (equal to ELTS_SHARED)
+ * The array is shared. The buffer this array points to is owned by
+ * another array (the shared root).
* 1: RARRAY_EMBED_FLAG
* The array is embedded (its contents follow the header, rather than
* being on a separately allocated buffer).
- * 2: RARRAY_SHARED_FLAG (equal to ELTS_SHARED)
- * The array is shared. The buffer this array points to is owned by
- * another array (the shared root).
* 3-9: RARRAY_EMBED_LEN
* The length of the array when RARRAY_EMBED_FLAG is set.
* 12: RARRAY_SHARED_ROOT_FLAG
@@ -105,10 +108,12 @@ should_be_T_ARRAY(VALUE ary)
} while (0)
#define FL_UNSET_SHARED(ary) FL_UNSET((ary), RARRAY_SHARED_FLAG)
+#define ARY_SET_PTR_FORCE(ary, p) \
+ (RARRAY(ary)->as.heap.ptr = (p))
#define ARY_SET_PTR(ary, p) do { \
RUBY_ASSERT(!ARY_EMBED_P(ary)); \
RUBY_ASSERT(!OBJ_FROZEN(ary)); \
- RARRAY(ary)->as.heap.ptr = (p); \
+ ARY_SET_PTR_FORCE(ary, p); \
} while (0)
#define ARY_SET_EMBED_LEN(ary, n) do { \
long tmp_n = (n); \
@@ -146,11 +151,13 @@ should_be_T_ARRAY(VALUE ary)
#define ARY_CAPA(ary) (ARY_EMBED_P(ary) ? ary_embed_capa(ary) : \
ARY_SHARED_ROOT_P(ary) ? RARRAY_LEN(ary) : ARY_HEAP_CAPA(ary))
+#define ARY_SET_CAPA_FORCE(ary, n) \
+ RARRAY(ary)->as.heap.aux.capa = (n);
#define ARY_SET_CAPA(ary, n) do { \
RUBY_ASSERT(!ARY_EMBED_P(ary)); \
RUBY_ASSERT(!ARY_SHARED_P(ary)); \
RUBY_ASSERT(!OBJ_FROZEN(ary)); \
- RARRAY(ary)->as.heap.aux.capa = (n); \
+ ARY_SET_CAPA_FORCE(ary, n); \
} while (0)
#define ARY_SHARED_ROOT_OCCUPIED(ary) (!OBJ_FROZEN(ary) && ARY_SHARED_ROOT_REFCNT(ary) == 1)
@@ -187,7 +194,9 @@ ary_embed_capa(VALUE ary)
static size_t
ary_embed_size(long capa)
{
- return offsetof(struct RArray, as.ary) + (sizeof(VALUE) * capa);
+ size_t size = offsetof(struct RArray, as.ary) + (sizeof(VALUE) * capa);
+ if (size < sizeof(struct RArray)) size = sizeof(struct RArray);
+ return size;
}
static bool
@@ -262,12 +271,6 @@ ary_verify_(VALUE ary, const char *file, int line)
return ary;
}
-
-void
-rb_ary_verify(VALUE ary)
-{
- ary_verify(ary);
-}
#else
#define ary_verify(ary) ((void)0)
#endif
@@ -370,6 +373,7 @@ ary_heap_free(VALUE ary)
static size_t
ary_heap_realloc(VALUE ary, size_t new_capa)
{
+ RUBY_ASSERT(!OBJ_FROZEN(ary));
SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, new_capa, ARY_HEAP_CAPA(ary));
ary_verify(ary);
@@ -441,7 +445,10 @@ ary_shrink_capa(VALUE ary)
long old_capa = ARY_HEAP_CAPA(ary);
RUBY_ASSERT(!ARY_SHARED_P(ary));
RUBY_ASSERT(old_capa >= capacity);
- if (old_capa > capacity) ary_heap_realloc(ary, capacity);
+ if (old_capa > capacity) {
+ size_t new_capa = ary_heap_realloc(ary, capacity);
+ ARY_SET_CAPA(ary, new_capa);
+ }
ary_verify(ary);
}
@@ -522,6 +529,8 @@ rb_ary_set_shared(VALUE ary, VALUE shared_root)
static inline void
rb_ary_modify_check(VALUE ary)
{
+ RUBY_ASSERT(ruby_thread_has_gvl_p());
+
rb_check_frozen(ary);
ary_verify(ary);
}
@@ -558,8 +567,8 @@ rb_ary_cancel_sharing(VALUE ary)
VALUE *ptr = ary_heap_alloc_buffer(len);
MEMCPY(ptr, ARY_HEAP_PTR(ary), VALUE, len);
rb_ary_unshare(ary);
- ARY_SET_CAPA(ary, len);
- ARY_SET_PTR(ary, ptr);
+ ARY_SET_CAPA_FORCE(ary, len);
+ ARY_SET_PTR_FORCE(ary, ptr);
}
rb_gc_writebarrier_remember(ary);
@@ -624,21 +633,32 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
/*
* call-seq:
- * array.freeze -> self
+ * freeze -> self
*
- * Freezes +self+; returns +self+:
+ * Freezes +self+ (if not already frozen); returns +self+:
*
* a = []
* a.frozen? # => false
* a.freeze
* a.frozen? # => true
*
- * An attempt to modify a frozen +Array+ raises FrozenError.
+ * No further changes may be made to +self+;
+ * raises FrozenError if a change is attempted.
+ *
+ * Related: Kernel#frozen?.
*/
VALUE
rb_ary_freeze(VALUE ary)
{
+ RUBY_ASSERT(RB_TYPE_P(ary, T_ARRAY));
+
+ if (OBJ_FROZEN(ary)) return ary;
+
+ if (!ARY_EMBED_P(ary) && !ARY_SHARED_P(ary) && !ARY_SHARED_ROOT_P(ary)) {
+ ary_shrink_capa(ary);
+ }
+
return rb_obj_freeze(ary);
}
@@ -682,6 +702,11 @@ ary_alloc_heap(VALUE klass)
NEWOBJ_OF(ary, struct RArray, klass,
T_ARRAY | (RGENGC_WB_PROTECTED_ARRAY ? FL_WB_PROTECTED : 0),
sizeof(struct RArray), 0);
+
+ ary->as.heap.len = 0;
+ ary->as.heap.aux.capa = 0;
+ ary->as.heap.ptr = NULL;
+
return (VALUE)ary;
}
@@ -695,6 +720,8 @@ empty_ary_alloc(VALUE klass)
static VALUE
ary_new(VALUE klass, long capa)
{
+ RUBY_ASSERT(ruby_thread_has_gvl_p());
+
VALUE ary;
if (capa < 0) {
@@ -793,6 +820,11 @@ ec_ary_alloc_heap(rb_execution_context_t *ec, VALUE klass)
NEWOBJ_OF(ary, struct RArray, klass,
T_ARRAY | (RGENGC_WB_PROTECTED_ARRAY ? FL_WB_PROTECTED : 0),
sizeof(struct RArray), ec);
+
+ ary->as.heap.len = 0;
+ ary->as.heap.aux.capa = 0;
+ ary->as.heap.ptr = NULL;
+
return (VALUE)ary;
}
@@ -880,17 +912,29 @@ rb_ary_free(VALUE ary)
}
}
+static VALUE fake_ary_flags;
+
+static VALUE
+init_fake_ary_flags(void)
+{
+ struct RArray fake_ary = {0};
+ fake_ary.basic.flags = T_ARRAY;
+ VALUE ary = (VALUE)&fake_ary;
+ rb_ary_freeze(ary);
+ return fake_ary.basic.flags;
+}
+
VALUE
-rb_setup_fake_ary(struct RArray *fake_ary, const VALUE *list, long len, bool freeze)
-{
- fake_ary->basic.flags = T_ARRAY;
- VALUE ary = (VALUE)fake_ary;
- RBASIC_CLEAR_CLASS(ary);
- ARY_SET_PTR(ary, list);
- ARY_SET_HEAP_LEN(ary, len);
- ARY_SET_CAPA(ary, len);
- if (freeze) OBJ_FREEZE(ary);
- return ary;
+rb_setup_fake_ary(struct RArray *fake_ary, const VALUE *list, long len)
+{
+ fake_ary->basic.flags = fake_ary_flags;
+ RBASIC_CLEAR_CLASS((VALUE)fake_ary);
+
+ // bypass frozen checks
+ fake_ary->as.heap.ptr = list;
+ fake_ary->as.heap.len = len;
+ fake_ary->as.heap.aux.capa = len;
+ return (VALUE)fake_ary;
}
size_t
@@ -916,9 +960,6 @@ ary_make_shared(VALUE ary)
return ary;
}
else if (OBJ_FROZEN(ary)) {
- if (!ARY_EMBED_P(ary)) {
- ary_shrink_capa(ary);
- }
return ary;
}
else {
@@ -1007,14 +1048,18 @@ rb_to_array(VALUE ary)
* call-seq:
* Array.try_convert(object) -> object, new_array, or nil
*
- * If +object+ is an +Array+ object, returns +object+.
+ * Attempts to return an array, based on the given +object+.
+ *
+ * If +object+ is an array, returns +object+.
*
- * Otherwise if +object+ responds to <tt>:to_ary</tt>,
- * calls <tt>object.to_ary</tt> and returns the result.
+ * Otherwise if +object+ responds to <tt>:to_ary</tt>.
+ * calls <tt>object.to_ary</tt>:
+ * if the return value is an array or +nil+, returns that value;
+ * if not, raises TypeError.
*
- * Returns +nil+ if +object+ does not respond to <tt>:to_ary</tt>
+ * Otherwise returns +nil+.
*
- * Raises an exception unless <tt>object.to_ary</tt> returns an +Array+ object.
+ * Related: see {Methods for Creating an Array}[rdoc-ref:Array@Methods+for+Creating+an+Array].
*/
static VALUE
@@ -1051,48 +1096,51 @@ rb_ary_s_new(int argc, VALUE *argv, VALUE klass)
* call-seq:
* Array.new -> new_empty_array
* Array.new(array) -> new_array
- * Array.new(size) -> new_array
- * Array.new(size, default_value) -> new_array
- * Array.new(size) {|index| ... } -> new_array
+ * Array.new(size, default_value = nil) -> new_array
+ * Array.new(size = 0) {|index| ... } -> new_array
*
- * Returns a new +Array+.
+ * Returns a new array.
*
- * With no block and no arguments, returns a new empty +Array+ object.
+ * With no block and no argument given, returns a new empty array:
*
- * With no block and a single +Array+ argument +array+,
- * returns a new +Array+ formed from +array+:
+ * Array.new # => []
*
- * a = Array.new([:foo, 'bar', 2])
- * a.class # => Array
- * a # => [:foo, "bar", 2]
+ * With no block and array argument given, returns a new array with the same elements:
+ *
+ * Array.new([:foo, 'bar', 2]) # => [:foo, "bar", 2]
*
- * With no block and a single Integer argument +size+,
- * returns a new +Array+ of the given size
- * whose elements are all +nil+:
+ * With no block and integer argument given, returns a new array containing
+ * that many instances of the given +default_value+:
*
- * a = Array.new(3)
- * a # => [nil, nil, nil]
+ * Array.new(0) # => []
+ * Array.new(3) # => [nil, nil, nil]
+ * Array.new(2, 3) # => [3, 3]
*
- * With no block and arguments +size+ and +default_value+,
- * returns an +Array+ of the given size;
- * each element is that same +default_value+:
+ * With a block given, returns an array of the given +size+;
+ * calls the block with each +index+ in the range <tt>(0...size)</tt>;
+ * the element at that +index+ in the returned array is the blocks return value:
*
- * a = Array.new(3, 'x')
- * a # => ['x', 'x', 'x']
+ * Array.new(3) {|index| "Element #{index}" } # => ["Element 0", "Element 1", "Element 2"]
*
- * With a block and argument +size+,
- * returns an +Array+ of the given size;
- * the block is called with each successive integer +index+;
- * the element for that +index+ is the return value from the block:
+ * A common pitfall for new Rubyists is providing an expression as +default_value+:
*
- * a = Array.new(3) {|index| "Element #{index}" }
- * a # => ["Element 0", "Element 1", "Element 2"]
+ * array = Array.new(2, {})
+ * array # => [{}, {}]
+ * array[0][:a] = 1
+ * array # => [{a: 1}, {a: 1}], as array[0] and array[1] are same object
*
- * Raises ArgumentError if +size+ is negative.
+ * If you want the elements of the array to be distinct, you should pass a block:
*
- * With a block and no argument,
- * or a single argument +0+,
- * ignores the block and returns a new empty +Array+.
+ * array = Array.new(2) { {} }
+ * array # => [{}, {}]
+ * array[0][:a] = 1
+ * array # => [{a: 1}, {}], as array[0] and array[1] are different objects
+ *
+ * Raises TypeError if the first argument is not either an array
+ * or an {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]).
+ * Raises ArgumentError if the first argument is a negative integer.
+ *
+ * Related: see {Methods for Creating an Array}[rdoc-ref:Array@Methods+for+Creating+an+Array].
*/
static VALUE
@@ -1150,11 +1198,13 @@ rb_ary_initialize(int argc, VALUE *argv, VALUE ary)
}
/*
- * Returns a new array populated with the given objects.
+ * Returns a new array, populated with the given objects:
+ *
+ * Array[1, 'a', /^A/] # => [1, "a", /^A/]
+ * Array[] # => []
+ * Array.[](1, 'a', /^A/) # => [1, "a", /^A/]
*
- * Array.[]( 1, 'a', /^A/) # => [1, "a", /^A/]
- * Array[ 1, 'a', /^A/ ] # => [1, "a", /^A/]
- * [ 1, 'a', /^A/ ] # => [1, "a", /^A/]
+ * Related: see {Methods for Creating an Array}[rdoc-ref:Array@Methods+for+Creating+an+Array].
*/
static VALUE
@@ -1333,19 +1383,17 @@ ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos
/*
* call-seq:
- * array << object -> self
+ * self << object -> self
*
- * Appends +object+ to +self+; returns +self+:
+ * Appends +object+ as the last element in +self+; returns +self+:
*
- * a = [:foo, 'bar', 2]
- * a << :baz # => [:foo, "bar", 2, :baz]
+ * [:foo, 'bar', 2] << :baz # => [:foo, "bar", 2, :baz]
*
- * Appends +object+ as one element, even if it is another +Array+:
+ * Appends +object+ as a single element, even if it is another array:
*
- * a = [:foo, 'bar', 2]
- * a1 = a << [3, 4]
- * a1 # => [:foo, "bar", 2, [3, 4]]
+ * [:foo, 'bar', 2] << [3, 4] # => [:foo, "bar", 2, [3, 4]]
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
VALUE
@@ -1373,22 +1421,20 @@ rb_ary_cat(VALUE ary, const VALUE *argv, long len)
/*
* call-seq:
- * array.push(*objects) -> self
+ * push(*objects) -> self
+ * append(*objects) -> self
*
- * Appends trailing elements.
+ * Appends each argument in +objects+ to +self+; returns +self+:
*
- * Appends each argument in +objects+ to +self+; returns +self+:
+ * a = [:foo, 'bar', 2] # => [:foo, "bar", 2]
+ * a.push(:baz, :bat) # => [:foo, "bar", 2, :baz, :bat]
*
- * a = [:foo, 'bar', 2]
- * a.push(:baz, :bat) # => [:foo, "bar", 2, :baz, :bat]
- *
- * Appends each argument as one element, even if it is another +Array+:
+ * Appends each argument as a single element, even if it is another array:
*
- * a = [:foo, 'bar', 2]
- * a1 = a.push([:baz, :bat], [:bam, :bad])
- * a1 # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
+ * a = [:foo, 'bar', 2] # => [:foo, "bar", 2]
+ a.push([:baz, :bat], [:bam, :bad]) # => [:foo, "bar", 2, [:baz, :bat], [:bam, :bad]]
*
- * Related: #pop, #shift, #unshift.
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -1410,41 +1456,42 @@ rb_ary_pop(VALUE ary)
{
ary_resize_capa(ary, n * 2);
}
- --n;
- ARY_SET_LEN(ary, n);
+
+ VALUE obj = RARRAY_AREF(ary, n - 1);
+
+ ARY_SET_LEN(ary, n - 1);
ary_verify(ary);
- return RARRAY_AREF(ary, n);
+ return obj;
}
/*
* call-seq:
- * array.pop -> object or nil
- * array.pop(n) -> new_array
+ * pop -> object or nil
+ * pop(count) -> new_array
*
- * Removes and returns trailing elements.
+ * Removes and returns trailing elements of +self+.
*
- * When no argument is given and +self+ is not empty,
- * removes and returns the last element:
+ * With no argument given, removes and returns the last element, if available;
+ * otherwise returns +nil+:
*
* a = [:foo, 'bar', 2]
- * a.pop # => 2
- * a # => [:foo, "bar"]
- *
- * Returns +nil+ if the array is empty.
+ * a.pop # => 2
+ * a # => [:foo, "bar"]
+ * [].pop # => nil
*
- * When a non-negative Integer argument +n+ is given and is in range,
+ * With non-negative integer argument +count+ given,
+ * returns a new array containing the trailing +count+ elements of +self+, as available:
*
- * removes and returns the last +n+ elements in a new +Array+:
* a = [:foo, 'bar', 2]
* a.pop(2) # => ["bar", 2]
- *
- * If +n+ is positive and out of range,
- * removes and returns all elements:
+ * a # => [:foo]
*
* a = [:foo, 'bar', 2]
* a.pop(50) # => [:foo, "bar", 2]
+ * a # => []
*
- * Related: #push, #shift, #unshift.
+ * Related: Array#push;
+ * see also {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -1483,35 +1530,40 @@ rb_ary_shift(VALUE ary)
/*
* call-seq:
- * array.shift -> object or nil
- * array.shift(n) -> new_array
+ * shift -> object or nil
+ * shift(count) -> new_array or nil
*
- * Removes and returns leading elements.
+ * Removes and returns leading elements from +self+.
*
- * When no argument is given, removes and returns the first element:
+ * With no argument, removes and returns one element, if available,
+ * or +nil+ otherwise:
*
- * a = [:foo, 'bar', 2]
- * a.shift # => :foo
- * a # => ['bar', 2]
- *
- * Returns +nil+ if +self+ is empty.
- *
- * When positive Integer argument +n+ is given, removes the first +n+ elements;
- * returns those elements in a new +Array+:
+ * a = [0, 1, 2, 3]
+ * a.shift # => 0
+ * a # => [1, 2, 3]
+ * [].shift # => nil
*
- * a = [:foo, 'bar', 2]
- * a.shift(2) # => [:foo, 'bar']
- * a # => [2]
+ * With non-negative numeric argument +count+ given,
+ * removes and returns the first +count+ elements:
*
- * If +n+ is as large as or larger than <tt>self.length</tt>,
- * removes all elements; returns those elements in a new +Array+:
+ * a = [0, 1, 2, 3]
+ * a.shift(2) # => [0, 1]
+ * a # => [2, 3]
+ * a.shift(1.1) # => [2]
+ * a # => [3]
+ * a.shift(0) # => []
+ * a # => [3]
+ *
+ * If +count+ is large,
+ * removes and returns all elements:
*
- * a = [:foo, 'bar', 2]
- * a.shift(3) # => [:foo, 'bar', 2]
+ * a = [0, 1, 2, 3]
+ * a.shift(50) # => [0, 1, 2, 3]
+ * a # => []
*
- * If +n+ is zero, returns a new empty +Array+; +self+ is unmodified.
+ * If +self+ is empty, returns a new empty array.
*
- * Related: #push, #pop, #unshift.
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -1652,14 +1704,16 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
/*
* call-seq:
- * array.unshift(*objects) -> self
+ * unshift(*objects) -> self
+ * prepend(*objects) -> self
*
* Prepends the given +objects+ to +self+:
*
* a = [:foo, 'bar', 2]
* a.unshift(:bam, :bat) # => [:bam, :bat, :foo, "bar", 2]
*
- * Related: #push, #pop, #shift.
+ * Related: Array#shift;
+ * see also {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
VALUE
@@ -1735,35 +1789,38 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e);
/*
* call-seq:
- * array[index] -> object or nil
- * array[start, length] -> object or nil
- * array[range] -> object or nil
- * array[aseq] -> object or nil
- * array.slice(index) -> object or nil
- * array.slice(start, length) -> object or nil
- * array.slice(range) -> object or nil
- * array.slice(aseq) -> object or nil
+ * self[offset] -> object or nil
+ * self[offset, size] -> object or nil
+ * self[range] -> object or nil
+ * self[aseq] -> object or nil
*
* Returns elements from +self+; does not modify +self+.
*
* In brief:
*
* a = [:foo, 'bar', 2]
- * a[0] # => :foo
- * a[-1] # => 2
+ *
+ * # Single argument offset: returns one element.
+ * a[0] # => :foo # Zero-based index.
+ * a[-1] # => 2 # Negative index counts backwards from end.
+ *
+ * # Arguments offset and size: returns an array.
* a[1, 2] # => ["bar", 2]
+ * a[-2, 2] # => ["bar", 2] # Negative offset counts backwards from end.
+ *
+ * # Single argument range: returns an array.
* a[0..1] # => [:foo, "bar"]
- * a[0..-2] # => [:foo, "bar"]
- * a[-2..2] # => ["bar", 2]
+ * a[0..-2] # => [:foo, "bar"] # Negative range-begin counts backwards from end.
+ * a[-2..2] # => ["bar", 2] # Negative range-end counts backwards from end.
*
- * When a single Integer argument +index+ is given, returns the element at offset +index+:
+ * When a single integer argument +offset+ is given, returns the element at offset +offset+:
*
* a = [:foo, 'bar', 2]
* a[0] # => :foo
* a[2] # => 2
* a # => [:foo, "bar", 2]
*
- * If +index+ is negative, counts relative to the end of +self+:
+ * If +offset+ is negative, counts backwards from the end of +self+:
*
* a = [:foo, 'bar', 2]
* a[-1] # => 2
@@ -1771,35 +1828,35 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e);
*
* If +index+ is out of range, returns +nil+.
*
- * When two Integer arguments +start+ and +length+ are given,
- * returns a new +Array+ of size +length+ containing successive elements beginning at offset +start+:
+ * When two Integer arguments +offset+ and +size+ are given,
+ * returns a new array of size +size+ containing successive elements beginning at offset +offset+:
*
* a = [:foo, 'bar', 2]
* a[0, 2] # => [:foo, "bar"]
* a[1, 2] # => ["bar", 2]
*
- * If <tt>start + length</tt> is greater than <tt>self.length</tt>,
- * returns all elements from offset +start+ to the end:
+ * If <tt>offset + size</tt> is greater than <tt>self.size</tt>,
+ * returns all elements from offset +offset+ to the end:
*
* a = [:foo, 'bar', 2]
* a[0, 4] # => [:foo, "bar", 2]
* a[1, 3] # => ["bar", 2]
* a[2, 2] # => [2]
*
- * If <tt>start == self.size</tt> and <tt>length >= 0</tt>,
- * returns a new empty +Array+.
+ * If <tt>offset == self.size</tt> and <tt>size >= 0</tt>,
+ * returns a new empty array.
*
- * If +length+ is negative, returns +nil+.
+ * If +size+ is negative, returns +nil+.
*
* When a single Range argument +range+ is given,
- * treats <tt>range.min</tt> as +start+ above
- * and <tt>range.size</tt> as +length+ above:
+ * treats <tt>range.min</tt> as +offset+ above
+ * and <tt>range.size</tt> as +size+ above:
*
* a = [:foo, 'bar', 2]
* a[0..1] # => [:foo, "bar"]
* a[1..2] # => ["bar", 2]
*
- * Special case: If <tt>range.start == a.size</tt>, returns a new empty +Array+.
+ * Special case: If <tt>range.start == a.size</tt>, returns a new empty array.
*
* If <tt>range.end</tt> is negative, calculates the end index from the end:
*
@@ -1823,7 +1880,7 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e);
* a[4..-1] # => nil
*
* When a single Enumerator::ArithmeticSequence argument +aseq+ is given,
- * returns an +Array+ of elements corresponding to the indexes produced by
+ * returns an array of elements corresponding to the indexes produced by
* the sequence.
*
* a = ['--', 'data1', '--', 'data2', '--', 'data3']
@@ -1845,6 +1902,7 @@ static VALUE rb_ary_aref2(VALUE ary, VALUE b, VALUE e);
* # Raises TypeError (no implicit conversion of Symbol into Integer):
* a[:foo]
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
VALUE
@@ -1892,13 +1950,26 @@ rb_ary_aref1(VALUE ary, VALUE arg)
/*
* call-seq:
- * array.at(index) -> object
+ * at(index) -> object or nil
+ *
+ * Returns the element of +self+ specified by the given +index+
+ * or +nil+ if there is no such element;
+ * +index+ must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
+ *
+ * For non-negative +index+, returns the element of +self+ at offset +index+:
*
- * Returns the element at Integer offset +index+; does not modify +self+.
* a = [:foo, 'bar', 2]
- * a.at(0) # => :foo
- * a.at(2) # => 2
+ * a.at(0) # => :foo
+ * a.at(2) # => 2
+ * a.at(2.0) # => 2
+ *
+ * For negative +index+, counts backwards from the end of +self+:
+ *
+ * a.at(-2) # => "bar"
*
+ * Related: Array#[];
+ * see also {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
VALUE
@@ -1947,17 +2018,19 @@ rb_ary_last(int argc, const VALUE *argv, VALUE ary) // used by parse.y
/*
* call-seq:
- * array.fetch(index) -> element
- * array.fetch(index, default_value) -> element
- * array.fetch(index) {|index| ... } -> element
+ * fetch(index) -> element
+ * fetch(index, default_value) -> element or default_value
+ * fetch(index) {|index| ... } -> element or block_return_value
*
- * Returns the element at offset +index+.
+ * Returns the element of +self+ at offset +index+ if +index+ is in range; +index+ must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
*
- * With the single Integer argument +index+,
+ * With the single argument +index+ and no block,
* returns the element at offset +index+:
*
* a = [:foo, 'bar', 2]
- * a.fetch(1) # => "bar"
+ * a.fetch(1) # => "bar"
+ * a.fetch(1.1) # => "bar"
*
* If +index+ is negative, counts from the end of the array:
*
@@ -1965,12 +2038,12 @@ rb_ary_last(int argc, const VALUE *argv, VALUE ary) // used by parse.y
* a.fetch(-1) # => 2
* a.fetch(-2) # => "bar"
*
- * With arguments +index+ and +default_value+,
- * returns the element at offset +index+ if index is in range,
- * otherwise returns +default_value+:
+ * With arguments +index+ and +default_value+ (which may be any object) and no block,
+ * returns +default_value+ if +index+ is out-of-range:
*
* a = [:foo, 'bar', 2]
- * a.fetch(1, nil) # => "bar"
+ * a.fetch(1, nil) # => "bar"
+ * a.fetch(3, :foo) # => :foo
*
* With argument +index+ and a block,
* returns the element at offset +index+ if index is in range
@@ -1980,6 +2053,7 @@ rb_ary_last(int argc, const VALUE *argv, VALUE ary) // used by parse.y
* a.fetch(1) {|index| raise 'Cannot happen' } # => "bar"
* a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -2011,14 +2085,106 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
}
/*
+ * call-seq:
+ * find(if_none_proc = nil) {|element| ... } -> object or nil
+ * find(if_none_proc = nil) -> enumerator
+ *
+ * Returns the first element for which the block returns a truthy value.
+ *
+ * With a block given, calls the block with successive elements of the array;
+ * returns the first element for which the block returns a truthy value:
+ *
+ * [1, 3, 5].find {|element| element > 2} # => 3
+ *
+ * If no such element is found, calls +if_none_proc+ and returns its return value.
+ *
+ * [1, 3, 5].find(proc {-1}) {|element| element > 12} # => -1
+ *
+ * With no block given, returns an Enumerator.
+ *
+ */
+
+static VALUE
+rb_ary_find(int argc, VALUE *argv, VALUE ary)
+{
+ VALUE if_none;
+ long idx;
+
+ RETURN_ENUMERATOR(ary, argc, argv);
+ if_none = rb_check_arity(argc, 0, 1) ? argv[0] : Qnil;
+
+ for (idx = 0; idx < RARRAY_LEN(ary); idx++) {
+ VALUE elem = RARRAY_AREF(ary, idx);
+ if (RTEST(rb_yield(elem))) {
+ return elem;
+ }
+ }
+
+ if (!NIL_P(if_none)) {
+ return rb_funcallv(if_none, idCall, 0, 0);
+ }
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * rfind(if_none_proc = nil) {|element| ... } -> object or nil
+ * rfind(if_none_proc = nil) -> enumerator
+ *
+ * Returns the last element for which the block returns a truthy value.
+ *
+ * With a block given, calls the block with successive elements of the array in
+ * reverse order; returns the first element for which the block returns a truthy
+ * value:
+ *
+ * [1, 2, 3, 4, 5, 6].rfind {|element| element < 5} # => 4
+ *
+ * If no such element is found, calls +if_none_proc+ and returns its return value.
+ *
+ * [1, 2, 3, 4].rfind(proc {0}) {|element| element < -2} # => 0
+ *
+ * With no block given, returns an Enumerator.
+ *
+ */
+
+static VALUE
+rb_ary_rfind(int argc, VALUE *argv, VALUE ary)
+{
+ VALUE if_none;
+ long len, idx;
+
+ RETURN_ENUMERATOR(ary, argc, argv);
+ if_none = rb_check_arity(argc, 0, 1) ? argv[0] : Qnil;
+
+ idx = RARRAY_LEN(ary);
+ while (idx--) {
+ VALUE elem = RARRAY_AREF(ary, idx);
+ if (RTEST(rb_yield(elem))) {
+ return elem;
+ }
+
+ len = RARRAY_LEN(ary);
+ idx = (idx >= len) ? len : idx;
+ }
+
+ if (!NIL_P(if_none)) {
+ return rb_funcallv(if_none, idCall, 0, 0);
+ }
+ return Qnil;
+}
+
+/*
* call-seq:
- * array.index(object) -> integer or nil
- * array.index {|element| ... } -> integer or nil
- * array.index -> new_enumerator
+ * find_index(object) -> integer or nil
+ * find_index {|element| ... } -> integer or nil
+ * find_index -> new_enumerator
+ * index(object) -> integer or nil
+ * index {|element| ... } -> integer or nil
+ * index -> new_enumerator
*
- * Returns the index of a specified element.
+ * Returns the zero-based integer index of a specified element, or +nil+.
*
- * When argument +object+ is given but no block,
+ * With only argument +object+ given,
* returns the index of the first element +element+
* for which <tt>object == element</tt>:
*
@@ -2027,7 +2193,7 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
*
* Returns +nil+ if no such element found.
*
- * When both argument +object+ and a block are given,
+ * With only a block given,
* calls the block with each successive element;
* returns the index of the first element for which the block returns a truthy value:
*
@@ -2036,14 +2202,9 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
*
* Returns +nil+ if the block never returns a truthy value.
*
- * When neither an argument nor a block is given, returns a new Enumerator:
- *
- * a = [:foo, 'bar', 2]
- * e = a.index
- * e # => #<Enumerator: [:foo, "bar", 2]:index>
- * e.each {|element| element == 'bar' } # => 1
+ * With neither an argument nor a block given, returns a new Enumerator.
*
- * Related: #rindex.
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -2076,20 +2237,20 @@ rb_ary_index(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.rindex(object) -> integer or nil
- * array.rindex {|element| ... } -> integer or nil
- * array.rindex -> new_enumerator
+ * rindex(object) -> integer or nil
+ * rindex {|element| ... } -> integer or nil
+ * rindex -> new_enumerator
*
* Returns the index of the last element for which <tt>object == element</tt>.
*
- * When argument +object+ is given but no block, returns the index of the last such element found:
+ * With argument +object+ given, returns the index of the last such element found:
*
* a = [:foo, 'bar', 2, 'bar']
* a.rindex('bar') # => 3
*
* Returns +nil+ if no such object found.
*
- * When a block is given but no argument, calls the block with each successive element;
+ * With a block given, calls the block with each successive element;
* returns the index of the last element for which the block returns a truthy value:
*
* a = [:foo, 'bar', 2, 'bar']
@@ -2097,14 +2258,9 @@ rb_ary_index(int argc, VALUE *argv, VALUE ary)
*
* Returns +nil+ if the block never returns a truthy value.
*
- * When neither an argument nor a block is given, returns a new Enumerator:
- *
- * a = [:foo, 'bar', 2, 'bar']
- * e = a.rindex
- * e # => #<Enumerator: [:foo, "bar", 2, "bar"]:rindex>
- * e.each {|element| element == 'bar' } # => 3
+ * When neither an argument nor a block is given, returns a new Enumerator.
*
- * Related: #index.
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -2251,7 +2407,7 @@ rb_ary_resize(VALUE ary, long len)
rb_raise(rb_eIndexError, "index %ld too big", len);
}
if (len > olen) {
- if (len >= ARY_CAPA(ary)) {
+ if (len > ARY_CAPA(ary)) {
ary_double_capa(ary, len);
}
ary_mem_clear(ary, olen, len - olen);
@@ -2301,15 +2457,16 @@ ary_aset_by_rb_ary_splice(VALUE ary, long beg, long len, VALUE val)
/*
* call-seq:
- * array[index] = object -> object
- * array[start, length] = object -> object
- * array[range] = object -> object
+ * self[index] = object -> object
+ * self[start, length] = object -> object
+ * self[range] = object -> object
*
- * Assigns elements in +self+; returns the given +object+.
+ * Assigns elements in +self+, based on the given +object+; returns +object+.
*
* In brief:
*
* a_orig = [:foo, 'bar', 2]
+ *
* # With argument index.
* a = a_orig.dup
* a[0] = 'foo' # => "foo"
@@ -2317,6 +2474,7 @@ ary_aset_by_rb_ary_splice(VALUE ary, long beg, long len, VALUE val)
* a = a_orig.dup
* a[7] = 'foo' # => "foo"
* a # => [:foo, "bar", 2, nil, nil, nil, nil, "foo"]
+ *
* # With arguments start and length.
* a = a_orig.dup
* a[0, 2] = 'foo' # => "foo"
@@ -2324,6 +2482,7 @@ ary_aset_by_rb_ary_splice(VALUE ary, long beg, long len, VALUE val)
* a = a_orig.dup
* a[6, 50] = 'foo' # => "foo"
* a # => [:foo, "bar", 2, nil, nil, nil, "foo"]
+ *
* # With argument range.
* a = a_orig.dup
* a[0..1] = 'foo' # => "foo"
@@ -2352,7 +2511,7 @@ ary_aset_by_rb_ary_splice(VALUE ary, long beg, long len, VALUE val)
* a[-1] = 'two' # => "two"
* a # => [:foo, "bar", "two"]
*
- * When Integer arguments +start+ and +length+ are given and +object+ is not an +Array+,
+ * When Integer arguments +start+ and +length+ are given and +object+ is not an array,
* removes <tt>length - 1</tt> elements beginning at offset +start+,
* and assigns +object+ at offset +start+:
*
@@ -2387,7 +2546,7 @@ ary_aset_by_rb_ary_splice(VALUE ary, long beg, long len, VALUE val)
* a[1, 5] = 'foo' # => "foo"
* a # => [:foo, "foo"]
*
- * When Range argument +range+ is given and +object+ is not an +Array+,
+ * When Range argument +range+ is given and +object+ is not an array,
* removes <tt>length - 1</tt> elements beginning at offset +start+,
* and assigns +object+ at offset +start+:
*
@@ -2437,6 +2596,7 @@ ary_aset_by_rb_ary_splice(VALUE ary, long beg, long len, VALUE val)
* a[1..5] = 'foo' # => "foo"
* a # => [:foo, "foo"]
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -2466,38 +2626,38 @@ rb_ary_aset(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.insert(index, *objects) -> self
+ * insert(index, *objects) -> self
*
- * Inserts given +objects+ before or after the element at Integer index +offset+;
+ * Inserts the given +objects+ as elements of +self+;
* returns +self+.
*
- * When +index+ is non-negative, inserts all given +objects+
- * before the element at offset +index+:
+ * When +index+ is non-negative, inserts +objects+
+ * _before_ the element at offset +index+:
*
- * a = [:foo, 'bar', 2]
- * a.insert(1, :bat, :bam) # => [:foo, :bat, :bam, "bar", 2]
+ * a = ['a', 'b', 'c'] # => ["a", "b", "c"]
+ * a.insert(1, :x, :y, :z) # => ["a", :x, :y, :z, "b", "c"]
*
* Extends the array if +index+ is beyond the array (<tt>index >= self.size</tt>):
*
- * a = [:foo, 'bar', 2]
- * a.insert(5, :bat, :bam)
- * a # => [:foo, "bar", 2, nil, nil, :bat, :bam]
+ * a = ['a', 'b', 'c'] # => ["a", "b", "c"]
+ * a.insert(5, :x, :y, :z) # => ["a", "b", "c", nil, nil, :x, :y, :z]
*
- * Does nothing if no objects given:
+ * When +index+ is negative, inserts +objects+
+ * _after_ the element at offset <tt>index + self.size</tt>:
*
- * a = [:foo, 'bar', 2]
- * a.insert(1)
- * a.insert(50)
- * a.insert(-50)
- * a # => [:foo, "bar", 2]
+ * a = ['a', 'b', 'c'] # => ["a", "b", "c"]
+ * a.insert(-2, :x, :y, :z) # => ["a", "b", :x, :y, :z, "c"]
*
- * When +index+ is negative, inserts all given +objects+
- * _after_ the element at offset <tt>index+self.size</tt>:
+ * With no +objects+ given, does nothing:
*
- * a = [:foo, 'bar', 2]
- * a.insert(-2, :bat, :bam)
- * a # => [:foo, "bar", :bat, :bam, 2]
+ * a = ['a', 'b', 'c'] # => ["a", "b", "c"]
+ * a.insert(1) # => ["a", "b", "c"]
+ * a.insert(50) # => ["a", "b", "c"]
+ * a.insert(-50) # => ["a", "b", "c"]
+ *
+ * Raises IndexError if +objects+ are given and +index+ is negative and out of range.
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -2547,6 +2707,39 @@ ary_fetch_next(VALUE self, VALUE *index, VALUE *value)
return Qtrue;
}
+/*
+ * call-seq:
+ * each {|element| ... } -> self
+ * each -> new_enumerator
+ *
+ * With a block given, iterates over the elements of +self+,
+ * passing each element to the block;
+ * returns +self+:
+ *
+ * a = [:foo, 'bar', 2]
+ * a.each {|element| puts "#{element.class} #{element}" }
+ *
+ * Output:
+ *
+ * Symbol foo
+ * String bar
+ * Integer 2
+ *
+ * Allows the array to be modified during iteration:
+ *
+ * a = [:foo, 'bar', 2]
+ * a.each {|element| puts element; a.clear if element.to_s.start_with?('b') }
+ *
+ * Output:
+ *
+ * foo
+ * bar
+ *
+ * With no block given, returns a new Enumerator.
+ *
+ * Related: see {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].
+ */
+
VALUE
rb_ary_each(VALUE ary)
{
@@ -2561,12 +2754,11 @@ rb_ary_each(VALUE ary)
/*
* call-seq:
- * array.each_index {|index| ... } -> self
- * array.each_index -> Enumerator
- *
- * Iterates over array indexes.
+ * each_index {|index| ... } -> self
+ * each_index -> new_enumerator
*
- * When a block given, passes each successive array index to the block;
+ * With a block given, iterates over the elements of +self+,
+ * passing each <i>array index</i> to the block;
* returns +self+:
*
* a = [:foo, 'bar', 2]
@@ -2582,26 +2774,16 @@ rb_ary_each(VALUE ary)
*
* a = [:foo, 'bar', 2]
* a.each_index {|index| puts index; a.clear if index > 0 }
+ * a # => []
*
* Output:
*
* 0
* 1
*
- * When no block given, returns a new Enumerator:
+ * With no block given, returns a new Enumerator.
*
- * a = [:foo, 'bar', 2]
- * e = a.each_index
- * e # => #<Enumerator: [:foo, "bar", 2]:each_index>
- * a1 = e.each {|index| puts "#{index} #{a[index]}"}
- *
- * Output:
- *
- * 0 foo
- * 1 bar
- * 2 2
- *
- * Related: #each, #reverse_each.
+ * Related: see {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].
*/
static VALUE
@@ -2618,47 +2800,26 @@ rb_ary_each_index(VALUE ary)
/*
* call-seq:
- * array.reverse_each {|element| ... } -> self
- * array.reverse_each -> Enumerator
+ * reverse_each {|element| ... } -> self
+ * reverse_each -> Enumerator
*
- * Iterates backwards over array elements.
- *
- * When a block given, passes, in reverse order, each element to the block;
+ * When a block given, iterates backwards over the elements of +self+,
+ * passing, in reverse order, each element to the block;
* returns +self+:
*
- * a = [:foo, 'bar', 2]
- * a.reverse_each {|element| puts "#{element.class} #{element}" }
- *
- * Output:
- *
- * Integer 2
- * String bar
- * Symbol foo
+ * a = []
+ * [0, 1, 2].reverse_each {|element| a.push(element) }
+ * a # => [2, 1, 0]
*
* Allows the array to be modified during iteration:
*
- * a = [:foo, 'bar', 2]
- * a.reverse_each {|element| puts element; a.clear if element.to_s.start_with?('b') }
- *
- * Output:
- *
- * 2
- * bar
- *
- * When no block given, returns a new Enumerator:
+ * a = ['a', 'b', 'c']
+ * a.reverse_each {|element| a.clear if element.start_with?('b') }
+ * a # => []
*
- * a = [:foo, 'bar', 2]
- * e = a.reverse_each
- * e # => #<Enumerator: [:foo, "bar", 2]:reverse_each>
- * a1 = e.each {|element| puts "#{element.class} #{element}" }
- *
- * Output:
- *
- * Integer 2
- * String bar
- * Symbol foo
+ * When no block given, returns a new Enumerator.
*
- * Related: #each, #each_index.
+ * Related: see {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].
*/
static VALUE
@@ -2681,9 +2842,15 @@ rb_ary_reverse_each(VALUE ary)
/*
* call-seq:
- * array.length -> an_integer
+ * length -> integer
+ * size -> integer
*
- * Returns the count of elements in +self+.
+ * Returns the count of elements in +self+:
+ *
+ * [0, 1, 2].length # => 3
+ * [].length # => 0
+ *
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -2695,10 +2862,12 @@ rb_ary_length(VALUE ary)
/*
* call-seq:
- * array.empty? -> true or false
+ * empty? -> true or false
*
* Returns +true+ if the count of elements in +self+ is zero,
* +false+ otherwise.
+ *
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -2833,23 +3002,28 @@ rb_ary_join(VALUE ary, VALUE sep)
StringValue(sep);
len += RSTRING_LEN(sep) * (RARRAY_LEN(ary) - 1);
}
- for (i=0; i<RARRAY_LEN(ary); i++) {
+ long len_memo = RARRAY_LEN(ary);
+ for (i=0; i < len_memo; i++) {
val = RARRAY_AREF(ary, i);
- tmp = rb_check_string_type(val);
-
- if (NIL_P(tmp) || tmp != val) {
- int first;
- long n = RARRAY_LEN(ary);
- if (i > n) i = n;
- result = rb_str_buf_new(len + (n-i)*10);
- rb_enc_associate(result, rb_usascii_encoding());
- i = ary_join_0(ary, sep, i, result);
- first = i == 0;
- ary_join_1(ary, ary, sep, i, result, &first);
- return result;
+ if (RB_UNLIKELY(!RB_TYPE_P(val, T_STRING))) {
+ tmp = rb_check_string_type(val);
+ if (NIL_P(tmp) || tmp != val) {
+ int first;
+ long n = RARRAY_LEN(ary);
+ if (i > n) i = n;
+ result = rb_str_buf_new(len + (n-i)*10);
+ rb_enc_associate(result, rb_usascii_encoding());
+ i = ary_join_0(ary, sep, i, result);
+ first = i == 0;
+ ary_join_1(ary, ary, sep, i, result, &first);
+ return result;
+ }
+ len += RSTRING_LEN(tmp);
+ len_memo = RARRAY_LEN(ary);
+ }
+ else {
+ len += RSTRING_LEN(val);
}
-
- len += RSTRING_LEN(tmp);
}
result = rb_str_new(0, len);
@@ -2862,31 +3036,32 @@ rb_ary_join(VALUE ary, VALUE sep)
/*
* call-seq:
- * array.join ->new_string
- * array.join(separator = $,) -> new_string
+ * join(separator = $,) -> new_string
*
- * Returns the new String formed by joining the array elements after conversion.
- * For each element +element+:
+ * Returns the new string formed by joining the converted elements of +self+;
+ * for each element +element+:
*
- * - Uses <tt>element.to_s</tt> if +element+ is not a <tt>kind_of?(Array)</tt>.
- * - Uses recursive <tt>element.join(separator)</tt> if +element+ is a <tt>kind_of?(Array)</tt>.
+ * - Converts recursively using <tt>element.join(separator)</tt>
+ * if +element+ is a <tt>kind_of?(Array)</tt>.
+ * - Otherwise, converts using <tt>element.to_s</tt>.
*
- * With no argument, joins using the output field separator, <tt>$,</tt>:
+ * With no argument given, joins using the output field separator, <tt>$,</tt>:
*
* a = [:foo, 'bar', 2]
* $, # => nil
* a.join # => "foobar2"
*
- * With \string argument +separator+, joins using that separator:
+ * With string argument +separator+ given, joins using that separator:
*
* a = [:foo, 'bar', 2]
* a.join("\n") # => "foo\nbar\n2"
*
- * Joins recursively for nested Arrays:
+ * Joins recursively for nested arrays:
*
* a = [:foo, [:bar, [:baz, :bat]]]
* a.join # => "foobarbazbat"
*
+ * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
rb_ary_join_m(int argc, VALUE *argv, VALUE ary)
@@ -2923,14 +3098,16 @@ inspect_ary(VALUE ary, VALUE dummy, int recur)
/*
* call-seq:
- * array.inspect -> new_string
+ * inspect -> new_string
+ * to_s -> new_string
*
- * Returns the new String formed by calling method <tt>#inspect</tt>
+ * Returns the new string formed by calling method <tt>#inspect</tt>
* on each array element:
*
* a = [:foo, 'bar', 2]
* a.inspect # => "[:foo, \"bar\", 2]"
*
+ * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -2950,21 +3127,17 @@ rb_ary_to_s(VALUE ary)
* call-seq:
* to_a -> self or new_array
*
- * When +self+ is an instance of +Array+, returns +self+:
+ * When +self+ is an instance of \Array, returns +self+.
*
- * a = [:foo, 'bar', 2]
- * a.to_a # => [:foo, "bar", 2]
- *
- * Otherwise, returns a new +Array+ containing the elements of +self+:
+ * Otherwise, returns a new array containing the elements of +self+:
*
* class MyArray < Array; end
- * a = MyArray.new(['foo', 'bar', 'two'])
- * a.instance_of?(Array) # => false
- * a.kind_of?(Array) # => true
- * a1 = a.to_a
- * a1 # => ["foo", "bar", "two"]
- * a1.class # => Array # Not MyArray
+ * my_a = MyArray.new(['foo', 'bar', 'two'])
+ * a = my_a.to_a
+ * a # => ["foo", "bar", "two"]
+ * a.class # => Array # Not MyArray.
*
+ * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -2980,27 +3153,27 @@ rb_ary_to_a(VALUE ary)
/*
* call-seq:
- * array.to_h -> new_hash
- * array.to_h {|item| ... } -> new_hash
+ * to_h -> new_hash
+ * to_h {|element| ... } -> new_hash
*
- * Returns a new Hash formed from +self+.
+ * Returns a new hash formed from +self+.
*
- * When a block is given, calls the block with each array element;
- * the block must return a 2-element +Array+ whose two elements
- * form a key-value pair in the returned Hash:
+ * With no block given, each element of +self+ must be a 2-element sub-array;
+ * forms each sub-array into a key-value pair in the new hash:
*
- * a = ['foo', :bar, 1, [2, 3], {baz: 4}]
- * h = a.to_h {|item| [item, item] }
- * h # => {"foo"=>"foo", :bar=>:bar, 1=>1, [2, 3]=>[2, 3], {:baz=>4}=>{:baz=>4}}
+ * a = [['foo', 'zero'], ['bar', 'one'], ['baz', 'two']]
+ * a.to_h # => {"foo"=>"zero", "bar"=>"one", "baz"=>"two"}
+ * [].to_h # => {}
*
- * When no block is given, +self+ must be an +Array+ of 2-element sub-arrays,
- * each sub-array is formed into a key-value pair in the new Hash:
+ * With a block given, the block must return a 2-element array;
+ * calls the block with each element of +self+;
+ * forms each returned array into a key-value pair in the returned hash:
*
- * [].to_h # => {}
- * a = [['foo', 'zero'], ['bar', 'one'], ['baz', 'two']]
- * h = a.to_h
- * h # => {"foo"=>"zero", "bar"=>"one", "baz"=>"two"}
+ * a = ['foo', :bar, 1, [2, 3], {baz: 4}]
+ * a.to_h {|element| [element, element.class] }
+ * # => {"foo"=>String, :bar=>Symbol, 1=>Integer, [2, 3]=>Array, {:baz=>4}=>Hash}
*
+ * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -3029,7 +3202,7 @@ rb_ary_to_h(VALUE ary)
/*
* call-seq:
- * array.to_ary -> self
+ * to_ary -> self
*
* Returns +self+.
*/
@@ -3068,13 +3241,16 @@ rb_ary_reverse(VALUE ary)
/*
* call-seq:
- * array.reverse! -> self
+ * reverse! -> self
*
- * Reverses +self+ in place:
+ * Reverses the order of the elements of +self+;
+ * returns +self+:
*
- * a = ['foo', 'bar', 'two']
- * a.reverse! # => ["two", "bar", "foo"]
+ * a = [0, 1, 2]
+ * a.reverse! # => [2, 1, 0]
+ * a # => [2, 1, 0]
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -3085,14 +3261,13 @@ rb_ary_reverse_bang(VALUE ary)
/*
* call-seq:
- * array.reverse -> new_array
+ * reverse -> new_array
*
- * Returns a new +Array+ with the elements of +self+ in reverse order:
+ * Returns a new array containing the elements of +self+ in reverse order:
*
- * a = ['foo', 'bar', 'two']
- * a1 = a.reverse
- * a1 # => ["two", "bar", "foo"]
+ * [0, 1, 2].reverse # => [2, 1, 0]
*
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -3154,48 +3329,34 @@ rb_ary_rotate(VALUE ary, long cnt)
/*
* call-seq:
- * array.rotate! -> self
- * array.rotate!(count) -> self
+ * rotate!(count = 1) -> self
*
* Rotates +self+ in place by moving elements from one end to the other; returns +self+.
*
- * When no argument given, rotates the first element to the last position:
- *
- * a = [:foo, 'bar', 2, 'bar']
- * a.rotate! # => ["bar", 2, "bar", :foo]
- *
- * When given a non-negative Integer +count+,
+ * With non-negative numeric +count+,
* rotates +count+ elements from the beginning to the end:
*
- * a = [:foo, 'bar', 2]
- * a.rotate!(2)
- * a # => [2, :foo, "bar"]
+ * [0, 1, 2, 3].rotate!(2) # => [2, 3, 0, 1]
+ [0, 1, 2, 3].rotate!(2.1) # => [2, 3, 0, 1]
*
* If +count+ is large, uses <tt>count % array.size</tt> as the count:
*
- * a = [:foo, 'bar', 2]
- * a.rotate!(20)
- * a # => [2, :foo, "bar"]
+ * [0, 1, 2, 3].rotate!(21) # => [1, 2, 3, 0]
*
- * If +count+ is zero, returns +self+ unmodified:
+ * If +count+ is zero, rotates no elements:
*
- * a = [:foo, 'bar', 2]
- * a.rotate!(0)
- * a # => [:foo, "bar", 2]
+ * [0, 1, 2, 3].rotate!(0) # => [0, 1, 2, 3]
*
- * When given a negative Integer +count+, rotates in the opposite direction,
+ * With a negative numeric +count+, rotates in the opposite direction,
* from end to beginning:
*
- * a = [:foo, 'bar', 2]
- * a.rotate!(-2)
- * a # => ["bar", 2, :foo]
+ * [0, 1, 2, 3].rotate!(-1) # => [3, 0, 1, 2]
*
* If +count+ is small (far from zero), uses <tt>count % array.size</tt> as the count:
*
- * a = [:foo, 'bar', 2]
- * a.rotate!(-5)
- * a # => ["bar", 2, :foo]
+ * [0, 1, 2, 3].rotate!(-21) # => [3, 0, 1, 2]
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -3208,51 +3369,35 @@ rb_ary_rotate_bang(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.rotate -> new_array
- * array.rotate(count) -> new_array
+ * rotate(count = 1) -> new_array
*
- * Returns a new +Array+ formed from +self+ with elements
+ * Returns a new array formed from +self+ with elements
* rotated from one end to the other.
*
- * When no argument given, returns a new +Array+ that is like +self+,
- * except that the first element has been rotated to the last position:
+ * With non-negative numeric +count+,
+ * rotates elements from the beginning to the end:
*
- * a = [:foo, 'bar', 2, 'bar']
- * a1 = a.rotate
- * a1 # => ["bar", 2, "bar", :foo]
- *
- * When given a non-negative Integer +count+,
- * returns a new +Array+ with +count+ elements rotated from the beginning to the end:
- *
- * a = [:foo, 'bar', 2]
- * a1 = a.rotate(2)
- * a1 # => [2, :foo, "bar"]
+ * [0, 1, 2, 3].rotate(2) # => [2, 3, 0, 1]
+ * [0, 1, 2, 3].rotate(2.1) # => [2, 3, 0, 1]
*
* If +count+ is large, uses <tt>count % array.size</tt> as the count:
*
- * a = [:foo, 'bar', 2]
- * a1 = a.rotate(20)
- * a1 # => [2, :foo, "bar"]
+ * [0, 1, 2, 3].rotate(22) # => [2, 3, 0, 1]
*
- * If +count+ is zero, returns a copy of +self+, unmodified:
+ * With a +count+ of zero, rotates no elements:
*
- * a = [:foo, 'bar', 2]
- * a1 = a.rotate(0)
- * a1 # => [:foo, "bar", 2]
+ * [0, 1, 2, 3].rotate(0) # => [0, 1, 2, 3]
*
- * When given a negative Integer +count+, rotates in the opposite direction,
- * from end to beginning:
+ * With negative numeric +count+, rotates in the opposite direction,
+ * from the end to the beginning:
*
- * a = [:foo, 'bar', 2]
- * a1 = a.rotate(-2)
- * a1 # => ["bar", 2, :foo]
+ * [0, 1, 2, 3].rotate(-1) # => [3, 0, 1, 2]
*
* If +count+ is small (far from zero), uses <tt>count % array.size</tt> as the count:
*
- * a = [:foo, 'bar', 2]
- * a1 = a.rotate(-5)
- * a1 # => ["bar", 2, :foo]
+ * [0, 1, 2, 3].rotate(-21) # => [3, 0, 1, 2]
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -3345,43 +3490,12 @@ sort_2(const void *ap, const void *bp, void *dummy)
/*
* call-seq:
- * array.sort! -> self
- * array.sort! {|a, b| ... } -> self
+ * sort! -> self
+ * sort! {|a, b| ... } -> self
*
- * Returns +self+ with its elements sorted in place.
- *
- * With no block, compares elements using operator <tt><=></tt>
- * (see Comparable):
- *
- * a = 'abcde'.split('').shuffle
- * a # => ["e", "b", "d", "a", "c"]
- * a.sort!
- * a # => ["a", "b", "c", "d", "e"]
- *
- * With a block, calls the block with each element pair;
- * for each element pair +a+ and +b+, the block should return an integer:
- *
- * - Negative when +b+ is to follow +a+.
- * - Zero when +a+ and +b+ are equivalent.
- * - Positive when +a+ is to follow +b+.
- *
- * Example:
- *
- * a = 'abcde'.split('').shuffle
- * a # => ["e", "b", "d", "a", "c"]
- * a.sort! {|a, b| a <=> b }
- * a # => ["a", "b", "c", "d", "e"]
- * a.sort! {|a, b| b <=> a }
- * a # => ["e", "d", "c", "b", "a"]
- *
- * When the block returns zero, the order for +a+ and +b+ is indeterminate,
- * and may be unstable:
- *
- * a = 'abcde'.split('').shuffle
- * a # => ["e", "b", "d", "a", "c"]
- * a.sort! {|a, b| 0 }
- * a # => ["d", "e", "c", "a", "b"]
+ * Like Array#sort, but returns +self+ with its elements sorted in place.
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
VALUE
@@ -3434,10 +3548,9 @@ rb_ary_sort_bang(VALUE ary)
ARY_SET_CAPA(ary, ARY_HEAP_LEN(tmp));
}
/* tmp was lost ownership for the ptr */
- FL_UNSET(tmp, FL_FREEZE);
FL_SET_EMBED(tmp);
ARY_SET_EMBED_LEN(tmp, 0);
- FL_SET(tmp, FL_FREEZE);
+ OBJ_FREEZE(tmp);
}
/* tmp will be GC'ed. */
RBASIC_SET_CLASS_RAW(tmp, rb_cArray); /* rb_cArray must be marked */
@@ -3448,21 +3561,18 @@ rb_ary_sort_bang(VALUE ary)
/*
* call-seq:
- * array.sort -> new_array
- * array.sort {|a, b| ... } -> new_array
+ * sort -> new_array
+ * sort {|a, b| ... } -> new_array
*
- * Returns a new +Array+ whose elements are those from +self+, sorted.
+ * Returns a new array containing the elements of +self+, sorted.
*
- * With no block, compares elements using operator <tt><=></tt>
- * (see Comparable):
+ * With no block given, compares elements using operator <tt>#<=></tt>
+ * (see Object#<=>):
*
- * a = 'abcde'.split('').shuffle
- * a # => ["e", "b", "d", "a", "c"]
- * a1 = a.sort
- * a1 # => ["a", "b", "c", "d", "e"]
+ * [0, 2, 3, 1].sort # => [0, 1, 2, 3]
*
- * With a block, calls the block with each element pair;
- * for each element pair +a+ and +b+, the block should return an integer:
+ * With a block given, calls the block with each combination of pairs of elements from +self+;
+ * for each pair +a+ and +b+, the block should return a numeric:
*
* - Negative when +b+ is to follow +a+.
* - Zero when +a+ and +b+ are equivalent.
@@ -3470,22 +3580,17 @@ rb_ary_sort_bang(VALUE ary)
*
* Example:
*
- * a = 'abcde'.split('').shuffle
- * a # => ["e", "b", "d", "a", "c"]
- * a1 = a.sort {|a, b| a <=> b }
- * a1 # => ["a", "b", "c", "d", "e"]
- * a2 = a.sort {|a, b| b <=> a }
- * a2 # => ["e", "d", "c", "b", "a"]
+ * a = [3, 2, 0, 1]
+ * a.sort {|a, b| a <=> b } # => [0, 1, 2, 3]
+ * a.sort {|a, b| b <=> a } # => [3, 2, 1, 0]
*
* When the block returns zero, the order for +a+ and +b+ is indeterminate,
- * and may be unstable:
+ * and may be unstable.
*
- * a = 'abcde'.split('').shuffle
- * a # => ["e", "b", "d", "a", "c"]
- * a1 = a.sort {|a, b| 0 }
- * a1 # => ["c", "e", "b", "d", "a"]
+ * See an example in Numeric#nonzero? for the idiom to sort more
+ * complex structure.
*
- * Related: Enumerable#sort_by.
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
VALUE
@@ -3500,12 +3605,15 @@ static VALUE rb_ary_bsearch_index(VALUE ary);
/*
* call-seq:
- * array.bsearch {|element| ... } -> object
- * array.bsearch -> new_enumerator
+ * bsearch {|element| ... } -> found_element or nil
+ * bsearch -> new_enumerator
*
- * Returns an element from +self+ selected by a binary search.
+ * Returns the element from +self+ found by a binary search,
+ * or +nil+ if the search found no suitable element.
*
- * See {Binary Searching}[rdoc-ref:bsearch.rdoc].
+ * See {Binary Searching}[rdoc-ref:language/bsearch.rdoc].
+ *
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -3521,11 +3629,15 @@ rb_ary_bsearch(VALUE ary)
/*
* call-seq:
- * array.bsearch_index {|element| ... } -> integer or nil
- * array.bsearch_index -> new_enumerator
+ * bsearch_index {|element| ... } -> integer or nil
+ * bsearch_index -> new_enumerator
+ *
+ * Returns the integer index of the element from +self+ found by a binary search,
+ * or +nil+ if the search found no suitable element.
*
- * Searches +self+ as described at method #bsearch,
- * but returns the _index_ of the found element instead of the element itself.
+ * See {Binary Searching}[rdoc-ref:language/bsearch.rdoc].
+ *
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -3584,28 +3696,24 @@ sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, dummy))
/*
* call-seq:
- * array.sort_by! {|element| ... } -> self
- * array.sort_by! -> new_enumerator
+ * sort_by! {|element| ... } -> self
+ * sort_by! -> new_enumerator
*
- * Sorts the elements of +self+ in place,
- * using an ordering determined by the block; returns self.
+ * With a block given, sorts the elements of +self+ in place;
+ * returns self.
*
* Calls the block with each successive element;
- * sorts elements based on the values returned from the block.
- *
- * For duplicates returned by the block, the ordering is indeterminate, and may be unstable.
- *
- * This example sorts strings based on their sizes:
+ * sorts elements based on the values returned from the block:
*
* a = ['aaaa', 'bbb', 'cc', 'd']
* a.sort_by! {|element| element.size }
* a # => ["d", "cc", "bbb", "aaaa"]
*
- * Returns a new Enumerator if no block given:
+ * For duplicate values returned by the block, the ordering is indeterminate, and may be unstable.
*
- * a = ['aaaa', 'bbb', 'cc', 'd']
- * a.sort_by! # => #<Enumerator: ["aaaa", "bbb", "cc", "d"]:sort_by!>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -3615,29 +3723,32 @@ rb_ary_sort_by_bang(VALUE ary)
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rb_ary_modify(ary);
- sorted = rb_block_call(ary, rb_intern("sort_by"), 0, 0, sort_by_i, 0);
- rb_ary_replace(ary, sorted);
+ if (RARRAY_LEN(ary) > 1) {
+ sorted = rb_block_call(ary, rb_intern("sort_by"), 0, 0, sort_by_i, 0);
+ rb_ary_replace(ary, sorted);
+ }
return ary;
}
/*
* call-seq:
- * array.map {|element| ... } -> new_array
- * array.map -> new_enumerator
+ * collect {|element| ... } -> new_array
+ * collect -> new_enumerator
+ * map {|element| ... } -> new_array
+ * map -> new_enumerator
*
- * Calls the block, if given, with each element of +self+;
- * returns a new +Array+ whose elements are the return values from the block:
+ * With a block given, calls the block with each element of +self+;
+ * returns a new array whose elements are the return values from the block:
*
* a = [:foo, 'bar', 2]
* a1 = a.map {|element| element.class }
* a1 # => [Symbol, String, Integer]
*
- * Returns a new Enumerator if no block given:
- * a = [:foo, 'bar', 2]
- * a1 = a.map
- * a1 # => #<Enumerator: [:foo, "bar", 2]:map>
+ * With no block given, returns a new Enumerator.
*
+ * Related: #collect!;
+ * see also {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -3657,21 +3768,22 @@ rb_ary_collect(VALUE ary)
/*
* call-seq:
- * array.map! {|element| ... } -> self
- * array.map! -> new_enumerator
+ * collect! {|element| ... } -> self
+ * collect! -> new_enumerator
+ * map! {|element| ... } -> self
+ * map! -> new_enumerator
*
- * Calls the block, if given, with each element;
- * replaces the element with the block's return value:
+ * With a block given, calls the block with each element of +self+
+ * and replaces the element with the block's return value;
+ * returns +self+:
*
* a = [:foo, 'bar', 2]
* a.map! { |element| element.class } # => [Symbol, String, Integer]
*
- * Returns a new Enumerator if no block given:
- *
- * a = [:foo, 'bar', 2]
- * a1 = a.map!
- * a1 # => #<Enumerator: [:foo, "bar", 2]:map!>
+ * With no block given, returns a new Enumerator.
*
+ * Related: #collect;
+ * see also {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -3743,45 +3855,108 @@ append_values_at_single(VALUE result, VALUE ary, long olen, VALUE idx)
/*
* call-seq:
- * array.values_at(*indexes) -> new_array
+ * values_at(*specifiers) -> new_array
*
- * Returns a new +Array+ whose elements are the elements
- * of +self+ at the given Integer or Range +indexes+.
+ * Returns elements from +self+ in a new array; does not modify +self+.
*
- * For each positive +index+, returns the element at offset +index+:
+ * The objects included in the returned array are the elements of +self+
+ * selected by the given +specifiers+,
+ * each of which must be a numeric index or a Range.
*
- * a = [:foo, 'bar', 2]
- * a.values_at(0, 2) # => [:foo, 2]
- * a.values_at(0..1) # => [:foo, "bar"]
+ * In brief:
+ *
+ * a = ['a', 'b', 'c', 'd']
*
- * The given +indexes+ may be in any order, and may repeat:
+ * # Index specifiers.
+ * a.values_at(2, 0, 2, 0) # => ["c", "a", "c", "a"] # May repeat.
+ * a.values_at(-4, -3, -2, -1) # => ["a", "b", "c", "d"] # Counts backwards if negative.
+ * a.values_at(-50, 50) # => [nil, nil] # Outside of self.
*
- * a = [:foo, 'bar', 2]
- * a.values_at(2, 0, 1, 0, 2) # => [2, :foo, "bar", :foo, 2]
- * a.values_at(1, 0..2) # => ["bar", :foo, "bar", 2]
+ * # Range specifiers.
+ * a.values_at(1..3) # => ["b", "c", "d"] # From range.begin to range.end.
+ * a.values_at(1...3) # => ["b", "c"] # End excluded.
+ * a.values_at(3..1) # => [] # No such elements.
*
- * Assigns +nil+ for an +index+ that is too large:
+ * a.values_at(-3..3) # => ["b", "c", "d"] # Negative range.begin counts backwards.
+ * a.values_at(-50..3) # Raises RangeError.
*
- * a = [:foo, 'bar', 2]
- * a.values_at(0, 3, 1, 3) # => [:foo, nil, "bar", nil]
+ * a.values_at(1..-2) # => ["b", "c"] # Negative range.end counts backwards.
+ * a.values_at(1..-50) # => [] # No such elements.
*
- * Returns a new empty +Array+ if no arguments given.
+ * # Mixture of specifiers.
+ * a.values_at(2..3, 3, 0..1, 0) # => ["c", "d", "d", "a", "b", "a"]
*
- * For each negative +index+, counts backward from the end of the array:
+ * With no +specifiers+ given, returns a new empty array:
*
- * a = [:foo, 'bar', 2]
- * a.values_at(-1, -3) # => [2, :foo]
+ * a = ['a', 'b', 'c', 'd']
+ * a.values_at # => []
*
- * Assigns +nil+ for an +index+ that is too small:
+ * For each numeric specifier +index+, includes an element:
*
- * a = [:foo, 'bar', 2]
- * a.values_at(0, -5, 1, -6, 2) # => [:foo, nil, "bar", nil, 2]
+ * - For each non-negative numeric specifier +index+ that is in-range (less than <tt>self.size</tt>),
+ * includes the element at offset +index+:
*
- * The given +indexes+ may have a mixture of signs:
+ * a.values_at(0, 2) # => ["a", "c"]
+ * a.values_at(0.1, 2.9) # => ["a", "c"]
*
- * a = [:foo, 'bar', 2]
- * a.values_at(0, -2, 1, -1) # => [:foo, "bar", "bar", 2]
+ * - For each negative numeric +index+ that is in-range (greater than or equal to <tt>- self.size</tt>),
+ * counts backwards from the end of +self+:
+ *
+ * a.values_at(-1, -4) # => ["d", "a"]
+ *
+ * The given indexes may be in any order, and may repeat:
*
+ * a.values_at(2, 0, 1, 0, 2) # => ["c", "a", "b", "a", "c"]
+ *
+ * For each +index+ that is out-of-range, includes +nil+:
+ *
+ * a.values_at(4, -5) # => [nil, nil]
+ *
+ * For each Range specifier +range+, includes elements
+ * according to <tt>range.begin</tt> and <tt>range.end</tt>:
+ *
+ * - If both <tt>range.begin</tt> and <tt>range.end</tt>
+ * are non-negative and in-range (less than <tt>self.size</tt>),
+ * includes elements from index <tt>range.begin</tt>
+ * through <tt>range.end - 1</tt> (if <tt>range.exclude_end?</tt>),
+ * or through <tt>range.end</tt> (otherwise):
+ *
+ * a.values_at(1..2) # => ["b", "c"]
+ * a.values_at(1...2) # => ["b"]
+ *
+ * - If <tt>range.begin</tt> is negative and in-range (greater than or equal to <tt>- self.size</tt>),
+ * counts backwards from the end of +self+:
+ *
+ * a.values_at(-2..3) # => ["c", "d"]
+ *
+ * - If <tt>range.begin</tt> is negative and out-of-range, raises an exception:
+ *
+ * a.values_at(-5..3) # Raises RangeError.
+ *
+ * - If <tt>range.end</tt> is positive and out-of-range,
+ * extends the returned array with +nil+ elements:
+ *
+ * a.values_at(1..5) # => ["b", "c", "d", nil, nil]
+ *
+ * - If <tt>range.end</tt> is negative and in-range,
+ * counts backwards from the end of +self+:
+ *
+ * a.values_at(1..-2) # => ["b", "c"]
+ *
+ * - If <tt>range.end</tt> is negative and out-of-range,
+ * returns an empty array:
+ *
+ * a.values_at(1..-5) # => []
+ *
+ * The given ranges may be in any order and may repeat:
+ *
+ * a.values_at(2..3, 0..1, 2..3) # => ["c", "d", "a", "b", "c", "d"]
+ *
+ * The given specifiers may be any mixture of indexes and ranges:
+ *
+ * a.values_at(3, 1..2, 0, 2..3) # => ["d", "b", "c", "a", "c", "d"]
+ *
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -3799,22 +3974,22 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.select {|element| ... } -> new_array
- * array.select -> new_enumerator
+ * select {|element| ... } -> new_array
+ * select -> new_enumerator
+ * filter {|element| ... } -> new_array
+ * filter -> new_enumerator
*
- * Calls the block, if given, with each element of +self+;
- * returns a new +Array+ containing those elements of +self+
+ * With a block given, calls the block with each element of +self+;
+ * returns a new array containing those elements of +self+
* for which the block returns a truthy value:
*
* a = [:foo, 'bar', 2, :bam]
- * a1 = a.select {|element| element.to_s.start_with?('b') }
- * a1 # => ["bar", :bam]
- *
- * Returns a new Enumerator if no block given:
+ * a.select {|element| element.to_s.start_with?('b') }
+ * # => ["bar", :bam]
*
- * a = [:foo, 'bar', 2, :bam]
- * a.select # => #<Enumerator: [:foo, "bar", 2, :bam]:select>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -3880,10 +4055,12 @@ select_bang_ensure(VALUE a)
/*
* call-seq:
- * array.select! {|element| ... } -> self or nil
- * array.select! -> new_enumerator
+ * select! {|element| ... } -> self or nil
+ * select! -> new_enumerator
+ * filter! {|element| ... } -> self or nil
+ * filter! -> new_enumerator
*
- * Calls the block, if given with each element of +self+;
+ * With a block given, calls the block with each element of +self+;
* removes from +self+ those elements for which the block returns +false+ or +nil+.
*
* Returns +self+ if any elements were removed:
@@ -3893,11 +4070,9 @@ select_bang_ensure(VALUE a)
*
* Returns +nil+ if no elements were removed.
*
- * Returns a new Enumerator if no block given:
- *
- * a = [:foo, 'bar', 2, :bam]
- * a.select! # => #<Enumerator: [:foo, "bar", 2, :bam]:select!>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -3915,20 +4090,18 @@ rb_ary_select_bang(VALUE ary)
/*
* call-seq:
- * array.keep_if {|element| ... } -> self
- * array.keep_if -> new_enumeration
+ * keep_if {|element| ... } -> self
+ * keep_if -> new_enumerator
*
- * Retains those elements for which the block returns a truthy value;
- * deletes all other elements; returns +self+:
+ * With a block given, calls the block with each element of +self+;
+ * removes the element from +self+ if the block does not return a truthy value:
*
* a = [:foo, 'bar', 2, :bam]
* a.keep_if {|element| element.to_s.start_with?('b') } # => ["bar", :bam]
*
- * Returns a new Enumerator if no block given:
- *
- * a = [:foo, 'bar', 2, :bam]
- * a.keep_if # => #<Enumerator: [:foo, "bar", 2, :bam]:keep_if>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -3954,38 +4127,39 @@ ary_resize_smaller(VALUE ary, long len)
/*
* call-seq:
- * array.delete(obj) -> deleted_object
- * array.delete(obj) {|nosuch| ... } -> deleted_object or block_return
+ * delete(object) -> last_removed_object
+ * delete(object) {|element| ... } -> last_removed_object or block_return
*
* Removes zero or more elements from +self+.
*
- * When no block is given,
- * removes from +self+ each element +ele+ such that <tt>ele == obj</tt>;
- * returns the last deleted element:
+ * With no block given,
+ * removes from +self+ each element +ele+ such that <tt>ele == object</tt>;
+ * returns the last removed element:
*
- * s1 = 'bar'; s2 = 'bar'
- * a = [:foo, s1, 2, s2]
- * a.delete('bar') # => "bar"
- * a # => [:foo, 2]
+ * a = [0, 1, 2, 2.0]
+ * a.delete(2) # => 2.0
+ * a # => [0, 1]
*
- * Returns +nil+ if no elements removed.
+ * Returns +nil+ if no elements removed:
*
- * When a block is given,
- * removes from +self+ each element +ele+ such that <tt>ele == obj</tt>.
+ * a.delete(2) # => nil
+ *
+ * With a block given,
+ * removes from +self+ each element +ele+ such that <tt>ele == object</tt>.
*
* If any such elements are found, ignores the block
- * and returns the last deleted element:
+ * and returns the last removed element:
*
- * s1 = 'bar'; s2 = 'bar'
- * a = [:foo, s1, 2, s2]
- * deleted_obj = a.delete('bar') {|obj| fail 'Cannot happen' }
- * a # => [:foo, 2]
+ * a = [0, 1, 2, 2.0]
+ * a.delete(2) {|element| fail 'Cannot happen' } # => 2.0
+ * a # => [0, 1]
*
- * If no such elements are found, returns the block's return value:
+ * If no such element is found, returns the block's return value:
*
- * a = [:foo, 'bar', 2]
- * a.delete(:nosuch) {|obj| "#{obj} not found" } # => "nosuch not found"
+ * a.delete(2) {|element| "Element #{element} not found." }
+ * # => "Element 2 not found."
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
VALUE
@@ -4066,9 +4240,10 @@ rb_ary_delete_at(VALUE ary, long pos)
/*
* call-seq:
- * array.delete_at(index) -> deleted_object or nil
+ * delete_at(index) -> removed_object or nil
*
- * Deletes an element from +self+, per the given Integer +index+.
+ * Removes the element of +self+ at the given +index+, which must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
*
* When +index+ is non-negative, deletes the element at offset +index+:
*
@@ -4076,15 +4251,19 @@ rb_ary_delete_at(VALUE ary, long pos)
* a.delete_at(1) # => "bar"
* a # => [:foo, 2]
*
- * If index is too large, returns +nil+.
- *
* When +index+ is negative, counts backward from the end of the array:
*
* a = [:foo, 'bar', 2]
* a.delete_at(-2) # => "bar"
* a # => [:foo, 2]
*
- * If +index+ is too small (far from zero), returns nil.
+ * When +index+ is out of range, returns +nil+.
+ *
+ * a = [:foo, 'bar', 2]
+ * a.delete_at(3) # => nil
+ * a.delete_at(-4) # => nil
+ *
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -4125,71 +4304,94 @@ ary_slice_bang_by_rb_ary_splice(VALUE ary, long pos, long len)
/*
* call-seq:
- * array.slice!(n) -> object or nil
- * array.slice!(start, length) -> new_array or nil
- * array.slice!(range) -> new_array or nil
+ * slice!(index) -> object or nil
+ * slice!(start, length) -> new_array or nil
+ * slice!(range) -> new_array or nil
*
* Removes and returns elements from +self+.
*
- * When the only argument is an Integer +n+,
- * removes and returns the _nth_ element in +self+:
+ * With numeric argument +index+ given,
+ * removes and returns the element at offset +index+:
*
- * a = [:foo, 'bar', 2]
- * a.slice!(1) # => "bar"
- * a # => [:foo, 2]
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(2) # => "c"
+ * a # => ["a", "b", "d"]
+ * a.slice!(2.1) # => "d"
+ * a # => ["a", "b"]
*
- * If +n+ is negative, counts backwards from the end of +self+:
+ * If +index+ is negative, counts backwards from the end of +self+:
*
- * a = [:foo, 'bar', 2]
- * a.slice!(-1) # => 2
- * a # => [:foo, "bar"]
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(-2) # => "c"
+ * a # => ["a", "b", "d"]
*
- * If +n+ is out of range, returns +nil+.
+ * If +index+ is out of range, returns +nil+.
*
- * When the only arguments are Integers +start+ and +length+,
- * removes +length+ elements from +self+ beginning at offset +start+;
- * returns the deleted objects in a new +Array+:
+ * With numeric arguments +start+ and +length+ given,
+ * removes +length+ elements from +self+ beginning at zero-based offset +start+;
+ * returns the removed objects in a new array:
*
- * a = [:foo, 'bar', 2]
- * a.slice!(0, 2) # => [:foo, "bar"]
- * a # => [2]
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(1, 2) # => ["b", "c"]
+ * a # => ["a", "d"]
+ * a.slice!(0.1, 1.1) # => ["a"]
+ * a # => ["d"]
+ *
+ * If +start+ is negative, counts backwards from the end of +self+:
+ *
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(-2, 1) # => ["c"]
+ * a # => ["a", "b", "d"]
+ *
+ * If +start+ is out-of-range, returns +nil+:
+ *
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(5, 1) # => nil
+ * a.slice!(-5, 1) # => nil
*
* If <tt>start + length</tt> exceeds the array size,
* removes and returns all elements from offset +start+ to the end:
*
- * a = [:foo, 'bar', 2]
- * a.slice!(1, 50) # => ["bar", 2]
- * a # => [:foo]
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(2, 50) # => ["c", "d"]
+ * a # => ["a", "b"]
*
* If <tt>start == a.size</tt> and +length+ is non-negative,
- * returns a new empty +Array+.
+ * returns a new empty array.
*
* If +length+ is negative, returns +nil+.
*
- * When the only argument is a Range object +range+,
- * treats <tt>range.min</tt> as +start+ above and <tt>range.size</tt> as +length+ above:
+ * With Range argument +range+ given,
+ * treats <tt>range.min</tt> as +start+ (as above)
+ * and <tt>range.size</tt> as +length+ (as above):
*
- * a = [:foo, 'bar', 2]
- * a.slice!(1..2) # => ["bar", 2]
- * a # => [:foo]
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(1..2) # => ["b", "c"]
+ * a # => ["a", "d"]
*
- * If <tt>range.start == a.size</tt>, returns a new empty +Array+.
+ * If <tt>range.start == a.size</tt>, returns a new empty array:
*
- * If <tt>range.start</tt> is larger than the array size, returns +nil+.
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(4..5) # => []
*
- * If <tt>range.end</tt> is negative, counts backwards from the end of the array:
+ * If <tt>range.start</tt> is larger than the array size, returns +nil+:
*
- * a = [:foo, 'bar', 2]
- * a.slice!(0..-2) # => [:foo, "bar"]
- * a # => [2]
+ * a = ['a', 'b', 'c', 'd']
+ a.slice!(5..6) # => nil
*
* If <tt>range.start</tt> is negative,
- * calculates the start index backwards from the end of the array:
+ * calculates the start index by counting backwards from the end of +self+:
*
- * a = [:foo, 'bar', 2]
- * a.slice!(-2..2) # => ["bar", 2]
- * a # => [:foo]
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(-2..2) # => ["c"]
+ *
+ * If <tt>range.end</tt> is negative,
+ * calculates the end index by counting backwards from the end of +self+:
+ *
+ * a = ['a', 'b', 'c', 'd']
+ * a.slice!(0..-2) # => ["a", "b", "c"]
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -4270,10 +4472,11 @@ ary_reject_bang(VALUE ary)
/*
* call-seq:
- * array.reject! {|element| ... } -> self or nil
- * array.reject! -> new_enumerator
+ * reject! {|element| ... } -> self or nil
+ * reject! -> new_enumerator
*
- * Removes each element for which the block returns a truthy value.
+ * With a block given, calls the block with each element of +self+;
+ * removes each element for which the block returns a truthy value.
*
* Returns +self+ if any elements removed:
*
@@ -4282,11 +4485,9 @@ ary_reject_bang(VALUE ary)
*
* Returns +nil+ if no elements removed.
*
- * Returns a new Enumerator if no block given:
- *
- * a = [:foo, 'bar', 2]
- * a.reject! # => #<Enumerator: [:foo, "bar", 2]:reject!>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -4299,21 +4500,19 @@ rb_ary_reject_bang(VALUE ary)
/*
* call-seq:
- * array.reject {|element| ... } -> new_array
- * array.reject -> new_enumerator
+ * reject {|element| ... } -> new_array
+ * reject -> new_enumerator
*
- * Returns a new +Array+ whose elements are all those from +self+
+ * With a block given, returns a new array whose elements are all those from +self+
* for which the block returns +false+ or +nil+:
*
* a = [:foo, 'bar', 2, 'bat']
* a1 = a.reject {|element| element.to_s.start_with?('b') }
* a1 # => [:foo, 2]
*
- * Returns a new Enumerator if no block given:
- *
- * a = [:foo, 'bar', 2]
- * a.reject # => #<Enumerator: [:foo, "bar", 2]:reject>
+ * With no block given, returns a new Enumerator.
*
+ * Related: {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -4329,20 +4528,19 @@ rb_ary_reject(VALUE ary)
/*
* call-seq:
- * array.delete_if {|element| ... } -> self
- * array.delete_if -> Enumerator
+ * delete_if {|element| ... } -> self
+ * delete_if -> new_numerator
*
- * Removes each element in +self+ for which the block returns a truthy value;
+ * With a block given, calls the block with each element of +self+;
+ * removes the element if the block returns a truthy value;
* returns +self+:
*
* a = [:foo, 'bar', 2, 'bat']
* a.delete_if {|element| element.to_s.start_with?('b') } # => [:foo, 2]
*
- * Returns a new Enumerator if no block given:
- *
- * a = [:foo, 'bar', 2]
- * a.delete_if # => #<Enumerator: [:foo, "bar", 2]:delete_if>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -4383,65 +4581,95 @@ take_items(VALUE obj, long n)
/*
* call-seq:
- * array.zip(*other_arrays) -> new_array
- * array.zip(*other_arrays) {|other_array| ... } -> nil
+ * zip(*other_arrays) -> new_array
+ * zip(*other_arrays) {|sub_array| ... } -> nil
+ *
+ * With no block given, combines +self+ with the collection of +other_arrays+;
+ * returns a new array of sub-arrays:
*
- * When no block given, returns a new +Array+ +new_array+ of size <tt>self.size</tt>
- * whose elements are Arrays.
+ * [0, 1].zip(['zero', 'one'], [:zero, :one])
+ * # => [[0, "zero", :zero], [1, "one", :one]]
*
- * Each nested array <tt>new_array[n]</tt> is of size <tt>other_arrays.size+1</tt>,
- * and contains:
+ * Returned:
*
- * - The _nth_ element of +self+.
- * - The _nth_ element of each of the +other_arrays+.
+ * - The outer array is of size <tt>self.size</tt>.
+ * - Each sub-array is of size <tt>other_arrays.size + 1</tt>.
+ * - The _nth_ sub-array contains (in order):
*
- * If all +other_arrays+ and +self+ are the same size:
+ * - The _nth_ element of +self+.
+ * - The _nth_ element of each of the other arrays, as available.
+ *
+ * Example:
+ *
+ * a = [0, 1]
+ * zipped = a.zip(['zero', 'one'], [:zero, :one])
+ * # => [[0, "zero", :zero], [1, "one", :one]]
+ * zipped.size # => 2 # Same size as a.
+ * zipped.first.size # => 3 # Size of other arrays plus 1.
+ *
+ * When the other arrays are all the same size as +self+,
+ * the returned sub-arrays are a rearrangement containing exactly elements of all the arrays
+ * (including +self+), with no omissions or additions:
*
* a = [:a0, :a1, :a2, :a3]
* b = [:b0, :b1, :b2, :b3]
* c = [:c0, :c1, :c2, :c3]
* d = a.zip(b, c)
- * d # => [[:a0, :b0, :c0], [:a1, :b1, :c1], [:a2, :b2, :c2], [:a3, :b3, :c3]]
+ * pp d
+ * # =>
+ * [[:a0, :b0, :c0],
+ * [:a1, :b1, :c1],
+ * [:a2, :b2, :c2],
+ * [:a3, :b3, :c3]]
*
- * If any array in +other_arrays+ is smaller than +self+,
- * fills to <tt>self.size</tt> with +nil+:
+ * When one of the other arrays is smaller than +self+,
+ * pads the corresponding sub-array with +nil+ elements:
*
* a = [:a0, :a1, :a2, :a3]
* b = [:b0, :b1, :b2]
* c = [:c0, :c1]
* d = a.zip(b, c)
- * d # => [[:a0, :b0, :c0], [:a1, :b1, :c1], [:a2, :b2, nil], [:a3, nil, nil]]
+ * pp d
+ * # =>
+ * [[:a0, :b0, :c0],
+ * [:a1, :b1, :c1],
+ * [:a2, :b2, nil],
+ * [:a3, nil, nil]]
*
- * If any array in +other_arrays+ is larger than +self+,
- * its trailing elements are ignored:
+ * When one of the other arrays is larger than +self+,
+ * _ignores_ its trailing elements:
*
* a = [:a0, :a1, :a2, :a3]
* b = [:b0, :b1, :b2, :b3, :b4]
* c = [:c0, :c1, :c2, :c3, :c4, :c5]
* d = a.zip(b, c)
- * d # => [[:a0, :b0, :c0], [:a1, :b1, :c1], [:a2, :b2, :c2], [:a3, :b3, :c3]]
- *
- * If an argument is not an array, it extracts the values by calling #each:
- *
- * a = [:a0, :a1, :a2, :a2]
- * b = 1..4
- * c = a.zip(b)
- * c # => [[:a0, 1], [:a1, 2], [:a2, 3], [:a2, 4]]
+ * pp d
+ * # =>
+ * [[:a0, :b0, :c0],
+ * [:a1, :b1, :c1],
+ * [:a2, :b2, :c2],
+ * [:a3, :b3, :c3]]
*
- * When a block is given, calls the block with each of the sub-arrays (formed as above); returns +nil+:
+ * With a block given, calls the block with each of the other arrays;
+ * returns +nil+:
*
+ * d = []
* a = [:a0, :a1, :a2, :a3]
* b = [:b0, :b1, :b2, :b3]
* c = [:c0, :c1, :c2, :c3]
- * a.zip(b, c) {|sub_array| p sub_array} # => nil
- *
- * Output:
- *
- * [:a0, :b0, :c0]
- * [:a1, :b1, :c1]
- * [:a2, :b2, :c2]
- * [:a3, :b3, :c3]
- *
+ * a.zip(b, c) {|sub_array| d.push(sub_array.reverse) } # => nil
+ * pp d
+ * # =>
+ * [[:c0, :b0, :a0],
+ * [:c1, :b1, :a1],
+ * [:c2, :b2, :a2],
+ * [:c3, :b3, :a3]]
+ *
+ * For an *object* in *other_arrays* that is not actually an array,
+ * forms the "other array" as <tt>object.to_ary</tt>, if defined,
+ * or as <tt>object.each.to_a</tt> otherwise.
+ *
+ * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -4504,14 +4732,17 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.transpose -> new_array
+ * transpose -> new_array
*
- * Transposes the rows and columns in an +Array+ of Arrays;
- * the nested Arrays must all be the same size:
+ * Returns a new array that is +self+
+ * as a {transposed matrix}[https://en.wikipedia.org/wiki/Transpose]:
*
* a = [[:a0, :a1], [:b0, :b1], [:c0, :c1]]
* a.transpose # => [[:a0, :b0, :c0], [:a1, :b1, :c1]]
*
+ * The elements of +self+ must all be the same size.
+ *
+ * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -4544,13 +4775,17 @@ rb_ary_transpose(VALUE ary)
/*
* call-seq:
- * array.replace(other_array) -> self
+ * initialize_copy(other_array) -> self
+ * replace(other_array) -> self
*
- * Replaces the content of +self+ with the content of +other_array+; returns +self+:
+ * Replaces the elements of +self+ with the elements of +other_array+, which must be an
+ * {array-convertible object}[rdoc-ref:implicit_conversion.rdoc@Array-Convertible+Objects];
+ * returns +self+:
*
- * a = [:foo, 'bar', 2]
- * a.replace(['foo', :bar, 3]) # => ["foo", :bar, 3]
+ * a = ['a', 'b', 'c'] # => ["a", "b", "c"]
+ * a.replace(['d', 'e']) # => ["d", "e"]
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
VALUE
@@ -4591,6 +4826,8 @@ rb_ary_replace(VALUE copy, VALUE orig)
ARY_SET_PTR(copy, ARY_HEAP_PTR(orig));
ARY_SET_LEN(copy, ARY_HEAP_LEN(orig));
rb_ary_set_shared(copy, shared_root);
+
+ RUBY_ASSERT(RB_OBJ_SHAREABLE_P(copy) ? RB_OBJ_SHAREABLE_P(shared_root) : 1);
}
ary_verify(copy);
return copy;
@@ -4598,13 +4835,14 @@ rb_ary_replace(VALUE copy, VALUE orig)
/*
* call-seq:
- * array.clear -> self
+ * clear -> self
*
- * Removes all elements from +self+:
+ * Removes all elements from +self+; returns +self+:
*
* a = [:foo, 'bar', 2]
* a.clear # => []
*
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
VALUE
@@ -4612,11 +4850,9 @@ rb_ary_clear(VALUE ary)
{
rb_ary_modify_check(ary);
if (ARY_SHARED_P(ary)) {
- if (!ARY_EMBED_P(ary)) {
- rb_ary_unshare(ary);
- FL_SET_EMBED(ary);
- ARY_SET_EMBED_LEN(ary, 0);
- }
+ rb_ary_unshare(ary);
+ FL_SET_EMBED(ary);
+ ARY_SET_EMBED_LEN(ary, 0);
}
else {
ARY_SET_LEN(ary, 0);
@@ -4630,198 +4866,182 @@ rb_ary_clear(VALUE ary)
/*
* call-seq:
- * array.fill(obj) -> self
- * array.fill(obj, start) -> self
- * array.fill(obj, start, length) -> self
- * array.fill(obj, range) -> self
- * array.fill {|index| ... } -> self
- * array.fill(start) {|index| ... } -> self
- * array.fill(start, length) {|index| ... } -> self
- * array.fill(range) {|index| ... } -> self
+ * fill(object, start = nil, count = nil) -> self
+ * fill(object, range) -> self
+ * fill(start = nil, count = nil) {|element| ... } -> self
+ * fill(range) {|element| ... } -> self
*
- * Replaces specified elements in +self+ with specified objects; returns +self+.
+ * Replaces selected elements in +self+;
+ * may add elements to +self+;
+ * always returns +self+ (never a new array).
*
- * With argument +obj+ and no block given, replaces all elements with that one object:
+ * In brief:
*
- * a = ['a', 'b', 'c', 'd']
- * a # => ["a", "b", "c", "d"]
- * a.fill(:X) # => [:X, :X, :X, :X]
+ * # Non-negative start.
+ * ['a', 'b', 'c', 'd'].fill('-', 1, 2) # => ["a", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1, 2) {|e| e.to_s } # => ["a", "1", "2", "d"]
*
- * With arguments +obj+ and Integer +start+, and no block given,
- * replaces elements based on the given start.
+ * # Extends with specified values if necessary.
+ * ['a', 'b', 'c', 'd'].fill('-', 3, 2) # => ["a", "b", "c", "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill(3, 2) {|e| e.to_s } # => ["a", "b", "c", "3", "4"]
*
- * If +start+ is in range (<tt>0 <= start < array.size</tt>),
- * replaces all elements from offset +start+ through the end:
+ * # Fills with nils if necessary.
+ * ['a', 'b', 'c', 'd'].fill('-', 6, 2) # => ["a", "b", "c", "d", nil, nil, "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill(6, 2) {|e| e.to_s } # => ["a", "b", "c", "d", nil, nil, "6", "7"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 2) # => ["a", "b", :X, :X]
+ * # For negative start, counts backwards from the end.
+ * ['a', 'b', 'c', 'd'].fill('-', -3, 3) # => ["a", "-", "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill(-3, 3) {|e| e.to_s } # => ["a", "1", "2", "3"]
*
- * If +start+ is too large (<tt>start >= array.size</tt>), does nothing:
+ * # Range.
+ * ['a', 'b', 'c', 'd'].fill('-', 1..2) # => ["a", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1..2) {|e| e.to_s } # => ["a", "1", "2", "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 4) # => ["a", "b", "c", "d"]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 5) # => ["a", "b", "c", "d"]
+ * When arguments +start+ and +count+ are given,
+ * they select the elements of +self+ to be replaced;
+ * each must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]
+ * (or +nil+):
*
- * If +start+ is negative, counts from the end (starting index is <tt>start + array.size</tt>):
+ * - +start+ specifies the zero-based offset of the first element to be replaced;
+ * +nil+ means zero.
+ * - +count+ is the number of consecutive elements to be replaced;
+ * +nil+ means "all the rest."
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, -2) # => ["a", "b", :X, :X]
+ * With argument +object+ given,
+ * that one object is used for all replacements:
*
- * If +start+ is too small (less than and far from zero), replaces all elements:
+ * o = Object.new # => #<Object:0x0000014e7bff7600>
+ * a = ['a', 'b', 'c', 'd'] # => ["a", "b", "c", "d"]
+ * a.fill(o, 1, 2)
+ * # => ["a", #<Object:0x0000014e7bff7600>, #<Object:0x0000014e7bff7600>, "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, -6) # => [:X, :X, :X, :X]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, -50) # => [:X, :X, :X, :X]
+ * With a block given, the block is called once for each element to be replaced;
+ * the value passed to the block is the _index_ of the element to be replaced
+ * (not the element itself);
+ * the block's return value replaces the element:
*
- * With arguments +obj+, Integer +start+, and Integer +length+, and no block given,
- * replaces elements based on the given +start+ and +length+.
+ * a = ['a', 'b', 'c', 'd'] # => ["a", "b", "c", "d"]
+ * a.fill(1, 2) {|element| element.to_s } # => ["a", "1", "2", "d"]
*
- * If +start+ is in range, replaces +length+ elements beginning at offset +start+:
+ * For arguments +start+ and +count+:
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 1, 1) # => ["a", :X, "c", "d"]
+ * - If +start+ is non-negative,
+ * replaces +count+ elements beginning at offset +start+:
*
- * If +start+ is negative, counts from the end:
+ * ['a', 'b', 'c', 'd'].fill('-', 0, 2) # => ["-", "-", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 1, 2) # => ["a", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 2, 2) # => ["a", "b", "-", "-"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, -2, 1) # => ["a", "b", :X, "d"]
+ * ['a', 'b', 'c', 'd'].fill(0, 2) {|e| e.to_s } # => ["0", "1", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1, 2) {|e| e.to_s } # => ["a", "1", "2", "d"]
+ * ['a', 'b', 'c', 'd'].fill(2, 2) {|e| e.to_s } # => ["a", "b", "2", "3"]
*
- * If +start+ is large (<tt>start >= array.size</tt>), extends +self+ with +nil+:
+ * Extends +self+ if necessary:
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 5, 0) # => ["a", "b", "c", "d", nil]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 5, 2) # => ["a", "b", "c", "d", nil, :X, :X]
+ * ['a', 'b', 'c', 'd'].fill('-', 3, 2) # => ["a", "b", "c", "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill('-', 4, 2) # => ["a", "b", "c", "d", "-", "-"]
*
- * If +length+ is zero or negative, replaces no elements:
+ * ['a', 'b', 'c', 'd'].fill(3, 2) {|e| e.to_s } # => ["a", "b", "c", "3", "4"]
+ * ['a', 'b', 'c', 'd'].fill(4, 2) {|e| e.to_s } # => ["a", "b", "c", "d", "4", "5"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, 1, 0) # => ["a", "b", "c", "d"]
- * a.fill(:X, 1, -1) # => ["a", "b", "c", "d"]
+ * Fills with +nil+ if necessary:
*
- * With arguments +obj+ and Range +range+, and no block given,
- * replaces elements based on the given range.
+ * ['a', 'b', 'c', 'd'].fill('-', 5, 2) # => ["a", "b", "c", "d", nil, "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill('-', 6, 2) # => ["a", "b", "c", "d", nil, nil, "-", "-"]
*
- * If the range is positive and ascending (<tt>0 < range.begin <= range.end</tt>),
- * replaces elements from <tt>range.begin</tt> to <tt>range.end</tt>:
+ * ['a', 'b', 'c', 'd'].fill(5, 2) {|e| e.to_s } # => ["a", "b", "c", "d", nil, "5", "6"]
+ * ['a', 'b', 'c', 'd'].fill(6, 2) {|e| e.to_s } # => ["a", "b", "c", "d", nil, nil, "6", "7"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, (1..1)) # => ["a", :X, "c", "d"]
+ * Does nothing if +count+ is non-positive:
*
- * If <tt>range.first</tt> is negative, replaces no elements:
+ * ['a', 'b', 'c', 'd'].fill('-', 2, 0) # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 2, -100) # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 6, -100) # => ["a", "b", "c", "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, (-1..1)) # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(2, 0) {|e| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(2, -100) {|e| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(6, -100) {|e| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
*
- * If <tt>range.last</tt> is negative, counts from the end:
+ * - If +start+ is negative, counts backwards from the end of +self+:
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, (0..-2)) # => [:X, :X, :X, "d"]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, (1..-2)) # => ["a", :X, :X, "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -4, 3) # => ["-", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -3, 3) # => ["a", "-", "-", "-"]
*
- * If <tt>range.last</tt> and <tt>range.last</tt> are both negative,
- * both count from the end of the array:
+ * ['a', 'b', 'c', 'd'].fill(-4, 3) {|e| e.to_s } # => ["0", "1", "2", "d"]
+ * ['a', 'b', 'c', 'd'].fill(-3, 3) {|e| e.to_s } # => ["a", "1", "2", "3"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, (-1..-1)) # => ["a", "b", "c", :X]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(:X, (-2..-2)) # => ["a", "b", :X, "d"]
+ * Extends +self+ if necessary:
*
- * With no arguments and a block given, calls the block with each index;
- * replaces the corresponding element with the block's return value:
+ * ['a', 'b', 'c', 'd'].fill('-', -2, 3) # => ["a", "b", "-", "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill('-', -1, 3) # => ["a", "b", "c", "-", "-", "-"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
+ * ['a', 'b', 'c', 'd'].fill(-2, 3) {|e| e.to_s } # => ["a", "b", "2", "3", "4"]
+ * ['a', 'b', 'c', 'd'].fill(-1, 3) {|e| e.to_s } # => ["a", "b", "c", "3", "4", "5"]
*
- * With argument +start+ and a block given, calls the block with each index
- * from offset +start+ to the end; replaces the corresponding element
- * with the block's return value.
+ * Starts at the beginning of +self+ if +start+ is negative and out-of-range:
*
- * If start is in range (<tt>0 <= start < array.size</tt>),
- * replaces from offset +start+ to the end:
+ * ['a', 'b', 'c', 'd'].fill('-', -5, 2) # => ["-", "-", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -6, 2) # => ["-", "-", "c", "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(1) { |index| "new_#{index}" } # => ["a", "new_1", "new_2", "new_3"]
+ * ['a', 'b', 'c', 'd'].fill(-5, 2) {|e| e.to_s } # => ["0", "1", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(-6, 2) {|e| e.to_s } # => ["0", "1", "c", "d"]
*
- * If +start+ is too large(<tt>start >= array.size</tt>), does nothing:
+ * Does nothing if +count+ is non-positive:
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(4) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(4) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -2, 0) # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -2, -1) # => ["a", "b", "c", "d"]
*
- * If +start+ is negative, counts from the end:
+ * ['a', 'b', 'c', 'd'].fill(-2, 0) {|e| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(-2, -1) {|e| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-2) { |index| "new_#{index}" } # => ["a", "b", "new_2", "new_3"]
+ * When argument +range+ is given,
+ * it must be a Range object whose members are numeric;
+ * its +begin+ and +end+ values determine the elements of +self+
+ * to be replaced:
*
- * If start is too small (<tt>start <= -array.size</tt>, replaces all elements:
+ * - If both +begin+ and +end+ are positive, they specify the first and last elements
+ * to be replaced:
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-6) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-50) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
+ * ['a', 'b', 'c', 'd'].fill('-', 1..2) # => ["a", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1..2) {|e| e.to_s } # => ["a", "1", "2", "d"]
*
- * With arguments +start+ and +length+, and a block given,
- * calls the block for each index specified by start length;
- * replaces the corresponding element with the block's return value.
+ * If +end+ is smaller than +begin+, replaces no elements:
*
- * If +start+ is in range, replaces +length+ elements beginning at offset +start+:
- *
- * a = ['a', 'b', 'c', 'd']
- * a.fill(1, 1) { |index| "new_#{index}" } # => ["a", "new_1", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 2..1) # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(2..1) {|e| e.to_s } # => ["a", "b", "c", "d"]
*
- * If start is negative, counts from the end:
+ * - If either is negative (or both are negative), counts backwards from the end of +self+:
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-2, 1) { |index| "new_#{index}" } # => ["a", "b", "new_2", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -3..2) # => ["a", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 1..-2) # => ["a", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', -3..-2) # => ["a", "-", "-", "d"]
*
- * If +start+ is large (<tt>start >= array.size</tt>), extends +self+ with +nil+:
+ * ['a', 'b', 'c', 'd'].fill(-3..2) {|e| e.to_s } # => ["a", "1", "2", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1..-2) {|e| e.to_s } # => ["a", "1", "2", "d"]
+ * ['a', 'b', 'c', 'd'].fill(-3..-2) {|e| e.to_s } # => ["a", "1", "2", "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(5, 0) { |index| "new_#{index}" } # => ["a", "b", "c", "d", nil]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(5, 2) { |index| "new_#{index}" } # => ["a", "b", "c", "d", nil, "new_5", "new_6"]
+ * - If the +end+ value is excluded (see Range#exclude_end?), omits the last replacement:
*
- * If +length+ is zero or less, replaces no elements:
+ * ['a', 'b', 'c', 'd'].fill('-', 1...2) # => ["a", "-", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', 1...-2) # => ["a", "-", "c", "d"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(1, 0) { |index| "new_#{index}" } # => ["a", "b", "c", "d"]
- * a.fill(1, -1) { |index| "new_#{index}" } # => ["a", "b", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1...2) {|e| e.to_s } # => ["a", "1", "c", "d"]
+ * ['a', 'b', 'c', 'd'].fill(1...-2) {|e| e.to_s } # => ["a", "1", "c", "d"]
*
- * With arguments +obj+ and +range+, and a block given,
- * calls the block with each index in the given range;
- * replaces the corresponding element with the block's return value.
+ * - If the range is endless (see {Endless Ranges}[rdoc-ref:Range@Endless+Ranges]),
+ * replaces elements to the end of +self+:
*
- * If the range is positive and ascending (<tt>range 0 < range.begin <= range.end</tt>,
- * replaces elements from <tt>range.begin</tt> to <tt>range.end</tt>:
+ * ['a', 'b', 'c', 'd'].fill('-', 1..) # => ["a", "-", "-", "-"]
+ * ['a', 'b', 'c', 'd'].fill(1..) {|e| e.to_s } # => ["a", "1", "2", "3"]
*
- * a = ['a', 'b', 'c', 'd']
- * a.fill(1..1) { |index| "new_#{index}" } # => ["a", "new_1", "c", "d"]
+ * - If the range is beginless (see {Beginless Ranges}[rdoc-ref:Range@Beginless+Ranges]),
+ * replaces elements from the beginning of +self+:
*
- * If +range.first+ is negative, does nothing:
- *
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-1..1) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
- *
- * If <tt>range.last</tt> is negative, counts from the end:
- *
- * a = ['a', 'b', 'c', 'd']
- * a.fill(0..-2) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "d"]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(1..-2) { |index| "new_#{index}" } # => ["a", "new_1", "new_2", "d"]
- *
- * If <tt>range.first</tt> and <tt>range.last</tt> are both negative,
- * both count from the end:
- *
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-1..-1) { |index| "new_#{index}" } # => ["a", "b", "c", "new_3"]
- * a = ['a', 'b', 'c', 'd']
- * a.fill(-2..-2) { |index| "new_#{index}" } # => ["a", "b", "new_2", "d"]
+ * ['a', 'b', 'c', 'd'].fill('-', ..2) # => ["-", "-", "-", "d"]
+ * ['a', 'b', 'c', 'd'].fill(..2) {|e| e.to_s } # => ["0", "1", "2", "d"]
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -4890,15 +5110,15 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array + other_array -> new_array
+ * self + other_array -> new_array
*
- * Returns a new +Array+ containing all elements of +array+
+ * Returns a new array containing all elements of +self+
* followed by all elements of +other_array+:
*
* a = [0, 1] + [2, 3]
* a # => [0, 1, 2, 3]
*
- * Related: #concat.
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
VALUE
@@ -4932,12 +5152,15 @@ ary_append(VALUE x, VALUE y)
/*
* call-seq:
- * array.concat(*other_arrays) -> self
+ * concat(*other_arrays) -> self
*
- * Adds to +array+ all elements from each +Array+ in +other_arrays+; returns +self+:
+ * Adds to +self+ all elements from each array in +other_arrays+; returns +self+:
*
* a = [0, 1]
- * a.concat([2, 3], [4, 5]) # => [0, 1, 2, 3, 4, 5]
+ * a.concat(['two', 'three'], [:four, :five], a)
+ * # => [0, 1, "two", "three", :four, :five, 0, 1]
+ *
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -4969,19 +5192,19 @@ rb_ary_concat(VALUE x, VALUE y)
/*
* call-seq:
- * array * n -> new_array
- * array * string_separator -> new_string
+ * self * n -> new_array
+ * self * string_separator -> new_string
*
- * When non-negative argument Integer +n+ is given,
- * returns a new +Array+ built by concatenating the +n+ copies of +self+:
+ * When non-negative integer argument +n+ is given,
+ * returns a new array built by concatenating +n+ copies of +self+:
*
* a = ['x', 'y']
* a * 3 # => ["x", "y", "x", "y", "x", "y"]
*
- * When String argument +string_separator+ is given,
- * equivalent to <tt>array.join(string_separator)</tt>:
+ * When string argument +string_separator+ is given,
+ * equivalent to <tt>self.join(string_separator)</tt>:
*
- * [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {:foo=>0}"
+ * [0, [0, 1], {foo: 0}] * ', ' # => "0, 0, 1, {foo: 0}"
*
*/
@@ -5031,17 +5254,18 @@ rb_ary_times(VALUE ary, VALUE times)
/*
* call-seq:
- * array.assoc(obj) -> found_array or nil
+ * assoc(object) -> found_array or nil
*
- * Returns the first element in +self+ that is an +Array+
- * whose first element <tt>==</tt> +obj+:
+ * Returns the first element +ele+ in +self+ such that +ele+ is an array
+ * and <tt>ele[0] == object</tt>:
*
* a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]]
* a.assoc(4) # => [4, 5, 6]
*
* Returns +nil+ if no such element is found.
*
- * Related: #rassoc.
+ * Related: Array#rassoc;
+ * see also {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
VALUE
@@ -5061,17 +5285,19 @@ rb_ary_assoc(VALUE ary, VALUE key)
/*
* call-seq:
- * array.rassoc(obj) -> found_array or nil
+ * rassoc(object) -> found_array or nil
*
- * Returns the first element in +self+ that is an +Array+
- * whose second element <tt>==</tt> +obj+:
+ * Returns the first element +ele+ in +self+ such that +ele+ is an array
+ * and <tt>ele[1] == object</tt>:
*
* a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]]
* a.rassoc(4) # => [2, 4]
+ * a.rassoc(5) # => [4, 5, 6]
*
* Returns +nil+ if no such element is found.
*
- * Related: #assoc.
+ * Related: Array#assoc;
+ * see also {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
VALUE
@@ -5126,20 +5352,26 @@ recursive_equal(VALUE ary1, VALUE ary2, int recur)
/*
* call-seq:
- * array == other_array -> true or false
+ * self == other_array -> true or false
*
- * Returns +true+ if both <tt>array.size == other_array.size</tt>
- * and for each index +i+ in +array+, <tt>array[i] == other_array[i]</tt>:
+ * Returns whether both:
*
- * a0 = [:foo, 'bar', 2]
- * a1 = [:foo, 'bar', 2.0]
- * a1 == a0 # => true
- * [] == [] # => true
+ * - +self+ and +other_array+ are the same size.
+ * - Their corresponding elements are the same;
+ * that is, for each index +i+ in <tt>(0...self.size)</tt>,
+ * <tt>self[i] == other_array[i]</tt>.
*
- * Otherwise, returns +false+.
+ * Examples:
+ *
+ * [:foo, 'bar', 2] == [:foo, 'bar', 2] # => true
+ * [:foo, 'bar', 2] == [:foo, 'bar', 2.0] # => true
+ * [:foo, 'bar', 2] == [:foo, 'bar'] # => false # Different sizes.
+ * [:foo, 'bar', 2] == [:foo, 'bar', 3] # => false # Different elements.
*
* This method is different from method Array#eql?,
* which compares elements using <tt>Object#eql?</tt>.
+ *
+ * Related: see {Methods for Comparing}[rdoc-ref:Array@Methods+for+Comparing].
*/
static VALUE
@@ -5172,7 +5404,7 @@ recursive_eql(VALUE ary1, VALUE ary2, int recur)
/*
* call-seq:
- * array.eql?(other_array) -> true or false
+ * eql?(other_array) -> true or false
*
* Returns +true+ if +self+ and +other_array+ are the same size,
* and if, for each index +i+ in +self+, <tt>self[i].eql?(other_array[i])</tt>:
@@ -5185,6 +5417,8 @@ recursive_eql(VALUE ary1, VALUE ary2, int recur)
*
* This method is different from method Array#==,
* which compares using method <tt>Object#==</tt>.
+ *
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -5197,8 +5431,8 @@ rb_ary_eql(VALUE ary1, VALUE ary2)
return rb_exec_recursive_paired(recursive_eql, ary1, ary2, ary2);
}
-VALUE
-rb_ary_hash_values(long len, const VALUE *elements)
+static VALUE
+ary_hash_values(long len, const VALUE *elements, const VALUE ary)
{
long i;
st_index_t h;
@@ -5209,39 +5443,55 @@ rb_ary_hash_values(long len, const VALUE *elements)
for (i=0; i<len; i++) {
n = rb_hash(elements[i]);
h = rb_hash_uint(h, NUM2LONG(n));
+ if (ary) {
+ len = RARRAY_LEN(ary);
+ elements = RARRAY_CONST_PTR(ary);
+ }
}
h = rb_hash_end(h);
return ST2FIX(h);
}
+VALUE
+rb_ary_hash_values(long len, const VALUE *elements)
+{
+ return ary_hash_values(len, elements, 0);
+}
+
/*
* call-seq:
- * array.hash -> integer
+ * hash -> integer
*
* Returns the integer hash value for +self+.
*
- * Two arrays with the same content will have the same hash code (and will compare using #eql?):
+ * Two arrays with the same content will have the same hash value
+ * (and will compare using eql?):
*
- * [0, 1, 2].hash == [0, 1, 2].hash # => true
- * [0, 1, 2].hash == [0, 1, 3].hash # => false
+ * ['a', 'b'].hash == ['a', 'b'].hash # => true
+ * ['a', 'b'].hash == ['a', 'c'].hash # => false
+ * ['a', 'b'].hash == ['a'].hash # => false
*
*/
static VALUE
rb_ary_hash(VALUE ary)
{
- return rb_ary_hash_values(RARRAY_LEN(ary), RARRAY_CONST_PTR(ary));
+ RBIMPL_ASSERT_OR_ASSUME(ary);
+ return ary_hash_values(RARRAY_LEN(ary), RARRAY_CONST_PTR(ary), ary);
}
/*
* call-seq:
- * array.include?(obj) -> true or false
+ * include?(object) -> true or false
*
- * Returns +true+ if for some index +i+ in +self+, <tt>obj == self[i]</tt>;
- * otherwise +false+:
+ * Returns whether for some element +element+ in +self+,
+ * <tt>object == element</tt>:
*
- * [0, 1, 2].include?(2) # => true
- * [0, 1, 2].include?(3) # => false
+ * [0, 1, 2].include?(2) # => true
+ * [0, 1, 2].include?(2.0) # => true
+ * [0, 1, 2].include?(2.1) # => false
+ *
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
VALUE
@@ -5296,33 +5546,40 @@ recursive_cmp(VALUE ary1, VALUE ary2, int recur)
/*
* call-seq:
- * array <=> other_array -> -1, 0, or 1
- *
- * Returns -1, 0, or 1 as +self+ is less than, equal to, or greater than +other_array+.
- * For each index +i+ in +self+, evaluates <tt>result = self[i] <=> other_array[i]</tt>.
+ * self <=> other_array -> -1, 0, or 1
*
- * Returns -1 if any result is -1:
+ * Returns -1, 0, or 1 as +self+ is determined
+ * to be less than, equal to, or greater than +other_array+.
*
- * [0, 1, 2] <=> [0, 1, 3] # => -1
+ * Iterates over each index +i+ in <tt>(0...self.size)</tt>:
*
- * Returns 1 if any result is 1:
+ * - Computes <tt>result[i]</tt> as <tt>self[i] <=> other_array[i]</tt>.
+ * - Immediately returns 1 if <tt>result[i]</tt> is 1:
*
- * [0, 1, 2] <=> [0, 1, 1] # => 1
+ * [0, 1, 2] <=> [0, 0, 2] # => 1
*
- * When all results are zero:
+ * - Immediately returns -1 if <tt>result[i]</tt> is -1:
*
- * - Returns -1 if +array+ is smaller than +other_array+:
+ * [0, 1, 2] <=> [0, 2, 2] # => -1
*
- * [0, 1, 2] <=> [0, 1, 2, 3] # => -1
+ * - Continues if <tt>result[i]</tt> is 0.
*
- * - Returns 1 if +array+ is larger than +other_array+:
+ * When every +result+ is 0,
+ * returns <tt>self.size <=> other_array.size</tt>
+ * (see Integer#<=>):
*
- * [0, 1, 2] <=> [0, 1] # => 1
+ * [0, 1, 2] <=> [0, 1] # => 1
+ * [0, 1, 2] <=> [0, 1, 2] # => 0
+ * [0, 1, 2] <=> [0, 1, 2, 3] # => -1
*
- * - Returns 0 if +array+ and +other_array+ are the same size:
+ * Note that when +other_array+ is larger than +self+,
+ * its trailing elements do not affect the result:
*
- * [0, 1, 2] <=> [0, 1, 2] # => 0
+ * [0, 1, 2] <=> [0, 1, 2, -3] # => -1
+ * [0, 1, 2] <=> [0, 1, 2, 0] # => -1
+ * [0, 1, 2] <=> [0, 1, 2, 3] # => -1
*
+ * Related: see {Methods for Comparing}[rdoc-ref:Array@Methods+for+Comparing].
*/
VALUE
@@ -5392,18 +5649,20 @@ ary_make_hash_by(VALUE ary)
/*
* call-seq:
- * array - other_array -> new_array
+ * self - other_array -> new_array
+ *
+ * Returns a new array containing only those elements of +self+
+ * that are not found in +other_array+;
+ * the order from +self+ is preserved:
*
- * Returns a new +Array+ containing only those elements from +array+
- * that are not found in +Array+ +other_array+;
- * items are compared using <tt>eql?</tt>;
- * the order from +array+ is preserved:
+ * [0, 1, 1, 2, 1, 1, 3, 1, 1] - [1] # => [0, 2, 3]
+ * [0, 1, 1, 2, 1, 1, 3, 1, 1] - [3, 2, 0, :foo] # => [1, 1, 1, 1, 1, 1]
+ * [0, 1, 2] - [:foo] # => [0, 1, 2]
*
- * [0, 1, 1, 2, 1, 1, 3, 1, 1] - [1] # => [0, 2, 3]
- * [0, 1, 2, 3] - [3, 0] # => [1, 2]
- * [0, 1, 2] - [4] # => [0, 1, 2]
+ * Element are compared using method <tt>#eql?</tt>
+ * (as defined in each element of +self+).
*
- * Related: Array#difference.
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
VALUE
@@ -5437,19 +5696,21 @@ rb_ary_diff(VALUE ary1, VALUE ary2)
/*
* call-seq:
- * array.difference(*other_arrays) -> new_array
+ * difference(*other_arrays = []) -> new_array
*
- * Returns a new +Array+ containing only those elements from +self+
- * that are not found in any of the Arrays +other_arrays+;
+ * Returns a new array containing only those elements from +self+
+ * that are not found in any of the given +other_arrays+;
* items are compared using <tt>eql?</tt>; order from +self+ is preserved:
*
* [0, 1, 1, 2, 1, 1, 3, 1, 1].difference([1]) # => [0, 2, 3]
- * [0, 1, 2, 3].difference([3, 0], [1, 3]) # => [2]
- * [0, 1, 2].difference([4]) # => [0, 1, 2]
+ * [0, 1, 2, 3].difference([3, 0], [1, 3]) # => [2]
+ * [0, 1, 2].difference([4]) # => [0, 1, 2]
+ * [0, 1, 2].difference # => [0, 1, 2]
*
- * Returns a copy of +self+ if no arguments given.
+ * Returns a copy of +self+ if no arguments are given.
*
- * Related: Array#-.
+ * Related: Array#-;
+ * see also {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -5473,7 +5734,7 @@ rb_ary_difference_multi(int argc, VALUE *argv, VALUE ary)
VALUE elt = rb_ary_elt(ary, i);
for (j = 0; j < argc; j++) {
if (is_hash[j]) {
- if (rb_hash_stlike_lookup(argv[j], RARRAY_AREF(ary, i), NULL))
+ if (rb_hash_stlike_lookup(argv[j], elt, NULL))
break;
}
else {
@@ -5491,20 +5752,25 @@ rb_ary_difference_multi(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array & other_array -> new_array
+ * self & other_array -> new_array
*
- * Returns a new +Array+ containing each element found in both +array+ and +Array+ +other_array+;
- * duplicates are omitted; items are compared using <tt>eql?</tt>
- * (items must also implement +hash+ correctly):
+ * Returns a new array containing the _intersection_ of +self+ and +other_array+;
+ * that is, containing those elements found in both +self+ and +other_array+:
*
* [0, 1, 2, 3] & [1, 2] # => [1, 2]
- * [0, 1, 0, 1] & [0, 1] # => [0, 1]
*
- * Preserves order from +array+:
+ * Omits duplicates:
+ *
+ * [0, 1, 1, 0] & [0, 1] # => [0, 1]
+ *
+ * Preserves order from +self+:
*
* [0, 1, 2] & [3, 2, 1, 0] # => [0, 1, 2]
*
- * Related: Array#intersection.
+ * Identifies common elements using method <tt>#eql?</tt>
+ * (as defined in each element of +self+).
+ *
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
@@ -5544,23 +5810,23 @@ rb_ary_and(VALUE ary1, VALUE ary2)
/*
* call-seq:
- * array.intersection(*other_arrays) -> new_array
+ * intersection(*other_arrays) -> new_array
*
- * Returns a new +Array+ containing each element found both in +self+
- * and in all of the given Arrays +other_arrays+;
- * duplicates are omitted; items are compared using <tt>eql?</tt>
- * (items must also implement +hash+ correctly):
+ * Returns a new array containing each element in +self+ that is +#eql?+
+ * to at least one element in each of the given +other_arrays+;
+ * duplicates are omitted:
*
- * [0, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1]
* [0, 0, 1, 1, 2, 3].intersection([0, 1, 2], [0, 1, 3]) # => [0, 1]
*
- * Preserves order from +self+:
+ * Each element must correctly implement method <tt>#hash</tt>.
+ *
+ * Order from +self+ is preserved:
*
* [0, 1, 2].intersection([2, 1, 0]) # => [0, 1, 2]
*
- * Returns a copy of +self+ if no arguments given.
+ * Returns a copy of +self+ if no arguments are given.
*
- * Related: Array#&.
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -5609,9 +5875,9 @@ rb_ary_union_hash(VALUE hash, VALUE ary2)
/*
* call-seq:
- * array | other_array -> new_array
+ * self | other_array -> new_array
*
- * Returns the union of +array+ and +Array+ +other_array+;
+ * Returns the union of +self+ and +other_array+;
* duplicates are removed; order is preserved;
* items are compared using <tt>eql?</tt>:
*
@@ -5619,7 +5885,7 @@ rb_ary_union_hash(VALUE hash, VALUE ary2)
* [0, 1, 1] | [2, 2, 3] # => [0, 1, 2, 3]
* [0, 1, 2] | [3, 2, 1, 0] # => [0, 1, 2, 3]
*
- * Related: Array#union.
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -5643,18 +5909,25 @@ rb_ary_or(VALUE ary1, VALUE ary2)
/*
* call-seq:
- * array.union(*other_arrays) -> new_array
+ * union(*other_arrays) -> new_array
*
- * Returns a new +Array+ that is the union of +self+ and all given Arrays +other_arrays+;
- * duplicates are removed; order is preserved; items are compared using <tt>eql?</tt>:
+ * Returns a new array that is the union of the elements of +self+
+ * and all given arrays +other_arrays+;
+ * items are compared using <tt>eql?</tt>:
*
* [0, 1, 2, 3].union([4, 5], [6, 7]) # => [0, 1, 2, 3, 4, 5, 6, 7]
+ *
+ * Removes duplicates (preserving the first found):
+ *
* [0, 1, 1].union([2, 1], [3, 1]) # => [0, 1, 2, 3]
- * [0, 1, 2, 3].union([3, 2], [1, 0]) # => [0, 1, 2, 3]
*
- * Returns a copy of +self+ if no arguments given.
+ * Preserves order (preserving the position of the first found):
+ *
+ * [3, 2, 1, 0].union([5, 3], [4, 2]) # => [3, 2, 1, 0, 5, 4]
*
- * Related: Array#|.
+ * With no arguments given, returns a copy of +self+.
+ *
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -5687,19 +5960,16 @@ rb_ary_union_multi(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * ary.intersect?(other_ary) -> true or false
+ * intersect?(other_array) -> true or false
+ *
+ * Returns whether +other_array+ has at least one element that is +#eql?+ to some element of +self+:
*
- * Returns +true+ if the array and +other_ary+ have at least one element in
- * common, otherwise returns +false+:
+ * [1, 2, 3].intersect?([3, 4, 5]) # => true
+ * [1, 2, 3].intersect?([4, 5, 6]) # => false
*
- * a = [ 1, 2, 3 ]
- * b = [ 3, 4, 5 ]
- * c = [ 5, 6, 7 ]
- * a.intersect?(b) #=> true
- * a.intersect?(c) #=> false
+ * Each element must correctly implement method <tt>#hash</tt>.
*
- * +Array+ elements are compared using <tt>eql?</tt>
- * (items must also implement +hash+ correctly).
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -5833,42 +6103,51 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax)
/*
* call-seq:
- * array.max -> element
- * array.max {|a, b| ... } -> element
- * array.max(n) -> new_array
- * array.max(n) {|a, b| ... } -> new_array
+ * max -> element
+ * max(count) -> new_array
+ * max {|a, b| ... } -> element
+ * max(count) {|a, b| ... } -> new_array
*
* Returns one of the following:
*
* - The maximum-valued element from +self+.
- * - A new +Array+ of maximum-valued elements selected from +self+.
+ * - A new array of maximum-valued elements from +self+.
*
- * When no block is given, each element in +self+ must respond to method <tt><=></tt>
- * with an Integer.
+ * Does not modify +self+.
+ *
+ * With no block given, each element in +self+ must respond to method <tt>#<=></tt>
+ * with a numeric.
*
* With no argument and no block, returns the element in +self+
- * having the maximum value per method <tt><=></tt>:
+ * having the maximum value per method <tt>#<=></tt>:
*
- * [0, 1, 2].max # => 2
+ * [1, 0, 3, 2].max # => 3
*
- * With an argument Integer +n+ and no block, returns a new +Array+ with at most +n+ elements,
- * in descending order per method <tt><=></tt>:
+ * With non-negative numeric argument +count+ and no block,
+ * returns a new array with at most +count+ elements,
+ * in descending order, per method <tt>#<=></tt>:
*
- * [0, 1, 2, 3].max(3) # => [3, 2, 1]
- * [0, 1, 2, 3].max(6) # => [3, 2, 1, 0]
+ * [1, 0, 3, 2].max(3) # => [3, 2, 1]
+ * [1, 0, 3, 2].max(3.0) # => [3, 2, 1]
+ * [1, 0, 3, 2].max(9) # => [3, 2, 1, 0]
+ * [1, 0, 3, 2].max(0) # => []
*
- * When a block is given, the block must return an Integer.
+ * With a block given, the block must return a numeric.
*
- * With a block and no argument, calls the block <tt>self.size-1</tt> times to compare elements;
+ * With a block and no argument, calls the block <tt>self.size - 1</tt> times to compare elements;
* returns the element having the maximum value per the block:
*
- * ['0', '00', '000'].max {|a, b| a.size <=> b.size } # => "000"
+ * ['0', '', '000', '00'].max {|a, b| a.size <=> b.size }
+ * # => "000"
*
- * With an argument +n+ and a block, returns a new +Array+ with at most +n+ elements,
- * in descending order per the block:
+ * With non-negative numeric argument +count+ and a block,
+ * returns a new array with at most +count+ elements,
+ * in descending order, per the block:
*
- * ['0', '00', '000'].max(2) {|a, b| a.size <=> b.size } # => ["000", "00"]
+ * ['0', '', '000', '00'].max(2) {|a, b| a.size <=> b.size }
+ * # => ["000", "00"]
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
rb_ary_max(int argc, VALUE *argv, VALUE ary)
@@ -6001,42 +6280,51 @@ ary_min_opt_string(VALUE ary, long i, VALUE vmin)
/*
* call-seq:
- * array.min -> element
- * array.min { |a, b| ... } -> element
- * array.min(n) -> new_array
- * array.min(n) { |a, b| ... } -> new_array
+ * min -> element
+ * min(count) -> new_array
+ * min {|a, b| ... } -> element
+ * min(count) {|a, b| ... } -> new_array
*
* Returns one of the following:
*
* - The minimum-valued element from +self+.
- * - A new +Array+ of minimum-valued elements selected from +self+.
+ * - A new array of minimum-valued elements from +self+.
+ *
+ * Does not modify +self+.
*
- * When no block is given, each element in +self+ must respond to method <tt><=></tt>
- * with an Integer.
+ * With no block given, each element in +self+ must respond to method <tt>#<=></tt>
+ * with a numeric.
*
* With no argument and no block, returns the element in +self+
- * having the minimum value per method <tt><=></tt>:
+ * having the minimum value per method <tt>#<=></tt>:
*
- * [0, 1, 2].min # => 0
+ * [1, 0, 3, 2].min # => 0
*
- * With Integer argument +n+ and no block, returns a new +Array+ with at most +n+ elements,
- * in ascending order per method <tt><=></tt>:
+ * With non-negative numeric argument +count+ and no block,
+ * returns a new array with at most +count+ elements,
+ * in ascending order, per method <tt>#<=></tt>:
*
- * [0, 1, 2, 3].min(3) # => [0, 1, 2]
- * [0, 1, 2, 3].min(6) # => [0, 1, 2, 3]
+ * [1, 0, 3, 2].min(3) # => [0, 1, 2]
+ * [1, 0, 3, 2].min(3.0) # => [0, 1, 2]
+ * [1, 0, 3, 2].min(9) # => [0, 1, 2, 3]
+ * [1, 0, 3, 2].min(0) # => []
*
- * When a block is given, the block must return an Integer.
+ * With a block given, the block must return a numeric.
*
- * With a block and no argument, calls the block <tt>self.size-1</tt> times to compare elements;
+ * With a block and no argument, calls the block <tt>self.size - 1</tt> times to compare elements;
* returns the element having the minimum value per the block:
*
- * ['0', '00', '000'].min { |a, b| a.size <=> b.size } # => "0"
+ * ['0', '', '000', '00'].min {|a, b| a.size <=> b.size }
+ * # => ""
*
- * With an argument +n+ and a block, returns a new +Array+ with at most +n+ elements,
- * in ascending order per the block:
+ * With non-negative numeric argument +count+ and a block,
+ * returns a new array with at most +count+ elements,
+ * in ascending order, per the block:
*
- * ['0', '00', '000'].min(2) {|a, b| a.size <=> b.size } # => ["0", "00"]
+ * ['0', '', '000', '00'].min(2) {|a, b| a.size <=> b.size }
+ * # => ["", "0"]
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
rb_ary_min(int argc, VALUE *argv, VALUE ary)
@@ -6080,26 +6368,25 @@ rb_ary_min(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.minmax -> [min_val, max_val]
- * array.minmax {|a, b| ... } -> [min_val, max_val]
+ * minmax -> array
+ * minmax {|a, b| ... } -> array
*
- * Returns a new 2-element +Array+ containing the minimum and maximum values
- * from +self+, either per method <tt><=></tt> or per a given block:.
+ * Returns a 2-element array containing the minimum-valued and maximum-valued
+ * elements from +self+;
+ * does not modify +self+.
*
- * When no block is given, each element in +self+ must respond to method <tt><=></tt>
- * with an Integer;
- * returns a new 2-element +Array+ containing the minimum and maximum values
- * from +self+, per method <tt><=></tt>:
+ * With no block given, the minimum and maximum values are determined using method <tt>#<=></tt>:
*
- * [0, 1, 2].minmax # => [0, 2]
+ * [1, 0, 3, 2].minmax # => [0, 3]
*
- * When a block is given, the block must return an Integer;
- * the block is called <tt>self.size-1</tt> times to compare elements;
- * returns a new 2-element +Array+ containing the minimum and maximum values
- * from +self+, per the block:
+ * With a block given, the block must return a numeric;
+ * the block is called <tt>self.size - 1</tt> times to compare elements;
+ * returns the elements having the minimum and maximum values per the block:
*
- * ['0', '00', '000'].minmax {|a, b| a.size <=> b.size } # => ["0", "000"]
+ * ['0', '', '000', '00'].minmax {|a, b| a.size <=> b.size }
+ * # => ["", "000"]
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
rb_ary_minmax(VALUE ary)
@@ -6119,32 +6406,30 @@ push_value(st_data_t key, st_data_t val, st_data_t ary)
/*
* call-seq:
- * array.uniq! -> self or nil
- * array.uniq! {|element| ... } -> self or nil
+ * uniq! -> self or nil
+ * uniq! {|element| ... } -> self or nil
*
* Removes duplicate elements from +self+, the first occurrence always being retained;
* returns +self+ if any elements removed, +nil+ otherwise.
*
* With no block given, identifies and removes elements using method <tt>eql?</tt>
- * to compare.
- *
- * Returns +self+ if any elements removed:
+ * to compare elements:
*
* a = [0, 0, 1, 1, 2, 2]
* a.uniq! # => [0, 1, 2]
- *
- * Returns +nil+ if no elements removed.
+ * a.uniq! # => nil
*
* With a block given, calls the block for each element;
- * identifies (using method <tt>eql?</tt>) and removes
- * elements for which the block returns duplicate values.
- *
- * Returns +self+ if any elements removed:
+ * identifies and omits "duplicate" elements using method <tt>eql?</tt>
+ * to compare <i>block return values</i>;
+ * that is, an element is a duplicate if its block return value
+ * is the same as that of a previous element:
*
* a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb']
- * a.uniq! {|element| element.size } # => ['a', 'aa', 'aaa']
+ * a.uniq! {|element| element.size } # => ["a", "aa", "aaa"]
+ * a.uniq! {|element| element.size } # => nil
*
- * Returns +nil+ if no elements removed.
+ * Related: see {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
rb_ary_uniq_bang(VALUE ary)
@@ -6166,7 +6451,7 @@ rb_ary_uniq_bang(VALUE ary)
}
rb_ary_modify_check(ary);
ARY_SET_LEN(ary, 0);
- if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) {
+ if (ARY_SHARED_P(ary)) {
rb_ary_unshare(ary);
FL_SET_EMBED(ary);
}
@@ -6178,25 +6463,28 @@ rb_ary_uniq_bang(VALUE ary)
/*
* call-seq:
- * array.uniq -> new_array
- * array.uniq {|element| ... } -> new_array
+ * uniq -> new_array
+ * uniq {|element| ... } -> new_array
*
- * Returns a new +Array+ containing those elements from +self+ that are not duplicates,
+ * Returns a new array containing those elements from +self+ that are not duplicates,
* the first occurrence always being retained.
*
- * With no block given, identifies and omits duplicates using method <tt>eql?</tt>
- * to compare:
+ * With no block given, identifies and omits duplicate elements using method <tt>eql?</tt>
+ * to compare elements:
*
* a = [0, 0, 1, 1, 2, 2]
* a.uniq # => [0, 1, 2]
*
* With a block given, calls the block for each element;
- * identifies (using method <tt>eql?</tt>) and omits duplicate values,
- * that is, those elements for which the block returns the same value:
+ * identifies and omits "duplicate" elements using method <tt>eql?</tt>
+ * to compare <i>block return values</i>;
+ * that is, an element is a duplicate if its block return value
+ * is the same as that of a previous element:
*
* a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb']
* a.uniq {|element| element.size } # => ["a", "aa", "aaa"]
*
+ * Related: {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -6222,11 +6510,18 @@ rb_ary_uniq(VALUE ary)
/*
* call-seq:
- * array.compact! -> self or nil
+ * compact! -> self or nil
*
- * Removes all +nil+ elements from +self+.
+ * Removes all +nil+ elements from +self+;
+ * Returns +self+ if any elements are removed, +nil+ otherwise:
*
- * Returns +self+ if any elements removed, otherwise +nil+.
+ * a = [nil, 0, nil, false, nil, '', nil, [], nil, {}]
+ * a.compact! # => [0, false, "", [], {}]
+ * a # => [0, false, "", [], {}]
+ * a.compact! # => nil
+ *
+ * Related: Array#compact;
+ * see also {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -6254,12 +6549,16 @@ rb_ary_compact_bang(VALUE ary)
/*
* call-seq:
- * array.compact -> new_array
+ * compact -> new_array
+ *
+ * Returns a new array containing only the non-+nil+ elements from +self+;
+ * element order is preserved:
*
- * Returns a new +Array+ containing all non-+nil+ elements from +self+:
+ * a = [nil, 0, nil, false, nil, '', nil, [], nil, {}]
+ * a.compact # => [0, false, "", [], {}]
*
- * a = [nil, 0, nil, 1, nil, 2, nil]
- * a.compact # => [0, 1, 2]
+ * Related: Array#compact!;
+ * see also {Methods for Deleting}[rdoc-ref:Array@Methods+for+Deleting].
*/
static VALUE
@@ -6272,29 +6571,29 @@ rb_ary_compact(VALUE ary)
/*
* call-seq:
- * array.count -> an_integer
- * array.count(obj) -> an_integer
- * array.count {|element| ... } -> an_integer
+ * count -> integer
+ * count(object) -> integer
+ * count {|element| ... } -> integer
*
* Returns a count of specified elements.
*
* With no argument and no block, returns the count of all elements:
*
- * [0, 1, 2].count # => 3
- * [].count # => 0
+ * [0, :one, 'two', 3, 3.0].count # => 5
*
- * With argument +obj+, returns the count of elements <tt>==</tt> to +obj+:
+ * With argument +object+ given, returns the count of elements <tt>==</tt> to +object+:
*
- * [0, 1, 2, 0.0].count(0) # => 2
- * [0, 1, 2].count(3) # => 0
+ * [0, :one, 'two', 3, 3.0].count(3) # => 2
*
* With no argument and a block given, calls the block with each element;
* returns the count of elements for which the block returns a truthy value:
*
- * [0, 1, 2, 3].count {|element| element > 1} # => 2
+ * [0, 1, 2, 3].count {|element| element > 1 } # => 2
*
- * With argument +obj+ and a block given, issues a warning, ignores the block,
- * and returns the count of elements <tt>==</tt> to +obj+.
+ * With argument +object+ and a block given, issues a warning, ignores the block,
+ * and returns the count of elements <tt>==</tt> to +object+.
+ *
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -6414,33 +6713,37 @@ flatten(VALUE ary, int level)
/*
* call-seq:
- * array.flatten! -> self or nil
- * array.flatten!(level) -> self or nil
+ * flatten!(depth = nil) -> self or nil
+ *
+ * Returns +self+ as a recursively flattening of +self+ to +depth+ levels of recursion;
+ * +depth+ must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects],
+ * or +nil+.
+ * At each level of recursion:
+ *
+ * - Each element that is an array is "flattened"
+ * (that is, replaced by its individual array elements).
+ * - Each element that is not an array is unchanged
+ * (even if the element is an object that has instance method +flatten+).
*
- * Replaces each nested +Array+ in +self+ with the elements from that +Array+;
- * returns +self+ if any changes, +nil+ otherwise.
+ * Returns +nil+ if no elements were flattened.
*
- * With non-negative Integer argument +level+, flattens recursively through +level+ levels:
+ * With non-negative integer argument +depth+, flattens recursively through +depth+ levels:
*
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten!(1) # => [0, 1, [2, 3], 4, 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten!(2) # => [0, 1, 2, 3, 4, 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten!(3) # => [0, 1, 2, 3, 4, 5]
- * [0, 1, 2].flatten!(1) # => nil
+ * a = [ 0, [ 1, [2, 3], 4 ], 5, {foo: 0}, Set.new([6, 7]) ]
+ * a # => [0, [1, [2, 3], 4], 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.dup.flatten!(1) # => [0, 1, [2, 3], 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.dup.flatten!(1.1) # => [0, 1, [2, 3], 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.dup.flatten!(2) # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.dup.flatten!(3) # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
*
- * With no argument, a +nil+ argument, or with negative argument +level+, flattens all levels:
+ * With +nil+ or negative argument +depth+, flattens all levels:
*
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten! # => [0, 1, 2, 3, 4, 5]
- * [0, 1, 2].flatten! # => nil
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten!(-1) # => [0, 1, 2, 3, 4, 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten!(-2) # => [0, 1, 2, 3, 4, 5]
- * [0, 1, 2].flatten!(-1) # => nil
+ * a.dup.flatten! # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.dup.flatten!(-1) # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
*
+ * Related: Array#flatten;
+ * see also {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE
@@ -6458,7 +6761,7 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary)
if (result == ary) {
return Qnil;
}
- if (!(mod = ARY_EMBED_P(result))) rb_obj_freeze(result);
+ if (!(mod = ARY_EMBED_P(result))) rb_ary_freeze(result);
rb_ary_replace(ary, result);
if (mod) ARY_SET_EMBED_LEN(result, 0);
@@ -6467,35 +6770,37 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.flatten -> new_array
- * array.flatten(level) -> new_array
- *
- * Returns a new +Array+ that is a recursive flattening of +self+:
- * - Each non-Array element is unchanged.
- * - Each +Array+ is replaced by its individual elements.
- *
- * With non-negative Integer argument +level+, flattens recursively through +level+ levels:
- *
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten(0) # => [0, [1, [2, 3], 4], 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten(1) # => [0, 1, [2, 3], 4, 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten(2) # => [0, 1, 2, 3, 4, 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten(3) # => [0, 1, 2, 3, 4, 5]
- *
- * With no argument, a +nil+ argument, or with negative argument +level+, flattens all levels:
- *
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten # => [0, 1, 2, 3, 4, 5]
- * [0, 1, 2].flatten # => [0, 1, 2]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten(-1) # => [0, 1, 2, 3, 4, 5]
- * a = [ 0, [ 1, [2, 3], 4 ], 5 ]
- * a.flatten(-2) # => [0, 1, 2, 3, 4, 5]
- * [0, 1, 2].flatten(-1) # => [0, 1, 2]
+ * flatten(depth = nil) -> new_array
+ *
+ * Returns a new array that is a recursive flattening of +self+
+ * to +depth+ levels of recursion;
+ * +depth+ must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]
+ * or +nil+.
+ * At each level of recursion:
+ *
+ * - Each element that is an array is "flattened"
+ * (that is, replaced by its individual array elements).
+ * - Each element that is not an array is unchanged
+ * (even if the element is an object that has instance method +flatten+).
+ *
+ * With non-negative integer argument +depth+, flattens recursively through +depth+ levels:
+ *
+ * a = [ 0, [ 1, [2, 3], 4 ], 5, {foo: 0}, Set.new([6, 7]) ]
+ * a # => [0, [1, [2, 3], 4], 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.flatten(0) # => [0, [1, [2, 3], 4], 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.flatten(1 ) # => [0, 1, [2, 3], 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.flatten(1.1) # => [0, 1, [2, 3], 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.flatten(2) # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.flatten(3) # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ *
+ * With +nil+ or negative +depth+, flattens all levels.
+ *
+ * a.flatten # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
+ * a.flatten(-1) # => [0, 1, 2, 3, 4, 5, {:foo=>0}, #<Set: {6, 7}>]
*
+ * Related: Array#flatten!;
+ * see also {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting].
*/
static VALUE
@@ -6527,7 +6832,7 @@ rb_ary_shuffle_bang(rb_execution_context_t *ec, VALUE ary, VALUE randgen)
rb_ary_modify(ary);
i = len = RARRAY_LEN(ary);
RARRAY_PTR_USE(ary, ptr, {
- while (i) {
+ while (i > 1) {
long j = RAND_UPTO(i);
VALUE tmp;
if (len != RARRAY_LEN(ary) || ptr != RARRAY_CONST_PTR(ary)) {
@@ -6687,6 +6992,12 @@ ary_sample(rb_execution_context_t *ec, VALUE ary, VALUE randgen, VALUE nv, VALUE
}
static VALUE
+ary_sized_alloc(rb_execution_context_t *ec, VALUE self)
+{
+ return rb_ary_new2(RARRAY_LEN(self));
+}
+
+static VALUE
ary_sample0(rb_execution_context_t *ec, VALUE ary)
{
return ary_sample(ec, ary, rb_cRandom, Qfalse, Qfalse);
@@ -6710,36 +7021,36 @@ rb_ary_cycle_size(VALUE self, VALUE args, VALUE eobj)
/*
* call-seq:
- * array.cycle {|element| ... } -> nil
- * array.cycle(count) {|element| ... } -> nil
- * array.cycle -> new_enumerator
- * array.cycle(count) -> new_enumerator
+ * cycle(count = nil) {|element| ... } -> nil
+ * cycle(count = nil) -> new_enumerator
+ *
+ * With a block given, may call the block, depending on the value of argument +count+;
+ * +count+ must be an
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects],
+ * or +nil+.
*
- * When called with positive Integer argument +count+ and a block,
- * calls the block with each element, then does so again,
+ * When +count+ is positive,
+ * calls the block with each element, then does so repeatedly,
* until it has done so +count+ times; returns +nil+:
*
* output = []
* [0, 1].cycle(2) {|element| output.push(element) } # => nil
* output # => [0, 1, 0, 1]
*
- * If +count+ is zero or negative, does not call the block:
+ * When +count+ is zero or negative, does not call the block:
*
- * [0, 1].cycle(0) {|element| fail 'Cannot happen' } # => nil
+ * [0, 1].cycle(0) {|element| fail 'Cannot happen' } # => nil
* [0, 1].cycle(-1) {|element| fail 'Cannot happen' } # => nil
*
- * When a block is given, and argument is omitted or +nil+, cycles forever:
+ * When +count+ is +nil+, cycles forever:
*
* # Prints 0 and 1 forever.
* [0, 1].cycle {|element| puts element }
* [0, 1].cycle(nil) {|element| puts element }
*
- * When no block is given, returns a new Enumerator:
- *
- * [0, 1].cycle(2) # => #<Enumerator: [0, 1]:cycle(2)>
- * [0, 1].cycle # => # => #<Enumerator: [0, 1]:cycle>
- * [0, 1].cycle.first(5) # => [0, 1, 0, 1, 0]
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].
*/
static VALUE
rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
@@ -6883,82 +7194,44 @@ rb_ary_permutation_size(VALUE ary, VALUE args, VALUE eobj)
/*
* call-seq:
- * array.permutation {|element| ... } -> self
- * array.permutation(n) {|element| ... } -> self
- * array.permutation -> new_enumerator
- * array.permutation(n) -> new_enumerator
- *
- * When invoked with a block, yield all permutations of elements of +self+; returns +self+.
- * The order of permutations is indeterminate.
+ * permutation(count = self.size) {|permutation| ... } -> self
+ * permutation(count = self.size) -> new_enumerator
*
- * When a block and an in-range positive Integer argument +n+ (<tt>0 < n <= self.size</tt>)
- * are given, calls the block with all +n+-tuple permutations of +self+.
+ * Iterates over permutations of the elements of +self+;
+ * the order of permutations is indeterminate.
*
- * Example:
- *
- * a = [0, 1, 2]
- * a.permutation(2) {|permutation| p permutation }
- *
- * Output:
- *
- * [0, 1]
- * [0, 2]
- * [1, 0]
- * [1, 2]
- * [2, 0]
- * [2, 1]
- *
- * Another example:
+ * With a block and an in-range positive integer argument +count+ (<tt>0 < count <= self.size</tt>) given,
+ * calls the block with each permutation of +self+ of size +count+;
+ * returns +self+:
*
* a = [0, 1, 2]
- * a.permutation(3) {|permutation| p permutation }
+ * perms = []
+ * a.permutation(1) {|perm| perms.push(perm) }
+ * perms # => [[0], [1], [2]]
*
- * Output:
- *
- * [0, 1, 2]
- * [0, 2, 1]
- * [1, 0, 2]
- * [1, 2, 0]
- * [2, 0, 1]
- * [2, 1, 0]
+ * perms = []
+ * a.permutation(2) {|perm| perms.push(perm) }
+ * perms # => [[0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1]]
*
- * When +n+ is zero, calls the block once with a new empty +Array+:
+ * perms = []
+ * a.permutation(3) {|perm| perms.push(perm) }
+ * perms # => [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
*
- * a = [0, 1, 2]
- * a.permutation(0) {|permutation| p permutation }
+ * When +count+ is zero, calls the block once with a new empty array:
*
- * Output:
+ * perms = []
+ * a.permutation(0) {|perm| perms.push(perm) }
+ * perms # => [[]]
*
- * []
- *
- * When +n+ is out of range (negative or larger than <tt>self.size</tt>),
+ * When +count+ is out of range (negative or larger than <tt>self.size</tt>),
* does not call the block:
*
- * a = [0, 1, 2]
* a.permutation(-1) {|permutation| fail 'Cannot happen' }
* a.permutation(4) {|permutation| fail 'Cannot happen' }
*
- * When a block given but no argument,
- * behaves the same as <tt>a.permutation(a.size)</tt>:
- *
- * a = [0, 1, 2]
- * a.permutation {|permutation| p permutation }
- *
- * Output:
- *
- * [0, 1, 2]
- * [0, 2, 1]
- * [1, 0, 2]
- * [1, 2, 0]
- * [2, 0, 1]
- * [2, 1, 0]
- *
- * Returns a new Enumerator if no block given:
- *
- * a = [0, 1, 2]
- * a.permutation # => #<Enumerator: [0, 1, 2]:permutation>
- * a.permutation(2) # => #<Enumerator: [0, 1, 2]:permutation(2)>
+ * With no block given, returns a new Enumerator.
*
+ * Related: {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].
*/
static VALUE
@@ -7031,56 +7304,46 @@ rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
/*
* call-seq:
- * array.combination(n) {|element| ... } -> self
- * array.combination(n) -> new_enumerator
- *
- * Calls the block, if given, with combinations of elements of +self+;
- * returns +self+. The order of combinations is indeterminate.
+ * combination(count) {|element| ... } -> self
+ * combination(count) -> new_enumerator
*
- * When a block and an in-range positive Integer argument +n+ (<tt>0 < n <= self.size</tt>)
- * are given, calls the block with all +n+-tuple combinations of +self+.
- *
- * Example:
+ * When a block and a positive
+ * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]
+ * argument +count+ (<tt>0 < count <= self.size</tt>)
+ * are given, calls the block with each combination of +self+ of size +count+;
+ * returns +self+:
*
- * a = [0, 1, 2]
- * a.combination(2) {|combination| p combination }
+ * a = %w[a b c] # => ["a", "b", "c"]
+ * a.combination(2) {|combination| p combination } # => ["a", "b", "c"]
*
* Output:
*
- * [0, 1]
- * [0, 2]
- * [1, 2]
- *
- * Another example:
- *
- * a = [0, 1, 2]
- * a.combination(3) {|combination| p combination }
+ * ["a", "b"]
+ * ["a", "c"]
+ * ["b", "c"]
*
- * Output:
+ * The order of the yielded combinations is not guaranteed.
*
- * [0, 1, 2]
+ * When +count+ is zero, calls the block once with a new empty array:
*
- * When +n+ is zero, calls the block once with a new empty +Array+:
- *
- * a = [0, 1, 2]
- * a1 = a.combination(0) {|combination| p combination }
+ * a.combination(0) {|combination| p combination }
+ * [].combination(0) {|combination| p combination }
*
* Output:
*
* []
+ * []
*
- * When +n+ is out of range (negative or larger than <tt>self.size</tt>),
+ * When +count+ is negative or larger than +self.size+ and +self+ is non-empty,
* does not call the block:
*
- * a = [0, 1, 2]
- * a.combination(-1) {|combination| fail 'Cannot happen' }
- * a.combination(4) {|combination| fail 'Cannot happen' }
- *
- * Returns a new Enumerator if no block given:
+ * a.combination(-1) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
+ * a.combination(4) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
*
- * a = [0, 1, 2]
- * a.combination(2) # => #<Enumerator: [0, 1, 2]:combination(2)>
+ * With no block given, returns a new Enumerator.
*
+ * Related: Array#permutation;
+ * see also {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].
*/
static VALUE
@@ -7167,68 +7430,41 @@ rb_ary_repeated_permutation_size(VALUE ary, VALUE args, VALUE eobj)
/*
* call-seq:
- * array.repeated_permutation(n) {|permutation| ... } -> self
- * array.repeated_permutation(n) -> new_enumerator
+ * repeated_permutation(size) {|permutation| ... } -> self
+ * repeated_permutation(size) -> new_enumerator
*
- * Calls the block with each repeated permutation of length +n+ of the elements of +self+;
- * each permutation is an +Array+;
+ * With a block given, calls the block with each repeated permutation of length +size+
+ * of the elements of +self+;
+ * each permutation is an array;
* returns +self+. The order of the permutations is indeterminate.
*
- * When a block and a positive Integer argument +n+ are given, calls the block with each
- * +n+-tuple repeated permutation of the elements of +self+.
- * The number of permutations is <tt>self.size**n</tt>.
+ * If a positive integer argument +size+ is given,
+ * calls the block with each +size+-tuple repeated permutation of the elements of +self+.
+ * The number of permutations is <tt>self.size**size</tt>.
*
- * +n+ = 1:
- *
- * a = [0, 1, 2]
- * a.repeated_permutation(1) {|permutation| p permutation }
- *
- * Output:
- *
- * [0]
- * [1]
- * [2]
- *
- * +n+ = 2:
- *
- * a.repeated_permutation(2) {|permutation| p permutation }
- *
- * Output:
+ * Examples:
*
- * [0, 0]
- * [0, 1]
- * [0, 2]
- * [1, 0]
- * [1, 1]
- * [1, 2]
- * [2, 0]
- * [2, 1]
- * [2, 2]
+ * - +size+ is 1:
*
- * If +n+ is zero, calls the block once with an empty +Array+.
+ * p = []
+ * [0, 1, 2].repeated_permutation(1) {|permutation| p.push(permutation) }
+ * p # => [[0], [1], [2]]
*
- * If +n+ is negative, does not call the block:
+ * - +size+ is 2:
*
- * a.repeated_permutation(-1) {|permutation| fail 'Cannot happen' }
+ * p = []
+ * [0, 1, 2].repeated_permutation(2) {|permutation| p.push(permutation) }
+ * p # => [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
*
- * Returns a new Enumerator if no block given:
+ * If +size+ is zero, calls the block once with an empty array.
*
- * a = [0, 1, 2]
- * a.repeated_permutation(2) # => #<Enumerator: [0, 1, 2]:permutation(2)>
+ * If +size+ is negative, does not call the block:
*
- * Using Enumerators, it's convenient to show the permutations and counts
- * for some values of +n+:
+ * [0, 1, 2].repeated_permutation(-1) {|permutation| fail 'Cannot happen' }
*
- * e = a.repeated_permutation(0)
- * e.size # => 1
- * e.to_a # => [[]]
- * e = a.repeated_permutation(1)
- * e.size # => 3
- * e.to_a # => [[0], [1], [2]]
- * e = a.repeated_permutation(2)
- * e.size # => 9
- * e.to_a # => [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
rb_ary_repeated_permutation(VALUE ary, VALUE num)
@@ -7299,65 +7535,41 @@ rb_ary_repeated_combination_size(VALUE ary, VALUE args, VALUE eobj)
/*
* call-seq:
- * array.repeated_combination(n) {|combination| ... } -> self
- * array.repeated_combination(n) -> new_enumerator
+ * repeated_combination(size) {|combination| ... } -> self
+ * repeated_combination(size) -> new_enumerator
*
- * Calls the block with each repeated combination of length +n+ of the elements of +self+;
- * each combination is an +Array+;
+ * With a block given, calls the block with each repeated combination of length +size+
+ * of the elements of +self+;
+ * each combination is an array;
* returns +self+. The order of the combinations is indeterminate.
*
- * When a block and a positive Integer argument +n+ are given, calls the block with each
- * +n+-tuple repeated combination of the elements of +self+.
- * The number of combinations is <tt>(n+1)(n+2)/2</tt>.
+ * If a positive integer argument +size+ is given,
+ * calls the block with each +size+-tuple repeated combination of the elements of +self+.
+ * The number of combinations is <tt>(size+1)(size+2)/2</tt>.
*
- * +n+ = 1:
- *
- * a = [0, 1, 2]
- * a.repeated_combination(1) {|combination| p combination }
- *
- * Output:
- *
- * [0]
- * [1]
- * [2]
- *
- * +n+ = 2:
- *
- * a.repeated_combination(2) {|combination| p combination }
- *
- * Output:
+ * Examples:
*
- * [0, 0]
- * [0, 1]
- * [0, 2]
- * [1, 1]
- * [1, 2]
- * [2, 2]
+ * - +size+ is 1:
*
- * If +n+ is zero, calls the block once with an empty +Array+.
+ * c = []
+ * [0, 1, 2].repeated_combination(1) {|combination| c.push(combination) }
+ * c # => [[0], [1], [2]]
*
- * If +n+ is negative, does not call the block:
+ * - +size+ is 2:
*
- * a.repeated_combination(-1) {|combination| fail 'Cannot happen' }
+ * c = []
+ * [0, 1, 2].repeated_combination(2) {|combination| c.push(combination) }
+ * c # => [[0, 0], [0, 1], [0, 2], [1, 1], [1, 2], [2, 2]]
*
- * Returns a new Enumerator if no block given:
+ * If +size+ is zero, calls the block once with an empty array.
*
- * a = [0, 1, 2]
- * a.repeated_combination(2) # => #<Enumerator: [0, 1, 2]:combination(2)>
+ * If +size+ is negative, does not call the block:
*
- * Using Enumerators, it's convenient to show the combinations and counts
- * for some values of +n+:
+ * [0, 1, 2].repeated_combination(-1) {|combination| fail 'Cannot happen' }
*
- * e = a.repeated_combination(0)
- * e.size # => 1
- * e.to_a # => [[]]
- * e = a.repeated_combination(1)
- * e.size # => 3
- * e.to_a # => [[0], [1], [2]]
- * e = a.repeated_combination(2)
- * e.size # => 6
- * e.to_a # => [[0, 0], [0, 1], [0, 2], [1, 1], [1, 2], [2, 2]]
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -7397,62 +7609,55 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
/*
* call-seq:
- * array.product(*other_arrays) -> new_array
- * array.product(*other_arrays) {|combination| ... } -> self
+ * product(*other_arrays) -> new_array
+ * product(*other_arrays) {|combination| ... } -> self
*
- * Computes and returns or yields all combinations of elements from all the Arrays,
+ * Computes all combinations of elements from all the arrays,
* including both +self+ and +other_arrays+:
*
* - The number of combinations is the product of the sizes of all the arrays,
* including both +self+ and +other_arrays+.
* - The order of the returned combinations is indeterminate.
*
- * When no block is given, returns the combinations as an +Array+ of Arrays:
+ * With no block given, returns the combinations as an array of arrays:
*
- * a = [0, 1, 2]
- * a1 = [3, 4]
- * a2 = [5, 6]
- * p = a.product(a1)
- * p.size # => 6 # a.size * a1.size
- * p # => [[0, 3], [0, 4], [1, 3], [1, 4], [2, 3], [2, 4]]
- * p = a.product(a1, a2)
- * p.size # => 12 # a.size * a1.size * a2.size
- * p # => [[0, 3, 5], [0, 3, 6], [0, 4, 5], [0, 4, 6], [1, 3, 5], [1, 3, 6], [1, 4, 5], [1, 4, 6], [2, 3, 5], [2, 3, 6], [2, 4, 5], [2, 4, 6]]
- *
- * If any argument is an empty +Array+, returns an empty +Array+.
- *
- * If no argument is given, returns an +Array+ of 1-element Arrays,
- * each containing an element of +self+:
+ * p = [0, 1].product([2, 3])
+ * # => [[0, 2], [0, 3], [1, 2], [1, 3]]
+ * p.size # => 4
+ * p = [0, 1].product([2, 3], [4, 5])
+ * # => [[0, 2, 4], [0, 2, 5], [0, 3, 4], [0, 3, 5], [1, 2, 4], [1, 2, 5], [1, 3, 4], [1, 3,...
+ * p.size # => 8
*
- * a.product # => [[0], [1], [2]]
+ * If +self+ or any argument is empty, returns an empty array:
*
- * When a block is given, yields each combination as an +Array+; returns +self+:
+ * [].product([2, 3], [4, 5]) # => []
+ * [0, 1].product([2, 3], []) # => []
*
- * a.product(a1) {|combination| p combination }
- *
- * Output:
+ * If no argument is given, returns an array of 1-element arrays,
+ * each containing an element of +self+:
*
- * [0, 3]
- * [0, 4]
- * [1, 3]
- * [1, 4]
- * [2, 3]
- * [2, 4]
+ * a.product # => [[0], [1], [2]]
*
- * If any argument is an empty +Array+, does not call the block:
+ * With a block given, calls the block with each combination; returns +self+:
*
- * a.product(a1, a2, []) {|combination| fail 'Cannot happen' }
+ * p = []
+ * [0, 1].product([2, 3]) {|combination| p.push(combination) }
+ * p # => [[0, 2], [0, 3], [1, 2], [1, 3]]
*
- * If no argument is given, yields each element of +self+ as a 1-element +Array+:
+ * If +self+ or any argument is empty, does not call the block:
*
- * a.product {|combination| p combination }
+ * [].product([2, 3], [4, 5]) {|combination| fail 'Cannot happen' }
+ * # => []
+ * [0, 1].product([2, 3], []) {|combination| fail 'Cannot happen' }
+ * # => [0, 1]
*
- * Output:
+ * If no argument is given, calls the block with each element of +self+ as a 1-element array:
*
- * [0]
- * [1]
- * [2]
+ * p = []
+ * [0, 1].product {|combination| p.push(combination) }
+ * p # => [[0], [1]]
*
+ * Related: see {Methods for Combining}[rdoc-ref:Array@Methods+for+Combining].
*/
static VALUE
@@ -7545,20 +7750,20 @@ done:
/*
* call-seq:
- * array.take(n) -> new_array
+ * take(count) -> new_array
*
- * Returns a new +Array+ containing the first +n+ element of +self+,
- * where +n+ is a non-negative Integer;
- * does not modify +self+.
+ * Returns a new array containing the first +count+ element of +self+
+ * (as available);
+ * +count+ must be a non-negative numeric;
+ * does not modify +self+:
*
- * Examples:
- *
- * a = [0, 1, 2, 3, 4, 5]
- * a.take(1) # => [0]
- * a.take(2) # => [0, 1]
- * a.take(50) # => [0, 1, 2, 3, 4, 5]
- * a # => [0, 1, 2, 3, 4, 5]
+ * a = ['a', 'b', 'c', 'd']
+ * a.take(2) # => ["a", "b"]
+ * a.take(2.1) # => ["a", "b"]
+ * a.take(50) # => ["a", "b", "c", "d"]
+ * a.take(0) # => []
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -7573,25 +7778,23 @@ rb_ary_take(VALUE obj, VALUE n)
/*
* call-seq:
- * array.take_while {|element| ... } -> new_array
- * array.take_while -> new_enumerator
- *
- * Returns a new +Array+ containing zero or more leading elements of +self+;
- * does not modify +self+.
+ * take_while {|element| ... } -> new_array
+ * take_while -> new_enumerator
*
* With a block given, calls the block with each successive element of +self+;
- * stops if the block returns +false+ or +nil+;
- * returns a new +Array+ containing those elements for which the block returned a truthy value:
+ * stops iterating if the block returns +false+ or +nil+;
+ * returns a new array containing those elements for which the block returned a truthy value:
*
* a = [0, 1, 2, 3, 4, 5]
* a.take_while {|element| element < 3 } # => [0, 1, 2]
- * a.take_while {|element| true } # => [0, 1, 2, 3, 4, 5]
- * a # => [0, 1, 2, 3, 4, 5]
+ * a.take_while {|element| true } # => [0, 1, 2, 3, 4, 5]
+ * a.take_while {|element| false } # => []
*
- * With no block given, returns a new Enumerator:
+ * With no block given, returns a new Enumerator.
*
- * [0, 1].take_while # => #<Enumerator: [0, 1]:take_while>
+ * Does not modify +self+.
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -7608,10 +7811,10 @@ rb_ary_take_while(VALUE ary)
/*
* call-seq:
- * array.drop(n) -> new_array
+ * drop(count) -> new_array
*
- * Returns a new +Array+ containing all but the first +n+ element of +self+,
- * where +n+ is a non-negative Integer;
+ * Returns a new array containing all but the first +count+ element of +self+,
+ * where +count+ is a non-negative integer;
* does not modify +self+.
*
* Examples:
@@ -7620,7 +7823,9 @@ rb_ary_take_while(VALUE ary)
* a.drop(0) # => [0, 1, 2, 3, 4, 5]
* a.drop(1) # => [1, 2, 3, 4, 5]
* a.drop(2) # => [2, 3, 4, 5]
+ * a.drop(9) # => []
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -7639,23 +7844,20 @@ rb_ary_drop(VALUE ary, VALUE n)
/*
* call-seq:
- * array.drop_while {|element| ... } -> new_array
- * array.drop_while -> new_enumerator
-
- * Returns a new +Array+ containing zero or more trailing elements of +self+;
- * does not modify +self+.
+ * drop_while {|element| ... } -> new_array
+ * drop_while -> new_enumerator
*
* With a block given, calls the block with each successive element of +self+;
* stops if the block returns +false+ or +nil+;
- * returns a new +Array+ _omitting_ those elements for which the block returned a truthy value:
+ * returns a new array _omitting_ those elements for which the block returned a truthy value;
+ * does not modify +self+:
*
* a = [0, 1, 2, 3, 4, 5]
* a.drop_while {|element| element < 3 } # => [3, 4, 5]
*
- * With no block given, returns a new Enumerator:
- *
- * [0, 1].drop_while # => # => #<Enumerator: [0, 1]:drop_while>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -7672,38 +7874,41 @@ rb_ary_drop_while(VALUE ary)
/*
* call-seq:
- * array.any? -> true or false
- * array.any? {|element| ... } -> true or false
- * array.any?(obj) -> true or false
+ * any? -> true or false
+ * any?(object) -> true or false
+ * any? {|element| ... } -> true or false
*
- * Returns +true+ if any element of +self+ meets a given criterion.
+ * Returns whether for any element of +self+, a given criterion is satisfied.
*
- * If +self+ has no element, returns +false+ and argument or block
- * are not used.
+ * With no block and no argument, returns whether any element of +self+ is truthy:
*
- * With no block given and no argument, returns +true+ if +self+ has any truthy element,
- * +false+ otherwise:
+ * [nil, false, []].any? # => true # Array object is truthy.
+ * [nil, false, {}].any? # => true # Hash object is truthy.
+ * [nil, false, ''].any? # => true # String object is truthy.
+ * [nil, false].any? # => false # Nil and false are not truthy.
*
- * [nil, 0, false].any? # => true
- * [nil, false].any? # => false
- * [].any? # => false
+ * With argument +object+ given,
+ * returns whether <tt>object === ele</tt> for any element +ele+ in +self+:
*
- * With a block given and no argument, calls the block with each element in +self+;
- * returns +true+ if the block returns any truthy value, +false+ otherwise:
+ * [nil, false, 0].any?(0) # => true
+ * [nil, false, 1].any?(0) # => false
+ * [nil, false, 'food'].any?(/foo/) # => true
+ * [nil, false, 'food'].any?(/bar/) # => false
*
- * [0, 1, 2].any? {|element| element > 1 } # => true
- * [0, 1, 2].any? {|element| element > 2 } # => false
+ * With a block given,
+ * calls the block with each element in +self+;
+ * returns whether the block returns any truthy value:
*
- * If argument +obj+ is given, returns +true+ if +obj+.<tt>===</tt> any element,
- * +false+ otherwise:
+ * [0, 1, 2].any? {|ele| ele < 1 } # => true
+ * [0, 1, 2].any? {|ele| ele < 0 } # => false
+ *
+ * With both a block and argument +object+ given,
+ * ignores the block and uses +object+ as above.
*
- * ['food', 'drink'].any?(/foo/) # => true
- * ['food', 'drink'].any?(/bar/) # => false
- * [].any?(/foo/) # => false
- * [0, 1, 2].any?(1) # => true
- * [0, 1, 2].any?(3) # => false
+ * <b>Special case</b>: returns +false+ if +self+ is empty
+ * (regardless of any given argument or block).
*
- * Related: Enumerable#any?
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -7736,37 +7941,41 @@ rb_ary_any_p(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.all? -> true or false
- * array.all? {|element| ... } -> true or false
- * array.all?(obj) -> true or false
+ * all? -> true or false
+ * all?(object) -> true or false
+ * all? {|element| ... } -> true or false
*
- * Returns +true+ if all elements of +self+ meet a given criterion.
+ * Returns whether for every element of +self+,
+ * a given criterion is satisfied.
*
- * If +self+ has no element, returns +true+ and argument or block
- * are not used.
+ * With no block and no argument,
+ * returns whether every element of +self+ is truthy:
*
- * With no block given and no argument, returns +true+ if +self+ contains only truthy elements,
- * +false+ otherwise:
+ * [[], {}, '', 0, 0.0, Object.new].all? # => true # All truthy objects.
+ * [[], {}, '', 0, 0.0, nil].all? # => false # nil is not truthy.
+ * [[], {}, '', 0, 0.0, false].all? # => false # false is not truthy.
+ *
+ * With argument +object+ given, returns whether <tt>object === ele</tt>
+ * for every element +ele+ in +self+:
*
- * [0, 1, :foo].all? # => true
- * [0, nil, 2].all? # => false
- * [].all? # => true
+ * [0, 0, 0].all?(0) # => true
+ * [0, 1, 2].all?(1) # => false
+ * ['food', 'fool', 'foot'].all?(/foo/) # => true
+ * ['food', 'drink'].all?(/foo/) # => false
*
- * With a block given and no argument, calls the block with each element in +self+;
- * returns +true+ if the block returns only truthy values, +false+ otherwise:
+ * With a block given, calls the block with each element in +self+;
+ * returns whether the block returns only truthy values:
*
- * [0, 1, 2].all? { |element| element < 3 } # => true
- * [0, 1, 2].all? { |element| element < 2 } # => false
+ * [0, 1, 2].all? { |ele| ele < 3 } # => true
+ * [0, 1, 2].all? { |ele| ele < 2 } # => false
*
- * If argument +obj+ is given, returns +true+ if <tt>obj.===</tt> every element, +false+ otherwise:
+ * With both a block and argument +object+ given,
+ * ignores the block and uses +object+ as above.
*
- * ['food', 'fool', 'foot'].all?(/foo/) # => true
- * ['food', 'drink'].all?(/bar/) # => false
- * [].all?(/foo/) # => true
- * [0, 0, 0].all?(0) # => true
- * [0, 1, 2].all?(1) # => false
+ * <b>Special case</b>: returns +true+ if +self+ is empty
+ * (regardless of any given argument or block).
*
- * Related: Enumerable#all?
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -7799,34 +8008,35 @@ rb_ary_all_p(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.none? -> true or false
- * array.none? {|element| ... } -> true or false
- * array.none?(obj) -> true or false
+ * none? -> true or false
+ * none?(object) -> true or false
+ * none? {|element| ... } -> true or false
*
- * Returns +true+ if no element of +self+ meet a given criterion.
+ * Returns +true+ if no element of +self+ meets a given criterion, +false+ otherwise.
*
* With no block given and no argument, returns +true+ if +self+ has no truthy elements,
* +false+ otherwise:
*
- * [nil, false].none? # => true
+ * [nil, false].none? # => true
* [nil, 0, false].none? # => false
- * [].none? # => true
+ * [].none? # => true
*
- * With a block given and no argument, calls the block with each element in +self+;
+ * With argument +object+ given, returns +false+ if for any element +element+,
+ * <tt>object === element</tt>; +true+ otherwise:
+ *
+ * ['food', 'drink'].none?(/bar/) # => true
+ * ['food', 'drink'].none?(/foo/) # => false
+ * [].none?(/foo/) # => true
+ * [0, 1, 2].none?(3) # => true
+ * [0, 1, 2].none?(1) # => false
+ *
+ * With a block given, calls the block with each element in +self+;
* returns +true+ if the block returns no truthy value, +false+ otherwise:
*
* [0, 1, 2].none? {|element| element > 3 } # => true
* [0, 1, 2].none? {|element| element > 1 } # => false
*
- * If argument +obj+ is given, returns +true+ if <tt>obj.===</tt> no element, +false+ otherwise:
- *
- * ['food', 'drink'].none?(/bar/) # => true
- * ['food', 'drink'].none?(/foo/) # => false
- * [].none?(/foo/) # => true
- * [0, 1, 2].none?(3) # => true
- * [0, 1, 2].none?(1) # => false
- *
- * Related: Enumerable#none?
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -7859,9 +8069,9 @@ rb_ary_none_p(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.one? -> true or false
- * array.one? {|element| ... } -> true or false
- * array.one?(obj) -> true or false
+ * one? -> true or false
+ * one? {|element| ... } -> true or false
+ * one?(object) -> true or false
*
* Returns +true+ if exactly one element of +self+ meets a given criterion.
*
@@ -7873,14 +8083,14 @@ rb_ary_none_p(int argc, VALUE *argv, VALUE ary)
* [nil, nil].one? # => false
* [].one? # => false
*
- * With a block given and no argument, calls the block with each element in +self+;
+ * With a block given, calls the block with each element in +self+;
* returns +true+ if the block a truthy value for exactly one element, +false+ otherwise:
*
* [0, 1, 2].one? {|element| element > 0 } # => false
* [0, 1, 2].one? {|element| element > 1 } # => true
* [0, 1, 2].one? {|element| element > 2 } # => false
*
- * If argument +obj+ is given, returns +true+ if <tt>obj.===</tt> exactly one element,
+ * With argument +object+ given, returns +true+ if for exactly one element +element+, <tt>object === element</tt>;
* +false+ otherwise:
*
* [0, 1, 2].one?(0) # => true
@@ -7890,7 +8100,7 @@ rb_ary_none_p(int argc, VALUE *argv, VALUE ary)
* ['food', 'drink'].one?(/foo/) # => true
* [].one?(/foo/) # => false
*
- * Related: Enumerable#one?
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
@@ -7933,11 +8143,11 @@ rb_ary_one_p(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
- * array.dig(index, *identifiers) -> object
+ * dig(index, *identifiers) -> object
*
- * Finds and returns the object in nested objects
- * that is specified by +index+ and +identifiers+.
- * The nested objects may be instances of various classes.
+ * Finds and returns the object in nested object
+ * specified by +index+ and +identifiers+;
+ * the nested objects may be instances of various classes.
* See {Dig Methods}[rdoc-ref:dig_methods.rdoc].
*
* Examples:
@@ -7948,6 +8158,7 @@ rb_ary_one_p(int argc, VALUE *argv, VALUE ary)
* a.dig(1, 2, 0) # => :bat
* a.dig(1, 2, 3) # => nil
*
+ * Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
@@ -7976,40 +8187,41 @@ finish_exact_sum(long n, VALUE r, VALUE v, int z)
/*
* call-seq:
- * array.sum(init = 0) -> object
- * array.sum(init = 0) {|element| ... } -> object
+ * sum(init = 0) -> object
+ * sum(init = 0) {|element| ... } -> object
*
- * When no block is given, returns the object equivalent to:
+ * With no block given, returns the sum of +init+ and all elements of +self+;
+ * for array +array+ and value +init+, equivalent to:
*
* sum = init
* array.each {|element| sum += element }
* sum
*
- * For example, <tt>[e1, e2, e3].sum</tt> returns <tt>init + e1 + e2 + e3</tt>.
+ * For example, <tt>[e0, e1, e2].sum</tt> returns <tt>init + e0 + e1 + e2</tt>.
*
* Examples:
*
- * a = [0, 1, 2, 3]
- * a.sum # => 6
- * a.sum(100) # => 106
+ * [0, 1, 2, 3].sum # => 6
+ * [0, 1, 2, 3].sum(100) # => 106
+ * ['abc', 'def', 'ghi'].sum('jkl') # => "jklabcdefghi"
+ * [[:foo, :bar], ['foo', 'bar']].sum([2, 3])
+ * # => [2, 3, :foo, :bar, "foo", "bar"]
*
- * The elements need not be numeric, but must be <tt>+</tt>-compatible
- * with each other and with +init+:
+ * The +init+ value and elements need not be numeric, but must all be <tt>+</tt>-compatible:
*
- * a = ['abc', 'def', 'ghi']
- * a.sum('jkl') # => "jklabcdefghi"
+ * # Raises TypeError: Array can't be coerced into Integer.
+ * [[:foo, :bar], ['foo', 'bar']].sum(2)
*
- * When a block is given, it is called with each element
- * and the block's return value (instead of the element itself) is used as the addend:
+ * With a block given, calls the block with each element of +self+;
+ * the block's return value (instead of the element itself) is used as the addend:
*
- * a = ['zero', 1, :two]
- * s = a.sum('Coerced and concatenated: ') {|element| element.to_s }
- * s # => "Coerced and concatenated: zero1two"
+ * ['zero', 1, :two].sum('Coerced and concatenated: ') {|element| element.to_s }
+ * # => "Coerced and concatenated: zero1two"
*
* Notes:
*
* - Array#join and Array#flatten may be faster than Array#sum
- * for an +Array+ of Strings or an +Array+ of Arrays.
+ * for an array of strings or an array of arrays.
* - Array#sum method may not respect method redefinition of "+" methods such as Integer#+.
*
*/
@@ -8139,15 +8351,37 @@ rb_ary_deconstruct(VALUE ary)
}
/*
- * An +Array+ is an ordered, integer-indexed collection of objects, called _elements_.
- * Any object (even another array) may be an array element,
- * and an array can contain objects of different types.
+ * An \Array object is an ordered, integer-indexed collection of objects,
+ * called _elements_;
+ * the object represents
+ * an {array data structure}[https://en.wikipedia.org/wiki/Array_(data_structure)].
*
- * == +Array+ Indexes
+ * An element may be any object (even another array);
+ * elements may be any mixture of objects of different types.
*
- * +Array+ indexing starts at 0, as in C or Java.
+ * Important data structures that use arrays include:
*
- * A positive index is an offset from the first element:
+ * - {Coordinate vector}[https://en.wikipedia.org/wiki/Coordinate_vector].
+ * - {Matrix}[https://en.wikipedia.org/wiki/Matrix_(mathematics)].
+ * - {Heap}[https://en.wikipedia.org/wiki/Heap_(data_structure)].
+ * - {Hash table}[https://en.wikipedia.org/wiki/Hash_table].
+ * - {Deque (double-ended queue)}[https://en.wikipedia.org/wiki/Double-ended_queue].
+ * - {Queue}[https://en.wikipedia.org/wiki/Queue_(abstract_data_type)].
+ * - {Stack}[https://en.wikipedia.org/wiki/Stack_(abstract_data_type)].
+ *
+ * There are also array-like data structures:
+ *
+ * - {Associative array}[https://en.wikipedia.org/wiki/Associative_array] (see Hash).
+ * - {Directory}[https://en.wikipedia.org/wiki/Directory_(computing)] (see Dir).
+ * - {Environment}[https://en.wikipedia.org/wiki/Environment_variable] (see ENV).
+ * - {Set}[https://en.wikipedia.org/wiki/Set_(abstract_data_type)] (see Set).
+ * - {String}[https://en.wikipedia.org/wiki/String_(computer_science)] (see String).
+ *
+ * == \Array Indexes
+ *
+ * \Array indexing starts at 0, as in C or Java.
+ *
+ * A non-negative index is an offset from the first element:
*
* - Index 0 indicates the first element.
* - Index 1 indicates the second element.
@@ -8159,6 +8393,9 @@ rb_ary_deconstruct(VALUE ary)
* - Index -2 indicates the next-to-last element.
* - ...
*
+ *
+ * === In-Range and Out-of-Range Indexes
+ *
* A non-negative index is <i>in range</i> if and only if it is smaller than
* the size of the array. For a 3-element array:
*
@@ -8171,31 +8408,32 @@ rb_ary_deconstruct(VALUE ary)
* - Indexes -1 through -3 are in range.
* - Index -4 is out of range.
*
+ * === Effective Index
+ *
* Although the effective index into an array is always an integer,
- * some methods (both within and outside of class +Array+)
+ * some methods (both within class \Array and elsewhere)
* accept one or more non-integer arguments that are
* {integer-convertible objects}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
*
- *
* == Creating Arrays
*
- * You can create an +Array+ object explicitly with:
+ * You can create an \Array object explicitly with:
*
- * - An {array literal}[rdoc-ref:literals.rdoc@Array+Literals]:
+ * - An {array literal}[rdoc-ref:syntax/literals.rdoc@Array+Literals]:
*
* [1, 'one', :one, [2, 'two', :two]]
*
- * - A {%w or %W: string-array Literal}[rdoc-ref:literals.rdoc@25w+and+-25W-3A+String-Array+Literals]:
+ * - A {%w or %W string-array Literal}[rdoc-ref:syntax/literals.rdoc@25w+and+-25W-3A+String-Array+Literals]:
*
* %w[foo bar baz] # => ["foo", "bar", "baz"]
* %w[1 % *] # => ["1", "%", "*"]
*
- * - A {%i pr %I: symbol-array Literal}[rdoc-ref:literals.rdoc@25i+and+-25I-3A+Symbol-Array+Literals]:
+ * - A {%i or %I symbol-array Literal}[rdoc-ref:syntax/literals.rdoc@25i+and+-25I-3A+Symbol-Array+Literals]:
*
* %i[foo bar baz] # => [:foo, :bar, :baz]
* %i[1 % *] # => [:"1", :%, :*]
*
- * - \Method Kernel#Array:
+ * - Method Kernel#Array:
*
* Array(["a", "b"]) # => ["a", "b"]
* Array(1..5) # => [1, 2, 3, 4, 5]
@@ -8204,7 +8442,7 @@ rb_ary_deconstruct(VALUE ary)
* Array(1) # => [1]
* Array({:a => "a", :b => "b"}) # => [[:a, "a"], [:b, "b"]]
*
- * - \Method Array.new:
+ * - Method Array.new:
*
* Array.new # => []
* Array.new(3) # => [nil, nil, nil]
@@ -8259,8 +8497,8 @@ rb_ary_deconstruct(VALUE ary)
*
* == Example Usage
*
- * In addition to the methods it mixes in through the Enumerable module, the
- * +Array+ class has proprietary methods for accessing, searching and otherwise
+ * In addition to the methods it mixes in through the Enumerable module,
+ * class \Array has proprietary methods for accessing, searching and otherwise
* manipulating arrays.
*
* Some of the more common ones are illustrated below.
@@ -8308,9 +8546,9 @@ rb_ary_deconstruct(VALUE ary)
*
* arr.drop(3) #=> [4, 5, 6]
*
- * == Obtaining Information about an +Array+
+ * == Obtaining Information about an \Array
*
- * Arrays keep track of their own length at all times. To query an array
+ * An array keeps track of its own length at all times. To query an array
* about the number of elements it contains, use #length, #count or #size.
*
* browsers = ['Chrome', 'Firefox', 'Safari', 'Opera', 'IE']
@@ -8325,7 +8563,7 @@ rb_ary_deconstruct(VALUE ary)
*
* browsers.include?('Konqueror') #=> false
*
- * == Adding Items to Arrays
+ * == Adding Items to an \Array
*
* Items can be added to the end of an array by using either #push or #<<
*
@@ -8346,7 +8584,7 @@ rb_ary_deconstruct(VALUE ary)
* arr.insert(3, 'orange', 'pear', 'grapefruit')
* #=> [0, 1, 2, "orange", "pear", "grapefruit", "apple", 3, 4, 5, 6]
*
- * == Removing Items from an +Array+
+ * == Removing Items from an \Array
*
* The method #pop removes the last element in an array and returns it:
*
@@ -8386,11 +8624,11 @@ rb_ary_deconstruct(VALUE ary)
* arr = [2, 5, 6, 556, 6, 6, 8, 9, 0, 123, 556]
* arr.uniq #=> [2, 5, 6, 556, 8, 9, 0, 123]
*
- * == Iterating over Arrays
+ * == Iterating over an \Array
*
- * Like all classes that include the Enumerable module, +Array+ has an each
+ * Like all classes that include the Enumerable module, class \Array has an each
* method, which defines what elements should be iterated over and how. In
- * case of Array's #each, all elements in the +Array+ instance are yielded to
+ * case of Array#each, all elements in +self+ are yielded to
* the supplied block in sequence.
*
* Note that this operation leaves the array unchanged.
@@ -8417,7 +8655,7 @@ rb_ary_deconstruct(VALUE ary)
* arr #=> [1, 4, 9, 16, 25]
*
*
- * == Selecting Items from an +Array+
+ * == Selecting Items from an \Array
*
* Elements can be selected from an array according to criteria defined in a
* block. The selection can happen in a destructive or a non-destructive
@@ -8450,13 +8688,13 @@ rb_ary_deconstruct(VALUE ary)
*
* == What's Here
*
- * First, what's elsewhere. \Class +Array+:
+ * First, what's elsewhere. Class \Array:
*
* - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
* - Includes {module Enumerable}[rdoc-ref:Enumerable@What-27s+Here],
* which provides dozens of additional methods.
*
- * Here, class +Array+ provides methods that are useful for:
+ * Here, class \Array provides methods that are useful for:
*
* - {Creating an Array}[rdoc-ref:Array@Methods+for+Creating+an+Array]
* - {Querying}[rdoc-ref:Array@Methods+for+Querying]
@@ -8469,154 +8707,138 @@ rb_ary_deconstruct(VALUE ary)
* - {Converting}[rdoc-ref:Array@Methods+for+Converting]
* - {And more....}[rdoc-ref:Array@Other+Methods]
*
- * === Methods for Creating an +Array+
+ * === Methods for Creating an \Array
*
* - ::[]: Returns a new array populated with given objects.
* - ::new: Returns a new array.
* - ::try_convert: Returns a new array created from a given object.
*
+ * See also {Creating Arrays}[rdoc-ref:Array@Creating+Arrays].
+ *
* === Methods for Querying
*
- * - #length, #size: Returns the count of elements.
- * - #include?: Returns whether any element <tt>==</tt> a given object.
- * - #empty?: Returns whether there are no elements.
* - #all?: Returns whether all elements meet a given criterion.
* - #any?: Returns whether any element meets a given criterion.
+ * - #count: Returns the count of elements that meet a given criterion.
+ * - #empty?: Returns whether there are no elements.
+ * - #find_index (aliased as #index): Returns the index of the first element that meets a given criterion.
+ * - #hash: Returns the integer hash code.
+ * - #include?: Returns whether any element <tt>==</tt> a given object.
+ * - #length (aliased as #size): Returns the count of elements.
* - #none?: Returns whether no element <tt>==</tt> a given object.
* - #one?: Returns whether exactly one element <tt>==</tt> a given object.
- * - #count: Returns the count of elements that meet a given criterion.
- * - #find_index, #index: Returns the index of the first element that meets a given criterion.
* - #rindex: Returns the index of the last element that meets a given criterion.
- * - #hash: Returns the integer hash code.
*
* === Methods for Comparing
*
- * - #<=>: Returns -1, 0, or 1 * as +self+ is less than, equal to, or
- * greater than a given object.
- * - #==: Returns whether each element in +self+ is <tt>==</tt> to the corresponding element
- * in a given object.
- * - #eql?: Returns whether each element in +self+ is <tt>eql?</tt> to the corresponding
- * element in a given object.
+ * - #<=>: Returns -1, 0, or 1, as +self+ is less than, equal to, or greater than a given object.
+ * - #==: Returns whether each element in +self+ is <tt>==</tt> to the corresponding element in a given object.
+ * - #eql?: Returns whether each element in +self+ is <tt>eql?</tt> to the corresponding element in a given object.
* === Methods for Fetching
*
* These methods do not modify +self+.
*
- * - #[]: Returns one or more elements.
- * - #fetch: Returns the element at a given offset.
- * - #first: Returns one or more leading elements.
- * - #last: Returns one or more trailing elements.
- * - #max: Returns one or more maximum-valued elements,
- * as determined by <tt><=></tt> or a given block.
- * - #min: Returns one or more minimum-valued elements,
- * as determined by <tt><=></tt> or a given block.
- * - #minmax: Returns the minimum-valued and maximum-valued elements,
- * as determined by <tt><=></tt> or a given block.
- * - #assoc: Returns the first element that is an array
- * whose first element <tt>==</tt> a given object.
- * - #rassoc: Returns the first element that is an array
- * whose second element <tt>==</tt> a given object.
+ * - #[] (aliased as #slice): Returns consecutive elements as determined by a given argument.
+ * - #assoc: Returns the first element that is an array whose first element <tt>==</tt> a given object.
* - #at: Returns the element at a given offset.
- * - #values_at: Returns the elements at given offsets.
- * - #dig: Returns the object in nested objects
- * that is specified by a given index and additional arguments.
+ * - #bsearch: Returns an element selected via a binary search as determined by a given block.
+ * - #bsearch_index: Returns the index of an element selected via a binary search as determined by a given block.
+ * - #compact: Returns an array containing all non-+nil+ elements.
+ * - #dig: Returns the object in nested objects that is specified by a given index and additional arguments.
* - #drop: Returns trailing elements as determined by a given index.
- * - #take: Returns leading elements as determined by a given index.
* - #drop_while: Returns trailing elements as determined by a given block.
- * - #take_while: Returns leading elements as determined by a given block.
- * - #slice: Returns consecutive elements as determined by a given argument.
- * - #sort: Returns all elements in an order determined by <tt><=></tt> or a given block.
+ * - #fetch: Returns the element at a given offset.
+ * - #fetch_values: Returns elements at given offsets.
+ * - #first: Returns one or more leading elements.
+ * - #last: Returns one or more trailing elements.
+ * - #max: Returns one or more maximum-valued elements, as determined by <tt>#<=></tt> or a given block.
+ * - #min: Returns one or more minimum-valued elements, as determined by <tt>#<=></tt> or a given block.
+ * - #minmax: Returns the minimum-valued and maximum-valued elements, as determined by <tt>#<=></tt> or a given block.
+ * - #rassoc: Returns the first element that is an array whose second element <tt>==</tt> a given object.
+ * - #reject: Returns an array containing elements not rejected by a given block.
* - #reverse: Returns all elements in reverse order.
- * - #compact: Returns an array containing all non-+nil+ elements.
- * - #select, #filter: Returns an array containing elements selected by a given block.
- * - #uniq: Returns an array containing non-duplicate elements.
* - #rotate: Returns all elements with some rotated from one end to the other.
- * - #bsearch: Returns an element selected via a binary search
- * as determined by a given block.
- * - #bsearch_index: Returns the index of an element selected via a binary search
- * as determined by a given block.
* - #sample: Returns one or more random elements.
+ * - #select (aliased as #filter): Returns an array containing elements selected by a given block.
* - #shuffle: Returns elements in a random order.
+ * - #sort: Returns all elements in an order determined by <tt>#<=></tt> or a given block.
+ * - #take: Returns leading elements as determined by a given index.
+ * - #take_while: Returns leading elements as determined by a given block.
+ * - #uniq: Returns an array containing non-duplicate elements.
+ * - #values_at: Returns the elements at given offsets.
*
* === Methods for Assigning
*
* These methods add, replace, or reorder elements in +self+.
*
+ * - #<<: Appends an element.
* - #[]=: Assigns specified elements with a given object.
- * - #push, #append, #<<: Appends trailing elements.
- * - #unshift, #prepend: Prepends leading elements.
- * - #insert: Inserts given objects at a given offset; does not replace elements.
* - #concat: Appends all elements from given arrays.
* - #fill: Replaces specified elements with specified objects.
- * - #replace: Replaces the content of +self+ with the content of a given array.
+ * - #flatten!: Replaces each nested array in +self+ with the elements from that array.
+ * - #initialize_copy (aliased as #replace): Replaces the content of +self+ with the content of a given array.
+ * - #insert: Inserts given objects at a given offset; does not replace elements.
+ * - #push (aliased as #append): Appends elements.
* - #reverse!: Replaces +self+ with its elements reversed.
* - #rotate!: Replaces +self+ with its elements rotated.
* - #shuffle!: Replaces +self+ with its elements in random order.
- * - #sort!: Replaces +self+ with its elements sorted,
- * as determined by <tt><=></tt> or a given block.
+ * - #sort!: Replaces +self+ with its elements sorted, as determined by <tt>#<=></tt> or a given block.
* - #sort_by!: Replaces +self+ with its elements sorted, as determined by a given block.
+ * - #unshift (aliased as #prepend): Prepends leading elements.
*
* === Methods for Deleting
*
* Each of these methods removes elements from +self+:
*
- * - #pop: Removes and returns the last element.
- * - #shift: Removes and returns the first element.
+ * - #clear: Removes all elements.
* - #compact!: Removes all +nil+ elements.
* - #delete: Removes elements equal to a given object.
* - #delete_at: Removes the element at a given offset.
* - #delete_if: Removes elements specified by a given block.
* - #keep_if: Removes elements not specified by a given block.
+ * - #pop: Removes and returns the last element.
* - #reject!: Removes elements specified by a given block.
- * - #select!, #filter!: Removes elements not specified by a given block.
+ * - #select! (aliased as #filter!): Removes elements not specified by a given block.
+ * - #shift: Removes and returns the first element.
* - #slice!: Removes and returns a sequence of elements.
* - #uniq!: Removes duplicates.
*
* === Methods for Combining
*
* - #&: Returns an array containing elements found both in +self+ and a given array.
- * - #intersection: Returns an array containing elements found both in +self+
- * and in each given array.
* - #+: Returns an array containing all elements of +self+ followed by all elements of a given array.
* - #-: Returns an array containing all elements of +self+ that are not found in a given array.
- * - #|: Returns an array containing all elements of +self+ and all elements of a given array,
- * duplicates removed.
- * - #union: Returns an array containing all elements of +self+ and all elements of given arrays,
- * duplicates removed.
- * - #difference: Returns an array containing all elements of +self+ that are not found
- * in any of the given arrays..
+ * - #|: Returns an array containing all element of +self+ and all elements of a given array, duplicates removed.
+ * - #difference: Returns an array containing all elements of +self+ that are not found in any of the given arrays..
+ * - #intersection: Returns an array containing elements found both in +self+ and in each given array.
* - #product: Returns or yields all combinations of elements from +self+ and given arrays.
+ * - #reverse: Returns an array containing all elements of +self+ in reverse order.
+ * - #union: Returns an array containing all elements of +self+ and all elements of given arrays, duplicates removed.
*
* === Methods for Iterating
*
+ * - #combination: Calls a given block with combinations of elements of +self+; a combination does not use the same element more than once.
+ * - #cycle: Calls a given block with each element, then does so again, for a specified number of times, or forever.
* - #each: Passes each element to a given block.
- * - #reverse_each: Passes each element, in reverse order, to a given block.
* - #each_index: Passes each element index to a given block.
- * - #cycle: Calls a given block with each element, then does so again,
- * for a specified number of times, or forever.
- * - #combination: Calls a given block with combinations of elements of +self+;
- * a combination does not use the same element more than once.
- * - #permutation: Calls a given block with permutations of elements of +self+;
- * a permutation does not use the same element more than once.
- * - #repeated_combination: Calls a given block with combinations of elements of +self+;
- * a combination may use the same element more than once.
- * - #repeated_permutation: Calls a given block with permutations of elements of +self+;
- * a permutation may use the same element more than once.
+ * - #permutation: Calls a given block with permutations of elements of +self+; a permutation does not use the same element more than once.
+ * - #repeated_combination: Calls a given block with combinations of elements of +self+; a combination may use the same element more than once.
+ * - #repeated_permutation: Calls a given block with permutations of elements of +self+; a permutation may use the same element more than once.
+ * - #reverse_each: Passes each element, in reverse order, to a given block.
*
* === Methods for Converting
*
- * - #map, #collect: Returns an array containing the block return-value for each element.
- * - #map!, #collect!: Replaces each element with a block return-value.
+ * - #collect (aliased as #map): Returns an array containing the block return-value for each element.
+ * - #collect! (aliased as #map!): Replaces each element with a block return-value.
* - #flatten: Returns an array that is a recursive flattening of +self+.
- * - #flatten!: Replaces each nested array in +self+ with the elements from that array.
- * - #inspect, #to_s: Returns a new String containing the elements.
- * - #join: Returns a newsString containing the elements joined by the field separator.
+ * - #inspect (aliased as #to_s): Returns a new String containing the elements.
+ * - #join: Returns a new String containing the elements joined by the field separator.
* - #to_a: Returns +self+ or a new array containing all elements.
* - #to_ary: Returns +self+.
* - #to_h: Returns a new hash formed from the elements.
* - #transpose: Transposes +self+, which must be an array of arrays.
- * - #zip: Returns a new array of arrays containing +self+ and given arrays;
- * follow the link for details.
+ * - #zip: Returns a new array of arrays containing +self+ and given arrays.
*
* === Other Methods
*
@@ -8627,7 +8849,6 @@ rb_ary_deconstruct(VALUE ary)
* - With string argument +field_separator+, a new string that is equivalent to
* <tt>join(field_separator)</tt>.
*
- * - #abbrev: Returns a hash of unambiguous abbreviations for elements.
* - #pack: Packs the elements into a binary sequence.
* - #sum: Returns a sum of elements according to either <tt>+</tt> or a given block.
*/
@@ -8635,6 +8856,8 @@ rb_ary_deconstruct(VALUE ary)
void
Init_Array(void)
{
+ fake_ary_flags = init_fake_ary_flags();
+
rb_cArray = rb_define_class("Array", rb_cObject);
rb_include_module(rb_cArray, rb_mEnumerable);
@@ -8672,11 +8895,15 @@ Init_Array(void)
rb_define_method(rb_cArray, "unshift", rb_ary_unshift_m, -1);
rb_define_alias(rb_cArray, "prepend", "unshift");
rb_define_method(rb_cArray, "insert", rb_ary_insert, -1);
+ rb_define_method(rb_cArray, "each", rb_ary_each, 0);
rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0);
rb_define_method(rb_cArray, "reverse_each", rb_ary_reverse_each, 0);
rb_define_method(rb_cArray, "length", rb_ary_length, 0);
rb_define_method(rb_cArray, "size", rb_ary_length, 0);
rb_define_method(rb_cArray, "empty?", rb_ary_empty_p, 0);
+ rb_define_method(rb_cArray, "find", rb_ary_find, -1);
+ rb_define_method(rb_cArray, "detect", rb_ary_find, -1);
+ rb_define_method(rb_cArray, "rfind", rb_ary_rfind, -1);
rb_define_method(rb_cArray, "find_index", rb_ary_index, -1);
rb_define_method(rb_cArray, "index", rb_ary_index, -1);
rb_define_method(rb_cArray, "rindex", rb_ary_rindex, -1);
@@ -8754,8 +8981,12 @@ Init_Array(void)
rb_define_method(rb_cArray, "one?", rb_ary_one_p, -1);
rb_define_method(rb_cArray, "dig", rb_ary_dig, -1);
rb_define_method(rb_cArray, "sum", rb_ary_sum, -1);
+ rb_define_method(rb_cArray, "freeze", rb_ary_freeze, 0);
rb_define_method(rb_cArray, "deconstruct", rb_ary_deconstruct, 0);
+
+ rb_cArray_empty_frozen = RB_OBJ_SET_SHAREABLE(rb_ary_freeze(rb_ary_new()));
+ rb_vm_register_global_object(rb_cArray_empty_frozen);
}
#include "array.rbinc"
diff --git a/array.rb b/array.rb
index f63ff00056..81beff0b1c 100644
--- a/array.rb
+++ b/array.rb
@@ -1,119 +1,97 @@
class Array
# call-seq:
- # array.each {|element| ... } -> self
- # array.each -> Enumerator
+ # shuffle!(random: Random) -> self
#
- # Iterates over array elements.
+ # Shuffles all elements in +self+ into a random order,
+ # as selected by the object given by the keyword argument +random+.
+ # Returns +self+:
#
- # When a block given, passes each successive array element to the block;
- # returns +self+:
+ # a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ # a.shuffle! # => [5, 3, 8, 7, 6, 1, 9, 4, 2, 0]
+ # a.shuffle! # => [9, 4, 0, 6, 2, 8, 1, 5, 3, 7]
#
- # a = [:foo, 'bar', 2]
- # a.each {|element| puts "#{element.class} #{element}" }
- #
- # Output:
- #
- # Symbol foo
- # String bar
- # Integer 2
+ # Duplicate elements are included:
#
- # Allows the array to be modified during iteration:
+ # a = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
+ # a.shuffle! # => [1, 0, 0, 1, 1, 0, 1, 0, 0, 1]
+ # a.shuffle! # => [0, 1, 0, 1, 1, 0, 1, 0, 1, 0]
#
- # a = [:foo, 'bar', 2]
- # a.each {|element| puts element; a.clear if element.to_s.start_with?('b') }
+ # The object given with the keyword argument +random+ is used as the random number generator.
#
- # Output:
+ # Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
+ def shuffle!(random: Random)
+ Primitive.rb_ary_shuffle_bang(random)
+ end
+
+ # call-seq:
+ # shuffle(random: Random) -> new_array
#
- # foo
- # bar
+ # Returns a new array containing all elements from +self+ in a random order,
+ # as selected by the object given by the keyword argument +random+:
#
- # When no block given, returns a new Enumerator:
- # a = [:foo, 'bar', 2]
+ # a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ # a.shuffle # => [0, 8, 1, 9, 6, 3, 4, 7, 2, 5]
+ # a.shuffle # => [8, 9, 0, 5, 1, 2, 6, 4, 7, 3]
#
- # e = a.each
- # e # => #<Enumerator: [:foo, "bar", 2]:each>
- # a1 = e.each {|element| puts "#{element.class} #{element}" }
+ # Duplicate elements are included:
#
- # Output:
+ # a = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
+ # a.shuffle # => [1, 0, 1, 1, 0, 0, 1, 0, 0, 1]
+ # a.shuffle # => [1, 1, 0, 0, 0, 1, 1, 0, 0, 1]
#
- # Symbol foo
- # String bar
- # Integer 2
+ # The object given with the keyword argument +random+ is used as the random number generator.
#
- # Related: #each_index, #reverse_each.
- def each
- Primitive.attr! :inline_block
- Primitive.attr! :use_block
-
- unless defined?(yield)
- return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
- end
- _i = 0
- value = nil
- while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) })
- yield value
- end
- self
+ # Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
+ def shuffle(random: Random)
+ Primitive.rb_ary_shuffle(random)
end
# call-seq:
- # array.shuffle!(random: Random) -> array
+ # sample(random: Random) -> object
+ # sample(count, random: Random) -> new_ary
#
- # Shuffles the elements of +self+ in place.
- # a = [1, 2, 3] #=> [1, 2, 3]
- # a.shuffle! #=> [2, 3, 1]
- # a #=> [2, 3, 1]
+ # Returns random elements from +self+,
+ # as selected by the object given by the keyword argument +random+.
#
- # The optional +random+ argument will be used as the random number generator:
- # a.shuffle!(random: Random.new(1)) #=> [1, 3, 2]
- def shuffle!(random: Random)
- Primitive.rb_ary_shuffle_bang(random)
- end
-
- # call-seq:
- # array.shuffle(random: Random) -> new_ary
+ # With no argument +count+ given, returns one random element from +self+:
#
- # Returns a new array with elements of +self+ shuffled.
- # a = [1, 2, 3] #=> [1, 2, 3]
- # a.shuffle #=> [2, 3, 1]
- # a #=> [1, 2, 3]
+ # a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ # a.sample # => 3
+ # a.sample # => 8
#
- # The optional +random+ argument will be used as the random number generator:
- # a.shuffle(random: Random.new(1)) #=> [1, 3, 2]
- def shuffle(random: Random)
- Primitive.rb_ary_shuffle(random)
- end
-
- # call-seq:
- # array.sample(random: Random) -> object
- # array.sample(n, random: Random) -> new_ary
+ # Returns +nil+ if +self+ is empty:
#
- # Returns random elements from +self+.
+ # [].sample # => nil
#
- # When no arguments are given, returns a random element from +self+:
- # a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- # a.sample # => 3
- # a.sample # => 8
- # If +self+ is empty, returns +nil+.
+ # With a non-negative numeric argument +count+ given,
+ # returns a new array containing +count+ random elements from +self+:
+ #
+ # a.sample(3) # => [8, 9, 2]
+ # a.sample(6) # => [9, 6, 0, 3, 1, 4]
+ #
+ # The order of the result array is unrelated to the order of +self+.
+ #
+ # Returns a new empty array if +self+ is empty:
+ #
+ # [].sample(4) # => []
+ #
+ # May return duplicates in +self+:
+ #
+ # a = [1, 1, 1, 2, 2, 3]
+ # a.sample(a.size) # => [1, 1, 3, 2, 1, 2]
#
- # When argument +n+ is given, returns a new +Array+ containing +n+ random
- # elements from +self+:
- # a.sample(3) # => [8, 9, 2]
- # a.sample(6) # => [9, 6, 10, 3, 1, 4]
# Returns no more than <tt>a.size</tt> elements
# (because no new duplicates are introduced):
- # a.sample(a.size * 2) # => [6, 4, 1, 8, 5, 9, 10, 2, 3, 7]
- # But +self+ may contain duplicates:
- # a = [1, 1, 1, 2, 2, 3]
- # a.sample(a.size * 2) # => [1, 1, 3, 2, 1, 2]
- # The argument +n+ must be a non-negative numeric value.
- # The order of the result array is unrelated to the order of +self+.
- # Returns a new empty +Array+ if +self+ is empty.
#
- # The optional +random+ argument will be used as the random number generator:
- # a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- # a.sample(random: Random.new(1)) #=> 6
- # a.sample(4, random: Random.new(1)) #=> [6, 10, 9, 2]
+ # a.sample(50) # => [6, 4, 1, 8, 5, 9, 0, 2, 3, 7]
+ #
+ # The object given with the keyword argument +random+ is used as the random number generator:
+ #
+ # a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+ # a.sample(random: Random.new(1)) # => 6
+ # a.sample(4, random: Random.new(1)) # => [6, 10, 9, 2]
+ #
+ # Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
def sample(n = (ary = false), random: Random)
if Primitive.mandatory_only?
# Primitive.cexpr! %{ rb_ary_sample(self, rb_cRandom, Qfalse, Qfalse) }
@@ -125,12 +103,12 @@ class Array
end
# call-seq:
- # array.first -> object or nil
- # array.first(n) -> new_array
+ # first -> object or nil
+ # first(count) -> new_array
#
- # Returns elements from +self+; does not modify +self+.
+ # Returns elements from +self+, or +nil+; does not modify +self+.
#
- # When no argument is given, returns the first element:
+ # With no argument given, returns the first element (if available):
#
# a = [:foo, 'bar', 2]
# a.first # => :foo
@@ -138,23 +116,16 @@ class Array
#
# If +self+ is empty, returns +nil+.
#
- # When non-negative Integer argument +n+ is given,
- # returns the first +n+ elements in a new +Array+:
- #
- # a = [:foo, 'bar', 2]
- # a.first(2) # => [:foo, "bar"]
+ # [].first # => nil
#
- # If <tt>n >= array.size</tt>, returns all elements:
+ # With a non-negative integer argument +count+ given,
+ # returns the first +count+ elements (as available) in a new array:
#
- # a = [:foo, 'bar', 2]
+ # a.first(0) # => []
+ # a.first(2) # => [:foo, "bar"]
# a.first(50) # => [:foo, "bar", 2]
#
- # If <tt>n == 0</tt> returns an new empty +Array+:
- #
- # a = [:foo, 'bar', 2]
- # a.first(0) # []
- #
- # Related: #last.
+ # Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
def first n = unspecified = true
if Primitive.mandatory_only?
Primitive.attr! :leaf
@@ -169,36 +140,29 @@ class Array
end
# call-seq:
- # array.last -> object or nil
- # array.last(n) -> new_array
+ # last -> last_object or nil
+ # last(count) -> new_array
#
- # Returns elements from +self+; +self+ is not modified.
+ # Returns elements from +self+, or +nil+; +self+ is not modified.
#
- # When no argument is given, returns the last element:
+ # With no argument given, returns the last element, or +nil+ if +self+ is empty:
#
# a = [:foo, 'bar', 2]
# a.last # => 2
# a # => [:foo, "bar", 2]
+ # [].last # => nil
#
- # If +self+ is empty, returns +nil+.
- #
- # When non-negative Integer argument +n+ is given,
- # returns the last +n+ elements in a new +Array+:
- #
- # a = [:foo, 'bar', 2]
- # a.last(2) # => ["bar", 2]
#
- # If <tt>n >= array.size</tt>, returns all elements:
+ # With non-negative integer argument +count+ given,
+ # returns a new array containing the trailing +count+ elements of +self+, as available:
#
# a = [:foo, 'bar', 2]
+ # a.last(2) # => ["bar", 2]
# a.last(50) # => [:foo, "bar", 2]
+ # a.last(0) # => []
+ # [].last(3) # => []
#
- # If <tt>n == 0</tt>, returns an new empty +Array+:
- #
- # a = [:foo, 'bar', 2]
- # a.last(0) # []
- #
- # Related: #first.
+ # Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
def last n = unspecified = true
if Primitive.mandatory_only?
Primitive.attr! :leaf
@@ -211,4 +175,113 @@ class Array
end
end
end
+
+ # call-seq:
+ # fetch_values(*indexes) -> new_array
+ # fetch_values(*indexes) { |index| ... } -> new_array
+ #
+ # With no block given, returns a new array containing the elements of +self+
+ # at the offsets specified by +indexes+. Each of the +indexes+ must be an
+ # {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]:
+ #
+ # a = [:foo, :bar, :baz]
+ # a.fetch_values(2, 0) # => [:baz, :foo]
+ # a.fetch_values(2.1, 0) # => [:baz, :foo]
+ # a.fetch_values # => []
+ #
+ # For a negative index, counts backwards from the end of the array:
+ #
+ # a.fetch_values(-2, -1) # [:bar, :baz]
+ #
+ # When no block is given, raises an exception if any index is out of range.
+ #
+ # With a block given, for each index:
+ #
+ # - If the index is in range, uses an element of +self+ (as above).
+ # - Otherwise, calls the block with the index and uses the block's return value.
+ #
+ # Example:
+ #
+ # a = [:foo, :bar, :baz]
+ # a.fetch_values(1, 0, 42, 777) { |index| index.to_s }
+ # # => [:bar, :foo, "42", "777"]
+ #
+ # Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
+ def fetch_values(*indexes, &block)
+ indexes.map! { |i| fetch(i, &block) }
+ indexes
+ end
+
+ with_jit do
+ if Primitive.rb_builtin_basic_definition_p(:each)
+ undef :each
+
+ def each # :nodoc:
+ Primitive.attr! :inline_block, :c_trace
+
+ unless defined?(yield)
+ return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
+ end
+ _i = 0
+ value = nil
+ while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) })
+ yield value
+ end
+ self
+ end
+ end
+
+ if Primitive.rb_builtin_basic_definition_p(:map)
+ undef :map
+
+ def map # :nodoc:
+ Primitive.attr! :inline_block, :c_trace
+
+ unless defined?(yield)
+ return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
+ end
+
+ _i = 0
+ value = nil
+ result = Primitive.ary_sized_alloc
+ while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) })
+ value = yield(value)
+ Primitive.cexpr!(%q{ rb_ary_push(result, value) })
+ end
+ result
+ end
+
+ if Primitive.rb_builtin_basic_definition_p(:collect)
+ undef :collect
+ alias collect map
+ end
+ end
+
+ if Primitive.rb_builtin_basic_definition_p(:select)
+ undef :select
+
+ def select # :nodoc:
+ Primitive.attr! :inline_block, :c_trace
+
+ unless defined?(yield)
+ return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
+ end
+
+ _i = 0
+ value = nil
+ result = Primitive.ary_sized_alloc
+ while Primitive.cexpr!(%q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) })
+ if yield value
+ Primitive.cexpr!(%q{ rb_ary_push(result, value) })
+ end
+ end
+ result
+ end
+
+ if Primitive.rb_builtin_basic_definition_p(:filter)
+ undef :filter
+ alias filter select
+ end
+ end
+ end
end
diff --git a/ast.c b/ast.c
index 12b3996f94..5357aa38a5 100644
--- a/ast.c
+++ b/ast.c
@@ -14,6 +14,7 @@
static VALUE rb_mAST;
static VALUE rb_cNode;
+static VALUE rb_cLocation;
struct ASTNodeData {
VALUE ast_value;
@@ -31,9 +32,13 @@ static size_t
node_memsize(const void *ptr)
{
struct ASTNodeData *data = (struct ASTNodeData *)ptr;
- rb_ast_t *ast = rb_ruby_ast_data_get(data->ast_value);
+ size_t size = sizeof(struct ASTNodeData);
+ if (data->ast_value) {
+ rb_ast_t *ast = rb_ruby_ast_data_get(data->ast_value);
+ size += rb_ast_memsize(ast);
+ }
- return sizeof(struct ASTNodeData) + rb_ast_memsize(ast);
+ return size;
}
static const rb_data_type_t rb_node_type = {
@@ -43,6 +48,32 @@ static const rb_data_type_t rb_node_type = {
RUBY_TYPED_FREE_IMMEDIATELY,
};
+struct ASTLocationData {
+ int first_lineno;
+ int first_column;
+ int last_lineno;
+ int last_column;
+};
+
+static void
+location_gc_mark(void *ptr)
+{
+}
+
+static size_t
+location_memsize(const void *ptr)
+{
+ return sizeof(struct ASTLocationData);
+}
+
+static const rb_data_type_t rb_location_type = {
+ "AST/location",
+ {location_gc_mark, RUBY_TYPED_DEFAULT_FREE, location_memsize,},
+ 0, 0,
+ RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
+
static VALUE rb_ast_node_alloc(VALUE klass);
static void
@@ -89,6 +120,16 @@ ast_parse_done(VALUE ast_value)
}
static VALUE
+setup_vparser(VALUE keep_script_lines, VALUE error_tolerant, VALUE keep_tokens)
+{
+ VALUE vparser = ast_parse_new();
+ if (RTEST(keep_script_lines)) rb_parser_set_script_lines(vparser);
+ if (RTEST(error_tolerant)) rb_parser_error_tolerant(vparser);
+ if (RTEST(keep_tokens)) rb_parser_keep_tokens(vparser);
+ return vparser;
+}
+
+static VALUE
ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE keep_script_lines, VALUE error_tolerant, VALUE keep_tokens)
{
return rb_ast_parse_str(str, keep_script_lines, error_tolerant, keep_tokens);
@@ -97,13 +138,9 @@ ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE keep_scri
static VALUE
rb_ast_parse_str(VALUE str, VALUE keep_script_lines, VALUE error_tolerant, VALUE keep_tokens)
{
- VALUE ast_value;
-
+ VALUE ast_value = Qnil;
StringValue(str);
- VALUE vparser = ast_parse_new();
- if (RTEST(keep_script_lines)) rb_parser_set_script_lines(vparser);
- if (RTEST(error_tolerant)) rb_parser_error_tolerant(vparser);
- if (RTEST(keep_tokens)) rb_parser_keep_tokens(vparser);
+ VALUE vparser = setup_vparser(keep_script_lines, error_tolerant, keep_tokens);
ast_value = rb_parser_compile_string_path(vparser, Qnil, str, 1);
return ast_parse_done(ast_value);
}
@@ -123,10 +160,7 @@ rb_ast_parse_file(VALUE path, VALUE keep_script_lines, VALUE error_tolerant, VAL
f = rb_file_open_str(path, "r");
rb_funcall(f, rb_intern("set_encoding"), 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
- VALUE vparser = ast_parse_new();
- if (RTEST(keep_script_lines)) rb_parser_set_script_lines(vparser);
- if (RTEST(error_tolerant)) rb_parser_error_tolerant(vparser);
- if (RTEST(keep_tokens)) rb_parser_keep_tokens(vparser);
+ VALUE vparser = setup_vparser(keep_script_lines, error_tolerant, keep_tokens);
ast_value = rb_parser_compile_file_path(vparser, Qnil, f, 1);
rb_io_close(f);
return ast_parse_done(ast_value);
@@ -138,10 +172,7 @@ rb_ast_parse_array(VALUE array, VALUE keep_script_lines, VALUE error_tolerant, V
VALUE ast_value = Qnil;
array = rb_check_array_type(array);
- VALUE vparser = ast_parse_new();
- if (RTEST(keep_script_lines)) rb_parser_set_script_lines(vparser);
- if (RTEST(error_tolerant)) rb_parser_error_tolerant(vparser);
- if (RTEST(keep_tokens)) rb_parser_keep_tokens(vparser);
+ VALUE vparser = setup_vparser(keep_script_lines, error_tolerant, keep_tokens);
ast_value = rb_parser_compile_array(vparser, Qnil, array, 1);
return ast_parse_done(ast_value);
}
@@ -334,6 +365,24 @@ dump_array(VALUE ast_value, const struct RNode_LIST *node)
}
static VALUE
+dump_parser_array(VALUE ast_value, rb_parser_ary_t *p_ary)
+{
+ VALUE ary;
+
+ if (p_ary->data_type != PARSER_ARY_DATA_NODE) {
+ rb_bug("unexpected rb_parser_ary_data_type: %d", p_ary->data_type);
+ }
+
+ ary = rb_ary_new();
+
+ for (long i = 0; i < p_ary->len; i++) {
+ rb_ary_push(ary, NEW_CHILD(ast_value, p_ary->data[i]));
+ }
+
+ return ary;
+}
+
+static VALUE
var_name(ID id)
{
if (!id) return Qnil;
@@ -402,7 +451,7 @@ node_children(VALUE ast_value, const NODE *node)
case NODE_RESCUE:
return rb_ary_new_from_node_args(ast_value, 3, RNODE_RESCUE(node)->nd_head, RNODE_RESCUE(node)->nd_resq, RNODE_RESCUE(node)->nd_else);
case NODE_RESBODY:
- return rb_ary_new_from_node_args(ast_value, 3, RNODE_RESBODY(node)->nd_args, RNODE_RESBODY(node)->nd_body, RNODE_RESBODY(node)->nd_next);
+ return rb_ary_new_from_node_args(ast_value, 4, RNODE_RESBODY(node)->nd_args, RNODE_RESBODY(node)->nd_exc_var, RNODE_RESBODY(node)->nd_body, RNODE_RESBODY(node)->nd_next);
case NODE_ENSURE:
return rb_ary_new_from_node_args(ast_value, 2, RNODE_ENSURE(node)->nd_head, RNODE_ENSURE(node)->nd_ensr);
case NODE_AND:
@@ -577,7 +626,7 @@ node_children(VALUE ast_value, const NODE *node)
case NODE_VALIAS:
return rb_ary_new_from_args(2, ID2SYM(RNODE_VALIAS(node)->nd_alias), ID2SYM(RNODE_VALIAS(node)->nd_orig));
case NODE_UNDEF:
- return rb_ary_new_from_node_args(ast_value, 1, RNODE_UNDEF(node)->nd_undef);
+ return rb_ary_new_from_args(1, dump_parser_array(ast_value, RNODE_UNDEF(node)->nd_undefs));
case NODE_CLASS:
return rb_ary_new_from_node_args(ast_value, 3, RNODE_CLASS(node)->nd_cpath, RNODE_CLASS(node)->nd_super, RNODE_CLASS(node)->nd_body);
case NODE_MODULE:
@@ -702,6 +751,249 @@ ast_node_children(rb_execution_context_t *ec, VALUE self)
return node_children(data->ast_value, data->node);
}
+static int
+null_loc_p(rb_code_location_t *loc)
+{
+ return (loc->beg_pos.lineno == 0 && loc->beg_pos.column == -1 && loc->end_pos.lineno == 0 && loc->end_pos.column == -1);
+}
+
+static VALUE
+location_new(rb_code_location_t *loc)
+{
+ VALUE obj;
+ struct ASTLocationData *data;
+
+ if (null_loc_p(loc)) return Qnil;
+
+ obj = TypedData_Make_Struct(rb_cLocation, struct ASTLocationData, &rb_location_type, data);
+ data->first_lineno = loc->beg_pos.lineno;
+ data->first_column = loc->beg_pos.column;
+ data->last_lineno = loc->end_pos.lineno;
+ data->last_column = loc->end_pos.column;
+
+ return obj;
+}
+
+static VALUE
+node_locations(VALUE ast_value, const NODE *node)
+{
+ enum node_type type = nd_type(node);
+ switch (type) {
+ case NODE_ALIAS:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_ALIAS(node)->keyword_loc));
+ case NODE_AND:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_AND(node)->operator_loc));
+ case NODE_BLOCK_PASS:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_BLOCK_PASS(node)->operator_loc));
+ case NODE_BREAK:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_BREAK(node)->keyword_loc));
+ case NODE_CASE:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_CASE(node)->case_keyword_loc),
+ location_new(&RNODE_CASE(node)->end_keyword_loc));
+ case NODE_CASE2:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_CASE2(node)->case_keyword_loc),
+ location_new(&RNODE_CASE2(node)->end_keyword_loc));
+ case NODE_CASE3:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_CASE3(node)->case_keyword_loc),
+ location_new(&RNODE_CASE3(node)->end_keyword_loc));
+ case NODE_CLASS:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_CLASS(node)->class_keyword_loc),
+ location_new(&RNODE_CLASS(node)->inheritance_operator_loc),
+ location_new(&RNODE_CLASS(node)->end_keyword_loc));
+ case NODE_COLON2:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_COLON2(node)->delimiter_loc),
+ location_new(&RNODE_COLON2(node)->name_loc));
+ case NODE_COLON3:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_COLON3(node)->delimiter_loc),
+ location_new(&RNODE_COLON3(node)->name_loc));
+ case NODE_DEFINED:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_DEFINED(node)->keyword_loc));
+ case NODE_DOT2:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_DOT2(node)->operator_loc));
+ case NODE_DOT3:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_DOT3(node)->operator_loc));
+ case NODE_EVSTR:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_EVSTR(node)->opening_loc),
+ location_new(&RNODE_EVSTR(node)->closing_loc));
+ case NODE_FLIP2:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_FLIP2(node)->operator_loc));
+ case NODE_FLIP3:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_FLIP3(node)->operator_loc));
+ case NODE_FOR:
+ return rb_ary_new_from_args(5,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_FOR(node)->for_keyword_loc),
+ location_new(&RNODE_FOR(node)->in_keyword_loc),
+ location_new(&RNODE_FOR(node)->do_keyword_loc),
+ location_new(&RNODE_FOR(node)->end_keyword_loc));
+ case NODE_LAMBDA:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_LAMBDA(node)->operator_loc),
+ location_new(&RNODE_LAMBDA(node)->opening_loc),
+ location_new(&RNODE_LAMBDA(node)->closing_loc));
+ case NODE_IF:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_IF(node)->if_keyword_loc),
+ location_new(&RNODE_IF(node)->then_keyword_loc),
+ location_new(&RNODE_IF(node)->end_keyword_loc));
+ case NODE_IN:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_IN(node)->in_keyword_loc),
+ location_new(&RNODE_IN(node)->then_keyword_loc),
+ location_new(&RNODE_IN(node)->operator_loc));
+ case NODE_MODULE:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_MODULE(node)->module_keyword_loc),
+ location_new(&RNODE_MODULE(node)->end_keyword_loc));
+ case NODE_NEXT:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_NEXT(node)->keyword_loc));
+ case NODE_OR:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_OR(node)->operator_loc));
+ case NODE_OP_ASGN1:
+ return rb_ary_new_from_args(5,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_OP_ASGN1(node)->call_operator_loc),
+ location_new(&RNODE_OP_ASGN1(node)->opening_loc),
+ location_new(&RNODE_OP_ASGN1(node)->closing_loc),
+ location_new(&RNODE_OP_ASGN1(node)->binary_operator_loc));
+ case NODE_OP_ASGN2:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_OP_ASGN2(node)->call_operator_loc),
+ location_new(&RNODE_OP_ASGN2(node)->message_loc),
+ location_new(&RNODE_OP_ASGN2(node)->binary_operator_loc));
+ case NODE_POSTEXE:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_POSTEXE(node)->keyword_loc),
+ location_new(&RNODE_POSTEXE(node)->opening_loc),
+ location_new(&RNODE_POSTEXE(node)->closing_loc));
+ case NODE_REDO:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_REDO(node)->keyword_loc));
+ case NODE_REGX:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_REGX(node)->opening_loc),
+ location_new(&RNODE_REGX(node)->content_loc),
+ location_new(&RNODE_REGX(node)->closing_loc));
+ case NODE_RETURN:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_RETURN(node)->keyword_loc));
+
+ case NODE_SCLASS:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_SCLASS(node)->class_keyword_loc),
+ location_new(&RNODE_SCLASS(node)->operator_loc),
+ location_new(&RNODE_SCLASS(node)->end_keyword_loc));
+
+ case NODE_SPLAT:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_SPLAT(node)->operator_loc));
+ case NODE_SUPER:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_SUPER(node)->keyword_loc),
+ location_new(&RNODE_SUPER(node)->lparen_loc),
+ location_new(&RNODE_SUPER(node)->rparen_loc));
+ case NODE_UNDEF:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_UNDEF(node)->keyword_loc));
+ case NODE_UNLESS:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_UNLESS(node)->keyword_loc),
+ location_new(&RNODE_UNLESS(node)->then_keyword_loc),
+ location_new(&RNODE_UNLESS(node)->end_keyword_loc));
+ case NODE_VALIAS:
+ return rb_ary_new_from_args(2,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_VALIAS(node)->keyword_loc));
+ case NODE_WHEN:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_WHEN(node)->keyword_loc),
+ location_new(&RNODE_WHEN(node)->then_keyword_loc));
+ case NODE_WHILE:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_WHILE(node)->keyword_loc),
+ location_new(&RNODE_WHILE(node)->closing_loc));
+ case NODE_UNTIL:
+ return rb_ary_new_from_args(3,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_UNTIL(node)->keyword_loc),
+ location_new(&RNODE_UNTIL(node)->closing_loc));
+ case NODE_YIELD:
+ return rb_ary_new_from_args(4,
+ location_new(nd_code_loc(node)),
+ location_new(&RNODE_YIELD(node)->keyword_loc),
+ location_new(&RNODE_YIELD(node)->lparen_loc),
+ location_new(&RNODE_YIELD(node)->rparen_loc));
+ case NODE_ARGS_AUX:
+ case NODE_LAST:
+ break;
+ default:
+ return rb_ary_new_from_args(1, location_new(nd_code_loc(node)));
+ }
+
+ rb_bug("node_locations: unknown node: %s", ruby_node_name(type));
+}
+
+static VALUE
+ast_node_locations(rb_execution_context_t *ec, VALUE self)
+{
+ struct ASTNodeData *data;
+ TypedData_Get_Struct(self, struct ASTNodeData, &rb_node_type, data);
+
+ return node_locations(data->ast_value, data->node);
+}
+
static VALUE
ast_node_first_lineno(rb_execution_context_t *ec, VALUE self)
{
@@ -769,7 +1061,7 @@ ast_node_all_tokens(rb_execution_context_t *ec, VALUE self)
token = rb_ary_new_from_args(4, INT2FIX(parser_token->id), ID2SYM(rb_intern(parser_token->type_name)), str, loc);
rb_ary_push(all_tokens, token);
}
- rb_obj_freeze(all_tokens);
+ rb_ary_freeze(all_tokens);
return all_tokens;
}
@@ -805,6 +1097,61 @@ ast_node_script_lines(rb_execution_context_t *ec, VALUE self)
return rb_parser_build_script_lines_from(ret);
}
+static VALUE
+ast_location_first_lineno(rb_execution_context_t *ec, VALUE self)
+{
+ struct ASTLocationData *data;
+ TypedData_Get_Struct(self, struct ASTLocationData, &rb_location_type, data);
+
+ return INT2NUM(data->first_lineno);
+}
+
+static VALUE
+ast_location_first_column(rb_execution_context_t *ec, VALUE self)
+{
+ struct ASTLocationData *data;
+ TypedData_Get_Struct(self, struct ASTLocationData, &rb_location_type, data);
+
+ return INT2NUM(data->first_column);
+}
+
+static VALUE
+ast_location_last_lineno(rb_execution_context_t *ec, VALUE self)
+{
+ struct ASTLocationData *data;
+ TypedData_Get_Struct(self, struct ASTLocationData, &rb_location_type, data);
+
+ return INT2NUM(data->last_lineno);
+}
+
+static VALUE
+ast_location_last_column(rb_execution_context_t *ec, VALUE self)
+{
+ struct ASTLocationData *data;
+ TypedData_Get_Struct(self, struct ASTLocationData, &rb_location_type, data);
+
+ return INT2NUM(data->last_column);
+}
+
+static VALUE
+ast_location_inspect(rb_execution_context_t *ec, VALUE self)
+{
+ VALUE str;
+ VALUE cname;
+ struct ASTLocationData *data;
+ TypedData_Get_Struct(self, struct ASTLocationData, &rb_location_type, data);
+
+ cname = rb_class_path(rb_obj_class(self));
+ str = rb_str_new2("#<");
+
+ rb_str_append(str, cname);
+ rb_str_catf(str, ":@%d:%d-%d:%d>",
+ data->first_lineno, data->first_column,
+ data->last_lineno, data->last_column);
+
+ return str;
+}
+
#include "ast.rbinc"
void
@@ -812,5 +1159,7 @@ Init_ast(void)
{
rb_mAST = rb_define_module_under(rb_cRubyVM, "AbstractSyntaxTree");
rb_cNode = rb_define_class_under(rb_mAST, "Node", rb_cObject);
+ rb_cLocation = rb_define_class_under(rb_mAST, "Location", rb_cObject);
rb_undef_alloc_func(rb_cNode);
+ rb_undef_alloc_func(rb_cLocation);
}
diff --git a/ast.rb b/ast.rb
index 51ee5b3d59..6380621780 100644
--- a/ast.rb
+++ b/ast.rb
@@ -13,9 +13,8 @@
# access children nodes by name, etc.
#
# If you are looking for a stable API or an API working under multiple Ruby
-# implementations, consider using the _parser_ gem or Ripper. If you would
-# like to make RubyVM::AbstractSyntaxTree stable, please join the discussion
-# at https://bugs.ruby-lang.org/issues/14844.
+# implementations, consider using the _prism_ gem, which is the official
+# Ruby API to parse Ruby code.
#
module RubyVM::AbstractSyntaxTree
@@ -272,5 +271,62 @@ module RubyVM::AbstractSyntaxTree
nil
end
end
+
+ # call-seq:
+ # node.locations -> array
+ #
+ # Returns location objects associated with the AST node.
+ # The returned array contains RubyVM::AbstractSyntaxTree::Location.
+ def locations
+ Primitive.ast_node_locations
+ end
+ end
+
+ # RubyVM::AbstractSyntaxTree::Location instances are created by
+ # RubyVM::AbstractSyntaxTree::Node#locations.
+ #
+ # This class is MRI specific.
+ #
+ class Location
+
+ # call-seq:
+ # location.first_lineno -> integer
+ #
+ # The line number in the source code where this AST's text began.
+ def first_lineno
+ Primitive.ast_location_first_lineno
+ end
+
+ # call-seq:
+ # location.first_column -> integer
+ #
+ # The column number in the source code where this AST's text began.
+ def first_column
+ Primitive.ast_location_first_column
+ end
+
+ # call-seq:
+ # location.last_lineno -> integer
+ #
+ # The line number in the source code where this AST's text ended.
+ def last_lineno
+ Primitive.ast_location_last_lineno
+ end
+
+ # call-seq:
+ # location.last_column -> integer
+ #
+ # The column number in the source code where this AST's text ended.
+ def last_column
+ Primitive.ast_location_last_column
+ end
+
+ # call-seq:
+ # location.inspect -> string
+ #
+ # Returns debugging information about this location as a string.
+ def inspect
+ Primitive.ast_location_inspect
+ end
end
end
diff --git a/autogen.sh b/autogen.sh
index f8cdf3c0c1..6cbc5dddab 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,17 +1,22 @@
#!/bin/sh
+# Clear PWD to force commands to recompute working directory
PWD=
+
+# Figure out the source directory for this script
+# configure.ac should be in the same place
case "$0" in
-*/*) srcdir=`dirname $0`;;
-*) srcdir="";;
+ */* ) srcdir=`dirname "$0"` ;; # Called with path
+ * ) srcdir="";; # Otherwise
esac
-symlink='--install --symlink'
+# If install-only is explicitly requested, disable symlink flags
case " $* " in
- *" -i "*|*" --install "*)
- # reset to copy missing standard auxiliary files, instead of symlinks
- symlink=
- ;;
+ *" -i "* | *" --install"* ) symlink_flags="" ;;
+ * ) symlink_flags="--install --symlink" ;;
esac
-exec ${AUTORECONF:-autoreconf} ${symlink} "$@" ${srcdir:+"$srcdir"}
+exec ${AUTORECONF:-autoreconf} \
+ $symlink_flags \
+ "$@" \
+ $srcdir
diff --git a/benchmark/README.md b/benchmark/README.md
index e11381cad9..9f9192685e 100644
--- a/benchmark/README.md
+++ b/benchmark/README.md
@@ -27,6 +27,7 @@ benchmark-driver benchmark/*.yml
See also:
```console
+benchmark-driver --help
Usage: benchmark-driver [options] RUBY|YAML...
-r, --runner TYPE Specify runner type: ips, time, memory, once, block (default: ips)
-o, --output TYPE Specify output type: compare, simple, markdown, record, all (default: compare)
@@ -39,7 +40,7 @@ Usage: benchmark-driver [options] RUBY|YAML...
--filter REGEXP Filter out benchmarks with given regexp
--run-duration SECONDS Warmup estimates loop_count to run for this duration (default: 3)
--timeout SECONDS Timeout ruby command execution with timeout(1)
- -v, --verbose Verbose mode. Multiple -v options increase visilibity (max: 2)
+ -v, --verbose Verbose mode. Multiple -v options increase visibility (max: 2)
```
## make benchmark
diff --git a/benchmark/app_aobench.rb b/benchmark/app_aobench.rb
index 16296af12b..c1546e08ab 100644
--- a/benchmark/app_aobench.rb
+++ b/benchmark/app_aobench.rb
@@ -151,7 +151,7 @@ def clamp(f)
i.to_i
end
-def otherBasis(basis, n)
+def orthoBasis(basis, n)
basis[2] = Vec.new(n.x, n.y, n.z)
basis[1] = Vec.new(0.0, 0.0, 0.0)
@@ -183,7 +183,7 @@ class Scene
def ambient_occlusion(isect)
basis = Array.new
- otherBasis(basis, isect.n)
+ orthoBasis(basis, isect.n)
ntheta = NAO_SAMPLES
nphi = NAO_SAMPLES
diff --git a/benchmark/app_fib.rb b/benchmark/app_fib.rb
index 34a7b2e725..e61bc8aa32 100644
--- a/benchmark/app_fib.rb
+++ b/benchmark/app_fib.rb
@@ -1,4 +1,4 @@
-def fib n
+def fib(n)
if n < 3
1
else
diff --git a/benchmark/class_superclass.yml b/benchmark/class_superclass.yml
new file mode 100644
index 0000000000..847ff811f1
--- /dev/null
+++ b/benchmark/class_superclass.yml
@@ -0,0 +1,23 @@
+prelude: |
+ class SimpleClass; end
+ class OneModuleClass
+ 1.times { include Module.new }
+ end
+ class MediumClass
+ 10.times { include Module.new }
+ end
+ class LargeClass
+ 100.times { include Module.new }
+ end
+benchmark:
+ object_class_superclass: |
+ Object.superclass
+ simple_class_superclass: |
+ SimpleClass.superclass
+ one_module_class: |
+ OneModuleClass.superclass
+ medium_class_superclass: |
+ MediumClass.superclass
+ large_class_superclass: |
+ LargeClass.superclass
+loop_count: 20000000
diff --git a/benchmark/file_join.yml b/benchmark/file_join.yml
new file mode 100644
index 0000000000..845257cf1e
--- /dev/null
+++ b/benchmark/file_join.yml
@@ -0,0 +1,7 @@
+prelude: |
+ # frozen_string_literal: true
+benchmark:
+ two_strings: File.join(__FILE__, "path")
+ many_strings: File.join(__FILE__, "path", "a", "b", "c", "d")
+ array: File.join([__FILE__, "path", "a", "b", "c", "d"])
+ mixed: File.join(__FILE__, "path", "a", "b", ["c", "d"])
diff --git a/benchmark/hash_new.yml b/benchmark/hash_new.yml
new file mode 100644
index 0000000000..9d8e34187f
--- /dev/null
+++ b/benchmark/hash_new.yml
@@ -0,0 +1,16 @@
+prelude: |
+ has_hash_with_capa = Hash.instance_method(:initialize).parameters.include?([:key, :capacity])
+ strings_1k = 1_000.times.map { |i| -i.to_s.freeze }
+ strings_100k = 100_000.times.map { |i| -i.to_s.freeze }
+benchmark:
+ new: Hash.new
+ new_with_capa_1k: |
+ h = has_hash_with_capa ? Hash.new(capacity: strings_1k.size) : {}
+ strings_1k.each do |x|
+ h[x] = true
+ end
+ new_with_capa_100k: |
+ h = has_hash_with_capa ? Hash.new(capacity: strings_100k.size) : {}
+ strings_100k.each do |x|
+ h[x] = true
+ end
diff --git a/benchmark/io_close.yml b/benchmark/io_close.yml
new file mode 100644
index 0000000000..a552872884
--- /dev/null
+++ b/benchmark/io_close.yml
@@ -0,0 +1,13 @@
+prelude: |
+ ios = 1000.times.map do
+ 100.times.map{IO.pipe}
+ end
+benchmark:
+ # Close IO
+ io_close: |
+ # Process each batch of ios per iteration of the benchmark.
+ ios.pop.each do |r, w|
+ r.close
+ w.close
+ end
+loop_count: 100
diff --git a/benchmark/io_close_contended.yml b/benchmark/io_close_contended.yml
new file mode 100644
index 0000000000..1d9e4e0d0f
--- /dev/null
+++ b/benchmark/io_close_contended.yml
@@ -0,0 +1,21 @@
+prelude: |
+ ios = 100.times.map do
+ 10.times.map do
+ pipe = IO.pipe.tap do |r, w|
+ Thread.new do
+ r.read
+ rescue IOError
+ # Ignore
+ end
+ end
+ end
+ end
+benchmark:
+ # Close IO
+ io_close_contended: |
+ # Process each batch of ios per iteration of the benchmark.
+ ios.pop.each do |r, w|
+ r.close
+ w.close
+ end
+loop_count: 10
diff --git a/benchmark/lib/benchmark_driver/runner/ractor.rb b/benchmark/lib/benchmark_driver/runner/ractor.rb
index c730b8e4a5..fd9c2dd4db 100644
--- a/benchmark/lib/benchmark_driver/runner/ractor.rb
+++ b/benchmark/lib/benchmark_driver/runner/ractor.rb
@@ -87,7 +87,7 @@ __bmdv_ractors << Ractor.new(__bmdv_loop_after - __bmdv_loop_before) { |__bmdv_l
<% end %>
# Wait for all Ractors before executing code to write results
-__bmdv_ractors.map!(&:take)
+__bmdv_ractors.map!(&:value)
<% results.each do |result| %>
File.write(<%= result.dump %>, __bmdv_ractors.shift)
diff --git a/benchmark/module_eqq.yml b/benchmark/module_eqq.yml
index a561fb86dc..2f9c490d92 100644
--- a/benchmark/module_eqq.yml
+++ b/benchmark/module_eqq.yml
@@ -1,4 +1,5 @@
prelude: |
+ module SomeModule; end
class SimpleClass; end
class MediumClass
10.times { include Module.new }
@@ -24,4 +25,8 @@ benchmark:
SimpleClass === LargeObj
simple_class_eqq_huge_obj: |
SimpleClass === HugeObj
-loop_count: 20000000
+ simple_class_eqq_module: |
+ SimpleClass === HugeObj
+ module_eqq_module: |
+ SomeModule === HugeObj
+loop_count: 10000000
diff --git a/benchmark/nilclass.yml b/benchmark/nilclass.yml
index fba67a5f6a..66234c4cdf 100644
--- a/benchmark/nilclass.yml
+++ b/benchmark/nilclass.yml
@@ -1,6 +1,16 @@
+prelude: |
+ def a = nil
benchmark:
+ rationalize:
+ nil.rationalize
+ to_c: |
+ nil.to_c
to_i: |
nil.to_i
to_f: |
nil.to_f
+ to_r: |
+ nil.to_r
+ splat: |
+ a(*nil)
loop_count: 100000
diff --git a/benchmark/object_allocate.yml b/benchmark/object_allocate.yml
index bdbd4536db..c6269923f0 100644
--- a/benchmark/object_allocate.yml
+++ b/benchmark/object_allocate.yml
@@ -45,4 +45,5 @@ benchmark:
allocate_kwarg_params: "KWArg.new(a: 1, b: 2, c: 3, d: 4)"
allocate_mixed_params: "Mixed.new(1, 2, c: 3, d: 4)"
allocate_no_params: "Object.new"
+ allocate_allocate: "Object.allocate"
loop_count: 100000
diff --git a/benchmark/object_class.yml b/benchmark/object_class.yml
new file mode 100644
index 0000000000..1e5409d1e2
--- /dev/null
+++ b/benchmark/object_class.yml
@@ -0,0 +1,40 @@
+prelude: |
+ def get_class(obj)
+ i = 10_000
+ while i > 0
+ i -= 1
+ # 100 times per loop
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class; obj.class;
+ end
+ end
+
+ class Obj
+ end
+ obj = Obj.new
+
+ singleton = Obj.new
+ def singleton.bar
+ end
+
+ extended = Obj.new
+ 2.times do
+ extended.extend Module.new
+ end
+
+ immediate = 1.4
+benchmark:
+ obj: get_class(obj)
+ extended: get_class(extended)
+ singleton: get_class(singleton)
+ immediate: get_class(immediate)
+loop_count: 1000
diff --git a/benchmark/object_id.yml b/benchmark/object_id.yml
new file mode 100644
index 0000000000..2bd52b923f
--- /dev/null
+++ b/benchmark/object_id.yml
@@ -0,0 +1,4 @@
+benchmark:
+ baseline: "Object.new"
+ object_id: "Object.new.object_id"
+# loop_count: 100000
diff --git a/benchmark/ractor_string_fstring.yml b/benchmark/ractor_string_fstring.yml
new file mode 100644
index 0000000000..14b92d8fd8
--- /dev/null
+++ b/benchmark/ractor_string_fstring.yml
@@ -0,0 +1,18 @@
+type: lib/benchmark_driver/runner/ractor
+benchmark:
+ ractor_fstring_random: |
+ i = 0
+ str = "same".dup
+ while i < 2000000
+ -(i.to_s.freeze)
+ i += 1
+ end
+ ractor_fstring_same: |
+ i = 0
+ str = "same".dup
+ while i < 2000000
+ -str
+ i += 1
+ end
+loop_count: 1
+ractor: 4
diff --git a/benchmark/scan.yaml b/benchmark/scan.yaml
new file mode 100644
index 0000000000..62ad1d6862
--- /dev/null
+++ b/benchmark/scan.yaml
@@ -0,0 +1,16 @@
+prelude: |
+ $LOAD_PATH.unshift(File.expand_path("lib"))
+ require "strscan"
+ str = "test string"
+ scanner = StringScanner.new(str)
+ str = "test"
+ reg = /test/
+benchmark:
+ check(reg): |
+ scanner.check(reg)
+ check(str): |
+ scanner.check(str)
+ match?(reg): |
+ scanner.match?(reg)
+ match?(str): |
+ scanner.match?(str)
diff --git a/benchmark/search.yaml b/benchmark/search.yaml
new file mode 100644
index 0000000000..42a50c90e6
--- /dev/null
+++ b/benchmark/search.yaml
@@ -0,0 +1,16 @@
+prelude: |
+ $LOAD_PATH.unshift(File.expand_path("lib"))
+ require "strscan"
+ str = "test string"
+ scanner = StringScanner.new(str)
+ str = "string"
+ reg = /string/
+benchmark:
+ check_until(reg): |
+ scanner.check_until(reg)
+ check_until(str): |
+ scanner.check_until(str)
+ exist?(reg): |
+ scanner.exist?(reg)
+ exist?(str): |
+ scanner.exist?(str)
diff --git a/benchmark/set.yml b/benchmark/set.yml
new file mode 100644
index 0000000000..061509cb1f
--- /dev/null
+++ b/benchmark/set.yml
@@ -0,0 +1,261 @@
+prelude: |
+ # First 1000 digits of pi
+ pi = <<~END.gsub(/\D/, '')
+ 31415926535897932384626433832795028841971693993751058209749445923078164062862089
+ 98628034825342117067982148086513282306647093844609550582231725359408128481117450
+ 28410270193852110555964462294895493038196442881097566593344612847564823378678316
+ 52712019091456485669234603486104543266482133936072602491412737245870066063155881
+ 74881520920962829254091715364367892590360011330530548820466521384146951941511609
+ 43305727036575959195309218611738193261179310511854807446237996274956735188575272
+ 48912279381830119491298336733624406566430860213949463952247371907021798609437027
+ 70539217176293176752384674818467669405132000568127145263560827785771342757789609
+ 17363717872146844090122495343014654958537105079227968925892354201995611212902196
+ 08640344181598136297747713099605187072113499999983729780499510597317328160963185
+ 95024459455346908302642522308253344685035261931188171010003137838752886587533208
+ 38142061717766914730359825349042875546873115956286388235378759375195778185778053
+ 21712268066130019278766111959092164201989380952572010654505906988788448549
+ END
+ array1 = 10.times.flat_map do |i|
+ pi[i...].chars.each_slice(10).map(&:join)
+ end
+ array2 = array1.map(&:reverse)
+ array1.map!(&:to_i)
+ array2.map!(&:to_i)
+ a1 = array1[...10]
+ a2 = array1[...100]
+ a3 = array1
+ oa1 = array2[...10]
+ oa2 = array2[...100]
+ oa3 = array2
+ s0 = Set.new
+ s0 = Set.new
+ s1 = Set.new(a1)
+ s2 = Set.new(a2)
+ s3 = Set.new(a3)
+ o0 = Set.new
+ o1 = Set.new(array2[...10])
+ o2 = Set.new(array2[...100])
+ o3 = Set.new(array2)
+ d0 = s0.dup
+ d1 = s1.dup
+ d2 = s2.dup
+ d3 = s3.dup
+ ss1 = s1 - a1[-1..-1]
+ ss2 = s2 - a2[-1..-1]
+ ss3 = s3 - a3[-1..-1]
+ os1 = o1 - oa1[-1..-1]
+ os2 = o2 - oa2[-1..-1]
+ os3 = o3 - oa3[-1..-1]
+ member = a1.first
+ cbi = s0.dup.compare_by_identity
+ ns = Set[s3, o3, d3]
+ set_subclass = Class.new(Set)
+
+benchmark:
+ new_0: Set.new
+ new_10: Set.new(a1)
+ new_100: Set.new(a2)
+ new_1000: Set.new(a3)
+ aref_0: Set[]
+ aref_10: Set[*a1]
+ aref_100: Set[*a2]
+ aref_1000: Set[*a3]
+ amp_0: s0 & o0
+ amp_10: s1 & o1
+ amp_100: s2 & o2
+ amp_1000: s3 & o3
+ amp_same_0: s0 & d0
+ amp_same_10: s1 & d1
+ amp_same_100: s2 & d2
+ amp_same_1000: s3 & d3
+ minus_0: s0 - o0
+ minus_10: s1 - o1
+ minus_100: s2 - o2
+ minus_1000: s3 - o3
+ minus_same_0: s0 - d0
+ minus_same_10: s1 - d1
+ minus_same_100: s2 - d2
+ minus_same_1000: s3 - d3
+ spaceship_0: s0 <=> o0
+ spaceship_diff_10: s1 <=> o1
+ spaceship_diff_100: s2 <=> o2
+ spaceship_diff_1000: s2 <=> o3
+ spaceship_sub_10: s1 <=> ss1
+ spaceship_sub_100: s2 <=> ss2
+ spaceship_sub_1000: s2 <=> ss3
+ spaceship_sup_10: ss1 <=> s1
+ spaceship_sup_100: ss2 <=> s2
+ spaceship_sup_1000: ss2 <=> s3
+ eq_0: s0 == o0
+ eq_10: s1 == o1
+ eq_100: s2 == o2
+ eq_1000: s3 == o3
+ eq_same_0: s0 == d0
+ eq_same_10: s1 == d1
+ eq_same_100: s2 == d2
+ eq_same_1000: s3 == d3
+ xor_0: s0 ^ o0
+ xor_10: s1 ^ o1
+ xor_100: s2 ^ o2
+ xor_1000: s3 ^ o3
+ xor_same_0: s0 ^ d0
+ xor_same_10: s1 ^ d1
+ xor_same_100: s2 ^ d2
+ xor_same_1000: s3 ^ d3
+ pipe_0: s0 | o0
+ pipe_10: s1 | o1
+ pipe_100: s2 | o2
+ pipe_1000: s3 | o3
+ pipe_same_0: s0 | d0
+ pipe_same_10: s1 | d1
+ pipe_same_100: s2 | d2
+ pipe_same_1000: s3 | d3
+ add: a3.each { s0.add(it) }
+ add_exist: a3.each { s3.add(it) }
+ addq: a3.each { s0.add?(it) }
+ addq_exist: a3.each { s3.add?(it) }
+ classify_0: s0.classify { it }
+ classify_10: s1.classify { it & 2 }
+ classify_100: s2.classify { it & 8 }
+ classify_1000: s3.classify { it & 32 }
+ clear: s0.clear
+ collect_0: s0.collect! { it }
+ collect_10: s1.collect! { it }
+ collect_100: s2.collect! { it }
+ collect_1000: s3.collect! { it }
+ compare_by_identity_0: s0.dup.compare_by_identity
+ compare_by_identity_10: s1.dup.compare_by_identity
+ compare_by_identity_100: s2.dup.compare_by_identity
+ compare_by_identity_1000: s3.dup.compare_by_identity
+ compare_by_identityq_false: s0.compare_by_identity?
+ compare_by_identityq_true: cbi.compare_by_identity?
+ clone_0: s0.clone
+ clone_10: s1.clone
+ clone_100: s2.clone
+ clone_1000: s3.clone
+ delete: a3.each { s3.delete(it) }
+ delete_not_exist: a3.each { o3.delete(it) }
+ deleteq: a3.each { s3.delete?(it) }
+ deleteq_not_exist: a3.each { o3.delete?(it) }
+ delete_if_0: s0.delete_if { it }
+ delete_if_10: s1.delete_if { it & 2 == 0 }
+ delete_if_100: s2.delete_if { it & 2 == 0 }
+ delete_if_1000: s3.delete_if { it & 2 == 0 }
+ disjoint_0: s0.disjoint? o0
+ disjoint_10: s1.disjoint? o1
+ disjoint_100: s2.disjoint? o2
+ disjoint_1000: s3.disjoint? o3
+ disjoint_same_0: s0.disjoint? d0
+ disjoint_same_10: s1.disjoint? d1
+ disjoint_same_100: s2.disjoint? d2
+ disjoint_same_1000: s3.disjoint? d3
+ divide_1arity_0: s0.divide { true }
+ divide_1arity_10: s1.divide { it & 2 }
+ divide_1arity_100: s2.divide { it & 8 }
+ divide_1arity_1000: s3.divide { it & 32 }
+ divide_2arity_0: s0.divide { true }
+ divide_2arity_10: s1.divide { (_1 & 2) == (_2 & 2) }
+ divide_2arity_100: s2.divide { (_1 & 8) == (_2 & 8) }
+ divide_2arity_1000: s3.divide { (_1 & 32) == (_2 & 32) }
+ dup_0: s0.dup
+ dup_10: s1.dup
+ dup_100: s2.dup
+ dup_1000: s3.dup
+ each_0: s0.each { it }
+ each_10: s1.each { it }
+ each_100: s2.each { it }
+ each_1000: s3.each { it }
+ empty_true: s0.empty?
+ empty_false: s3.empty?
+ flatten: ns.flatten
+ flattenb: ns.flatten!
+ include_true_0: s0.include? member
+ include_true_10: s1.include? member
+ include_true_100: s2.include? member
+ include_true_1000: s3.include? member
+ include_false_0: s0.include?(-1)
+ include_false_10: s1.include?(-1)
+ include_false_100: s2.include?(-1)
+ include_false_1000: s3.include?(-1)
+ intersect_0: s0.intersect? o0
+ intersect_10: s1.intersect? o1
+ intersect_100: s2.intersect? o2
+ intersect_1000: s3.intersect? o3
+ intersect_same_0: s0.intersect? d0
+ intersect_same_10: s1.intersect? d1
+ intersect_same_100: s2.intersect? d2
+ intersect_same_1000: s3.intersect? d3
+ join_0: s0.join
+ join_10: s1.join
+ join_100: s2.join
+ join_1000: s3.join
+ join_arg_0: s0.join ""
+ join_arg_10: s1.join ""
+ join_arg_100: s2.join ""
+ join_arg_1000: s3.join ""
+ keep_if_0: s0.keep_if { it }
+ keep_if_10: s1.keep_if { it & 2 == 0 }
+ keep_if_100: s2.keep_if { it & 2 == 0 }
+ keep_if_1000: s3.keep_if { it & 2 == 0 }
+ merge_set: s0.dup.merge(s3, o3)
+ merge_enum: s0.dup.merge(array1, array2)
+ proper_subset_0: s0.proper_subset? s0
+ proper_subset_10: s1.proper_subset? ss1
+ proper_subset_100: s2.proper_subset? ss2
+ proper_subset_1000: s3.proper_subset? ss3
+ proper_subset_false_10: s1.proper_subset? os1
+ proper_subset_false_100: s2.proper_subset? os2
+ proper_subset_false_1000: s3.proper_subset? os3
+ proper_superset_0: s0.proper_superset? s0
+ proper_superset_10: ss1.proper_superset? s1
+ proper_superset_100: ss2.proper_superset? s2
+ proper_superset_1000: ss3.proper_superset? s3
+ proper_superset_false_10: os1.proper_superset? s1
+ proper_superset_false_100: os2.proper_superset? s2
+ proper_superset_false_1000: os3.proper_superset? s3
+ reject_0: s0.reject! { it }
+ reject_10: s1.reject! { it & 2 == 0 }
+ reject_100: s2.reject! { it & 2 == 0 }
+ reject_1000: s3.reject! { it & 2 == 0 }
+ replace_0: s = Set.new; array1.each { s.replace(s0) }
+ replace_10: s = Set.new; array1.each { s.replace(s1) }
+ replace_100: s = Set.new; array1.each { s.replace(s2) }
+ replace_1000: s = Set.new; array1.each { s.replace(s3) }
+ reset_0: s0.reset
+ reset_10: s1.reset
+ reset_100: s2.reset
+ reset_1000: s3.reset
+ select_0: s0.select! { it }
+ select_10: s1.select! { it & 2 == 0 }
+ select_100: s2.select! { it & 2 == 0 }
+ select_1000: s3.select! { it & 2 == 0 }
+ size_0: s0.size
+ size_10: s1.size
+ size_100: s2.size
+ size_1000: s3.size
+ subtract_set: s3.dup.subtract(os3)
+ subtract_enum: s3.dup.subtract(oa3)
+ subtract_same_set: s3.dup.subtract(s3)
+ subtract_same_enum: s3.dup.subtract(a3)
+ subset_0: s0.subset? s0
+ subset_10: s1.subset? ss1
+ subset_100: s2.subset? ss2
+ subset_1000: s3.subset? ss3
+ subset_false_10: s1.subset? os1
+ subset_false_100: s2.subset? os2
+ subset_false_1000: s3.subset? os3
+ superset_0: s0.superset? s0
+ superset_10: ss1.superset? s1
+ superset_100: ss2.superset? s2
+ superset_1000: ss3.superset? s3
+ superset_false_10: os1.superset? s1
+ superset_false_100: os2.superset? s2
+ superset_false_1000: os3.superset? s3
+ to_a_0: s0.to_a
+ to_a_10: s1.to_a
+ to_a_100: s2.to_a
+ to_a_1000: s3.to_a
+ to_set_0: s0.to_set
+ to_set_10: s1.to_set
+ to_set_100: s2.to_set
+ to_set_1000: s3.to_set
diff --git a/benchmark/string_casecmp.yml b/benchmark/string_casecmp.yml
index 2354040a04..88a3555c8a 100644
--- a/benchmark/string_casecmp.yml
+++ b/benchmark/string_casecmp.yml
@@ -20,7 +20,9 @@ benchmark:
casecmp-10: lstr10.casecmp(ustr10)
casecmp-100: lstr100.casecmp(ustr100)
casecmp-1000: lstr1000.casecmp(ustr1000)
+ casecmp-1000vs10: lstr1000.casecmp(ustr10)
casecmp-nonascii1: lnonascii1.casecmp(unonascii1)
casecmp-nonascii10: lnonascii10.casecmp(unonascii10)
casecmp-nonascii100: lnonascii100.casecmp(unonascii100)
casecmp-nonascii1000: lnonascii1000.casecmp(unonascii1000)
+ casecmp-nonascii1000vs10: lnonascii1000.casecmp(unonascii10)
diff --git a/benchmark/string_concat.yml b/benchmark/string_concat.yml
index da14692f5e..f11f95ee9a 100644
--- a/benchmark/string_concat.yml
+++ b/benchmark/string_concat.yml
@@ -45,7 +45,7 @@ benchmark:
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}"
- interpolation_same_size_pool: |
+ interpolation_same_heap: |
buffer = "#{SHORT}#{SHORT}"
- interpolation_switching_size_pools: |
+ interpolation_switching_heaps: |
buffer = "#{SHORT}#{LONG}"
diff --git a/benchmark/string_fstring.yml b/benchmark/string_fstring.yml
new file mode 100644
index 0000000000..cafef1f3fe
--- /dev/null
+++ b/benchmark/string_fstring.yml
@@ -0,0 +1,16 @@
+benchmark:
+ fstring_random: |
+ i = 0
+ str = "same".dup
+ while i < 5_000_000
+ -(i.to_s.freeze)
+ i += 1
+ end
+ fstring_same: |
+ i = 0
+ str = "same".dup
+ while i < 10_000_000
+ -str
+ i += 1
+ end
+loop_count: 1
diff --git a/benchmark/string_gsub.yml b/benchmark/string_gsub.yml
new file mode 100644
index 0000000000..0f964337dd
--- /dev/null
+++ b/benchmark/string_gsub.yml
@@ -0,0 +1,43 @@
+prelude: |
+ # frozen_string_literal: true
+ STR = ((("a" * 31) + "<") * 1000).freeze
+ STR_UNICODE = ((("a" * 30) + "\u2028") * 1000).freeze
+ ESCAPED_CHARS_BINARY = {
+ "\u2028".b => '\u2028'.b,
+ "\u2029".b => '\u2029'.b,
+ ">".b => '\u003e'.b.freeze,
+ "<".b => '\u003c'.b.freeze,
+ "&".b => '\u0026'.b.freeze,
+ }
+ BINARY_PATTERN = Regexp.union(ESCAPED_CHARS_BINARY.keys)
+
+ ESCAPED_CHARS = {
+ "\u2028" => '\u2028',
+ "\u2029" => '\u2029',
+ ">" => '\u003e',
+ "<" => '\u003c',
+ "&" => '\u0026',
+ }
+ ESCAPE_PATTERN = Regexp.union(ESCAPED_CHARS.keys)
+
+
+benchmark:
+ escape: |
+ str = STR.dup
+ str.gsub!(ESCAPE_PATTERN, ESCAPED_CHARS)
+ str
+
+ escape_bin: |
+ str = STR.b
+ str.gsub!(BINARY_PATTERN, ESCAPED_CHARS_BINARY)
+ str.force_encoding(Encoding::UTF_8)
+
+ escape_utf8: |
+ str = STR_UNICODE.dup
+ str.gsub!(ESCAPE_PATTERN, ESCAPED_CHARS)
+ str
+
+ escape_utf8_bin: |
+ str = STR_UNICODE.b
+ str.gsub!(BINARY_PATTERN, ESCAPED_CHARS_BINARY)
+ str.force_encoding(Encoding::UTF_8)
diff --git a/benchmark/struct_accessor.yml b/benchmark/struct_accessor.yml
index 61176cfdd4..d95240e2dd 100644
--- a/benchmark/struct_accessor.yml
+++ b/benchmark/struct_accessor.yml
@@ -1,5 +1,12 @@
prelude: |
C = Struct.new(:x) do
+ def initialize(...)
+ super
+ @ivar = 42
+ end
+
+ attr_accessor :ivar
+
class_eval <<-END
def r
#{'x;'*256}
@@ -15,11 +22,16 @@ prelude: |
m = method(:x=)
#{'m.call(nil);'*256}
end
+ def r_ivar
+ #{'ivar;'*256}
+ end
END
end
+ C.new(nil) # ensure common shape is known
obj = C.new(nil)
benchmark:
member_reader: "obj.r"
member_writer: "obj.w"
member_reader_method: "obj.rm"
member_writer_method: "obj.wm"
+ ivar_reader: "obj.r_ivar"
diff --git a/benchmark/time_now.yml b/benchmark/time_now.yml
index f6d6a31489..9336877cd4 100644
--- a/benchmark/time_now.yml
+++ b/benchmark/time_now.yml
@@ -1,3 +1,4 @@
benchmark:
- 'Time.now'
- 'Time.now(in: "+09:00")'
+ - 'Time.now.year'
diff --git a/benchmark/time_strftime.yml b/benchmark/time_strftime.yml
new file mode 100644
index 0000000000..28f62aec87
--- /dev/null
+++ b/benchmark/time_strftime.yml
@@ -0,0 +1,7 @@
+prelude: |
+ # frozen_string_literal: true
+ time = Time.now
+benchmark:
+ - time.strftime("%FT%T") # 19B
+ - time.strftime("%FT%T.%3N") # 23B
+ - time.strftime("%FT%T.%6N") # 26B
diff --git a/benchmark/time_xmlschema.yml b/benchmark/time_xmlschema.yml
new file mode 100644
index 0000000000..654e5cfcbc
--- /dev/null
+++ b/benchmark/time_xmlschema.yml
@@ -0,0 +1,27 @@
+prelude: |
+ # frozen_string_literal
+ unless Time.method_defined?(:xmlschema)
+ class Time
+ def xmlschema(fraction_digits=0)
+ fraction_digits = fraction_digits.to_i
+ s = strftime("%FT%T")
+ if fraction_digits > 0
+ s << strftime(".%#{fraction_digits}N")
+ end
+ s << (utc? ? 'Z' : strftime("%:z"))
+ end
+ end
+ end
+ time = Time.now
+ utc_time = Time.now.utc
+ fraction_sec = Time.at(123456789.quo(9999999999)).getlocal("+09:00")
+ future_time = Time.utc(10000)
+benchmark:
+ - time.xmlschema
+ - utc_time.xmlschema
+ - time.xmlschema(6)
+ - utc_time.xmlschema(6)
+ - time.xmlschema(9)
+ - utc_time.xmlschema(9)
+ - fraction_sec.xmlschema(10)
+ - future_time.xmlschema
diff --git a/benchmark/vm_ivar_get.yml b/benchmark/vm_ivar_get.yml
index 9174af6965..1e0dad665f 100644
--- a/benchmark/vm_ivar_get.yml
+++ b/benchmark/vm_ivar_get.yml
@@ -1,17 +1,75 @@
prelude: |
class Example
def initialize
+ @levar = 1
@v0 = 1
@v1 = 2
@v3 = 3
+ end
+
+ def get_value_loop
+ sum = 0
+
+ i = 0
+ while i < 100_000
+ # 10 times to de-emphasize loop overhead
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ i += 1
+ end
+
+ return sum
+ end
+
+ @levar = 1
+ @v0 = 1
+ @v1 = 2
+ @v3 = 3
+
+ def self.get_value_loop
+ sum = 0
+
+ i = 0
+ while i < 100_000
+ # 10 times to de-emphasize loop overhead
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ sum += @levar
+ i += 1
+ end
+
+ return sum
+ end
+ end
+
+ class GenExample < Time
+ def initialize
@levar = 1
+ @v0 = 1
+ @v1 = 2
+ @v3 = 3
end
def get_value_loop
sum = 0
i = 0
- while i < 1000000
+ while i < 100_000
# 10 times to de-emphasize loop overhead
sum += @levar
sum += @levar
@@ -31,7 +89,12 @@ prelude: |
end
obj = Example.new
+ gen = GenExample.new
benchmark:
- vm_ivar_get: |
+ vm_ivar_get_on_obj: |
obj.get_value_loop
+ vm_ivar_get_on_class: |
+ Example.get_value_loop
+ vm_ivar_get_on_generic: |
+ gen.get_value_loop
loop_count: 100
diff --git a/benchmark/vm_ivar_set_on_instance.yml b/benchmark/vm_ivar_set_on_instance.yml
index 91857b7742..6ce53a86ec 100644
--- a/benchmark/vm_ivar_set_on_instance.yml
+++ b/benchmark/vm_ivar_set_on_instance.yml
@@ -1,16 +1,44 @@
prelude: |
class TheClass
def initialize
+ @levar = 1
@v0 = 1
@v1 = 2
@v3 = 3
+ end
+
+ def set_value_loop
+ # 100k
+ i = 0
+ while i < 100_000
+ # 10 times to de-emphasize loop overhead
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ i += 1
+ end
+ end
+ end
+
+ class Generic < Time
+ def initialize
@levar = 1
+ @v0 = 1
+ @v1 = 2
+ @v3 = 3
end
def set_value_loop
- # 1M
+ # 100k
i = 0
- while i < 1000000
+ while i < 100_000
# 10 times to de-emphasize loop overhead
@levar = i
@levar = i
@@ -28,8 +56,39 @@ prelude: |
end
obj = TheClass.new
+ gen_obj = Generic.new
+
+ class SomeClass
+ @levar = 1
+ @v0 = 1
+ @v1 = 2
+ @v3 = 3
+
+ def self.set_value_loop
+ # 100k
+ i = 0
+ while i < 100_000
+ # 10 times to de-emphasize loop overhead
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ @levar = i
+ i += 1
+ end
+ end
+ end
benchmark:
vm_ivar_set_on_instance: |
obj.set_value_loop
+ vm_ivar_set_on_generic: |
+ gen_obj.set_value_loop
+ vm_ivar_set_on_class: |
+ SomeClass.set_value_loop
loop_count: 100
diff --git a/bignum.c b/bignum.c
index e04843f478..ee2fa1ed30 100644
--- a/bignum.c
+++ b/bignum.c
@@ -79,7 +79,6 @@ STATIC_ASSERT(sizeof_bdigit_and_dbl, SIZEOF_BDIGIT*2 <= SIZEOF_BDIGIT_DBL);
STATIC_ASSERT(bdigit_signedness, 0 < (BDIGIT)-1);
STATIC_ASSERT(bdigit_dbl_signedness, 0 < (BDIGIT_DBL)-1);
STATIC_ASSERT(bdigit_dbl_signed_signedness, 0 > (BDIGIT_DBL_SIGNED)-1);
-STATIC_ASSERT(rbignum_embed_len_max, BIGNUM_EMBED_LEN_MAX <= (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT));
#if SIZEOF_BDIGIT < SIZEOF_LONG
STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_LONG % SIZEOF_BDIGIT == 0);
@@ -2699,7 +2698,7 @@ bigdivrem_restoring(BDIGIT *zds, size_t zn, BDIGIT *yds, size_t yn)
if (bds.zn > 10000 || bds.yn > 10000) {
retry:
bds.stop = Qfalse;
- rb_nogvl(bigdivrem1, &bds, rb_big_stop, &bds, RB_NOGVL_UBF_ASYNC_SAFE);
+ rb_nogvl(bigdivrem1, &bds, rb_big_stop, &bds, RB_NOGVL_UBF_ASYNC_SAFE | RB_NOGVL_OFFLOAD_SAFE);
if (bds.stop == Qtrue) {
/* execute trap handler, but exception was not raised. */
@@ -2990,25 +2989,56 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
((l) << BIGNUM_EMBED_LEN_SHIFT)) : \
(void)(RBIGNUM(b)->as.heap.len = (l)))
+static size_t
+big_embed_capa(VALUE big)
+{
+ size_t size = rb_gc_obj_slot_size(big) - offsetof(struct RBignum, as.ary);
+ RUBY_ASSERT(size % sizeof(BDIGIT) == 0);
+ size_t capa = size / sizeof(BDIGIT);
+ RUBY_ASSERT(capa <= BIGNUM_EMBED_LEN_MAX);
+ return capa;
+}
+
+static size_t
+big_embed_size(size_t capa)
+{
+ size_t size = offsetof(struct RBignum, as.ary) + (sizeof(BDIGIT) * capa);
+ if (size < sizeof(struct RBignum)) {
+ size = sizeof(struct RBignum);
+ }
+ return size;
+}
+
+static bool
+big_embeddable_p(size_t capa)
+{
+ if (capa > BIGNUM_EMBED_LEN_MAX) {
+ return false;
+ }
+ return rb_gc_size_allocatable_p(big_embed_size(capa));
+}
+
static void
rb_big_realloc(VALUE big, size_t len)
{
BDIGIT *ds;
+ size_t embed_capa = big_embed_capa(big);
+
if (BIGNUM_EMBED_P(big)) {
- if (BIGNUM_EMBED_LEN_MAX < len) {
+ if (embed_capa < len) {
ds = ALLOC_N(BDIGIT, len);
- MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, BIGNUM_EMBED_LEN_MAX);
+ MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, embed_capa);
RBIGNUM(big)->as.heap.len = BIGNUM_LEN(big);
RBIGNUM(big)->as.heap.digits = ds;
FL_UNSET_RAW(big, BIGNUM_EMBED_FLAG);
}
}
else {
- if (len <= BIGNUM_EMBED_LEN_MAX) {
+ if (len <= embed_capa) {
ds = RBIGNUM(big)->as.heap.digits;
FL_SET_RAW(big, BIGNUM_EMBED_FLAG);
BIGNUM_SET_LEN(big, len);
- (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, embed_capa * sizeof(BDIGIT));
if (ds) {
MEMCPY(RBIGNUM(big)->as.ary, ds, BDIGIT, len);
xfree(ds);
@@ -3018,7 +3048,7 @@ rb_big_realloc(VALUE big, size_t len)
if (BIGNUM_LEN(big) == 0) {
RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
}
- else {
+ else if (BIGNUM_LEN(big) < len) {
REALLOC_N(RBIGNUM(big)->as.heap.digits, BDIGIT, len);
}
}
@@ -3035,16 +3065,24 @@ rb_big_resize(VALUE big, size_t len)
static VALUE
bignew_1(VALUE klass, size_t len, int sign)
{
- NEWOBJ_OF(big, struct RBignum, klass,
- T_BIGNUM | (RGENGC_WB_PROTECTED_BIGNUM ? FL_WB_PROTECTED : 0), sizeof(struct RBignum), 0);
- VALUE bigv = (VALUE)big;
- BIGNUM_SET_SIGN(bigv, sign);
- if (len <= BIGNUM_EMBED_LEN_MAX) {
- FL_SET_RAW(bigv, BIGNUM_EMBED_FLAG);
+ VALUE bigv;
+
+ if (big_embeddable_p(len)) {
+ size_t size = big_embed_size(len);
+ RUBY_ASSERT(rb_gc_size_allocatable_p(size));
+ NEWOBJ_OF(big, struct RBignum, klass,
+ T_BIGNUM | BIGNUM_EMBED_FLAG | (RGENGC_WB_PROTECTED_BIGNUM ? FL_WB_PROTECTED : 0),
+ size, 0);
+ bigv = (VALUE)big;
+ BIGNUM_SET_SIGN(bigv, sign);
BIGNUM_SET_LEN(bigv, len);
- (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)big->as.ary, sizeof(big->as.ary));
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)big->as.ary, len * sizeof(BDIGIT));
}
else {
+ NEWOBJ_OF(big, struct RBignum, klass,
+ T_BIGNUM | (RGENGC_WB_PROTECTED_BIGNUM ? FL_WB_PROTECTED : 0), sizeof(struct RBignum), 0);
+ bigv = (VALUE)big;
+ BIGNUM_SET_SIGN(bigv, sign);
big->as.heap.digits = ALLOC_N(BDIGIT, len);
big->as.heap.len = len;
}
@@ -3055,7 +3093,9 @@ bignew_1(VALUE klass, size_t len, int sign)
VALUE
rb_big_new(size_t len, int sign)
{
- return bignew(len, sign != 0);
+ VALUE obj = bignew(len, sign != 0);
+ memset(BIGNUM_DIGITS(obj), 0, len * sizeof(BDIGIT));
+ return obj;
}
VALUE
@@ -4475,7 +4515,7 @@ rb_str2big_gmp(VALUE arg, int base, int badcheck)
#if HAVE_LONG_LONG
-static VALUE
+VALUE
rb_ull2big(unsigned LONG_LONG n)
{
long i;
@@ -4497,7 +4537,7 @@ rb_ull2big(unsigned LONG_LONG n)
return big;
}
-static VALUE
+VALUE
rb_ll2big(LONG_LONG n)
{
long neg = 0;
@@ -4535,7 +4575,7 @@ rb_ll2inum(LONG_LONG n)
#endif /* HAVE_LONG_LONG */
#ifdef HAVE_INT128_T
-static VALUE
+VALUE
rb_uint128t2big(uint128_t n)
{
long i;
@@ -5914,6 +5954,8 @@ bigsq(VALUE x)
BDIGIT *xds, *zds;
xn = BIGNUM_LEN(x);
+ if (MUL_OVERFLOW_LONG_P(2, xn))
+ rb_raise(rb_eArgError, "square overflow");
zn = 2 * xn;
z = bignew(zn, 1);
@@ -5942,6 +5984,8 @@ bigmul0(VALUE x, VALUE y)
xn = BIGNUM_LEN(x);
yn = BIGNUM_LEN(y);
+ if (ADD_OVERFLOW_LONG_P(xn, yn))
+ rb_raise(rb_eArgError, "multiplication overflow");
zn = xn + yn;
z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
@@ -6287,8 +6331,7 @@ rb_big_pow(VALUE x, VALUE y)
y = bignorm(y);
if (FIXNUM_P(y))
goto again;
- rb_warn("in a**b, b may be too big");
- d = rb_big2dbl(y);
+ rb_raise(rb_eArgError, "exponent is too large");
}
else if (FIXNUM_P(y)) {
yy = FIX2LONG(y);
@@ -6304,13 +6347,17 @@ rb_big_pow(VALUE x, VALUE y)
VALUE z = 0;
SIGNED_VALUE mask;
const size_t xbits = rb_absint_numwords(x, 1, NULL);
- const size_t BIGLEN_LIMIT = 32*1024*1024;
+#if SIZEOF_SIZE_T == 4
+ const size_t BIGLEN_LIMIT = 1ULL << 31; // 2 GB
+#else // SIZEOF_SIZE_T == 8
+ const size_t BIGLEN_LIMIT = 1ULL << 34; // 16 GB
+#endif
if (xbits == (size_t)-1 ||
(xbits > BIGLEN_LIMIT) ||
+ MUL_OVERFLOW_LONG_P(yy, xbits) ||
(xbits * yy > BIGLEN_LIMIT)) {
- rb_warn("in a**b, b may be too big");
- d = (double)yy;
+ rb_raise(rb_eArgError, "exponent is too large");
}
else {
for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
@@ -6339,7 +6386,7 @@ bigand_int(VALUE x, long xn, BDIGIT hibitsx, long y)
BDIGIT hibitsy;
if (y == 0) return INT2FIX(0);
- if (xn == 0) return hibitsx ? LONG2NUM(y) : 0;
+ if (xn == 0) return hibitsx ? LONG2NUM(y) : INT2FIX(0);
hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
#if SIZEOF_BDIGIT >= SIZEOF_LONG
@@ -6751,6 +6798,73 @@ rb_big_aref(VALUE x, VALUE y)
}
VALUE
+rb_big_aref2(VALUE x, VALUE beg, VALUE len)
+{
+ BDIGIT *xds, *vds;
+ VALUE v;
+ size_t copy_begin, xn, shift;
+ ssize_t begin, length, end;
+ bool negative_add_one;
+
+ beg = rb_to_int(beg);
+ len = rb_to_int(len);
+ length = NUM2SSIZET(len);
+ begin = NUM2SSIZET(beg);
+ end = NUM2SSIZET(rb_int_plus(beg, len));
+ shift = begin < 0 ? -begin : 0;
+ xn = BIGNUM_LEN(x);
+ xds = BDIGITS(x);
+
+ if (length < 0) return rb_big_rshift(x, beg);
+ if (length == 0 || end <= 0) return INT2FIX(0);
+ if (begin < 0) begin = 0;
+
+ if ((size_t)(end - 1) / BITSPERDIG >= xn) {
+ /* end > xn * BITSPERDIG */
+ end = xn * BITSPERDIG;
+ }
+
+ if ((size_t)begin / BITSPERDIG < xn) {
+ /* begin < xn * BITSPERDIG */
+ size_t shift_bits, copy_end;
+ copy_begin = begin / BITSPERDIG;
+ shift_bits = begin % BITSPERDIG;
+ copy_end = (end - 1) / BITSPERDIG + 1;
+ v = bignew(copy_end - copy_begin, 1);
+ vds = BDIGITS(v);
+ MEMCPY(vds, xds + copy_begin, BDIGIT, copy_end - copy_begin);
+ negative_add_one = (vds[0] & ((1 << shift_bits) - 1)) == 0;
+ v = bignorm(v);
+ if (shift_bits) v = rb_int_rshift(v, SIZET2NUM(shift_bits));
+ }
+ else {
+ /* Out of range */
+ v = INT2FIX(0);
+ negative_add_one = false;
+ copy_begin = begin = end = 0;
+ }
+
+ if (BIGNUM_NEGATIVE_P(x)) {
+ size_t mask_size = length - shift;
+ VALUE mask = rb_int_minus(rb_int_lshift(INT2FIX(1), SIZET2NUM(mask_size)), INT2FIX(1));
+ v = rb_int_xor(v, mask);
+ for (size_t i = 0; negative_add_one && i < copy_begin; i++) {
+ if (xds[i]) negative_add_one = false;
+ }
+ if (negative_add_one) v = rb_int_plus(v, INT2FIX(1));
+ v = rb_int_and(v, mask);
+ }
+ else {
+ size_t mask_size = (size_t)end - begin;
+ VALUE mask = rb_int_minus(rb_int_lshift(INT2FIX(1), SIZET2NUM(mask_size)), INT2FIX(1));
+ v = rb_int_and(v, mask);
+ }
+ RB_GC_GUARD(x);
+ if (shift) v = rb_int_lshift(v, SSIZET2NUM(shift));
+ return v;
+}
+
+VALUE
rb_big_hash(VALUE x)
{
st_index_t hash;
@@ -6956,7 +7070,7 @@ int_pow_tmp3(VALUE x, VALUE y, VALUE m, int nega_flg)
zn = mn;
z = bignew(zn, 1);
bary_powm_gmp(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn, BDIGITS(m), mn);
- if (nega_flg & BIGNUM_POSITIVE_P(z)) {
+ if (nega_flg && BIGNUM_POSITIVE_P(z) && !BIGZEROP(z)) {
z = rb_big_minus(z, m);
}
RB_GC_GUARD(x);
@@ -6984,7 +7098,7 @@ int_pow_tmp3(VALUE x, VALUE y, VALUE m, int nega_flg)
x = rb_int_modulo(x, m);
}
- if (nega_flg && rb_int_positive_p(tmp)) {
+ if (nega_flg && rb_int_positive_p(tmp) && !rb_int_zero_p(tmp)) {
tmp = rb_int_minus(tmp, m);
}
return tmp;
@@ -7096,6 +7210,11 @@ rb_int_powm(int const argc, VALUE * const argv, VALUE const num)
rb_raise(rb_eTypeError, "Integer#pow() 2nd argument not allowed unless all arguments are integers");
}
+ if (rb_int_zero_p(a) && !rb_int_zero_p(b)) {
+ /* shortcut; 0**x => 0 except for x == 0 */
+ return INT2FIX(0);
+ }
+
if (rb_int_negative_p(m)) {
m = rb_int_uminus(m);
nega_flg = 1;
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 329d429f33..04de0c93b9 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -16,6 +16,7 @@ rescue LoadError
$:.unshift File.join(File.dirname(__FILE__), '../lib')
retry
end
+require_relative '../tool/lib/test/jobserver'
if !Dir.respond_to?(:mktmpdir)
# copied from lib/tmpdir.rb
@@ -78,6 +79,7 @@ bt = Struct.new(:ruby,
:platform,
:timeout,
:timeout_scale,
+ :launchable_test_reports
)
BT = Class.new(bt) do
def indent=(n)
@@ -109,35 +111,7 @@ BT = Class.new(bt) do
def wn=(wn)
unless wn == 1
- if /(?:\A|\s)--jobserver-(?:auth|fds)=(?:(\d+),(\d+)|fifo:((?:\\.|\S)+))/ =~ ENV.delete("MAKEFLAGS")
- begin
- if fifo = $3
- fifo.gsub!(/\\(?=.)/, '')
- r = File.open(fifo, IO::RDONLY|IO::NONBLOCK|IO::BINARY)
- w = File.open(fifo, IO::WRONLY|IO::NONBLOCK|IO::BINARY)
- else
- r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
- w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
- end
- rescue
- r.close if r
- else
- r.close_on_exec = true
- w.close_on_exec = true
- tokens = r.read_nonblock(wn > 0 ? wn : 1024, exception: false)
- r.close
- if String === tokens
- tokens.freeze
- auth = w
- w = nil
- at_exit {auth << tokens; auth.close}
- wn = tokens.size + 1
- else
- w.close
- wn = 1
- end
- end
- end
+ wn = Test::JobServer.max_jobs(wn > 0 ? wn : 1024, ENV.delete("MAKEFLAGS")) || wn
if wn <= 0
require 'etc'
wn = [Etc.nprocessors / 2, 1].max
@@ -162,7 +136,11 @@ def main
BT.tty = nil
BT.quiet = false
BT.timeout = 180
- BT.timeout_scale = (defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? ? 3 : 1) # for --jit-wait
+ BT.timeout_scale = 1
+ if (ts = (ENV["RUBY_TEST_TIMEOUT_SCALE"] || ENV["RUBY_TEST_SUBPROCESS_TIMEOUT_SCALE"]).to_i) > 1
+ BT.timeout_scale *= ts
+ end
+
# BT.wn = 1
dir = nil
quiet = false
@@ -225,6 +203,31 @@ End
exit true
when /\A-j/
true
+ when /--launchable-test-reports=(.*)/
+ if File.exist?($1)
+ # To protect files from overwritten, do nothing when the file exists.
+ return true
+ end
+
+ begin
+ require_relative '../tool/lib/launchable'
+ rescue LoadError
+ # The following error sometimes happens, so we're going to skip writing Launchable report files in this case.
+ #
+ # ```
+ # /tmp/tmp.bISss9CtXZ/.ext/common/json/ext.rb:15:in 'Kernel#require':
+ # /tmp/tmp.bISss9CtXZ/.ext/x86_64-linux/json/ext/parser.so:
+ # undefined symbol: ruby_abi_version - ruby_abi_version (LoadError)
+ # ```
+ #
+ return true
+ end
+ BT.launchable_test_reports = writer = Launchable::JsonStreamWriter.new($1)
+ writer.write_array('testCases')
+ at_exit {
+ writer.close
+ }
+ true
else
false
end
@@ -268,7 +271,7 @@ End
if defined?(RUBY_DESCRIPTION)
puts "Driver is #{RUBY_DESCRIPTION}"
elsif defined?(RUBY_PATCHLEVEL)
- puts "Driver is ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}#{RUBY_PLATFORM}) [#{RUBY_PLATFORM}]"
+ puts "Driver is ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}#{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]"
else
puts "Driver is ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end
@@ -324,6 +327,7 @@ def concurrent_exec_test
begin
while BT.wn != term_wn
if r = rq.pop
+ BT_STATE.count += 1
case
when BT.quiet
when BT.tty
@@ -341,6 +345,59 @@ def concurrent_exec_test
end
end
+##
+# Module for writing a test file for uploading test results into Launchable.
+# In bootstraptest, we aggregate the test results based on file level.
+module Launchable
+ @@last_test_name = nil
+ @@failure_log = ''
+ @@duration = 0
+
+ def show_progress(message = '')
+ faildesc, t = super
+
+ if writer = BT.launchable_test_reports
+ if faildesc
+ @@failure_log += faildesc
+ end
+ repo_path = File.expand_path("#{__dir__}/../")
+ relative_path = File.join(__dir__, self.path).delete_prefix("#{repo_path}/")
+ if @@last_test_name != nil && @@last_test_name != relative_path
+ # The test path is a URL-encoded representation.
+ # https://github.com/launchableinc/cli/blob/v1.81.0/launchable/testpath.py#L18
+ test_path = "#{encode_test_path_component("file")}=#{encode_test_path_component(@@last_test_name)}"
+ if @@failure_log.size > 0
+ status = 'TEST_FAILED'
+ else
+ status = 'TEST_PASSED'
+ end
+ writer.write_object(
+ {
+ testPath: test_path,
+ status: status,
+ duration: t,
+ createdAt: Time.now.to_s,
+ stderr: @@failure_log,
+ stdout: nil,
+ data: {
+ lineNumber: self.lineno
+ }
+ }
+ )
+ @@duration = 0
+ @@failure_log = ''
+ end
+ @@last_test_name = relative_path
+ @@duration += t
+ end
+ end
+
+ private
+ def encode_test_path_component component
+ component.to_s.gsub('%', '%25').gsub('=', '%3D').gsub('#', '%23').gsub('&', '%26')
+ end
+end
+
def exec_test(paths)
# setup
load_test paths
@@ -417,6 +474,7 @@ def target_platform
end
class Assertion < Struct.new(:src, :path, :lineno, :proc)
+ prepend Launchable
@count = 0
@all = Hash.new{|h, k| h[k] = []}
@errbuf = []
@@ -491,9 +549,9 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
$stderr.print "#{BT.progress_bs}#{BT.progress[BT_STATE.count % BT.progress.size]}"
end
- t = Time.now if BT.verbose
+ t = Time.now if BT.verbose || BT.launchable_test_reports
faildesc, errout = with_stderr {yield}
- t = Time.now - t if BT.verbose
+ t = Time.now - t if BT.verbose || BT.launchable_test_reports
if !faildesc
# success
@@ -520,6 +578,8 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
$stderr.printf("%-*s%s", BT.width, path, BT.progress[BT_STATE.count % BT.progress.size])
end
end
+
+ [faildesc, t]
rescue Interrupt
$stderr.puts "\##{@id} #{path}:#{lineno}"
raise
@@ -538,6 +598,8 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
end
end
+ class Timeout < StandardError; end
+
def get_result_string(opt = '', timeout: BT.timeout, **argh)
if BT.ruby
timeout = BT.apply_timeout_scale(timeout)
@@ -547,7 +609,11 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc)
out = IO.popen("#{BT.ruby} -W0 #{opt} #{filename}", **kw)
pid = out.pid
th = Thread.new {out.read.tap {Process.waitpid(pid); out.close}}
- th.value if th.join(timeout)
+ if th.join(timeout)
+ th.value
+ else
+ Timeout.new("timed out after #{timeout} seconds")
+ end
ensure
raise Interrupt if $? and $?.signaled? && $?.termsig == Signal.list["INT"]
@@ -644,23 +710,19 @@ def assert_normal_exit(testsrc, *rest, timeout: BT.timeout, **opt)
timeout_signaled = false
logfile = "assert_normal_exit.#{as.path}.#{as.lineno}.log"
- begin
- err = open(logfile, "w")
- io = IO.popen("#{BT.ruby} -W0 #{filename}", err: err)
- pid = io.pid
- th = Thread.new {
- io.read
- io.close
- $?
- }
- if !th.join(timeout)
- Process.kill :KILL, pid
- timeout_signaled = true
- end
- status = th.value
- ensure
- err.close
+ io = IO.popen("#{BT.ruby} -W0 #{filename}", err: logfile)
+ pid = io.pid
+ th = Thread.new {
+ io.read
+ io.close
+ $?
+ }
+ if !th.join(timeout)
+ Process.kill :KILL, pid
+ timeout_signaled = true
end
+ status = th.value
+
if status && status.signaled?
signo = status.termsig
signame = Signal.list.invert[signo]
@@ -745,6 +807,8 @@ end
def pretty(src, desc, result)
src = src.sub(/\A\s*\n/, '')
+ lines = src.lines
+ src = lines[0..20].join + "(...snip)\n" if lines.size > 20
(/\n/ =~ src ? "\n#{adjust_indent(src)}" : src) + " #=> #{desc}"
end
@@ -806,9 +870,8 @@ def yjit_enabled?
ENV.key?('RUBY_YJIT_ENABLE') || ENV.fetch('RUN_OPTS', '').include?('yjit') || BT.ruby.include?('yjit')
end
-def rjit_enabled?
- # Don't check `RubyVM::RJIT.enabled?`. On btest-bruby, target Ruby != runner Ruby.
- ENV.fetch('RUN_OPTS', '').include?('rjit')
+def zjit_enabled?
+ ENV.key?('RUBY_ZJIT_ENABLE') || ENV.fetch('RUN_OPTS', '').include?('zjit') || BT.ruby.include?('zjit')
end
exit main
diff --git a/bootstraptest/test_autoload.rb b/bootstraptest/test_autoload.rb
index 9e0850bc52..de66f1f3ee 100644
--- a/bootstraptest/test_autoload.rb
+++ b/bootstraptest/test_autoload.rb
@@ -11,7 +11,7 @@ assert_equal 'ok', %q{
}, '[ruby-dev:43816]'
assert_equal 'ok', %q{
- open('zzz2.rb', 'w') {|f| f.puts '' }
+ File.write('zzz2.rb', '')
instance_eval do
autoload :ZZZ, './zzz2.rb'
begin
@@ -23,7 +23,7 @@ assert_equal 'ok', %q{
}, '[ruby-dev:43816]'
assert_equal 'ok', %q{
- open('zzz3.rb', 'w') {|f| f.puts 'class ZZZ; def self.ok;:ok;end;end'}
+ File.write('zzz3.rb', "class ZZZ; def self.ok;:ok;end;end\n")
instance_eval do
autoload :ZZZ, './zzz3.rb'
ZZZ.ok
@@ -31,20 +31,20 @@ assert_equal 'ok', %q{
}, '[ruby-dev:43816]'
assert_equal 'ok', %q{
- open("zzz4.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
+ File.write("zzz4.rb", "class ZZZ; def self.ok;:ok;end;end\n")
autoload :ZZZ, "./zzz4.rb"
ZZZ.ok
}
assert_equal 'ok', %q{
- open("zzz5.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
+ File.write("zzz5.rb", "class ZZZ; def self.ok;:ok;end;end\n")
autoload :ZZZ, "./zzz5.rb"
require "./zzz5.rb"
ZZZ.ok
}
assert_equal 'okok', %q{
- open("zzz6.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
+ File.write("zzz6.rb", "class ZZZ; def self.ok;:ok;end;end\n")
autoload :ZZZ, "./zzz6.rb"
t1 = Thread.new {ZZZ.ok}
t2 = Thread.new {ZZZ.ok}
@@ -60,7 +60,7 @@ assert_finish 5, %q{
}, '[ruby-core:21696]'
assert_equal 'A::C', %q{
- open("zzz7.rb", "w") {}
+ File.write("zzz7.rb", "")
class A
autoload :C, "./zzz7"
class C
diff --git a/bootstraptest/test_eval.rb b/bootstraptest/test_eval.rb
index d923a957bc..20bd9615f4 100644
--- a/bootstraptest/test_eval.rb
+++ b/bootstraptest/test_eval.rb
@@ -217,7 +217,7 @@ assert_equal %q{[10, main]}, %q{
}
%w[break next redo].each do |keyword|
- assert_match %r"Can't escape from eval with #{keyword}\b", %{
+ assert_match %r"Invalid #{keyword}\b", %{
$stderr = STDOUT
begin
eval "0 rescue #{keyword}"
diff --git a/bootstraptest/test_fiber.rb b/bootstraptest/test_fiber.rb
index 2614dd13bf..ae809a5936 100644
--- a/bootstraptest/test_fiber.rb
+++ b/bootstraptest/test_fiber.rb
@@ -37,3 +37,8 @@ assert_normal_exit %q{
assert_normal_exit %q{
Fiber.new(&Object.method(:class_eval)).resume("foo")
}, '[ruby-dev:34128]'
+
+# [Bug #21400]
+assert_normal_exit %q{
+ Thread.new { Fiber.current.kill }.join
+}
diff --git a/bootstraptest/test_fork.rb b/bootstraptest/test_fork.rb
index 83923dad97..860ef285d0 100644
--- a/bootstraptest/test_fork.rb
+++ b/bootstraptest/test_fork.rb
@@ -75,3 +75,30 @@ assert_equal '[1, 2]', %q{
end
}, '[ruby-dev:44005] [Ruby 1.9 - Bug #4950]'
+assert_equal 'ok', %q{
+ def now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
+
+ Thread.new do
+ loop { sleep 0.0001 }
+ end
+
+ 10.times do
+ pid = fork{ exit!(0) }
+ deadline = now + 10
+ while true
+ _, status = Process.waitpid2(pid, Process::WNOHANG)
+ break if status
+ if now > deadline
+ Process.kill(:KILL, pid)
+ raise "failed"
+ end
+ sleep 0.001
+ end
+ unless status.success?
+ raise "child exited with status #{status}"
+ end
+ rescue NotImplementedError
+ end
+ :ok
+}, '[Bug #20670]'
+
diff --git a/bootstraptest/test_gc.rb b/bootstraptest/test_gc.rb
index 17bc497822..eb68c9845e 100644
--- a/bootstraptest/test_gc.rb
+++ b/bootstraptest/test_gc.rb
@@ -14,7 +14,7 @@ ms = "a".."k"
o.send(meth)
end
end
-}, '[ruby-dev:39453]' unless rjit_enabled? # speed up RJIT CI
+}, '[ruby-dev:39453]'
assert_normal_exit %q{
a = []
diff --git a/bootstraptest/test_insns.rb b/bootstraptest/test_insns.rb
index 06828a7f7a..9e2c4a52a7 100644
--- a/bootstraptest/test_insns.rb
+++ b/bootstraptest/test_insns.rb
@@ -214,8 +214,21 @@ tests = [
'true'.freeze
},
+ [ 'opt_duparray_send', %q{ x = :a; [:a, :b].include?(x) }, ],
+ [ 'opt_duparray_send', <<-'},', ], # {
+ class Array
+ def include?(i)
+ i == 1
+ end
+ end
+ x = 1
+ [:a, :b].include?(x)
+ },
+
[ 'opt_newarray_send', %q{ ![ ].hash.nil? }, ],
+ [ 'opt_newarray_send', %q{ v=2; [1, Object.new, 2].include?(v) }, ],
+
[ 'opt_newarray_send', %q{ [ ].max.nil? }, ],
[ 'opt_newarray_send', %q{ [1, x = 2, 3].max == 3 }, ],
[ 'opt_newarray_send', <<-'},', ], # {
@@ -236,6 +249,48 @@ tests = [
end
[3, x = 2, 1].min
},
+ [ 'opt_newarray_send', %q{ v = 1.23; [v, v*2].pack("E*").unpack("E*") == [v, v*2] }, ],
+ [ 'opt_newarray_send', %q{ v = 4.56; b = +"x"; [v, v*2].pack("E*", buffer: b); b[1..].unpack("E*") == [v, v*2] }, ],
+ [ 'opt_newarray_send', <<-'},', ], # {
+ v = 7.89;
+ b = +"x";
+ class Array
+ alias _pack pack
+ def pack(s, buffer: nil, prefix: "y")
+ buffer ||= +"b"
+ buffer << prefix
+ _pack(s, buffer: buffer)
+ end
+ end
+ tests = []
+
+ ret = [v].pack("E*", prefix: "z")
+ tests << (ret[0..1] == "bz")
+ tests << (ret[2..].unpack("E*") == [v])
+
+ ret = [v].pack("E*")
+ tests << (ret[0..1] == "by")
+ tests << (ret[2..].unpack("E*") == [v])
+
+ [v, v*2, v*3].pack("E*", buffer: b)
+ tests << (b[0..1] == "xy")
+ tests << (b[2..].unpack("E*") == [v, v*2, v*3])
+
+ class Array
+ def pack(_fmt, buffer:) = buffer
+ end
+
+ b = nil
+ tests << [v].pack("E*", buffer: b).nil?
+
+ class Array
+ def pack(_fmt, **kw) = kw.empty?
+ end
+
+ tests << [v].pack("E*") == true
+
+ tests.all? or puts tests
+ },
[ 'throw', %q{ false.tap { break true } }, ],
[ 'branchif', %q{ x = nil; x ||= true }, ],
@@ -371,11 +426,6 @@ tests = [
x&.x[true] ||= true # here
},
- [ 'opt_aref_with', %q{ { 'true' => true }['true'] }, ],
- [ 'opt_aref_with', %q{ Struct.new(:nil).new['nil'].nil? }, ],
- [ 'opt_aset_with', %q{ {}['true'] = true }, ],
- [ 'opt_aset_with', %q{ Struct.new(:true).new['true'] = true }, ],
-
[ 'opt_length', %q{ 'true' .length == 4 }, ],
[ 'opt_length', %q{ :true .length == 4 }, ],
[ 'opt_length', %q{ [ 'true' ] .length == 1 }, ],
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index 666e5a011b..4081769a8c 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -85,13 +85,13 @@ assert_normal_exit %q{
ARGF.set_encoding "foo"
}
-/freebsd/ =~ RUBY_PLATFORM or
+/(freebsd|mswin)/ =~ RUBY_PLATFORM or
10.times do
assert_normal_exit %q{
at_exit { p :foo }
megacontent = "abc" * 12345678
- #File.open("megasrc", "w") {|f| f << megacontent }
+ #File.write("megasrc", megacontent)
t0 = Thread.main
Thread.new { sleep 0.001 until t0.stop?; Process.kill(:INT, $$) }
diff --git a/bootstraptest/test_literal.rb b/bootstraptest/test_literal.rb
index a30661a796..39e6527027 100644
--- a/bootstraptest/test_literal.rb
+++ b/bootstraptest/test_literal.rb
@@ -117,16 +117,16 @@ assert_equal '1', 'a = [obj = Object.new]; a.size'
assert_equal 'true', 'a = [obj = Object.new]; a[0] == obj'
assert_equal '5', 'a = [1,2,3]; a[1] = 5; a[1]'
assert_equal 'bar', '[*:foo];:bar'
-assert_equal '[1, 2]', 'def nil.to_a; [2]; end; [1, *nil]'
-assert_equal '[1, 2]', 'def nil.to_a; [1, 2]; end; [*nil]'
-assert_equal '[0, 1, {2=>3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"
+assert_equal '[]', 'def nil.to_a; [1, 2]; end; [*nil]'
+assert_equal '[1]', 'def nil.to_a; [2]; end; [1, *nil]'
+assert_equal '[0, 1, {2 => 3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"
# hash
assert_equal 'Hash', '{}.class'
assert_equal '{}', '{}.inspect'
assert_equal 'Hash', '{1=>2}.class'
-assert_equal '{1=>2}', '{1=>2}.inspect'
+assert_equal '{1 => 2}', '{1=>2}.inspect'
assert_equal '2', 'h = {1 => 2}; h[1]'
assert_equal '0', 'h = {1 => 2}; h.delete(1); h.size'
assert_equal '', 'h = {1 => 2}; h.delete(1); h[1]'
diff --git a/bootstraptest/test_load.rb b/bootstraptest/test_load.rb
index 3253582a32..fa8d31c098 100644
--- a/bootstraptest/test_load.rb
+++ b/bootstraptest/test_load.rb
@@ -1,9 +1,9 @@
assert_equal 'ok', %q{
- open("require-lock-test.rb", "w") {|f|
- f.puts "sleep 0.1"
- f.puts "module M"
- f.puts "end"
- }
+ File.write("require-lock-test.rb", <<-END)
+ sleep 0.1
+ module M
+ end
+ END
$:.unshift Dir.pwd
vs = (1..2).map {|i|
Thread.start {
@@ -12,11 +12,11 @@ assert_equal 'ok', %q{
}
}.map {|t| t.value }
vs[0] == M && vs[1] == M ? :ok : :ng
-}, '[ruby-dev:32048]' unless ENV.fetch('RUN_OPTS', '').include?('rjit') # Thread seems to be switching during JIT. To be fixed later.
+}, '[ruby-dev:32048]'
assert_equal 'ok', %q{
%w[a a/foo b].each {|d| Dir.mkdir(d)}
- open("b/foo", "w") {|f| f.puts "$ok = :ok"}
+ File.write("b/foo", "$ok = :ok\n")
$:.replace(%w[a b])
begin
load "foo"
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index d1d1f57d55..78aab73485 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -1176,3 +1176,261 @@ assert_equal 'ok', %q{
foo
foo
}, '[Bug #20178]'
+
+assert_equal 'ok', %q{
+ def bar(x); x; end
+ def foo(...); bar(...); end
+ foo('ok')
+}
+
+assert_equal 'ok', %q{
+ def bar(x); x; end
+ def foo(z, ...); bar(...); end
+ foo(1, 'ok')
+}
+
+assert_equal 'ok', %q{
+ def bar(x, y); x; end
+ def foo(...); bar("ok", ...); end
+ foo(1)
+}
+
+assert_equal 'ok', %q{
+ def bar(x); x; end
+ def foo(...); 1.times { return bar(...) }; end
+ foo("ok")
+}
+
+assert_equal 'ok', %q{
+ def bar(x); x; end
+ def foo(...); x = nil; 1.times { x = bar(...) }; x; end
+ foo("ok")
+}
+
+assert_equal 'ok', %q{
+ def bar(x); yield; end
+ def foo(...); bar(...); end
+ foo(1) { "ok" }
+}
+
+assert_equal 'ok', %q{
+ def baz(x); x; end
+ def bar(...); baz(...); end
+ def foo(...); bar(...); end
+ foo("ok")
+}
+
+assert_equal '[1, 2, 3, 4]', %q{
+ def baz(a, b, c, d); [a, b, c, d]; end
+ def bar(...); baz(1, ...); end
+ def foo(...); bar(2, ...); end
+ foo(3, 4)
+}
+
+assert_equal 'ok', %q{
+ class Foo; def self.foo(x); x; end; end
+ class Bar < Foo; def self.foo(...); super; end; end
+ Bar.foo('ok')
+}
+
+assert_equal 'ok', %q{
+ class Foo; def self.foo(x); x; end; end
+ class Bar < Foo; def self.foo(...); super(...); end; end
+ Bar.foo('ok')
+}
+
+assert_equal 'ok', %q{
+ class Foo; def self.foo(x, y); x + y; end; end
+ class Bar < Foo; def self.foo(...); super("o", ...); end; end
+ Bar.foo('k')
+}
+
+assert_equal 'ok', %q{
+ def bar(a); a; end
+ def foo(...); lambda { bar(...) }; end
+ foo("ok").call
+}
+
+assert_equal 'ok', %q{
+ class Foo; def self.foo(x, y); x + y; end; end
+ class Bar < Foo; def self.y(&b); b; end; def self.foo(...); y { super("o", ...) }; end; end
+ Bar.foo('k').call
+}
+
+assert_equal 'ok', %q{
+ def baz(n); n; end
+ def foo(...); bar = baz(...); lambda { lambda { bar } }; end
+ foo("ok").call.call
+}
+
+assert_equal 'ok', %q{
+ class A; def self.foo(...); new(...); end; attr_reader :b; def initialize(a, b:"ng"); @a = a; @b = b; end end
+ A.foo(1).b
+ A.foo(1, b: "ok").b
+}
+
+assert_equal 'ok', %q{
+ class A; def initialize; @a = ["ok"]; end; def first(...); @a.first(...); end; end
+ def call x; x.first; end
+ def call1 x; x.first(1); end
+ call(A.new)
+ call1(A.new).first
+}
+
+assert_equal 'ok', %q{
+ class A; def foo; yield("o"); end; end
+ class B < A; def foo(...); super { |x| yield(x + "k") }; end; end
+ B.new.foo { |x| x }
+}
+
+assert_equal "[1, 2, 3, 4]", %q{
+ def foo(*b) = b
+
+ def forward(...)
+ splat = [1,2,3]
+ foo(*splat, ...)
+ end
+
+ forward(4)
+}
+
+assert_equal "[1, 2, 3, 4]", %q{
+class A
+ def foo(*b) = b
+end
+
+class B < A
+ def foo(...)
+ splat = [1,2,3]
+ super(*splat, ...)
+ end
+end
+
+B.new.foo(4)
+}
+
+assert_equal 'ok', %q{
+ class A; attr_reader :iv; def initialize(...) = @iv = "ok"; end
+ A.new("foo", bar: []).iv
+}
+
+assert_equal 'ok', %q{
+ def foo(a, b) = a + b
+ def bar(...) = foo(...)
+ bar(1, 2)
+ bar(1, 2)
+ begin
+ bar(1, 2, 3)
+ "ng"
+ rescue ArgumentError
+ "ok"
+ end
+}
+
+assert_equal 'ok', %q{
+ class C
+ def foo(...) = :ok
+ def bar(...) = __send__(:foo, ...)
+ end
+
+ C.new.bar
+}
+
+assert_equal 'ok', %q{
+ class C
+ def method_missing(...) = :ok
+ def foo(...) = xyzzy(...)
+ end
+
+ C.new.foo
+}
+
+assert_equal 'ok', %q{
+ class C
+ def initialize(a)
+ end
+ end
+
+ def foo(...)
+ C.new(...)
+ :ok
+ end
+
+ foo(*["bar"])
+ foo("baz")
+}
+
+assert_equal 'ok', %q{
+ class C
+ def foo(b:)
+ b
+ end
+ end
+
+ def foo(...)
+ C.new.send(...)
+ end
+
+ foo(:foo, b: :ok)
+ foo(*["foo"], b: :ok)
+}
+
+assert_equal 'ok', %q{
+ Thing = Struct.new(:value)
+
+ Obj = Thing.new("ok")
+
+ def delegate(...)
+ Obj.value(...)
+ end
+
+ def no_args
+ delegate
+ end
+
+ def splat_args(*args)
+ delegate(*args)
+ end
+
+ no_args
+ splat_args
+}
+
+assert_equal 'ok', %q{
+ class A
+ private
+ def foo = "ng"
+ end
+
+ class B
+ def initialize(o)
+ @o = o
+ end
+
+ def foo(...) = @o.foo(...)
+ def internal_foo = foo
+ end
+
+ b = B.new(A.new)
+
+ begin
+ b.internal_foo
+ rescue NoMethodError
+ "ok"
+ end
+}
+
+assert_equal 'ok', <<~RUBY
+ def test(*, kw: false)
+ "ok"
+ end
+
+ test
+RUBY
+
+assert_equal '[1, 2, 3]', %q{
+ def target(*args) = args
+ def x = [1]
+ def forwarder(...) = target(*x, 2, ...)
+ forwarder(3).inspect
+}, '[Bug #21832] post-splat args before forwarding'
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 0390d38f9c..e2a3e8dd5b 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -67,7 +67,7 @@ assert_equal "#<Ractor:#1 running>", %q{
# Return id, loc, and status for no-name ractor
assert_match /^#<Ractor:#([^ ]*?) .+:[0-9]+ terminated>$/, %q{
r = Ractor.new { '' }
- r.take
+ r.join
sleep 0.1 until r.inspect =~ /terminated/
r.inspect
}
@@ -75,7 +75,7 @@ assert_match /^#<Ractor:#([^ ]*?) .+:[0-9]+ terminated>$/, %q{
# Return id, name, loc, and status for named ractor
assert_match /^#<Ractor:#([^ ]*?) Test Ractor .+:[0-9]+ terminated>$/, %q{
r = Ractor.new(name: 'Test Ractor') { '' }
- r.take
+ r.join
sleep 0.1 until r.inspect =~ /terminated/
r.inspect
}
@@ -86,7 +86,7 @@ assert_equal 'ok', %q{
r = Ractor.new do
'ok'
end
- r.take
+ r.value
}
# Passed arguments to Ractor.new will be a block parameter
@@ -96,7 +96,7 @@ assert_equal 'ok', %q{
r = Ractor.new 'ok' do |msg|
msg
end
- r.take
+ r.value
}
# Pass multiple arguments to Ractor.new
@@ -105,7 +105,7 @@ assert_equal 'ok', %q{
r = Ractor.new 'ping', 'pong' do |msg, msg2|
[msg, msg2]
end
- 'ok' if r.take == ['ping', 'pong']
+ 'ok' if r.value == ['ping', 'pong']
}
# Ractor#send passes an object with copy to a Ractor
@@ -115,65 +115,23 @@ assert_equal 'ok', %q{
msg = Ractor.receive
end
r.send 'ok'
- r.take
+ r.value
}
# Ractor#receive_if can filter the message
-assert_equal '[2, 3, 1]', %q{
- r = Ractor.new Ractor.current do |main|
- main << 1
- main << 2
- main << 3
- end
- a = []
- a << Ractor.receive_if{|msg| msg == 2}
- a << Ractor.receive_if{|msg| msg == 3}
- a << Ractor.receive
-}
+assert_equal '[1, 2, 3]', %q{
+ ports = 3.times.map{Ractor::Port.new}
-# Ractor#receive_if with break
-assert_equal '[2, [1, :break], 3]', %q{
- r = Ractor.new Ractor.current do |main|
- main << 1
- main << 2
- main << 3
+ r = Ractor.new ports do |ports|
+ ports[0] << 3
+ ports[1] << 1
+ ports[2] << 2
end
-
a = []
- a << Ractor.receive_if{|msg| msg == 2}
- a << Ractor.receive_if{|msg| break [msg, :break]}
- a << Ractor.receive
-}
-
-# Ractor#receive_if can't be called recursively
-assert_equal '[[:e1, 1], [:e2, 2]]', %q{
- r = Ractor.new Ractor.current do |main|
- main << 1
- main << 2
- main << 3
- end
-
- a = []
-
- Ractor.receive_if do |msg|
- begin
- Ractor.receive
- rescue Ractor::Error
- a << [:e1, msg]
- end
- true # delete 1 from queue
- end
-
- Ractor.receive_if do |msg|
- begin
- Ractor.receive_if{}
- rescue Ractor::Error
- a << [:e2, msg]
- end
- true # delete 2 from queue
- end
-
- a #
+ a << ports[1].receive # 1
+ a << ports[2].receive # 2
+ a << ports[0].receive # 3
+ a
}
# dtoa race condition
@@ -184,73 +142,145 @@ assert_equal '[:ok, :ok, :ok]', %q{
10_000.times{ rand.to_s }
:ok
}
- }.map(&:take)
+ }.map(&:value)
}
-# Ractor.make_shareable issue for locals in proc [Bug #18023]
+assert_equal "42", %q{
+ a = 42
+ Ractor.shareable_lambda{ a }.call
+}
+
+# Ractor.shareable_proc issue for locals in proc [Bug #18023]
assert_equal '[:a, :b, :c, :d, :e]', %q{
v1, v2, v3, v4, v5 = :a, :b, :c, :d, :e
- closure = Ractor.current.instance_eval{ Proc.new { [v1, v2, v3, v4, v5] } }
+ closure = Proc.new { [v1, v2, v3, v4, v5] }
+ Ractor.shareable_proc(&closure).call
+}
- Ractor.make_shareable(closure).call
+# Ractor.shareable_proc makes a copy of given Proc
+assert_equal '[true, true]', %q{
+ pr1 = Proc.new do
+ self
+ end
+ pr2 = Ractor.shareable_proc(&pr1)
+
+ [pr1.call == self, pr2.call == nil]
}
-# Ractor.make_shareable issue for locals in proc [Bug #18023]
-assert_equal '[:a, :b, :c, :d, :e, :f, :g]', %q{
- a = :a
- closure = Ractor.current.instance_eval do
- -> {
- b, c, d = :b, :c, :d
- -> {
- e, f, g = :e, :f, :g
- -> { [a, b, c, d, e, f, g] }
- }.call
- }.call
+# Ractor.shareable_proc keeps the original Proc intact
+assert_equal '[SyntaxError, [Object, 43, 43], Binding]', %q{
+ a = 42
+ pr1 = Proc.new do
+ [self.class, eval("a"), binding.local_variable_get(:a)]
+ end
+ a += 1
+ pr2 = Ractor.shareable_proc(&pr1)
+
+ r = []
+ begin
+ pr2.call
+ rescue SyntaxError
+ r << SyntaxError
end
- Ractor.make_shareable(closure).call
+ r << pr1.call << pr1.binding.class
}
-# Now autoload in non-main Ractor is not supported
-assert_equal 'ok', %q{
- autoload :Foo, 'foo.rb'
- r = Ractor.new do
- p Foo
- rescue Ractor::UnsafeError
- :ok
+# Ractor.make_shareable mutates the original Proc
+# This is the current behavior, it's currently considered safe enough
+# because in most cases it would raise anyway due to not-shared self or not-shared captured variable value
+assert_equal '[[42, 42], Binding, true, SyntaxError, "Can\'t create Binding from isolated Proc"]', %q{
+ a = 42
+ pr1 = nil.instance_exec do
+ Proc.new do
+ [eval("a"), binding.local_variable_get(:a)]
+ end
+ end
+
+ r = [pr1.call, pr1.binding.class]
+
+ pr2 = Ractor.make_shareable(pr1)
+ r << pr1.equal?(pr2)
+
+ begin
+ pr1.call
+ rescue SyntaxError
+ r << SyntaxError
+ end
+
+ begin
+ r << pr1.binding
+ rescue ArgumentError
+ r << $!.message
+ end
+
+ r
+}
+
+# Ractor::IsolationError cases
+assert_equal '3', %q{
+ ok = 0
+
+ begin
+ a = 1
+ Ractor.shareable_proc{a}
+ a = 2
+ rescue Ractor::IsolationError => e
+ ok += 1
+ end
+
+ begin
+ cond = false
+ b = 1
+ b = 2 if cond
+ Ractor.shareable_proc{b}
+ rescue Ractor::IsolationError => e
+ ok += 1
+ end
+
+ begin
+ 1.times{|i|
+ i = 2
+ Ractor.shareable_proc{i}
+ }
+ rescue Ractor::IsolationError => e
+ ok += 1
end
- r.take
}
###
###
# Ractor still has several memory corruption so skip huge number of tests
-if ENV['GITHUB_WORKFLOW'] &&
- ENV['GITHUB_WORKFLOW'] == 'Compilations'
+if ENV['GITHUB_WORKFLOW'] == 'Compilations'
# ignore the follow
else
-# Ractor.select(*ractors) receives a values from a ractors.
-# It is similar to select(2) and Go's select syntax.
-# The return value is [ch, received_value]
+# Ractor.select with a Ractor argument
assert_equal 'ok', %q{
# select 1
r1 = Ractor.new{'r1'}
- r, obj = Ractor.select(r1)
- 'ok' if r == r1 and obj == 'r1'
+ port, obj = Ractor.select(r1)
+ if port == r1 and obj == 'r1'
+ 'ok'
+ else
+ # failed
+ [port, obj].inspect
+ end
}
# Ractor.select from two ractors.
assert_equal '["r1", "r2"]', %q{
# select 2
- r1 = Ractor.new{'r1'}
- r2 = Ractor.new{'r2'}
- rs = [r1, r2]
+ p1 = Ractor::Port.new
+ p2 = Ractor::Port.new
+ r1 = Ractor.new(p1){|p1| p1 << 'r1'}
+ r2 = Ractor.new(p2){|p2| p2 << 'r2'}
+ ps = [p1, p2]
as = []
- r, obj = Ractor.select(*rs)
- rs.delete(r)
+ port, obj = Ractor.select(*ps)
+ ps.delete(port)
as << obj
- r, obj = Ractor.select(*rs)
+ port, obj = Ractor.select(*ps)
as << obj
as.sort #=> ["r1", "r2"]
}
@@ -286,7 +316,7 @@ assert_equal 30.times.map { 'ok' }.to_s, %q{
} unless (ENV.key?('TRAVIS') && ENV['TRAVIS_CPU_ARCH'] == 'arm64') # https://bugs.ruby-lang.org/issues/17878
# Exception for empty select
-assert_match /specify at least one ractor/, %q{
+assert_match /specify at least one Ractor::Port or Ractor/, %q{
begin
Ractor.select
rescue ArgumentError => e
@@ -294,30 +324,12 @@ assert_match /specify at least one ractor/, %q{
end
}
-# Outgoing port of a ractor will be closed when the Ractor is terminated.
-assert_equal 'ok', %q{
- r = Ractor.new do
- 'finish'
- end
-
- r.take
- sleep 0.1 until r.inspect =~ /terminated/
-
- begin
- o = r.take
- rescue Ractor::ClosedError
- 'ok'
- else
- "ng: #{o}"
- end
-}
-
# Raise Ractor::ClosedError when try to send into a terminated ractor
assert_equal 'ok', %q{
r = Ractor.new do
end
- r.take # closed
+ r.join # closed
sleep 0.1 until r.inspect =~ /terminated/
begin
@@ -329,47 +341,16 @@ assert_equal 'ok', %q{
end
}
-# Raise Ractor::ClosedError when try to send into a closed actor
-assert_equal 'ok', %q{
- r = Ractor.new { Ractor.receive }
- r.close_incoming
-
- begin
- r.send(1)
- rescue Ractor::ClosedError
- 'ok'
- else
- 'ng'
- end
-}
-
-# Raise Ractor::ClosedError when try to take from closed actor
-assert_equal 'ok', %q{
- r = Ractor.new do
- Ractor.yield 1
- Ractor.receive
- end
-
- r.close_outgoing
- begin
- r.take
- rescue Ractor::ClosedError
- 'ok'
- else
- 'ng'
- end
-}
-
-# Can mix with Thread#interrupt and Ractor#take [Bug #17366]
+# Can mix with Thread#interrupt and Ractor#join [Bug #17366]
assert_equal 'err', %q{
- Ractor.new{
+ Ractor.new do
t = Thread.current
begin
Thread.new{ t.raise "err" }.join
rescue => e
e.message
end
- }.take
+ end.value
}
# Killed Ractor's thread yields nil
@@ -377,34 +358,18 @@ assert_equal 'nil', %q{
Ractor.new{
t = Thread.current
Thread.new{ t.kill }.join
- }.take.inspect #=> nil
+ }.value.inspect #=> nil
}
-# Ractor.yield raises Ractor::ClosedError when outgoing port is closed.
+# Raise Ractor::ClosedError when try to send into a ractor with closed default port
assert_equal 'ok', %q{
- r = Ractor.new Ractor.current do |main|
+ r = Ractor.new {
+ Ractor.current.close
+ Ractor.main << :ok
Ractor.receive
- main << true
- Ractor.yield 1
- end
-
- r.close_outgoing
- r << true
- Ractor.receive
-
- begin
- r.take
- rescue Ractor::ClosedError
- 'ok'
- else
- 'ng'
- end
-}
+ }
-# Raise Ractor::ClosedError when try to send into a ractor with closed incoming port
-assert_equal 'ok', %q{
- r = Ractor.new { Ractor.receive }
- r.close_incoming
+ Ractor.receive # wait for ok
begin
r.send(1)
@@ -415,154 +380,82 @@ assert_equal 'ok', %q{
end
}
-# A ractor with closed incoming port still can send messages out
-assert_equal '[1, 2]', %q{
- r = Ractor.new do
- Ractor.yield 1
- 2
- end
- r.close_incoming
-
- [r.take, r.take]
-}
-
-# Raise Ractor::ClosedError when try to take from a ractor with closed outgoing port
-assert_equal 'ok', %q{
- r = Ractor.new do
- Ractor.yield 1
- Ractor.receive
- end
-
- sleep 0.01 # wait for Ractor.yield in r
- r.close_outgoing
- begin
- r.take
- rescue Ractor::ClosedError
- 'ok'
- else
- 'ng'
- end
-}
-
-# A ractor with closed outgoing port still can receive messages from incoming port
-assert_equal 'ok', %q{
- r = Ractor.new do
- Ractor.receive
- end
-
- r.close_outgoing
- begin
- r.send(1)
- rescue Ractor::ClosedError
- 'ng'
- else
- 'ok'
- end
-}
-
# Ractor.main returns main ractor
assert_equal 'true', %q{
Ractor.new{
Ractor.main
- }.take == Ractor.current
+ }.value == Ractor.current
}
# a ractor with closed outgoing port should terminate
assert_equal 'ok', %q{
Ractor.new do
- close_outgoing
+ Ractor.current.close
end
true until Ractor.count == 1
:ok
}
-# multiple Ractors can receive (wait) from one Ractor
-assert_equal '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]', %q{
- pipe = Ractor.new do
- loop do
- Ractor.yield Ractor.receive
- end
+# an exception in a Ractor main thread will be re-raised at Ractor#receive
+assert_equal '[RuntimeError, "ok", true]', %q{
+ r = Ractor.new do
+ raise 'ok' # exception will be transferred receiver
end
-
- RN = 10
- rs = RN.times.map{|i|
- Ractor.new pipe, i do |pipe, i|
- msg = pipe.take
- msg # ping-pong
- end
- }
- RN.times{|i|
- pipe << i
- }
- RN.times.map{
- r, n = Ractor.select(*rs)
- rs.delete r
- n
- }.sort
-} unless /mswin/ =~ RUBY_PLATFORM # randomly hangs on mswin https://github.com/ruby/ruby/actions/runs/3753871445/jobs/6377551069#step:20:131
-
-# Ractor.select also support multiple take, receive and yield
-assert_equal '[true, true, true]', %q{
- RN = 10
- CR = Ractor.current
-
- rs = (1..RN).map{
- Ractor.new do
- CR.send 'send' + CR.take #=> 'sendyield'
- 'take'
- end
- }
- received = []
- taken = []
- yielded = []
- until received.size == RN && taken.size == RN && yielded.size == RN
- r, v = Ractor.select(CR, *rs, yield_value: 'yield')
- case r
- when :receive
- received << v
- when :yield
- yielded << v
- else
- taken << v
- rs.delete r
- end
+ begin
+ r.join
+ rescue Ractor::RemoteError => e
+ [e.cause.class, #=> RuntimeError
+ e.cause.message, #=> 'ok'
+ e.ractor == r] #=> true
end
- r = [received == ['sendyield'] * RN,
- yielded == [nil] * RN,
- taken == ['take'] * RN,
- ]
-
- STDERR.puts [received, yielded, taken].inspect
- r
}
-# multiple Ractors can send to one Ractor
-assert_equal '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]', %q{
- pipe = Ractor.new do
- loop do
- Ractor.yield Ractor.receive
- end
+# an exception in a Ractor will be re-raised at Ractor#value
+assert_equal '[RuntimeError, "ok", true]', %q{
+ r = Ractor.new do
+ raise 'ok' # exception will be transferred receiver
+ end
+ begin
+ r.value
+ rescue Ractor::RemoteError => e
+ [e.cause.class, #=> RuntimeError
+ e.cause.message, #=> 'ok'
+ e.ractor == r] #=> true
end
+}
- RN = 10
- RN.times.map{|i|
- Ractor.new pipe, i do |pipe, i|
- pipe << i
+# an exception in a Ractor non-main thread will not be re-raised at Ractor#receive
+assert_equal 'ok', %q{
+ r = Ractor.new do
+ Thread.new do
+ raise 'ng'
end
- }
- RN.times.map{
- pipe.take
- }.sort
+ sleep 0.1
+ 'ok'
+ end
+ r.value
}
-# an exception in a Ractor will be re-raised at Ractor#receive
-assert_equal '[RuntimeError, "ok", true]', %q{
- r = Ractor.new do
- raise 'ok' # exception will be transferred receiver
+# SystemExit from a Ractor is re-raised
+# [Bug #21505]
+assert_equal '[SystemExit, "exit", true]', %q{
+ r = Ractor.new { exit }
+ begin
+ r.value
+ rescue Ractor::RemoteError => e
+ [e.cause.class, #=> RuntimeError
+ e.cause.message, #=> 'ok'
+ e.ractor == r] #=> true
end
+}
+
+# SystemExit from a Thread inside a Ractor is re-raised
+# [Bug #21505]
+assert_equal '[SystemExit, "exit", true]', %q{
+ r = Ractor.new { Thread.new { exit }.join }
begin
- r.take
+ r.value
rescue Ractor::RemoteError => e
[e.cause.class, #=> RuntimeError
e.cause.message, #=> 'ok'
@@ -571,7 +464,7 @@ assert_equal '[RuntimeError, "ok", true]', %q{
}
# threads in a ractor will killed
-assert_equal '{:ok=>3}', %q{
+assert_equal '{ok: 3}', %q{
Ractor.new Ractor.current do |main|
q = Thread::Queue.new
Thread.new do
@@ -601,7 +494,7 @@ assert_equal '{:ok=>3}', %q{
end
3.times.map{Ractor.receive}.tally
-} unless yjit_enabled? # `[BUG] Bus Error at 0x000000010b7002d0` in jit_exec()
+} unless yjit_enabled? # YJIT: `[BUG] Bus Error at 0x000000010b7002d0` in jit_exec()
# unshareable object are copied
assert_equal 'false', %q{
@@ -610,7 +503,7 @@ assert_equal 'false', %q{
msg.object_id
end
- obj.object_id == r.take
+ obj.object_id == r.value
}
# To copy the object, now Marshal#dump is used
@@ -629,10 +522,11 @@ assert_equal "allocator undefined for Thread", %q{
# send shareable and unshareable objects
assert_equal "ok", <<~'RUBY', frozen_string_literal: false
- echo_ractor = Ractor.new do
+ port = Ractor::Port.new
+ echo_ractor = Ractor.new port do |port|
loop do
v = Ractor.receive
- Ractor.yield v
+ port << v
end
end
@@ -680,13 +574,13 @@ assert_equal "ok", <<~'RUBY', frozen_string_literal: false
shareable_objects.map{|o|
echo_ractor << o
- o2 = echo_ractor.take
+ o2 = port.receive
results << "#{o} is copied" unless o.object_id == o2.object_id
}
unshareable_objects.map{|o|
echo_ractor << o
- o2 = echo_ractor.take
+ o2 = port.receive
results << "#{o.inspect} is not copied" if o.object_id == o2.object_id
}
@@ -712,7 +606,7 @@ assert_equal [false, true, false].inspect, <<~'RUBY', frozen_string_literal: fal
def check obj1
obj2 = Ractor.new obj1 do |obj|
obj
- end.take
+ end.value
obj1.object_id == obj2.object_id
end
@@ -734,7 +628,7 @@ assert_equal 'hello world', <<~'RUBY', frozen_string_literal: false
str = 'hello'
r.send str, move: true
- modified = r.take
+ modified = r.value
begin
str << ' exception' # raise Ractor::MovedError
@@ -754,7 +648,7 @@ assert_equal '[0, 1]', %q{
a1 = [0]
r.send a1, move: true
- a2 = r.take
+ a2 = r.value
begin
a1 << 2 # raise Ractor::MovedError
rescue Ractor::MovedError
@@ -762,70 +656,39 @@ assert_equal '[0, 1]', %q{
end
}
-# move with yield
-assert_equal 'hello', %q{
- r = Ractor.new do
- Thread.current.report_on_exception = false
- obj = 'hello'
- Ractor.yield obj, move: true
- obj << 'world'
- end
-
- str = r.take
- begin
- r.take
- rescue Ractor::RemoteError
- str #=> "hello"
- end
-}
-
-# yield/move should not make moved object when the yield is not succeeded
-assert_equal '"str"', %q{
- R = Ractor.new{}
- M = Ractor.current
+# unshareable frozen objects should still be frozen in new ractor after move
+assert_equal 'true', %q{
r = Ractor.new do
- s = 'str'
- selected_r, v = Ractor.select R, yield_value: s, move: true
- raise if selected_r != R # taken from R
- M.send s.inspect # s should not be a moved object
+ obj = receive
+ { frozen: obj.frozen? }
end
-
- Ractor.receive
+ obj = [Object.new].freeze
+ r.send(obj, move: true)
+ r.value[:frozen]
}
-# yield/move can fail
-assert_equal "allocator undefined for Thread", %q{
- r = Ractor.new do
- obj = Thread.new{}
- Ractor.yield obj
- rescue => e
- e.message
- end
- r.take
-}
-
-# Access to global-variables are prohibited
-assert_equal 'can not access global variables $gv from non-main Ractors', %q{
+# Access to global-variables are prohibited (read)
+assert_equal 'can not access global variable $gv from non-main Ractor', %q{
$gv = 1
r = Ractor.new do
$gv
end
begin
- r.take
+ r.join
rescue Ractor::RemoteError => e
e.cause.message
end
}
-# Access to global-variables are prohibited
-assert_equal 'can not access global variables $gv from non-main Ractors', %q{
+# Access to global-variables are prohibited (write)
+assert_equal 'can not access global variable $gv from non-main Ractor', %q{
r = Ractor.new do
$gv = 1
end
begin
- r.take
+ r.join
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -839,7 +702,7 @@ assert_equal 'ok', %q{
}
end
- [$stdin, $stdout, $stderr].zip(r.take){|io, (oid, fno)|
+ [$stdin, $stdout, $stderr].zip(r.value){|io, (oid, fno)|
raise "should not be different object" if io.object_id == oid
raise "fd should be same" unless io.fileno == fno
}
@@ -855,7 +718,7 @@ assert_equal 'ok', %q{
'ok'
end
- r.take
+ r.value
}
# $DEBUG, $VERBOSE are Ractor local
@@ -913,7 +776,7 @@ assert_equal 'true', %q{
h = Ractor.new do
ractor_local_globals
- end.take
+ end.value
ractor_local_globals == h #=> true
}
@@ -922,7 +785,8 @@ assert_equal 'false', %q{
r = Ractor.new do
self.object_id
end
- r.take == self.object_id #=> false
+ ret = r.value
+ ret == self.object_id
}
# self is a Ractor instance
@@ -930,7 +794,12 @@ assert_equal 'true', %q{
r = Ractor.new do
self.object_id
end
- r.object_id == r.take #=> true
+ ret = r.value
+ if r.object_id == ret #=> true
+ true
+ else
+ raise [ret, r.object_id].inspect
+ end
}
# given block Proc will be isolated, so can not access outer variables.
@@ -945,8 +814,39 @@ assert_equal 'ArgumentError', %q{
end
}
+# eval with outer locals in a Ractor raises SyntaxError
+# [Bug #21522]
+assert_equal 'SyntaxError', %q{
+ outer = 42
+ r = Ractor.new do
+ eval("outer")
+ end
+ begin
+ r.value
+ rescue Ractor::RemoteError => e
+ e.cause.class
+ end
+}
+
+# eval of an undefined name in a Ractor raises NameError
+assert_equal 'NameError', %q{
+ r = Ractor.new do
+ eval("totally_undefined_name")
+ end
+ begin
+ r.value
+ rescue Ractor::RemoteError => e
+ e.cause.class
+ end
+}
+
+# eval of a local defined inside the Ractor works
+assert_equal '99', %q{
+ Ractor.new { inner = 99; eval("inner").to_s }.value
+}
+
# ivar in shareable-objects are not allowed to access from non-main Ractor
-assert_equal "can not get unshareable values from instance variables of classes/modules from non-main Ractors", <<~'RUBY', frozen_string_literal: false
+assert_equal "can not get unshareable values from instance variables of classes/modules from non-main Ractors (@iv from C)", <<~'RUBY', frozen_string_literal: false
class C
@iv = 'str'
end
@@ -958,7 +858,7 @@ assert_equal "can not get unshareable values from instance variables of classes/
end
begin
- r.take
+ r.value
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -974,7 +874,7 @@ assert_equal 'can not access instance variables of shareable objects from non-ma
end
begin
- r.take
+ r.value
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -1000,7 +900,7 @@ assert_equal 'can not access instance variables of shareable objects from non-ma
end
begin
- r.take
+ r.value
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -1021,7 +921,7 @@ assert_equal 'can not access instance variables of shareable objects from non-ma
end
begin
- r.take
+ r.value
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -1035,7 +935,7 @@ assert_equal '11', %q{
Ractor.new obj do |obj|
obj.instance_variable_get('@a')
- end.take.to_s
+ end.value.to_s
}.join
}
@@ -1061,54 +961,68 @@ assert_equal '333', %q{
def self.fstr = @fstr
end
- a = Ractor.new{ C.int }.take
+ a = Ractor.new{ C.int }.value
b = Ractor.new do
C.str.to_i
rescue Ractor::IsolationError
10
- end.take
+ end.value
c = Ractor.new do
C.fstr.to_i
- end.take
+ end.value
- d = Ractor.new{ M.int }.take
+ d = Ractor.new{ M.int }.value
e = Ractor.new do
M.str.to_i
rescue Ractor::IsolationError
20
- end.take
+ end.value
f = Ractor.new do
M.fstr.to_i
- end.take
+ end.value
# 1 + 10 + 100 + 2 + 20 + 200
a + b + c + d + e + f
}
+assert_equal '["instance-variable", "instance-variable", nil]', %q{
+ class C
+ @iv1 = ""
+ @iv2 = 42
+ def self.iv1 = defined?(@iv1) # "instance-variable"
+ def self.iv2 = defined?(@iv2) # "instance-variable"
+ def self.iv3 = defined?(@iv3) # nil
+ end
+
+ Ractor.new{
+ [C.iv1, C.iv2, C.iv3]
+ }.value
+}
+
# moved objects have their shape properly set to original object's shape
assert_equal '1234', %q{
-class Obj
- attr_accessor :a, :b, :c, :d
- def initialize
- @a = 1
- @b = 2
- @c = 3
+ class Obj
+ attr_accessor :a, :b, :c, :d
+ def initialize
+ @a = 1
+ @b = 2
+ @c = 3
+ end
end
-end
-r = Ractor.new do
- obj = receive
- obj.d = 4
- [obj.a, obj.b, obj.c, obj.d]
-end
-obj = Obj.new
-r.send(obj, move: true)
-values = r.take
-values.join
+ r = Ractor.new do
+ obj = receive
+ obj.d = 4
+ [obj.a, obj.b, obj.c, obj.d]
+ end
+ obj = Obj.new
+ r.send(obj, move: true)
+ values = r.value
+ values.join
}
# cvar in shareable-objects are not allowed to access from non-main Ractor
-assert_equal 'can not access class variables from non-main Ractors', %q{
+assert_equal 'can not access class variables from non-main Ractors (@@cv from C)', %q{
class C
@@cv = 'str'
end
@@ -1120,14 +1034,14 @@ assert_equal 'can not access class variables from non-main Ractors', %q{
end
begin
- r.take
+ r.join
rescue Ractor::RemoteError => e
e.cause.message
end
}
# also cached cvar in shareable-objects are not allowed to access from non-main Ractor
-assert_equal 'can not access class variables from non-main Ractors', %q{
+assert_equal 'can not access class variables from non-main Ractors (@@cv from C)', %q{
class C
@@cv = 'str'
def self.cv
@@ -1142,7 +1056,7 @@ assert_equal 'can not access class variables from non-main Ractors', %q{
end
begin
- r.take
+ r.join
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -1157,19 +1071,33 @@ assert_equal 'can not access non-shareable objects in constant C::CONST by non-m
C::CONST
end
begin
- r.take
+ r.join
rescue Ractor::RemoteError => e
e.cause.message
end
RUBY
-# Constant cache should care about non-sharable constants
+# Constant cache should care about non-shareable constants
assert_equal "can not access non-shareable objects in constant Object::STR by non-main Ractor.", <<~'RUBY', frozen_string_literal: false
STR = "hello"
def str; STR; end
s = str() # fill const cache
begin
- Ractor.new{ str() }.take
+ Ractor.new{ str() }.join
+ rescue Ractor::RemoteError => e
+ e.cause.message
+ end
+RUBY
+
+# The correct constant path shall be reported
+assert_equal "can not access non-shareable objects in constant Object::STR by non-main Ractor.", <<~'RUBY', frozen_string_literal: false
+ STR = "hello"
+ module M
+ def self.str; STR; end
+ end
+
+ begin
+ Ractor.new{ M.str }.join
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -1183,7 +1111,7 @@ assert_equal 'can not set constants with non-shareable objects by non-main Racto
C::CONST = 'str'
end
begin
- r.take
+ r.join
rescue Ractor::RemoteError => e
e.cause.message
end
@@ -1194,7 +1122,7 @@ assert_equal "defined with an un-shareable Proc in a different Ractor", %q{
str = "foo"
define_method(:buggy){|i| str << "#{i}"}
begin
- Ractor.new{buggy(10)}.take
+ Ractor.new{buggy(10)}.join
rescue => e
e.cause.message
end
@@ -1205,7 +1133,7 @@ assert_equal '[1000, 3]', %q{
A = Array.new(1000).freeze # [nil, ...]
H = {a: 1, b: 2, c: 3}.freeze
- Ractor.new{ [A.size, H.size] }.take
+ Ractor.new{ [A.size, H.size] }.value
}
# Ractor.count
@@ -1215,15 +1143,15 @@ assert_equal '[1, 4, 3, 2, 1]', %q{
ractors = (1..3).map { Ractor.new { Ractor.receive } }
counts << Ractor.count
- ractors[0].send('End 0').take
+ ractors[0].send('End 0').join
sleep 0.1 until ractors[0].inspect =~ /terminated/
counts << Ractor.count
- ractors[1].send('End 1').take
+ ractors[1].send('End 1').join
sleep 0.1 until ractors[1].inspect =~ /terminated/
counts << Ractor.count
- ractors[2].send('End 2').take
+ ractors[2].send('End 2').join
sleep 0.1 until ractors[2].inspect =~ /terminated/
counts << Ractor.count
@@ -1236,7 +1164,7 @@ assert_equal '0', %q{
n = 0
ObjectSpace.each_object{|o| n += 1 unless Ractor.shareable?(o)}
n
- }.take
+ }.value
}
# ObjectSpace._id2ref can not handle unshareable objects with Ractors
@@ -1249,7 +1177,25 @@ assert_equal 'ok', <<~'RUBY', frozen_string_literal: false
rescue => e
:ok
end
- end.take
+ end.value
+RUBY
+
+# Inserting into the id2ref table should be Ractor-safe
+assert_equal 'ok', <<~'RUBY'
+ # Force all calls to Kernel#object_id to insert into the id2ref table
+ obj = Object.new
+ ObjectSpace._id2ref(obj.object_id) rescue nil
+