74915 Commits

Author SHA1 Message Date
Takashi Kokubun
a50aabde9c
YJIT: Simplify Insn::CCall to obviate Target::FunPtr (#6793) 2022-11-23 12:14:43 -05:00
BurdetteLamar
5ee947314e [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/86b0514239
2022-11-23 17:12:35 +00:00
BurdetteLamar
4b32ed6e33 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/ef0ef53b0c
2022-11-23 17:12:34 +00:00
BurdetteLamar
79a9280aa5 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/0af9fb94a9
2022-11-23 17:12:33 +00:00
BurdetteLamar
c6dc126641 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/995ff356b4
2022-11-23 17:12:33 +00:00
BurdetteLamar
66be0922b7 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/e924f1205b
2022-11-23 17:12:32 +00:00
Takashi Kokubun
d88adaad7e
YJIT: Use NonNull pointer for CodePtr (#6792) 2022-11-23 12:02:05 -05:00
Takashi Kokubun
9c36de3c48 YJIT: Stop passing target1 to gen_return_branch 2022-11-23 11:59:50 -05:00
Takashi Kokubun
fe2bed6778
YJIT: Simplify code for RB_SPECIAL_CONST_P (#6795) 2022-11-23 11:59:02 -05:00
Jemma Issroff
e82b15b660
Fix YJIT backend to account for unsigned int immediates (#6789)
YJIT: x86_64: Fix cmp with number where sign bit is set

Before this commit, we were unconditionally treating unsigned ints as
signed ints when counting the number of bits required for representing
the immediate in machine code. When the size of the immediate matches
the size of the other operand, no sign extension happens, so this was
incorrect. `asm.cmp(opnd64, 0x8000_0000)` panicked even though it's
encodable as `CMP r/m32, imm32`. Large shape ids were impacted by this
issue.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Alan Wu <alanwu@ruby-lang.org>

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2022-11-23 10:48:17 -05:00
Aaron Patterson
aedf682bfa
Free the IV table after estimation
We need to make sure the name table is freed otherwise we have a memory
leak.
2022-11-22 13:54:30 -08:00
Peter Zhu
003f8ea809 Remove dead code in rb_obj_copy_ivar
The removed code is a duplicate of the code above.
2022-11-22 13:49:46 -08:00
Maxime Chevalier-Boisvert
c4e99ac454
Update yjit.md 2022-11-22 16:18:31 -05:00
zverok
eaf2b6c439 Add Time#deconstruct_keys 2022-11-22 23:10:46 +02:00
Takashi Kokubun
63f4a7a1ec
YJIT: Skip padding jumps to side exits on Arm (#6790)
YJIT: Skip padding jumps to side exits

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2022-11-22 15:57:17 -05:00
Jemma Issroff
9c5e3671eb
Increment max_iv_count on class based on number of set_iv in initialize (#6788)
We can loosely predict the number of ivar sets on a class based on the
number of iv set instructions in the initialize method. This should give
us a more accurate estimate to use for initial size pool allocation,
which should in turn give us more cache hits.
2022-11-22 15:28:14 -05:00
Nobuyoshi Nakada
20b9d7b9fd
Use enum over int 2022-11-22 14:20:45 +09:00
Nobuyoshi Nakada
8c02084ac8
Use dedicated assertions for warnings 2022-11-22 14:07:21 +09:00
Nobuyoshi Nakada
77f963004f
Avoid unnecessary use of global variables 2022-11-22 13:58:56 +09:00
Nobuyoshi Nakada
36f297e621
Use valid tokens as cookie names 2022-11-22 11:32:28 +09:00
git
32d202eb93 Update default gems list at 805d70f716c782e82ec77ca623b217 [ci skip] 2022-11-22 02:13:26 +00:00
Hiroshi SHIBATA
805d70f716 [ruby/cgi] Bump up 0.3.5
https://github.com/ruby/cgi/commit/daf88c2a75
2022-11-22 02:12:50 +00:00
Nobuyoshi Nakada
58682b6980 [ruby/cgi] Relax domain label restrictions
https://github.com/ruby/cgi/commit/b46d41c363
2022-11-22 02:12:50 +00:00
git
5304b3bd85 Update default gems list at 3f960cf445dd387a5497ffad897ea6 [ci skip] 2022-11-22 02:01:14 +00:00
Hiroshi SHIBATA
3f960cf445 [ruby/cgi] Bump up 0.3.4
https://github.com/ruby/cgi/commit/3649a27bf4
2022-11-22 02:00:11 +00:00
Yusuke Endoh
0e75b2f2e6 [ruby/cgi] Prevent CRLF injection
Throw a RuntimeError if the HTTP response header contains CR or LF to
prevent HTTP response splitting.

https://hackerone.com/reports/1204695

https://github.com/ruby/cgi/commit/64c5045c0a
2022-11-22 02:00:11 +00:00
Nobuyoshi Nakada
c05f85f373 [ruby/cgi] Check cookie name/path/domain characters
https://hackerone.com/reports/1204977

https://github.com/ruby/cgi/commit/30107a4797
2022-11-22 02:00:10 +00:00
MSP-Greg
cf05c202ce Fixup spec/ruby/optional/capi/rbasic_spec.rb for mswin 2022-11-21 19:52:44 +01:00
Takashi Kokubun
607fb49dbc
YJIT: Lower the required Rust version from 1.58.1 to 1.58.0 (#6780) 2022-11-21 10:27:39 -08:00
Peter Zhu
09423876f9 Let SHAPE_BITS take 32 bits on debug builds
The ractor_belonging_id has been moved out of the headers, so object
shapes can take the top 32 bits of the flags on debug builds.
2022-11-21 11:26:26 -05:00
Peter Zhu
5f95228c76 Add RVALUE_OVERHEAD and move ractor_belonging_id
This commit adds RVALUE_OVERHEAD for storing metadata at the end of the
slot. This commit moves the ractor_belonging_id in debug builds from the
flags to RVALUE_OVERHEAD which frees the 16 bits in the headers for
object shapes.
2022-11-21 11:26:26 -05:00
Nobuyoshi Nakada
b7a0ce32da [Bug #19016] SyntaxError with parser error messages
Raise a `SyntaxError` with the parser error message, in the case
reading from a file instead of the `-e` option or standard input. So
syntax_suggest can get the message from the caught error.
2022-11-22 00:33:19 +09:00
Nobuyoshi Nakada
5b959e238e [Bug #19016] re-order error handling at cleanup
Build and store the error message with `#detailed_message` before
terminating all Ractors, then show the message later.
2022-11-22 00:33:19 +09:00
Peter Zhu
1f0888ab3e Speed up shape transitions
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)
2022-11-21 10:22:29 -05:00
Peter Zhu
648927d71b Refactor obj_ivar_set and vm_setivar
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.
2022-11-21 09:58:53 -05:00
Nobuyoshi Nakada
612aa5c24a
Use class methods of File over Kernel.open and IO.read 2022-11-21 22:16:49 +09:00
Nobuyoshi Nakada
116920cff8 [ruby/un] Use class methods of File over Kernel.open
https://github.com/ruby/un/commit/13bdd766fe
2022-11-21 13:15:48 +00:00
Nobuyoshi Nakada
e2b15461a7 [ruby/optparse] Use class methods of File over IO
https://github.com/ruby/optparse/commit/ab5073e4d8
2022-11-21 10:26:42 +00:00
Takashi Kokubun
c9fbc779a6 [ruby/irb] Add commands to start and use the debugger
(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
2022-11-21 08:46:27 +00:00
Nobuyoshi Nakada
65e31402ae
Use double quotes for nmake [ci skip] 2022-11-21 16:35:28 +09:00
yui-knk
854312eede Refactor to use has_delayed_token macro 2022-11-21 16:32:13 +09:00
Takashi Kokubun
3071a727e0
Add a comment about confusing code [ci skip] 2022-11-20 23:21:28 -08:00
Yusuke Endoh
730b841f8d Prevent a "warning: ambiguity between regexp and two divisions" 2022-11-21 16:13:15 +09:00
Nobuyoshi Nakada
166598a6eb
Add outdate-bundled-gems target [ci skip] 2022-11-21 15:10:29 +09:00
git
427985c194 Update default gems list at 509f04ca9159d1dd046af4ffb19cfa [ci skip] 2022-11-21 05:25:05 +00:00
Takashi Kokubun
509f04ca91 [ruby/irb] Version 1.5.0
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
2022-11-20 21:24:25 -08:00
Takashi Kokubun
1753cf59cc
Fix a broken interpolation #{head} 2022-11-20 21:23:28 -08:00
yui-knk
db8ff237c7 Add a link to Feature #19070 ticket [ci skip] 2022-11-21 14:17:07 +09:00
Yudai Takada
29e6d97517
Fix typos (#6775)
* s/Innteger/Integer/

* s/diretory/directory/

* s/Bufer/Buffer/

* s/defalt/default/

* s/covearge/coverage/
2022-11-20 21:07:18 -08:00
yui-knk
d8601621ed Enhance keep_tokens option for RubyVM::AbstractSyntaxTree parsing methods
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|         -|
```
2022-11-21 09:01:34 +09:00