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

69496 Коммитов

Автор SHA1 Сообщение Дата
Kazuhiro NISHIYAMA d844459377
Fix a warning
```
../gc.c:2342:45: warning: comparison of integers of different signs: 'short' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
    GC_ASSERT(size_pools[pool_id].slot_size == slot_size);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
```

Add cast to short, because `GC_ASSERT`s in `size_pool_for_size`
already use cast to short.
2021-10-28 09:22:17 +09:00
Kazuhiro NISHIYAMA da22e43ce0
Fix a warning
```
../gc.c:2342:25: warning: array subscript is of type 'char' [-Wchar-subscripts]
    GC_ASSERT(size_pools[pool_id].slot_size == slot_size);
                        ^~~~~~~~
```
2021-10-28 09:07:22 +09:00
Nobuyoshi Nakada b74bf8dd88
Follow up the RString change [ci skip]
Since 46b66eb9e8, already `ary` has
been enclosed in `embed`.
2021-10-28 08:58:59 +09:00
git 30942c19c0 * 2021-10-28 [ci skip] 2021-10-28 02:00:25 +09:00
Alan Wu fdbae38546 YJIT: move --yjit-stats at_exit call into Ruby
This change fixes `-v --yjit-stats`. Previously in this situation,
YJIT._print_stats wasn't defined as yjit.rb is not evaluated when there
is only "-v" and no Ruby code to run.
2021-10-27 13:00:05 -04:00
Alan Wu 6875d6d1fa Expect multi-line -v output for -DRUBY_DEVEL in tests
On -DRUBY_DEVEL builds, `ruby -v` can print extra info about the last
commit on a separate line, breaking some tests that expect a single
line. Assert only the first line instead.
2021-10-27 13:00:05 -04:00
Alan Wu 0d9913e52f Fix indentation in test 2021-10-27 13:00:05 -04:00
Nobuyoshi Nakada 367884c659
Fix yjit_asm_tests.c as C99 compliant (#5033)
* rb_bug should be variadic

* Prefer ANSI-style prototypes over old K&R-style definitions

* Add missing argument types
2021-10-27 10:57:08 -04:00
John Hawthorn a6104b392a
YJIT: Support newhash with values (#5029)
* YJIT: Implement newhash with values

* YJIT: Add test of duphash

* Fix compilation on macos/clang
2021-10-27 10:55:43 -04:00
Vít Ondruch 5086c25f60 Properly exclude test cases.
Lets consider the following scenario:

~~~
irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):001:0> p suite
OpenSSL::TestEC
=> OpenSSL::TestEC

irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):002:0> p all_test_methods
["test_ECPrivateKey", "test_ECPrivateKey_encrypted", "test_PUBKEY", "test_check_key", "test_derive_key", "test_dh_compute_key", "test_dsa_sign_asn1_FIPS186_3", "test_ec_group", "test_ec_key", "test_ec_point", "test_ec_point_add", "test_ec_point_mul", "test_generate", "test_marshal", "test_sign_verify", "test_sign_verify_raw"]
=>
["test_ECPrivateKey",
 "test_ECPrivateKey_encrypted",
 "test_PUBKEY",
 "test_check_key",
 "test_derive_key",
 "test_dh_compute_key",
 "test_dsa_sign_asn1_FIPS186_3",
 "test_ec_group",
 "test_ec_key",
 "test_ec_point",
 "test_ec_point_add",
 "test_ec_point_mul",
 "test_generate",
 "test_marshal",
 "test_sign_verify",
 "test_sign_verify_raw"]

irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):003:0> p filter
/\A(?=.*)(?!.*(?-mix:(?-mix:memory_leak)|(?-mix:OpenSSL::TestEC.test_check_key)))/
=> /\A(?=.*)(?!.*(?-mix:(?-mix:memory_leak)|(?-mix:OpenSSL::TestEC.test_check_key)))/

irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):004:0> method = "test_check_key"
=> "test_check_key"
~~~

The intention here is to exclude the `test_check_key` test case.
Unfortunately this does not work as expected, because the negative filter
is never checked:

~~~
irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):005:0> filter === method
=> true

irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):006:0> filter === "#{suite}##{method}"
=> false

