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

74850 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu 1d64a5a7c0 YJIT: Run test-all tests without requiring RUN_OPTS
Most tests in test_yjit.rb use a sub process, so we can run them even
when the parent process is not running with YJIT. Run them so simply
running `make check` tests YJIT a bit.

[Misc #19149]
2022-11-25 17:15:24 -05:00
Alan Wu 790cf4b6d0 Fix autoload status of statically linked extensions
Previously, for statically-linked extensions, we used
`vm->loading_table` to delay calling the init function until the
extensions are required. This caused the extensions to look like they
are in the middle of being loaded even before they're required.
(`rb_feature_p()` returned true with a loading path output.) Combined
with autoload, queries like `defined?(CONST)` and `Module#autoload?`
were confused by this and returned nil incorrectly. RubyGems uses
`defined?` to detect if OpenSSL is available and failed when OpenSSL was
available in builds using `--with-static-linked-ext`.

Use a dedicated table for the init functions instead of adding them to
the loading table. This lets us remove some logic from non-EXTSTATIC
builds.

[Bug #19115]
2022-11-25 16:21:40 -05:00
StepSecurity Bot e15cd01149 [StepSecurity] ci: Harden GitHub Actions
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
2022-11-25 20:12:23 +09:00
Nobuyoshi Nakada 8a50db7dfa
NEWS: "Find pattern" is not related to find.rb [ci skip] 2022-11-25 19:53:35 +09:00
Nobuyoshi Nakada 26baf4813e
[Feature #18925] [DOC] Add `FileUtils.ln_sr` to NEWS 2022-11-25 19:51:31 +09:00
Nobuyoshi Nakada e9d6d2a579
[DOC] Fix AST documents
- Fix indents of `tokens`, to make the contents of Token a list
- Move the example of `tokens` to separate from the above list
- Markup keyword argument and method name
2022-11-25 19:42:47 +09:00
Nobuyoshi Nakada fb7598fb3e
[DOC] Remove extraneous backticks
So cross-references to defined classes/modules/methods work.
2022-11-25 19:17:44 +09:00
Nobuyoshi Nakada 4ab89d57bb
Fix indents in NEWS [ci skip]
The MarkDown parser in RDoc requires 4 columns indentation for
paragraphs following list items.
2022-11-25 19:07:21 +09:00
Takashi Kokubun addb1cbbfd [ruby/erb] Keep ERB::Util#html_escape private
ERB::Util.html_escape has been public, but ERB::Util#html_escape had
been private.

https://github.com/ruby/erb/commit/e62210bf56
2022-11-25 08:54:18 +00:00
Nobuyoshi Nakada 58dc9c931b [rubygems/rubygems] Stop installing everything under "lib" at the top in all tests
https://github.com/rubygems/rubygems/commit/f9772d62e1
2022-11-25 08:02:28 +00:00
Nobuyoshi Nakada 64c8ed272f `remain` no longer starts with 0 2022-11-25 16:11:17 +09:00
Nobuyoshi Nakada ffc6c5d056 [Bug #18971] Add precheck to enumerator 2022-11-25 16:11:17 +09:00
Nobuyoshi Nakada 67d0f4821f [Bug #19145] `volatile` on an argument may not be effective 2022-11-25 15:50:06 +09:00
Nobuyoshi Nakada 45bad8c7b8 The mode flags may be clobbered by tag jumps 2022-11-25 15:50:06 +09:00
yui-knk e29d9e9fba Add examples to error_tolerant option in NEWS [ci skip] 2022-11-25 15:36:00 +09:00
Koichi Sasada 67766cd55c add debug context APIs for debuggers (frame depth)
The following new debug context APIs are for implementing debugger's
`next` (step over) and similar functionality.

* `rb_debug_inspector_frame_depth(dc, index)` returns `index`-th
  frame's depth.
* `rb_debug_inspector_current_depth()` returns current frame depth.

The frame depth is not related to the frame index because debug
context API skips some special frames but proposed `_depth()` APIs
returns the count of all frames (raw depth).
2022-11-25 14:01:36 +09:00
Jeremy Evans 571d21fd4a Make String#rstrip{,!} raise Encoding::CompatibilityError for broken coderange
It's questionable whether we want to allow rstrip to work for strings
where the broken coderange occurs before the trailing whitespace and
not after, but this approach is probably simpler, and I don't think
users should expect string operations like rstrip to work on broken
strings.

In some cases, this changes rstrip to raise
Encoding::CompatibilityError instead of ArgumentError.  However, as
the problem is related to an encoding issue in the receiver, and due
not due to an issue with an argument, I think
Encoding::CompatibilityError is the more appropriate error.

Fixes [Bug #18931]
2022-11-24 18:24:42 -08:00
Nobuyoshi Nakada c6330cd32b [ruby/fileutils] [Feature #18925] Add `ln_sr` method and `relative:` option to `ln_s`
https://github.com/ruby/fileutils/commit/5116088d5c
2022-11-25 01:03:57 +00:00
Nobuyoshi Nakada 1a47521c44
Use `rb_sprintf` instead of deprecated `sprintf` 2022-11-25 08:51:14 +09:00
Takashi Kokubun bcdfe12919 [ruby/erb] Allow requiring erb/escape.so alone
(https://github.com/ruby/erb/pull/37)

Prior to this commit, requiring erb/escape first and then requiring erb
did not work as expected.
2022-11-24 23:49:15 +00:00
Takashi Kokubun 8ac4081aa8 [ruby/erb] Split erb.rb into files for each module under ERB
(https://github.com/ruby/erb/pull/36)

https://github.com/ruby/erb/commit/f74833cc07
2022-11-24 23:40:53 +00:00
Takashi Kokubun c480f589c2 [ruby/erb] Rename erb.so to erb/escape.so
(https://github.com/ruby/erb/pull/35)

https://github.com/ruby/erb/commit/1280046952
2022-11-24 23:22:00 +00:00
Jeremy Evans 04a92a6764 Raise TypeError for endless non-numeric range include?
Beginless ranges previously raised TypeError for this case,
except for string ranges, which had unexpected behavior:

  ('a'..'z').include?('ww') # false
  (..'z').include?('ww') # previously true, now TypeError

Use of include? with endless ranges could previously result
in an infinite loop.

This splits off a range_string_cover_internal function from
range_include_internal.

Fixes [Bug #18580]
2022-11-24 15:18:44 -08:00
Takashi Kokubun d15de2f0d7 Add a NEWS entry about erb -S removal [ci skip] 2022-11-24 14:55:07 -08:00
Takashi Kokubun 1c0c1c8098 [ruby/erb] Drop deprecated -S option from erb command
We attempted to remove things like this and reverted all of them, but I
think nobody relies on this unlike the positional arguments of
`ERB#initialize`.

https://github.com/ruby/erb/commit/92fde7e403
2022-11-24 22:49:21 +00:00
Takashi Kokubun e5a0abc5de [ruby/erb] Suppress warnings to fix ruby-head CI
(https://github.com/ruby/erb/pull/34)

There seems to be no way to fix this. It doesn't happen in an installed
directory, so it's likely a false positive and/or a bug in rubygems.

  | <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: loading in progress, circular require considered harmful - /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb
  | 	from /home/runner/work/erb/erb/libexec/erb:0:in  `require'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb:3:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb:3:in  `require_relative'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/shared_helpers.rb:8:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/shared_helpers.rb:8:in  `require_relative'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/rubygems_integration.rb:3:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/rubygems_integration.rb:3:in  `require'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems.rb:1352:in  `<top (required)>'
  | 	from <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85:in  `require'
  | 	from <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85:in  `require'
2022-11-24 22:35:33 +00:00
Jeremy Evans 1340195e79 Reduce duplication in pack by sharing code for some cases
s/S, i/I, l/L, and q/Q had the same code in both cases, so
combine the cases.

Alternatively, we could actually the size of the unsigned type,
but I doubt there are any platforms where the unsigned type is
a different size than the signed type.
2022-11-24 14:27:19 -08:00
Jeremy Evans f5d73da806 Fix the position of rescue clause without exc_list
If the rescue clause has only exc_var and not exc_list, use the
exc_var position instead of the rescue body position.

This issue appears to have been introduced in
688169fd83 when "opt_list" was split
into "exc_list exc_var".

Fixes [Bug #18974]
2022-11-24 14:26:08 -08:00
Maxime Chevalier-Boisvert 07169fd824
Update YJIT section of `NEWS.md` (#6803)
* Update YJIT section of `NEWS.md`

* Update NEWS.md
2022-11-24 16:37:04 -05:00
Alan Wu a81c89b7c8
YJIT: Make sure rustc's target matches before enabling (#6804)
For people using Rosetta 2 on ARM Macs, it can happen that the
rustc in the PATH compiles for x86_64 while clang is targeting
ARM. We were enabling YJIT in these situations because the test
program compiled fine, but caused linking failure later due to
the architecture mismatch.

Adjust the test program to fail when rustc's target arch is different
from ruby's target arch.

[Bug #19146]
2022-11-24 14:58:41 -05:00
Jean Boussier 656f25987c [ruby/cgi] Fix test_cgi_cookie_new_with_domain to pass on older rubies
https://github.com/ruby/cgi/commit/05f0c58048
2022-11-24 18:32:19 +00:00
Maxime Chevalier-Boisvert d2fa67de81
YJIT: rename `InsnOpnd` => `YARVOpnd` (#6801)
Rename InsnOpnd => YARVOpnd

Make it more clear this refers to YARV insn/vm operands rather
than backend IR, x86 or ARM insn operands.
2022-11-24 10:30:28 -05:00
Yusuke Endoh 66e5200ba4 Relax the timeout of TestRegexp#test_cache_optimization_square
It fails on riscv (QEmu)

http://rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20221124T000021Z.fail.html.gz
```
  1) Error:
TestRegexp#test_cache_optimization_square:
Regexp::TimeoutError: regexp match timeout
    /home/rubyci/chkbuild/tmp/build/20221124T000021Z/ruby/test/ruby/test_regexp.rb:1693:in `<main>'
    /home/rubyci/chkbuild/tmp/build/20221124T000021Z/ruby/test/ruby/test_regexp.rb:1688:in `test_cache_optimization_square'
```
2022-11-24 15:13:00 +09:00
Alan Wu d92054e371 YJIT: Use a Box for branch targets to save memory
We frequently make branches that only have one target but we used to
always allocate space for two branch targets. This patch moves all the
information a branch target has into a struct and refer to them using
Option<Box<BranchTarget>>, this way when the second branch target is not
present it only takes 8 bytes.

Retained heap size on railsbench went from 16.17 MiB to 14.57 MiB, a
ratio of about 1.1.
2022-11-23 18:00:12 -05:00
Aaron Patterson e788215125 Add next_shape_id to vm stats
We need to track this number in CI.  It's important to know how changes
to the codebase impact the number of shapes in the system, so lets add
the number to the VM stat hash
2022-11-23 14:18:10 -08:00
Takashi Kokubun a50aabde9c
YJIT: Simplify Insn::CCall to obviate Target::FunPtr (#6793) 2022-11-23 12:14:43 -05:00
BurdetteLamar 5ee947314e [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/86b0514239
2022-11-23 17:12:35 +00:00
BurdetteLamar 4b32ed6e33 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/ef0ef53b0c
2022-11-23 17:12:34 +00:00
BurdetteLamar 79a9280aa5 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/0af9fb94a9
2022-11-23 17:12:33 +00:00
BurdetteLamar c6dc126641 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/995ff356b4
2022-11-23 17:12:33 +00:00
BurdetteLamar 66be0922b7 [ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/e924f1205b
2022-11-23 17:12:32 +00:00
Takashi Kokubun d88adaad7e
YJIT: Use NonNull pointer for CodePtr (#6792) 2022-11-23 12:02:05 -05:00
Takashi Kokubun 9c36de3c48 YJIT: Stop passing target1 to gen_return_branch 2022-11-23 11:59:50 -05:00
Takashi Kokubun fe2bed6778
YJIT: Simplify code for RB_SPECIAL_CONST_P (#6795) 2022-11-23 11:59:02 -05:00
Jemma Issroff e82b15b660
Fix YJIT backend to account for unsigned int immediates (#6789)
YJIT: x86_64: Fix cmp with number where sign bit is set

Before this commit, we were unconditionally treating unsigned ints as
signed ints when counting the number of bits required for representing
the immediate in machine code. When the size of the immediate matches
the size of the other operand, no sign extension happens, so this was
incorrect. `asm.cmp(opnd64, 0x8000_0000)` panicked even though it's
encodable as `CMP r/m32, imm32`. Large shape ids were impacted by this
issue.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Alan Wu <alanwu@ruby-lang.org>

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2022-11-23 10:48:17 -05:00
Aaron Patterson aedf682bfa
Free the IV table after estimation
We need to make sure the name table is freed otherwise we have a memory
leak.
2022-11-22 13:54:30 -08:00
Peter Zhu 003f8ea809 Remove dead code in rb_obj_copy_ivar
The removed code is a duplicate of the code above.
2022-11-22 13:49:46 -08:00
Maxime Chevalier-Boisvert c4e99ac454
Update yjit.md 2022-11-22 16:18:31 -05:00
zverok eaf2b6c439 Add Time#deconstruct_keys 2022-11-22 23:10:46 +02:00
Takashi Kokubun 63f4a7a1ec
YJIT: Skip padding jumps to side exits on Arm (#6790)
YJIT: Skip padding jumps to side exits

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2022-11-22 15:57:17 -05:00