Commit graph

72962 commits

Author SHA1 Message Date
Jeremy Evans
fc4b4f2e8d Expand newarray/expandarray optimization for unequal operands
This optimizes unbalanced multiple assignment cases such as:

```ruby
a.b, c.d = e, f, g
a.b, c.d, e.f = g, h
```

Previously, this would use:

```
newarray(3)
expandarray(2, 0)

newarray(2)
expandarray(3, 0)
```

These would both allocate arrays.  This switches to opt_reverse
with either pop or putnil:

```
pop
opt_reverse(2)

putnil
opt_reverse(3)
```

This avoids an unnecessary array allocation, and results in a 35-76%
performance increase in these types of unbalanced cases (tested with
benchmark/masgn.yml).
2022-08-09 22:19:46 -07:00
Jeremy Evans
7922fd65e3 Update multiple assignment benchmarks to include non-literal array cases
This allows them to show the effect of the previous newarray/expandarray
to swap/opt_reverse optimization.  This shows an 35-83% performance
improvement in the four multiple assignment benchmarks that use this
optimization.
2022-08-09 22:19:46 -07:00
Jeremy Evans
5089b6acc7 Add peephole optimizer for newarray(X)/expandarray(X, 0) -> opt_reverse(X)
This renames the reverse instruction to opt_reverse, since now it
is only added by the optimizer.  Then it uses as a more general
form of swap.  This optimizes multiple assignment in the popped
case with more than two elements.
2022-08-09 22:19:46 -07:00
Jeremy Evans
d9167491db Revert "Remove reverse VM instruction"
This reverts commit 5512353d97.
2022-08-09 22:19:46 -07:00
Jeremy Evans
9f8abd28ba Add peephole optimizer for newarray(2)/expandarray(2, 0) -> swap
An optimization for multiple assignment in the popped case to avoid
array allocation was lost in my fix to make multiple assignment follow
left-to-right evaluation (50c54d40a8).

Before, in the two element case, swap was used.  Afterward, newarray(2)
and expandarray(2, 0) were used, which is the same as swap, with the
addition of an unnecessary allocation.

Because this issue is not specific to multiple assignment, and the
multiple assignment code is complex enough as it is, this updates
the peephole optimizer to do the newarray(2)/expandarray(2, 0) -> swap
conversion.

A more general optimization pass for
newarray(X)/expandarray(X, 0) -> reverse(X) will follow, but that
requires readding the reverse instruction.
2022-08-09 22:19:46 -07:00
git
3569d13095 * 2022-08-10 [ci skip] 2022-08-10 14:13:45 +09:00
Jeremy Evans
357352af5e Do not enable RUBY_DEVEL by RUBY_PATCHLEVEL
This makes RUBY_DEVEL not enabled automatically.  It still can be
enabled manually.

Test manually using RUBY_DEVEL in CI.

