73583 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
c722597103
[MSWin] Get rid of single quotes in sed command lines
GnuWin32 sed strips only double quotes, but not single quotes, and
dies:

```
sed: -e expression #1, char 1: unknown command: `''
```
2022-09-10 20:50:37 +09:00
Benoit Daloze
92b907d12d Enable deprecation warnings for test-all
* So deprecated methods/constants/functions are dealt with early,
  instead of many tests breaking suddenly when removing a deprecated
  method/constant/function.
* Follows https://bugs.ruby-lang.org/issues/17591
2022-09-10 13:14:18 +02:00
John Hawthorn
5e39b3b844 YJIT: Branch directly when nil? is known from types 2022-09-09 20:29:40 -07:00
John Hawthorn
d319184390 YJIT: Branch directly when truthyness is known 2022-09-09 20:29:40 -07:00
S-H-GAMELINKS
79f50b9d02 Using is_broken_string function 2022-09-10 09:32:51 +09:00
Lars Kanis
518301883e Fix parallel build on MINGW
When the build is running with a base ruby then generating `x64-ucrt-ruby320.rc`
could fail due to a missing dependency to `x64-mingw-ucrt-fake.rb`.
This commit adds this dependency.

A failing build looks like so:
```
generating x64-mingw-ucrt-fake.rb
generating x64-ucrt-ruby320.rc
../snapshot-master/win32/resource.rb:in `require': cannot load such file -- ./x64-mingw-ucrt-fake (LoadError)
make: *** [GNUmakefile:57: x64-ucrt-ruby320.rc] Error 1
make: *** Waiting for unfinished jobs....
linking miniruby.exe
x64-mingw-ucrt-fake.rb updated
```
2022-09-10 09:32:27 +09:00
Maxime Chevalier-Boisvert
5b5c627d37
YJIT: eliminate redundant mov in csel/cmov on x86 (#6348)
* Eliminate redundant mov in csel/cmov. Translate mov reg,0 into xor

* Fix x86 asm test

* Remove dbg!()

* xor optimization unsound because it resets flags
2022-09-09 18:41:19 -04:00
git
2a08a39d7d * 2022-09-10 [ci skip] 2022-09-10 00:38:09 +09:00
Kevin Newton
848037cadd
Better offsets (#6315)
* Introduce InstructionOffset for AArch64

There are a lot of instructions on AArch64 where we take an offset
from PC in terms of the number of instructions. This is for loading
a value relative to the PC or for jumping.

We were usually accepting an A64Opnd or an i32. It can get
confusing and inconsistent though because sometimes you would
divide by 4 to get the number of instructions or multiply by 4 to
get the number of bytes.

This commit adds a struct that wraps an i32 in order to keep all of
that logic in one place. It makes it much easier to read and reason
about how these offsets are getting used.

* Use b instruction when the offset fits on AArch64
2022-09-09 11:37:41 -04:00
David Rodríguez
b350053ae4 [rubygems/rubygems] Fix resolution on non-musl platforms
Gems without specific platform were being preferred over matching
platform specific gems.

https://github.com/rubygems/rubygems/commit/37b95b9159
2022-09-09 19:38:52 +09:00
Nobuyoshi Nakada
cfe10e482e
[DOC] Update Struct#new behavior with keyword_init: true 2022-09-09 18:58:07 +09:00
Kazuki Yamaguchi
aff6534e32 Avoid unnecessary copying when removing the leading part of a string
Remove the superfluous str_modify_keep_cr() call from rb_str_update().
It ends up calling either rb_str_drop_bytes() or rb_str_splice_0(),
which already does checks if necessary.

The extra call makes the string "independent". This is not always
wanted, in other words, it can keep the same shared root when merely
removing the leading part of a shared string.
2022-09-09 16:03:20 +09:00
Nobuyoshi Nakada
9faa9ced96 Support sub-library in builtin-loader
Previously, it was supported in prelude.c, but has not followed up the
builtin-loader system.
2022-09-09 15:47:24 +09:00
Aaron Patterson
56e5210cde
More robust macro parser (#6343)
I want to use more complicated macros with MJIT.  For example:

```
  # define SHAPE_MASK (((unsigned int)1 << SHAPE_BITS) - 1)
```

This commit adds a simple recursive descent parser that produces an AST
and a small visitor that converts the AST to Ruby.
2022-09-09 15:19:23 +09:00
Nobuyoshi Nakada
be56033248
Move RDoc --/++ directives to comments 2022-09-09 14:23:39 +09:00
Nobuyoshi Nakada
2dcaeb75ff
Built-in function table sentinels do not need names 2022-09-09 14:20:47 +09:00
Kazuki Tsujimoto
db0e0dad11
Fix unexpected "duplicated key name" error in paren-less one line pattern matching
[Bug #18990]
2022-09-09 14:00:27 +09:00
Nobuyoshi Nakada
59eadf3d25
Ignore EACCES on Windows 2022-09-09 11:36:15 +09:00
Kevin Newton
35cfc9a3bb
Remove as many unnecessary moves as possible (#6342)
This commit does a bunch of stuff to try to eliminate as many
unnecessary mov instructions as possible.

First, it introduces the Insn::LoadInto instruction. Previously
when we needed a value to go into a specific register (like in
Insn::CCall when we're putting values into the argument registers
or in Insn::CRet when we're putting a value into the return
register) we would first load the value and then mov it into the
correct register. This resulted in a lot of duplicated work with
short live ranges since they basically immediately we unnecessary.
The new instruction accepts a destination and does not interact
with the register allocator at all, making it much more efficient.

We then use the new instruction when we're loading values into
argument registers for AArch64 or X86_64, and when we're returning
a value from AArch64. Notably we don't do it when we're returning
a value from X86_64 because everything can be accomplished with a
single mov anyway.

A couple of unnecessary movs were also present because when we
called the split_load_opnd function in a lot of split passes we
were loading all registers and instruction outputs. We no longer do
that.

This commit also makes it so that UImm(0) passes through the
Insn::Store split without attempting to be loaded, which allows it
can take advantage of the zero register. So now instead of mov-ing
0 into a register and then calling store, it just stores XZR.
v3_2_0_preview2
2022-09-08 17:09:50 -04:00
Nobuyoshi Nakada
e4f5296f06
No longer bundle external library sources 2022-09-09 01:33:53 +09:00
git
6d93644ba1 * 2022-09-09 [ci skip] 2022-09-09 00:46:21 +09:00
YO4
28030f7b54 eliminate magic number 2022-09-09 00:45:56 +09:00
YO4
81e7573a64 win32.c additional fix: is_readable_console
classic console(conhost.exe) reports an input with ALT+NUMPAD as VK_MENU, KeyUp, and uChar!=0.
additional fix for #5634
2022-09-09 00:45:56 +09:00
YO4
7a849e1903 win32.c fix: is_readable_console
UnicodeChar with lower byte == 0 has dropped accidentaly
this is additional fix for #5634
2022-09-09 00:45:56 +09:00
Nobuyoshi Nakada
e2ccb316b4 [Bug #5317] Use rb_off_t instead of off_t
Get rid of the conflict with system-provided small `off_t`.
2022-09-08 23:01:07 +09:00
Nobuyoshi Nakada
55fef084da [Win32] Remove dead code using chsize
Already using `rb_w32_truncate` and `rb_w32_ftruncate`, and
`HAVE_FTRUNCATE` has been added 14 years ago.
2022-09-08 23:01:07 +09:00
Jean Boussier
b7fa78b0f3 vm_objtostring: skip method lookup for T_STRING receivers
We don't need it, and in string interpolation context
that's the common case.
2022-09-08 15:02:21 +02:00
Jean Boussier
cd1724bdde rb_str_concat_literals: use rb_str_buf_append
That's about 1.30x faster.
2022-09-08 15:02:21 +02:00
David Rodríguez
e0cd466ae7 [rubygems/rubygems] Fix unused variable warning
https://github.com/rubygems/rubygems/commit/ca8d47e53a
2022-09-08 20:44:35 +09:00
Nobuyoshi Nakada
bcf82b7c26
Process token IDs from id.def without id.h
Fixes id.h error during updating ripper.c by `make after-update`.

While it used to update id.h in the build directory, but was trying to
update ripper.c in the source directory.  In principle, files in the
source directory can or should not depend on files in the build
directory.
2022-09-08 18:22:47 +09:00
Nobuyoshi Nakada
a977c66312
Generate token ID indexes in id.def
Separate the logic accross the tables from the template view for
id.h.
2022-09-08 18:18:56 +09:00
Xin Li
7400628cb0
[Bug #18997] Don't define ruby_qsort when POSIX qsort_r is available
The current code would define ruby_qsort as a wrapper of qsort_s
when it is available. When both qsort_s and POSIX (GNU) qsort_r
are available, we should call qsort_r directly instead, and
the qsort_s wrapper is redundant.
2022-09-08 17:37:37 +09:00
rm155
78af05ba0f [ruby/forwardable] Freeze VERSION and FORWARDABLE_VERSION to improve Ractor-compliance
https://github.com/ruby/forwardable/commit/c91f41f4fa
2022-09-08 14:31:42 +09:00
rm155
70e6be2b05 [ruby/ipaddr] Improve Ractor-compliance
https://github.com/ruby/ipaddr/commit/73461724e5
2022-09-08 14:09:06 +09:00
Nobuyoshi Nakada
e76a550876 [MSWin] Fix for non-Windows (cygwin/msys) BASERUBY 2022-09-08 13:41:02 +09:00
Nobuyoshi Nakada
26c4230404 [MSWin] Disable rubygems of BASERUBY 2022-09-08 13:41:02 +09:00
Nobuyoshi Nakada
332d29df53
[DOC] non-positive base in Kernel#Integer and String#to_i 2022-09-08 11:52:16 +09:00
git
b1efdcee6e * 2022-09-08 [ci skip] 2022-09-08 11:25:32 +09:00
David Rodríguez
24fd2f73d0 Resync Bundler & RubyGems 2022-09-08 11:25:03 +09:00
Nobuyoshi Nakada
2d57447ae8
Fix missing replacement in 1f91dcdab3b 2022-09-07 19:07:24 +09:00
Nobuyoshi Nakada
35c493ecf5
Dump cross.rb only when verbose [ci skip] 2022-09-07 14:48:54 +09:00
Nobuyoshi Nakada
1f91dcdab3
Define BOOTSTRAPRUBY from HAVE_BASERUBY 2022-09-07 14:33:25 +09:00
Takashi Kokubun
cac0dcfbff
Fix typo
I meant the other one. Otherwise this option doesn't make sense.
2022-09-07 14:26:58 +09:00
Takashi Kokubun
496bdf01e2
Adjust pch_status for --mjit=pause
to let mjit_add_iseq_to_process work
2022-09-06 22:14:01 -07:00
Takashi Kokubun
f0661bf3a0
Skip early mjit_add_iseq_to_process on --mjit=pause 2022-09-06 18:40:23 -07:00
Nobuyoshi Nakada
e6b47f2fb0
Now Psych uses the proleptic Gregorian calendar 2022-09-07 10:37:01 +09:00
Takashi Kokubun
f24c65ea7e
Skip calling check_unit_queue with mjit_opts.custom
fixing the behavior of b726c06e7eeafff52e368179dbe79a11b1aff975
2022-09-06 18:25:46 -07:00
Nobuyoshi Nakada
6a43245e6c
Use BOOTSTRAPRUBY_COMMAND instead of fake.rb directly 2022-09-07 10:08:24 +09:00
Nobuyoshi Nakada
3a575d13d5
Ensure BASERUBY when cross-compiling 2022-09-07 10:08:23 +09:00
Chad Wilson
1b034d66f5 [ruby/psych] Bump snakeyaml from 1.28 to 1.31
Resolves CVE-2022-25857, among other fixes.

https://github.com/ruby/psych/commit/918cd25d37
2022-09-07 09:51:57 +09:00