Commit graph

74217 commits

Author SHA1 Message Date
Peter Zhu
ad0def7f25 Add more debugging output to test_thrashing_for_young_objects 2022-10-07 09:39:07 -04:00
Samuel Williams
24f3e397e9
Add spec for Coverage.supported? and start(eval: true). (#6499)
* Don't emit coverage for eval when eval coverage is disabled.
2022-10-08 00:33:40 +13:00
lijunwei
1e6cdc76e4 [ruby/logger] Fix the Logger::Formatter documentation
db554fbda7
2022-10-07 19:37:27 +09:00
Samuel Williams
a081fe76de
Simplify default argument specification. (#6507) 2022-10-07 22:51:27 +13:00
Samuel Williams
e4f91bbdba
Add IO#timeout attribute and use it for blocking IO operations. (#5653) 2022-10-07 21:48:38 +13:00
git
e76217a7f3 Update bundled gems list at c3a87e16d8 [ci skip] 2022-10-07 07:03:33 +00:00
Soutaro Matsumoto
c3a87e16d8
Bundle RBS 2.7.0 (#6506) 2022-10-07 16:02:45 +09:00
Hiroshi SHIBATA
4f78560cf1
Add --with-libffi-source-dir feature and removed --enable-bundled-libffi option. (#113)
https://bugs.ruby-lang.org/issues/18571

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:20:11 +09:00
Sutou Kouhei
92f0c53934 [ruby/fiddle] test: don't use assert_true/assert_false
GitHub: GH-102

They aren't available in ruby/ruby.

ced671e43b
2022-10-07 15:18:54 +09:00
Sutou Kouhei
ada9f8a9f7 [ruby/fiddle] closure: follow variable name change
GitHub: GH-102

2530496602
2022-10-07 15:18:54 +09:00
Sutou Kouhei
a4ad6bd9aa [ruby/fiddle] closure: free resources when an exception is raised in Closure.new
GitHub: GH-102

81a8a56239
2022-10-07 15:18:53 +09:00
Sutou Kouhei
9f62768e51 [ruby/fiddle] test: ensure freeing closure
GitHub: GH-102

b2fef1770d
2022-10-07 15:18:53 +09:00
Sutou Kouhei
824c474c95 [ruby/fiddle] test: ensure freeing closure
GitHub: GH-102

This also improves freed closures assertions.

0495624caf
2022-10-07 15:18:53 +09:00
Sutou Kouhei
dfca6a8799 [ruby/fiddle] test: don't use power-assert
It seems that we can't use it in ruby/ruby.

e1221297fb
2022-10-07 15:18:52 +09:00
Sutou Kouhei
7c33141293 [ruby/fiddle] test: ensure freeing closure
GitHub: GH-102

This also improves freed closures assertions.

f6431f3cf8
2022-10-07 15:18:52 +09:00
Sutou Kouhei
255e617bc3 [ruby/fiddle] Add Fiddle::Closure.create and Fiddle::Closure.free
GitHub: fix GH-102

It's for freeing a closure explicitly.

We can't use Fiddle::Closure before we fork the process. If we do it,
the process may be crashed with SELinux.

See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091
for details.

Reported by Vít Ondruch. Thanks!!!

a0ccc6bb1b
2022-10-07 15:18:51 +09:00
Sutou Kouhei
191b91f47a [ruby/fiddle] test: suppress a warning
test/fiddle/test_import.rb:138: warning:
    ambiguous first argument; put parentheses or a space even after `-' operator

060eef76ad
2022-10-07 15:18:51 +09:00
Aaron Patterson
0097c7f388 [ruby/fiddle] Add sym_defined? methods to test if a symbol is defined (https://github.com/ruby/fiddle/pull/108)
I would like to check if a symbol is defined before trying to access it.
Some symbols aren't available on all platforms, so instead of raising an
exception, I want to check if it's defined first.

Today we have to do:

```ruby
begin
  addr = Fiddle::Handle.sym("something")
  # do something
rescue Fiddle::DLError
end
```

I want to write this:

```ruby
if Fiddle::Handle.sym_defined?("something")
  addr = Fiddle::Handle.sym("something")
  # do something
end
```

9d3371de13

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:18:51 +09:00
Aaron Patterson
755d99e878 [ruby/fiddle] Move "type" constants to Fiddle::Types (https://github.com/ruby/fiddle/pull/112)
This helps to reduce repetition in code. Instead of doing "TYPE_*"
everywhere, you can do `include Fiddle::Types`, and write the type name
directly.

This PR is to help reduce repetition when writing Fiddle code. Right now
we have to type `TYPE_` everywhere, and you also have to include all of
`Fiddle` to access `TYPE_*` constants. With this change, you can just
include `Fiddle::Types` and it will shorten your code and also you only
have to include those constants.

Here is an example before:

```ruby
require "fiddle"

module MMAP
  # All Fiddle constants included
  include Fiddle

  def self.make_function name, args, ret
    ptr = Handle::DEFAULT[name]
    func = Function.new ptr, args, ret, name: name
    define_singleton_method name, &func.to_proc
  end

  make_function "munmap", [TYPE_VOIDP, # addr
                           TYPE_SIZE_T], # len
                           TYPE_INT

  make_function "mmap", [TYPE_VOIDP,
                         TYPE_SIZE_T,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT,
                         TYPE_INT], TYPE_VOIDP

  make_function "mprotect", [TYPE_VOIDP, TYPE_SIZE_T, TYPE_INT], TYPE_INT
end
```

After:

```ruby
require "fiddle"

module MMAP
  # Only type names included
  include Fiddle::Types

  def self.make_function name, args, ret
    ptr = Fiddle::Handle::DEFAULT[name]
    func = Fiddle::Function.new ptr, args, ret, name: name
    define_singleton_method name, &func.to_proc
  end

  make_function "munmap", [VOIDP, # addr
                           SIZE_T], # len
                           INT

  make_function "mmap", [VOIDP, SIZE_T, INT, INT, INT, INT], VOIDP

  make_function "mprotect", [VOIDP, SIZE_T, INT], INT
end
```

We only need to import the type names, and you don't have to type
`TYPE_` over and over. I think this makes Fiddle code easier to read.

49fa7233e5

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:18:50 +09:00
Aaron Patterson
48a6498406 [ruby/fiddle] Add constants for unsigned values (https://github.com/ruby/fiddle/pull/111)
This commit adds constants for unsigned values. Currently we can use `-`
to mean "unsigned", but I think having a specific name makes Fiddle more
user friendly. This commit continues to support `-`, but introduces
negative constants with "unsigned" names

I think this will help to eliminate [this
code](3a56bf0bcc/lib/mjit/c_type.rb (L31-L38))

2bef0f1082

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2022-10-07 15:18:49 +09:00
Sutou Kouhei
6d01b66764 [ruby/fiddle] test: ensure GC-ing closures
GitHub: fix GH-102

We can't use Fiddle::Closure before we fork the process. If we do it,
the process may be crashed with SELinux.

See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091
for details.

Reported by Vít Ondruch. Thanks!!!

1343ac7a95
2022-10-07 15:18:49 +09:00
Nobuyoshi Nakada
1b7c5c394f [ruby/date] Fix misplaced time zone offset checks
d21c69450a
2022-10-07 14:41:31 +09:00
Hiroshi SHIBATA
fc218e5977 [ruby/psych] Removed the related condition of --enable-bundled-libyaml
7c211a43c1
2022-10-07 12:55:31 +09:00
Hiroshi SHIBATA
94d4bea7c9 [ruby/psych] --enable-bundled-libyaml config has been removed
447d372dcd
2022-10-07 12:55:30 +09:00
Nobuyoshi Nakada
a87de5e3c1 [ruby/rdoc] Special characters are prohibited as filename on Windows
13b9da5932
2022-10-07 12:12:10 +09:00
Nobuyoshi Nakada
39909d8c18 [ruby/rdoc] Escape search results
https://hackerone.com/reports/1321358

2ebf8fd510
2022-10-07 12:12:09 +09:00
Nobuyoshi Nakada
a3cb09c7d1 [ruby/rdoc] Escape file names
https://hackerone.com/reports/1321358

8c07cc4657
2022-10-07 12:12:08 +09:00
Nobuyoshi Nakada
8d0b2162a0 [ruby/rdoc] Escape main title
https://hackerone.com/reports/1187156

5dedb5741d
2022-10-07 12:09:23 +09:00
Nobuyoshi Nakada
586e18b946 [ruby/rdoc] Escape HYPERLINKs
ac35485be6
2022-10-07 12:09:22 +09:00
Nobuyoshi Nakada
9e3ab9da7f [ruby/rdoc] Escape RDOCLINKs
https://hackerone.com/reports/1187156

7cecf1efae
2022-10-07 12:09:21 +09:00
Nobuyoshi Nakada
deaa656608 [ruby/rdoc] Escape TIDYLINKs
https://hackerone.com/reports/1187156

1ad2dd3ca2
2022-10-07 12:09:20 +09:00
Alan Wu
0472effc41
YJIT: add an assert for branch_stub_hit() (#6505)
We set the PC in branch_stub_hit(), which only makes sense if we're
running with the intended iseq for the stub. We ran into an issue caught
by this while tweaking code layout.
2022-10-06 18:42:26 -04:00
Alan Wu
43e87c7e8a
YJIT: fix ARM64 bitmask encoding for 32 bit registers (#6503)
For logical instructions such as AND, there is a constraint that the N
part of the bitmask immediate must be 0. We weren't respecting this
condition previously and were silently emitting undefined instructions.

Check for this condition in the assembler and tweak the backend to
correctly detect whether a number could be encoded as an immediate in a
32 bit logical instruction. Due to the nature of the immediate encoding,
the same numeric value encodes differently depending on the size of
the register the instruction works on.

We currently don't have cases where we use 32 bit immediates but we ran
into this encoding issue during development.
2022-10-06 18:41:38 -04:00
Janko Marohnić
fa2e1b67e5 [ruby/open-uri] Support 308 status redirect
d8899ae4ac
2022-10-07 06:58:37 +09:00
Burdette Lamar
7837dccb0e
Adapt doc guide to new GFM features (#6504)
* Adapt doc guide to new GFM features

* Adapt doc guide to new GFM features
2022-10-06 15:02:37 -05:00
Takashi Kokubun
43650f606e
Notify CI failures of Miscellaneous checks 2022-10-06 11:58:50 -07:00
Takashi Kokubun
1f2c84de83
[ruby/rdoc] Remove trailing spaces to fix CI
5224898228

369e4fa32d
2022-10-06 11:56:05 -07:00
Peter Zhu
3df904d1a8 Add debug output to test_thrashing_for_young_objects
The test is failing only on trunk-repeat50@phosphorus-docker. This
commit adds some debugging output to debug the failure.
2022-10-06 13:46:31 -04:00
Yuri Smirnov
13e87e5049
fix Data docs (#6497) 2022-10-06 10:13:17 -07:00
Burdette Lamar
bbbdb574c5
[DOC] Integrate io_streams.rdoc into io.c (#6491)
Integrate io_streams.rdoc into io.c
2022-10-06 09:30:12 -05:00
Nobuyoshi Nakada
cf3056be69 [ruby/rdoc] Add center align
512cc55a0e
2022-10-06 23:22:02 +09:00
Nobuyoshi Nakada
28e24ce355 [ruby/rdoc] Allow spaces around pipes
3b3a583580
2022-10-06 23:21:16 +09:00
Nobuyoshi Nakada
7c03c82444 [ruby/rdoc] Allow escaped pipes in cells
333952a62d
2022-10-06 23:17:49 +09:00
Nobuyoshi Nakada
f6c916c7ef [ruby/rdoc] Allow leading pipes to be ommitted
d263a2c9c4
2022-10-06 23:16:54 +09:00
Nobuyoshi Nakada
a19bf47d03 [ruby/rdoc] Allow trailing pipes to be ommitted
1318048877
2022-10-06 23:14:29 +09:00
Peter Zhu
76bae60d9b [Bug #19038] Fix corruption of generic_iv_tbl when compacting
When the generic_iv_tbl is resized up, rebuild_table performs
allocations that can trigger GC. If autocompaction is enabled, then
moved objects are removed from and inserted into the generic_iv_tbl.
This may cause another call to rebuild_table to resize the
generic_iv_tbl. When returning back to the original rebuild_table, some
of the data may be stale, causing the generic_iv_tbl to be corrupted.

This commit changes rebuild_table to only read data from the st_table
after the allocations have completed.

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
2022-10-06 09:01:12 -04:00
Samuel Williams
e696ec67ac
Introduce Fiber.blocking{} for bypassing the fiber scheduler. (#6498) 2022-10-06 23:00:49 +13:00
Nobuyoshi Nakada
75a53f6be0 [ruby/rdoc] Allow RDoc markups in table cells
b16d3f1727
2022-10-06 18:24:44 +09:00
Nobuyoshi Nakada
e929b0aac5 [ruby/rdoc] Add RDoc::Markup::ToHtml#accept_table test
0cb3df713b
2022-10-06 18:24:43 +09:00
git
4e1086f903 * remove trailing spaces. [ci skip] 2022-10-06 18:01:08 +09:00