irb(#<Test::Unit::AutoRunner::Runner:0x0000560f68afc3c8>):007:0> filter === method || filter === "#{suite}##{method}"
=> true
~~~

Therefore always filter against the fully qualified method name
`#{suite}##{method}`, which should provide the expected result.

However, if plain string filter is used, keep checking also only the
method name.

This resolves [Bug #16936].
2021-10-27 19:56:19 +09:00
Kazuhiro NISHIYAMA 9fc2f5375d
Sort URLs by issue numbers [ci skip] 2021-10-27 16:55:29 +09:00
Nobuyoshi Nakada 5ff47e0c8a Check old-style definitions 2021-10-27 16:28:10 +09:00
Kazuhiro NISHIYAMA 219f54152a
Update stdlib versions 2021-10-27 16:22:04 +09:00
Satoshi Moris Tagomori 489e5e3a82 the core problem is the Proc is not shareable 2021-10-27 16:13:43 +09:00
Kazuki Yamaguchi 9541b3b7c0 random.c: simplify Random object deallocation
This is a follow-up for commit 265c002239 ("Do not allocate
ractor-local storage in dfree function during GC", 2021-02-09).

The comparison with the default rb_random_mt_t is useless in the first
place, since it is never equal: no actual Random object is associated
with it.

[Bug #17653] https://bugs.ruby-lang.org/issues/17653
2021-10-27 15:44:27 +09:00
David Rodríguez ed5f8eaf49 [rubygems/rubygems] Don't warn when a lockfile is locked to a dev version
Even if it's newer than the running versions. Dev versions are not
released to rubygems.org, so the warning message suggests a command that
doesn't work. And dev versions are currently non deterministic
(2.3.0.dev can be many different versions), so the warning doesn't
really make sense at the moment.

https://github.com/rubygems/rubygems/commit/6f31af27ef
2021-10-27 14:47:21 +09:00
Yusuke Endoh 4c32fcb84f [ruby/error_highlight] Make the formatter mechanism support Ractor
Now the formatter configuration is per Ractor. DefaultFormatter is used
if not set.

DefaultFormatter#message_for is now a class method to allow sub-Ractors
to call the method.

https://github.com/ruby/error_highlight/commit/9fbaa8ab7c
2021-10-27 11:29:20 +09:00
Nobuyoshi Nakada 33844f3096
Prefer ANSI-style prototypes over old K&R-style definitions 2021-10-27 10:16:52 +09:00
Jean Boussier e5319dc985 pack.c: add an offset argument to unpack and unpack1
[Feature #18254]

This is useful to avoid repeteadly copying strings when parsing binary formats
2021-10-26 22:27:30 +02:00
Jeremy Evans 717ab0bb2e
Add Class#descendants
Doesn't include receiver or singleton classes.

Implements [Feature #14394]

Co-authored-by: fatkodima <fatkodima123@gmail.com>
Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2021-10-26 12:35:21 -07:00
Peter Zhu a4d5ee4f31 [Bug #18264] Fix memory leak in TracePoint
TracePoint leaks memory because it allocates a `rb_tp_t` struct
without ever freeing it (it is created with `RUBY_TYPED_NEVER_FREE`).
2021-10-26 13:11:35 -04:00
Steven Nunez f180fa6ca3 Fix Typo 2021-10-26 13:10:49 -04:00
git 66e318503f * 2021-10-27 [ci skip] 2021-10-27 02:05:22 +09:00
Nobuyoshi Nakada 26353c75a9 Embed bare `double` if `sizeof(double) == sizeof(VALUE)` 2021-10-27 02:05:06 +09:00
Nobuyoshi Nakada e3a783b141 Align `RFloat` at VALUE boundary 2021-10-27 02:05:06 +09:00
Nobuyoshi Nakada afdca0e780
Fix unaligned access to `double` in RFloat 2021-10-26 20:17:00 +09:00
Nobuyoshi Nakada e1ecda297e
Make new object for negated float as `Float` is always frozen now 2021-10-26 20:17:00 +09:00
Shugo Maeda 37395ffa05
Make the metaclass of Refinement explicitly
Otherwise, singleton methods of Module are not inherited unless
Refinement.singleton_class is called.
2021-10-26 19:36:52 +09:00
Koichi Sasada 8a49c7e481 Revert "introduce check code for mysterious EBADF"
This reverts commit 7864efa105.
2021-10-26 17:06:57 +09:00
Koichi Sasada d1424f7f7e Revert "check other IO#close calls"
This reverts commit a1c4cab11d.
2021-10-26 17:06:57 +09:00
Nobuyoshi Nakada 049e1f8560
Fix typo 2021-10-26 14:43:12 +09:00
Koichi Sasada 5c2b644166 fix random EBADF problem
```ruby
      r, w = IO.pipe
      r.close

      IO.for_fd(w.fileno).close
```

This code closes a file descriptor `w.fileno`, but `w` doesn't know
the closing. Another code can open same file descriptor with opening
file (`f`). After that, the `w` will GCed and `w.fileno` is closed
again, and `f.fileno` is closed too, so IO operations for `f` (`f.close`)
will cause EBADF.

To fix this issue, do this test in another process.
2021-10-26 11:39:52 +09:00
卜部昌平 7d4c59203f improve doc coverage [ci skip]
Just split the comment for struct's one and array's one.
2021-10-26 09:30:42 +09:00
卜部昌平 a0029ae2b6 just another evidence that @shyouhei is an idiot [ci skip]
(gdb) ptype/o struct RString
/* offset    |  size */  type = struct RString {
/*    0      |    16 */    struct RBasic {
/*    0      |     8 */        VALUE flags;
/*    8      |     8 */        const VALUE klass;

                               /* total size (bytes):   16 */
                           } basic;
/*   16      |    24 */    union {
/*                24 */        struct {
/*   16      |     8 */            long len;
/*   24      |     8 */            char *ptr;
/*   32      |     8 */            union {
/*                 8 */                long capa;
/*                 8 */                VALUE shared;

                                       /* total size (bytes):    8 */
                                   } aux;

                                   /* total size (bytes):   24 */
                               } heap;
/*                24 */        struct {
/*   16      |    24 */            char ary[24];

                                   /* total size (bytes):   24 */
                               } embed;
/* XXX  8-byte padding  */

                               /* total size (bytes):   24 */
                           } as;

                           /* total size (bytes):   40 */
                         }
(gdb)
2021-10-26 09:30:12 +09:00
卜部昌平 b49ec78fd0 more on eliminating $make 2021-10-26 09:05:46 +09:00
卜部昌平 b682f76339 GNUMAKEFLAGS is too new for mac
It is relatively well known that mac does not update its command line
tools, and make is no exception.  They ship GNU make 3.x, which didn't
yet implemented GNUMAKEFLAGS.

Resort to MAKEFLAGS there.
2021-10-26 09:05:46 +09:00
卜部昌平 748688a63d .github: use GNUMAKEFLAGS instead of JOBS
A bit readable to me.
See also https://github.com/ruby/ruby/pull/4880
2021-10-26 09:05:46 +09:00
Jenny Shen 92ec010595
[rubygems/rubygems] Add support to build and sign certificates with multiple key algorithms
https://github.com/rubygems/rubygems/commit/967876f15d

Co-Authored-By: Frederik Dudzik <frederik.dudzik@shopify.com>
2021-10-26 08:01:55 +09:00
Maxime Chevalier-Boisvert 10fe8495cd Update YJIT code owners. Revert accidental commit. 2021-10-25 14:53:22 -04:00
Maxime Chevalier-Boisvert 722d43ad5e
Test PR 2021-10-25 14:29:36 -04:00
Maxime Chevalier-Boisvert cf52a2c9ba
Add code owners for YJIT sources
Code owners are automatically tagged as reviewers on pull requests
2021-10-25 14:28:39 -04:00
Peter Zhu a5b6598192 [Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
2021-10-25 13:26:23 -04:00
Peter Zhu 6374be5a81 [Feature #18239] Refactor RVARGC alloc functions
The allocation functions no longer assume that one RVALUE needs to be
allocated.
2021-10-25 13:26:23 -04:00
Peter Zhu 46b66eb9e8 [Feature #18239] Add struct for embedded strings 2021-10-25 13:26:23 -04:00
Yusuke Endoh 09fa773e04
ast.c: Use kept script_lines data instead of re-opening the source file (#5019)
ast.c: Use kept script_lines data instead of re-open the source file
2021-10-26 01:58:01 +09:00
git 33113c6b64 * 2021-10-26 [ci skip] 2021-10-26 01:51:20 +09:00
Jean Boussier 557fa38915 [rubygems/rubygems] Fix Bundler::Digest#sha1 on big-endian systems
As noticed by @nobu https://github.com/rubygems/rubygems/pull/4989#discussion_r735674633

From wikipedia: https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode

> append ml, the original message length in bits, as a 64-bit big-endian integer.

`Q` is native endian, so little-endian on most modern hardware.
The original code from RubyDigest reverses the bytes:
d15f906caf/lib/ruby_digest.rb (L521)

But that makes the code non-portable, the correct way is to directly ask
for a big-endian representation.

https://github.com/rubygems/rubygems/commit/ba2be01ea4
2021-10-26 01:51:05 +09:00
Alan Wu 244c98e635
Strip out YJIT at build time when unsupported or disabled (#5003)
In an effort to minimize build issues on non x64 platforms, we can
decide at build time to not build the bulk of YJIT. This should fix
obscure build errors like this one on riscv64:

    yjit_asm.c:137:(.text+0x3fa): relocation truncated to fit: R_RISCV_PCREL_HI20 against `alloc_exec_mem'

We also don't need to bulid YJIT on `--disable-jit-support` builds.

One wrinkle to this is that the YJIT Ruby module will not be defined
when YJIT is stripped from the build. I think that's a fair change as
it's only meant to be used for YJIT development.
2021-10-25 10:45:22 -04:00
Ian C. Anderson e943511455
YJIT: Implement duphash (#5009)
`duphash` showed up in the top-20 most frequent exit ops for @jhawthorn's benchmark that renders github.com/about

The implementation was almost exactly the same as `duparray`

Co-authored-by: John Hawthorn <john@hawthorn.email>

Co-authored-by: John Hawthorn <john@hawthorn.email>
2021-10-25 10:40:33 -04:00
Yusuke Endoh 1c0c8d5da2 test/ruby/test_jit.rb: Add a test for checkmatch insn 2021-10-25 21:30:16 +09:00