summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Speed up shape transitionsPeter Zhu2022-11-212-72/+48
| | | | | | | | | | | | | | | | | | | | | | | | | This commit significantly speeds up shape transitions as it changes get_next_shape_internal to not perform a lookup (and instead require the caller to perform the lookup). This avoids double lookups during shape transitions. There is a significant (~2x) speedup in the following micro-benchmark: puts(Benchmark.measure do o = Object.new 100_000.times do |i| o.instance_variable_set(:"@a#{i}", 0) end end) Before: 22.393194 0.201639 22.594833 ( 22.684237) After: 11.323086 0.022284 11.345370 ( 11.389346)
* Refactor obj_ivar_set and vm_setivarPeter Zhu2022-11-214-49/+27
| | | | | | | obj_ivar_set and vm_setivar_slowpath is essentially doing the same thing, but the code is duplicated and not quite implemented in the same way, which could cause bugs. This commit refactors vm_setivar_slowpath to use obj_ivar_set.
* Use class methods of `File` over `Kernel.open` and `IO.read`Nobuyoshi Nakada2022-11-2112-49/+39
|
* [ruby/un] Use class methods of `File` over `Kernel.open`Nobuyoshi Nakada2022-11-211-2/+2
| | | | https://github.com/ruby/un/commit/13bdd766fe
* [ruby/optparse] Use class methods of `File` over `IO`Nobuyoshi Nakada2022-11-211-1/+1
| | | | https://github.com/ruby/optparse/commit/ab5073e4d8
* [ruby/irb] Add commands to start and use the debuggerTakashi Kokubun2022-11-2117-37/+484
| | | | | | | | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/449) * Seamlessly integrate a few debug commands * Improve the break command support * Utilize skip_src option if available * Add step and delete commands * Write end-to-end tests for each debugger command * Add documentation * Add backtrace, info, catch commands https://github.com/ruby/irb/commit/976100c1c2
* Use double quotes for nmake [ci skip]Nobuyoshi Nakada2022-11-211-6/+6
|
* Refactor to use has_delayed_token macroyui-knk2022-11-211-1/+1
|
* Add a comment about confusing code [ci skip]Takashi Kokubun2022-11-201-0/+1
|
* Prevent a "warning: ambiguity between regexp and two divisions"Yusuke Endoh2022-11-211-1/+1
|
* Add outdate-bundled-gems target [ci skip]Nobuyoshi Nakada2022-11-211-0/+11
|
* Update default gems list at 509f04ca9159d1dd046af4ffb19cfa [ci skip]git2022-11-211-1/+1
|
* [ruby/irb] Version 1.5.0Takashi Kokubun2022-11-201-2/+2
| | | | | | | | | | | | | Asked by ko1 to release https://github.com/ruby/irb/pull/444 for simplifying https://github.com/ruby/debug/pull/808, and hsbt made me a gem owner for this. Stan said 1.4.3 should have been 1.5.0, but now that it's already released and it's not worth yanking it, we're not doing that change. However, now that this release includes `debug` and `edit`, I think it's a good opportunity to hit the version 1.5.0. https://github.com/ruby/irb/commit/85937d71f6
* Fix a broken interpolation #{head}Takashi Kokubun2022-11-201-2/+3
|
* Add a link to Feature #19070 ticket [ci skip]yui-knk2022-11-211-0/+1
|
* Fix typos (#6775)Yudai Takada2022-11-205-6/+6
| | | | | | | | | | | * s/Innteger/Integer/ * s/diretory/directory/ * s/Bufer/Buffer/ * s/defalt/default/ * s/covearge/coverage/
* Enhance keep_tokens option for RubyVM::AbstractSyntaxTree parsing methodsyui-knk2022-11-219-104/+556
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation for Language Server Protocol (LSP) sometimes needs token information. For example both `m(1)` and `m(1, )` has same AST structure other than node locations then it's impossible to check the existence of `,` from AST. However in later case, it might be better to suggest variables list for the second argument. Token information is important for such case. This commit adds these methods. * Add `keep_tokens` option for `RubyVM::AbstractSyntaxTree.parse`, `.parse_file` and `.of` * Add `RubyVM::AbstractSyntaxTree::Node#tokens` which returns tokens for the node including tokens for descendants nodes. * Add `RubyVM::AbstractSyntaxTree::Node#all_tokens` which returns all tokens for the input script regardless the receiver node. [Feature #19070] Impacts on memory usage and performance are below: Memory usage: ``` $ cat test.rb root = RubyVM::AbstractSyntaxTree.parse_file(File.expand_path('../test/ruby/test_keyword.rb', __FILE__), keep_tokens: true) $ /usr/bin/time -f %Mkb /usr/local/bin/ruby -v ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux] 11408kb # keep_tokens :false $ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb 17508kb # keep_tokens :true $ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb 30960kb ``` Performance: ``` $ cat ../ast_keep_tokens.yml prelude: | src = <<~SRC module M class C def m1(a, b) 1 + a + b end end end SRC benchmark: without_keep_tokens: | RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: false) with_keep_tokens: | RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: true) $ make benchmark COMPARE_RUBY="./ruby" ARGS=../ast_keep_tokens.yml /home/kaneko.y/.rbenv/shims/ruby --disable=gems -rrubygems -I../benchmark/lib ../benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::./ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I../lib -I. -I.ext/common ../tool/runruby.rb --extout=.ext -- --disable-gems --disable-gem" \ --output=markdown --output-compare -v ../ast_keep_tokens.yml compare-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux] built-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux] warming up.. | |compare-ruby|built-ruby| |:--------------------|-----------:|---------:| |without_keep_tokens | 21.659k| 21.303k| | | 1.02x| -| |with_keep_tokens | 6.220k| 5.691k| | | 1.09x| -| ```
* Revert wrong sync in 5958c305e5 [ci skip]Takashi Kokubun2022-11-201-51/+0
| | | | sync_default_gems.rb sometimes syncs too much.
* [Bug #19016] Handle syntax error in main script like other errorsNobuyoshi Nakada2022-11-202-1/+19
| | | | | So that `SyntaxError#detailed_message` will be used also in the case exiting by such syntax error.
* Use `enum ruby_tag_type` over `int`Nobuyoshi Nakada2022-11-202-5/+5
|
* sync_default_gems.rb: Fix substitution [ci skip]Nobuyoshi Nakada2022-11-201-3/+9
| | | | | | As there should be no modified files just affter `git cherry-pick` succeeded in `sync_default_gems_with_commits`, reset to the previous revision once to pick up the committed files.
* Avoid a timeout on test_cache_optimization_exponentialTakashi Kokubun2022-11-191-1/+1
| | | | | The timeout seems too short for some CIs. http://rubyci.s3.amazonaws.com/debian11-aarch64/ruby-master/log/20221120T012840Z.fail.html.gz
* [ruby/irb] Push an accidentally uncommitted diffTakashi Kokubun2022-11-201-1/+1
| | | | https://github.com/ruby/irb/commit/7e9f27afd7
* [ruby/irb] Deal with inconsistency with ruby/rubyTakashi Kokubun2022-11-201-0/+4
| | | | https://github.com/ruby/irb/commit/41d5012849
* [ruby/irb] Require missing EnvUtilTakashi Kokubun2022-11-201-0/+4
| | | | https://github.com/ruby/irb/commit/9bb1757b02
* [ruby/irb] Try using a different file nameTakashi Kokubun2022-11-201-1/+1
| | | | | | | hoping to address: https://github.com/ruby/ruby/actions/runs/3506561941/jobs/5873689640 https://github.com/ruby/irb/commit/de9a6b9d00
* [ruby/irb] Require rubygems for ruby/rubyTakashi Kokubun2022-11-201-0/+1
| | | | | | | You can't take rubygems for granted in a default gem. https://github.com/ruby/ruby/actions/runs/3506561943/jobs/5873689466 https://github.com/ruby/irb/commit/58bb3954d0
* Skip TestDRbSSLAry on mswinTakashi Kokubun2022-11-191-0/+4
| | | | | | | | This doesn't seem to stably work on mswin: https://github.com/ruby/ruby/actions/runs/3505363753/jobs/5871633211 For CI stability, it generally seems like a bad idea to run druby tests on Windows, given that it's pretty much unstable on MinGW as well.
* [ruby/irb] Fix CI failure on ruby/rubyTakashi Kokubun2022-11-201-19/+19
| | | | https://github.com/ruby/irb/commit/ea8c716922
* [ruby/irb] Add edit command (https://github.com/ruby/irb/pull/453)Stan Lo2022-11-205-44/+197
| | | | | | | | | | | | | | * Add edit command * Make find_source a public singleton method * Add document for the edit command * Make find_end private * Remove duplicated private https://github.com/ruby/irb/commit/4321674aa7 Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* Avoid warnings on MINGW:Lars Kanis2022-11-201-0/+4
| | | | | | | | | | | | | win32/win32.c: In function 'rtc_error_handler': win32/win32.c:691:5: warning: function 'rtc_error_handler' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] 691 | rb_str_vcatf(str, fmt, ap); | ^~~~~~~~~~~~ and win32/win32.c:683:1: warning: 'rtc_error_handler' defined but not used [-Wunused-function] 683 | rtc_error_handler(int e, const char *src, int line, const char *exe, const char *fmt, ...) | ^~~~~~~~~~~~~~~~~
* [ruby/irb] Document a full list of commandsTakashi Kokubun2022-11-193-20/+89
| | | | | | | | | (https://github.com/ruby/irb/pull/451) * Document a full list of commands * Document debug as well * Make it less duplicated
* [ruby/irb] Update documentation about AutocompletionTakashi Kokubun2022-11-191-2/+2
| | | | | | (https://github.com/ruby/irb/pull/452) https://github.com/ruby/irb/commit/e6b4917750
* Update fake.rb for test-specNobuyoshi Nakada2022-11-201-1/+1
| | | | spec/ruby/command_line/dash_v_spec.rb needs it.
* [ruby/net-http] About the Examples moved to separate fileBurdetteLamar2022-11-193-51/+32
| | | | https://github.com/ruby/net-http/commit/0512b5bfc9
* [ruby/net-http] Enhanced RDoc for Net::HTTPBurdetteLamar2022-11-191-71/+17
|
* [ruby/net-http] Update lib/net/http/request.rbBurdette Lamar2022-11-191-3/+1
| | | | | https://github.com/ruby/net-http/commit/e3c9011edb Co-authored-by: Peter Zhu <peter@peterzhu.ca>
* [ruby/net-http] Enhanced RDoc for Net::HTTPBurdetteLamar2022-11-193-48/+15
| | | | https://github.com/ruby/net-http/commit/4444e8cea4
* [ruby/net-http] Enhanced RDoc for Net::HTTPBurdetteLamar2022-11-193-320/+596
| | | | https://github.com/ruby/net-http/commit/6b30c5310b
* [DOC] Change formatting in the exec docsMaciek Rząsa2022-11-191-3/+4
| | | | | The last part of the sentence was accidentally put in enumeration, It made an impression that it's one of the rules, not the result of applying the rules.
* Run skipped minitest tests that now passAlan Wu2022-11-191-5/+0
| | | | The mentioned PR was merged.
* YJIT: Improve the failure message on enlarging a branch (#6769)Takashi Kokubun2022-11-181-5/+8
|
* Add test cases for args forwarding after rest argumentyui-knk2022-11-191-0/+2
|
* Rename misleading labelAlan Wu2022-11-181-3/+3
| | | | | | We use this code path when we require the same extension twice, so it's not necessarily about the feature being statically linked. Removing this code when there is no statically linked extensions leads to breakage.
* Fix io/console test for --with-static-linked-extAlan Wu2022-11-181-1/+3
| | | | | | The tests looks for the .so file, which doesn't exist when the extension is statically linked. In that situation it passes -I to ruby with nothing after it which ate the -rio/console argument.
* Update assertionAaron Patterson2022-11-181-1/+1
| | | | New T_OBJECT objects will have a T_OBJECT shape
* 32 bit comparison on shape idAaron Patterson2022-11-188-22/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the shape id comparisons to use a 32 bit comparison rather than 64 bit. That means we don't need to load the shape id to a register on x86 machines. Given the following program: ```ruby class Foo def initialize @foo = 1 @bar = 1 end def read [@foo, @bar] end end foo = Foo.new foo.read foo.read foo.read foo.read foo.read puts RubyVM::YJIT.disasm(Foo.instance_method(:read)) ``` The machine code we generated _before_ this change is like this: ``` == BLOCK 1/4, ISEQ RANGE [0,3), 65 bytes ====================== # getinstancevariable 0x559a18623023: mov rax, qword ptr [r13 + 0x18] # guard object is heap 0x559a18623027: test al, 7 0x559a1862302a: jne 0x559a1862502d 0x559a18623030: cmp rax, 4 0x559a18623034: jbe 0x559a1862502d # guard shape, embedded, and T_OBJECT 0x559a1862303a: mov rcx, qword ptr [rax] 0x559a1862303d: movabs r11, 0xffff00000000201f 0x559a18623047: and rcx, r11 0x559a1862304a: movabs r11, 0xb000000002001 0x559a18623054: cmp rcx, r11 0x559a18623057: jne 0x559a18625046 0x559a1862305d: mov rax, qword ptr [rax + 0x18] 0x559a18623061: mov qword ptr [rbx], rax == BLOCK 2/4, ISEQ RANGE [3,6), 0 bytes ======================= == BLOCK 3/4, ISEQ RANGE [3,6), 47 bytes ====================== # gen_direct_jmp: fallthrough # getinstancevariable # regenerate_branch # getinstancevariable # regenerate_branch 0x559a18623064: mov rax, qword ptr [r13 + 0x18] # guard shape, embedded, and T_OBJECT 0x559a18623068: mov rcx, qword ptr [rax] 0x559a1862306b: movabs r11, 0xffff00000000201f 0x559a18623075: and rcx, r11 0x559a18623078: movabs r11, 0xb000000002001 0x559a18623082: cmp rcx, r11 0x559a18623085: jne 0x559a18625099 0x559a1862308b: mov rax, qword ptr [rax + 0x20] 0x559a1862308f: mov qword ptr [rbx + 8], rax ``` After this change, it's like this: ``` == BLOCK 1/4, ISEQ RANGE [0,3), 41 bytes ====================== # getinstancevariable 0x5560c986d023: mov rax, qword ptr [r13 + 0x18] # guard object is heap 0x5560c986d027: test al, 7 0x5560c986d02a: jne 0x5560c986f02d 0x5560c986d030: cmp rax, 4 0x5560c986d034: jbe 0x5560c986f02d # guard shape 0x5560c986d03a: cmp word ptr [rax + 6], 0x19 0x5560c986d03f: jne 0x5560c986f046 0x5560c986d045: mov rax, qword ptr [rax + 0x10] 0x5560c986d049: mov qword ptr [rbx], rax == BLOCK 2/4, ISEQ RANGE [3,6), 0 bytes ======================= == BLOCK 3/4, ISEQ RANGE [3,6), 23 bytes ====================== # gen_direct_jmp: fallthrough # getinstancevariable # regenerate_branch # getinstancevariable # regenerate_branch 0x5560c986d04c: mov rax, qword ptr [r13 + 0x18] # guard shape 0x5560c986d050: cmp word ptr [rax + 6], 0x19 0x5560c986d055: jne 0x5560c986f099 0x5560c986d05b: mov rax, qword ptr [rax + 0x18] 0x5560c986d05f: mov qword ptr [rbx + 8], rax ``` The first ivar read is a bit more complex, but the second ivar read is much simpler. I think eventually we could teach the context about the shape, then emit only one shape guard.
* rename SHAPE_BITS to SHAPE_ID_NUM_BITSAaron Patterson2022-11-185-14/+14
|
* [ruby/irb] Discover and load debug.gem even if it's not in GemfileTakashi Kokubun2022-11-181-2/+25
| | | | | | | | | | | (https://github.com/ruby/irb/pull/448) * Minor fixes on debug command * Discover and load debug.gem even if it's not in Gemfile * Eliminate else for rescue * Discover the latest one from all gem paths
* [ruby/irb] Minor fixes on debug commandTakashi Kokubun2022-11-182-20/+59
| | | | | | | (https://github.com/ruby/irb/pull/447) * Minor fixes on debug command * Update lib/irb/cmd/debug.rb