Implements [Feature #17468]
2022-08-09 22:13:17 -07:00
Nobuyoshi Nakada
ff07e5c264
Skip poisoned regions
Poisoned regions cannot be accessed without unpoisoning outside gc.c.
Specifically, debug.gem is terminated by AddressSanitizer.

```
SUMMARY: AddressSanitizer: use-after-poison iseq_collector.c:39 in iseq_i
```
2022-08-09 20:11:48 +09:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
Takashi Kokubun
f8936b3341
Remove documentation about dev
dev is Shopify's internal tool that doesn't work if you use Intel
Homebrew on M1 (or rbenv, btw). Now that we maintain this outside
Shopify's repository, we should stop talking about it here.
2022-08-08 19:02:30 -07:00
dependabot[bot]
35b9cd1def [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.28 to 0.9.29.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.28...v0.9.29)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

77a945f0e8
2022-08-09 04:35:33 +09:00
Nobuyoshi Nakada
79fdf9712d
Tentatively exclude the test that triggers ruby/psych#572 2022-08-09 03:09:33 +09:00
dependabot[bot]
78bc2aae7f [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.28 to 0.9.29.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.28...v0.9.29)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

d5d96f6bae
2022-08-09 01:50:18 +09:00
Alexander Momchilov
9c13a6ce5f [ruby/psych] Raise specific error when an anchor isn't defined
98fbd5247a
2022-08-09 01:33:34 +09:00
Alexander Momchilov
4b9cdf4e1c [ruby/psych] Update to squiggly heredocs in the file
42b43de997
2022-08-09 01:33:33 +09:00
Alexander Momchilov
38ea6b30dc [ruby/psych] Add test for missing anchor
5f08137ae6
2022-08-09 01:33:32 +09:00
Alexander Momchilov
ea1efdf32f [ruby/psych] Add test for anchor reuse
The spec calls this a "reuse" of an anchor
https://yaml.org/spec/1.2.2/#71-alias-nodes

57e3b70a56
2022-08-09 01:33:31 +09:00
Alexander Momchilov
54219ae8c4 [ruby/psych] Raise specific error when aliases are not enabled
0c11ddcf46
2022-08-09 01:32:47 +09:00
Alexander Momchilov
71f89c2874 [ruby/psych] Don't hardcode expected alias names
b9ab19094f
2022-08-09 01:31:24 +09:00
Alexander Momchilov
0b7cfdca09 [ruby/psych] Test that recursive refs dump as aliases
d9f7289190
2022-08-09 01:31:23 +09:00
Alexander Momchilov
c851bced39 [ruby/psych] Clarify tests about parsing aliases
0bc30cb4cb
2022-08-09 01:31:22 +09:00
git
1602443c98 * 2022-08-09 [ci skip] 2022-08-09 00:00:15 +09:00
git
dcf0bb3032 Update default gems list at 5c9ce54757 [ci skip] 2022-08-08 14:59:56 +00:00
Nobuyoshi Nakada
5c9ce54757 [ruby/date] bump up to 3.2.3
dff37b3dd1
2022-08-08 23:59:12 +09:00
Nobuyoshi Nakada
e07d450dea [ruby/date] Fix Time#to_datetime before calendar reform
Time is always in the proleptic Gregorian calendar.
Also DateTime#to_time should convert to the Gregorian calendar first,
before extracting its components.

https://bugs.ruby-lang.org/issues/18946#change-98527

b2aee75248
2022-08-08 23:50:17 +09:00
Nobuyoshi Nakada
43239b23b4
[Bug #18946] New tests for fixed Time/DateTime conversions 2022-08-08 23:48:13 +09:00
Nobuyoshi Nakada
e0dfa5967e
[Bug #18946] Use Gregorian dates to test 2022-08-08 23:48:09 +09:00
Peter Zhu
a24c607e30 [DOC] Fix formatting issue in Enumerable 2022-08-08 09:26:07 -04:00
Jean Boussier
1cb77f2304 Update IO::Buffer#get_value benchmark
- The method was renamed from `get` to `get_value`
- Comparing to `String#unpack` isn't quite equivalent, `unpack1` is closer.
- Use frozen_string_literal to avoid allocating a format string every time.
- Use `N` format which is equivalent to `:U32` (`uint_32_t` big-endian).
- Disable experimental warnings to not mess up the output.
2022-08-08 15:15:33 +02:00
Nobuyoshi Nakada
289d219758 [ruby/date] [DOC] Fix about calendars difference
0ae93e26aa
2022-08-08 21:14:10 +09:00
Burdette Lamar
1607c6d281 [DOC] New doc about Julian/Gregorian (#70) 2022-08-07 20:42:31 -04:00
git
40f2078d48 * 2022-08-08 [ci skip] 2022-08-08 01:13:54 +09:00
Nobuyoshi Nakada
5beb75ce8d
[ruby/rdoc] Allow multiple footnotes without in-between blank lines
e4e054e3ce used four footnotes
without blank lines.  And the ChangeLog generated from that commit
resulted in ``undefined method `parts' for nil`` error.

For now, let a footnote terminated by the next footnote mark.

Also refined the error message when undefined footnote is used.

a7f290130b
2022-08-08 01:12:49 +09:00
Burdette Lamar
23a84d53c6 [ruby/rdoc] [DOC] Removes remaining old Markup Reference (https://github.com/ruby/rdoc/pull/910)
4e44c9c6cf
2022-08-07 21:07:23 +09:00
Nobuyoshi Nakada
e5e6b87e26
Create temporary file exclusively and clean 2022-08-07 18:25:10 +09:00
Nobuyoshi Nakada
03f86565a6
Silent backtrace from cve_2019_8325_spec.rb
Since the change at f310ac1cb2 to show
the backtraces by default, this test started to show the backtraces.
As the backtraces are not the subject of this test, silence them by
using Gem::SilentUI.
2022-08-07 17:57:52 +09:00
Nobuyoshi Nakada
0bb5525eb2
Fix files for gemspec files direct-under lib
Collected `files` lacked `lib` prefix.
2022-08-07 17:01:22 +09:00
Nobuyoshi Nakada
f2423be49d
Duplicate libruby self path
When LOAD_RELATIVE, as `sopath` is truncated to the prefix path, make
the duplicate before it.  Also make `rb_libruby_selfpath` frozen and
hidden.
2022-08-07 14:46:59 +09:00
Nobuyoshi Nakada
591ee9d068
[DOC] Add return values of rb_enc_mbcput 2022-08-07 13:09:46 +09:00
git
6d742c9412 * 2022-08-07 [ci skip] 2022-08-07 00:03:21 +09:00
Nobuyoshi Nakada
e545cfad20
Stop using casted rb_syswait as proc_syswait
The argument of `rb_syswait` is now `rb_pid_t` which may differ from
`int`.  Also it is an undefined behavior to take the result of casted
void function (in `rb_protect`).
2022-08-07 00:02:38 +09:00
Nobuyoshi Nakada
f245b425af
Fix the sizes comparison
`proc_syswait` will be called with a `VALUE` argument.
2022-08-06 23:56:44 +09:00
David Rodríguez
466a760e18 [rubygems/rubygems] Fix yanked gems being unintentionally update when other gems are unlocked
This is a regression from a change intended to raise errors when user
puts a gem under an incorrect source in the Gemfile by mistake. To fix
the issue, we revert the change that caused it and implement it in a
different way that restores the resolver independency from real
specifications. Now it deals only with names and versions and does not
try to materialize anything into real specifications before resolving.

d2bf1b86eb
2022-08-06 15:41:46 +09:00
David Rodríguez
8dd63b89d9 [rubygems/rubygems] Move comment where the actual replacement happens
d60acdf80d
2022-08-06 15:41:46 +09:00
David Rodríguez
4ea521f6c7 [rubygems/rubygems] Remove unclear comment
3a843c1ac7
2022-08-06 15:41:45 +09:00
David Rodríguez
af40af45b2 [rubygems/rubygems] Extract SourceList#get_with_fallback
9dbc4757a8
2022-08-06 15:41:45 +09:00
Nobuyoshi Nakada
27173e3735
Allow RUBY_DEBUG_LOG format to be empty
GCC warns of empty format strings, perhaps because they have no
effects in printf() and there are better ways than sprintf().
However, ruby_debug_log() adds informations other than the format,
this warning is not the case.
2022-08-06 10:52:00 +09:00
Nobuyoshi Nakada
58c8b6e862
Adjust styles [ci skip] 2022-08-06 10:13:20 +09:00
Alan Wu
c433d36b5b Test that File.read defaults to text mode
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-08-05 14:34:08 -04:00
Alan Wu
ca8daf70fa [DOC] Mention Windows text mode EOF marker interpretation
I don't think this is super well known so it's worth mentioning as it
can be a pitfall.

See: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-08-05 14:34:08 -04:00