Граф коммитов

74600 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun 23750c866a [ruby/irb] Update documentation about Autocompletion
(https://github.com/ruby/irb/pull/452)

https://github.com/ruby/irb/commit/e6b4917750
2022-11-19 22:10:09 +00:00
Nobuyoshi Nakada 01bc2fc514
Update fake.rb for test-spec
spec/ruby/command_line/dash_v_spec.rb needs it.
2022-11-20 01:10:40 +09:00
BurdetteLamar 909ea6b60d [ruby/net-http] About the Examples moved to separate file
https://github.com/ruby/net-http/commit/0512b5bfc9
2022-11-19 15:33:28 +00:00
BurdetteLamar e6162728f6 [ruby/net-http] Enhanced RDoc for Net::HTTP 2022-11-19 10:25:12 -05:00
Burdette Lamar 2047636af8 [ruby/net-http] Update lib/net/http/request.rb
https://github.com/ruby/net-http/commit/e3c9011edb

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-11-19 10:17:54 -05:00
BurdetteLamar dbb902fc91 [ruby/net-http] Enhanced RDoc for Net::HTTP
https://github.com/ruby/net-http/commit/4444e8cea4
2022-11-19 10:17:54 -05:00
BurdetteLamar 951eabdcf2 [ruby/net-http] Enhanced RDoc for Net::HTTP
https://github.com/ruby/net-http/commit/6b30c5310b
2022-11-19 10:17:53 -05:00
Maciek Rząsa 50c6cabadc
[DOC] Change formatting in the exec docs
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.
2022-11-19 11:38:16 +09:00
Alan Wu 574d849869 Run skipped minitest tests that now pass
The mentioned PR was merged.
2022-11-19 10:36:51 +09:00
Takashi Kokubun 6dcb7b9216
YJIT: Improve the failure message on enlarging a branch (#6769) 2022-11-18 17:27:07 -08:00
yui-knk 082cfcfd06 Add test cases for args forwarding after rest argument 2022-11-19 10:17:16 +09:00
Alan Wu 5c505f4a48 Rename misleading label
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.
2022-11-18 19:42:24 -05:00
Alan Wu 7f269a3c2d Fix io/console test for --with-static-linked-ext
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.
2022-11-18 18:50:34 -05:00
Aaron Patterson 2185f0ca77
Update assertion
New T_OBJECT objects will have a T_OBJECT shape
2022-11-18 13:58:13 -08:00
Aaron Patterson 9e067df76b 32 bit comparison on shape id
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.
2022-11-18 12:04:10 -08:00
Aaron Patterson 6582f34831 rename SHAPE_BITS to SHAPE_ID_NUM_BITS 2022-11-18 12:04:10 -08:00
Takashi Kokubun ba3b40a9ae [ruby/irb] Discover and load debug.gem even if it's not in Gemfile
(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
2022-11-18 18:03:33 +00:00
Takashi Kokubun b1cbc883f2 [ruby/irb] Minor fixes on debug command
(https://github.com/ruby/irb/pull/447)

* Minor fixes on debug command

* Update lib/irb/cmd/debug.rb
2022-11-18 17:34:42 +00:00
Aaron Patterson 10788166e7 Differentiate T_OBJECT shapes from other objects
We would like to differentiate types of objects via their shape.  This
commit adds a special T_OBJECT shape when we allocate an instance of
T_OBJECT.  This allows us to avoid testing whether an object is an
instance of a T_OBJECT or not, we can just check the shape.
2022-11-18 08:31:56 -08:00
yui-knk f0ce118662 Make anonymous rest arg (*) and block arg (&) accessible from ARGS node 2022-11-18 18:25:42 +09:00
Shugo Maeda ddd62fadaf Allow anonymous keyword rest parameter with other keyword parameters
Fixes [Bug #19132]
2022-11-18 18:23:06 +09:00
Stan Lo 00872d120b [ruby/irb] Add debug command (https://github.com/ruby/irb/pull/446)
https://github.com/ruby/irb/commit/30faa13fa3
2022-11-18 09:11:23 +00:00
Hiroshi SHIBATA a80b66e7eb
Added build instructions of psych and fiddle with source files of libyaml and libffi 2022-11-18 17:51:37 +09:00
Yusuke Endoh ca1aa7afea Prevent a "method redefined" warning
http://rubyci.s3.amazonaws.com/ubuntu2004-arm/ruby-master/log/20221118T033003Z.log.html.gz
```
[21350/22024] TestIRB::ExtendCommandTest#test_show_source_end_finder/home/chkbuild/chkbuild/tmp/build/20221118T033003Z/ruby/test/irb/test_cmd.rb:523: warning: method redefined; discarding old show_source_test_method
/home/chkbuild/chkbuild/tmp/build/20221118T033003Z/ruby/test/irb/test_cmd.rb:523: warning: previous definition of show_source_test_method was here
 ```
2022-11-18 15:39:50 +09:00
Yusuke Endoh 417f3cd893 tool/generic_erb.rb: Add a hack to prevent "unused variable" warnings 2022-11-18 14:56:55 +09:00
Yusuke Endoh e19afe36ca Revert "tool/generic_erb.rb: Use ERB#result_with_hash instead of #result"
This reverts commit bd148a2bdd.

ERB#result_with_hash does not work on Ruby 2.2

https://ci.appveyor.com/project/ruby/ruby/builds/45420170
```
../tool/generic_erb.rb:33:in `block (2 levels) in <main>': undefined method `result_with_hash' for #<ERB:0x0000000002516650> (NoMethodError)
```
2022-11-18 14:45:21 +09:00
Yusuke Endoh 096ffebbbf Prevent a "warning: assigned but unused variable - s2" 2022-11-18 14:39:40 +09:00
Yusuke Endoh bd148a2bdd tool/generic_erb.rb: Use ERB#result_with_hash instead of #result
to prevent the warnings:
```
./tool/generic_erb.rb:23: warning: assigned but unused variable - output
./tool/generic_erb.rb:24: warning: assigned but unused variable - vpath
```
2022-11-18 14:38:49 +09:00
Jimmy Miller 98e9165b0a
Fix bug involving .send and overwritten methods. (#6752)
@casperisfine reporting a bug in this gist https://gist.github.com/casperisfine/d59e297fba38eb3905a3d7152b9e9350

After investigating I found it was caused by a combination of send and a c_func that we have overwritten in the JIT. For send calls, we need to do some stack manipulation before making the call. Because of the way exits works, we need to do that stack manipulation at the last possible moment. In this case, we weren't doing that stack manipulation at all. Unfortunately, with how the code is structured there isn't a great place to do that stack manipulation for our overridden C funcs.

Each overridden C func can return a boolean stating that it shouldn't be used. We would need to do the stack manipulation after all of those checks are done. We could pass a lambda(?) or separate out the logic for "can I run this override" from "now generate the code for it". Since we are coming up on a release, I went with the path of least resistence and just decided to not use these overrides if we are in a send call.

We definitely should revist this in the future.
2022-11-17 23:17:40 -05:00
Takashi Kokubun ab4379e086
Refactor RB_SPECIAL_CONST_P (#6759)
Since https://github.com/ruby/ruby/pull/6599, RUBY_IMMEDIATE_MASK also
overlaps RUBY_Qnil. Now RB_SPECIAL_CONST_P seems confusing since both
RB_IMMEDIATE_P and RB_TEST check for RUBY_Qnil while we only need to
check RUBY_Qnil besides RUBY_IMMEDIATE_MASK. I'd like to make this
change to make it less confusing.

I confirmed that this doesn't change the number of instructions used for
the RUBY_Qfalse check on Linux x86_64 GCC and macOS arm64 Clang.
2022-11-17 17:55:24 -08:00
Takashi Kokubun d8202a52a5 [ruby/irb] Add an option to suppress code_around_binding
(https://github.com/ruby/irb/pull/444)

for debug.gem's `irb` command
2022-11-18 00:47:53 +00:00
Samuel Williams cb4c89e08e
Fix quoting of code in `NEWS.md`. 2022-11-17 15:19:21 -08:00
Samuel Williams ea8a7287e2
Add support for `sockaddr_un` on Windows. (#6513)
* Windows: Fix warning about undefined if_indextoname()

* Windows: Fix UNIXSocket on MINGW and make .pair more reliable

* Windows: Use nonblock=true for read tests with scheduler

* Windows: Move socket detection from File.socket? to File.stat

Add S_IFSOCK to Windows and interpret reparse points accordingly.
Enable tests that work now.

* Windows: Use wide-char functions to UNIXSocket

This fixes behaviour with non-ASCII characters.
It also fixes deletion of temporary UNIXSocket.pair files.

* Windows: Add UNIXSocket tests for specifics of Windows impl.

* Windows: fix VC build due to missing _snwprintf

Avoid usage of _snwprintf, since it fails linking ruby.dll like so:

  linking shared-library x64-vcruntime140-ruby320.dll
  x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf
  x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l

whereas linking miniruby.exe succeeds.

This patch uses snprintf on the UTF-8 string instead.

Also remove branch GetWindowsDirectoryW, since it doesn't work.

* Windows: Fix dangling symlink test failures

Co-authored-by: Lars Kanis <kanis@comcard.de>
2022-11-17 14:50:25 -08:00
Takashi Kokubun 4e4b29b1a9
YJIT: Make the code GC test stabler
The first `add_pages` call shouldn't hit Code GC yet; otherwise
`compiles` returns false. With the increased code size in runtime_stats
itself, it sometimes hits Code GC too early, at least in arm64 that has
a large code size.
2022-11-17 14:02:01 -08:00
Takashi Kokubun c80edc9f98
YJIT: Add object shape count to stats (#6754) 2022-11-17 12:59:59 -08:00
Peter Zhu 4b29eb17f2 Fix indentation of switch statement in shape.c 2022-11-17 14:43:46 -05:00
Takashi Kokubun 3f3a539197
YJIT: Add missing key for non-stats build 2022-11-17 11:31:56 -08:00
Takashi Kokubun 0446d961a0
YJIT: Fix typo in stats references (#6753) 2022-11-17 10:58:56 -08:00
TSUYUSATO Kitsune 189e3c0ada Add default cases for cache point finding function 2022-11-17 23:19:17 +09:00
TSUYUSATO Kitsune 90bfac296e Add OP_CCLASS_MB case 2022-11-17 23:19:17 +09:00
Nobuyoshi Nakada a145a204ec
[DOC] Update about `sec` argument of `Time.new` 2022-11-17 21:52:50 +09:00
Lars Kanis 7b1d23fd29
Windows: Readlink improvements (#6745)
* Windows: Use readlink emulation for File.readlink

This fixes readlink emulation for the ERROR_MORE_DATA case and general error reporting.
It now releases GVL while readlink IO operation.

The dedicated rb_readlink was introduced in commit 2ffb87995a
in order to improve encoding and buffer allocation.
However the encoding issues are solved since ruby-3.0 switched to UTF-8
and the buffer allocation will be improved in a later commit.

* Windows: Increase the default buffer size for reparse point info

So far nearly all queries of reparse points needed two attempts to get enough buffer.

* Windows: Remove declaration of rb_w32_wreadlink

It was removed in commit 2f6fdd3aeb
2022-11-17 01:57:52 -08:00
git 71e668e633 Update default gems list at c76909e551 [ci skip] 2022-11-17 04:53:46 +00:00
Hiroshi SHIBATA c76909e551 [ruby/irb] Bump up 1.4.3
https://github.com/ruby/irb/commit/1bddbbf602
2022-11-17 04:52:50 +00:00
st0012 923c1aaed7
Drop Ruby 2.5 support
Because it has reached EOL for more than 1.5 years and it won't be
supported by the next reline version either.
2022-11-17 13:06:32 +09:00
Patrick Plenefisch e61b3e6f43 [ruby/irb] Fix https://github.com/ruby/irb/pull/295: Ignore Java
package reference objects in
JRuby

https://github.com/ruby/irb/commit/84d030182d
2022-11-17 03:39:04 +00:00
Takashi Kokubun a777ec0d85
YJIT: Shrink version lists after mutation (#6749) 2022-11-16 16:30:39 -08:00
Takashi Kokubun 3259aceb35
YJIT: Pack BlockId and CodePtr (#6748) 2022-11-16 15:48:46 -08:00
Takashi Kokubun 1b8236acc2
YJIT: Add compiled_branch_count stats (#6746) 2022-11-16 15:31:13 -08:00
Takashi Kokubun 6de4032e40
YJIT: Stop wrapping CmePtr with CmeDependency (#6747)
* YJIT: Stop wrapping CmePtr with CmeDependency

* YJIT: Fix an outdated comment [ci skip]
2022-11-16 15:30:29 -08:00