74915 Commits

Author SHA1 Message Date
Jean Boussier
7390eb43fe io.c (read_all): grow the buffer exponentially when size is unknown
[Feature #6047]

Currently it's grown by `BUFSIZ` (1024) on every iteration which is bit wasteful.
Instead we can double the capacity whenever there is less than `BUFSIZ` capacity
left.
2022-12-02 09:53:57 +01:00
Takashi Kokubun
07ac707758 MJIT: Use install = true for bundler/inline
It prints a `bundle install`-like output, which seems more useful than
a silent output.
2022-12-01 23:56:02 -08:00
Takashi Kokubun
f01bfa8af7 [ruby/irb] This doesn't work on RubyCI either
http://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20221202T063302Z.fail.html.gz
http://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20221202T053006Z.fail.html.gz
http://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20221202T063002Z.fail.html.gz
http://rubyci.s3.amazonaws.com/osx1013/ruby-master/log/20221202T054503Z.fail.html.gz

https://github.com/ruby/irb/commit/13c2484d59
2022-12-02 07:41:18 +00:00
Kazuhiro NISHIYAMA
b3890670b2
Fix a link [ci skip] 2022-12-02 16:22:12 +09:00
Kazuhiro NISHIYAMA
6930a2564c
NEWS.md: sort [ci skip] 2022-12-02 16:22:12 +09:00
Nobuyoshi Nakada
ad4eab1a8c
Wait killed thread 2022-12-02 16:20:43 +09:00
Samuel Williams
4fa47eabf2
Clarify the storage argument. (#6849)
* Slightly more consistent indentation with other parts of the document.
2022-12-02 17:49:42 +13:00
Takashi Kokubun
7e3b42d008 [ruby/irb] Skip debug command tests on ruby/ruby
Stan has said these tests could be excluded if they don't work on
ruby/ruby CI.

https://github.com/ruby/irb/commit/11e779ecb7
2022-12-02 04:43:36 +00:00
Yusuke Endoh
bc3ac86795 [rubygems/rubygems] require bundler/setup only when Bundler is not defined
... to prevent "circular require" when `--disable-gems` is used.

This is a simplified case of e5a0abc5de

```
$ bundle exec ruby -we 'system("ruby", "-w", "--disable-gems", "-e", "")'
<internal:/home/mame/work/ruby/local/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: <internal:/home/mame/work/ruby/local/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: loading in progress, circular require considered harmful - /home/mame/work/ruby/local/lib/ruby/3.2.0+3/bundler/setup.rb
```

When bundler/setup is require'ed under --disable-gems mode, it loads
rubygems by `require "rubygems" unless defined?(Gem)` in
0b1f682a6d/bundler/lib/bundler/rubygems_integration.rb (L3)
In this case, require'ing bundler/setup from rubygems.rb is circular.

This change makes rubygems.rb to require "bundler/setup" only when
`Bundler` is not defined.

https://github.com/rubygems/rubygems/commit/b4608dee5e
2022-12-02 04:12:16 +00:00
Nobuyoshi Nakada
b6c66ead9d [ruby/irb] Use the proper ruby command and library path
https://github.com/ruby/irb/commit/1416cc1871
2022-12-02 03:14:51 +00:00
Hiroshi SHIBATA
d55d1a737b
Skip examples for SyntaxError extensions on Ruby 3.2 2022-12-02 10:34:00 +09:00
Stan Lo
8abf9e6ad0 [ruby/irb] Test debug commands without yamatanooroti
(https://github.com/ruby/irb/pull/464)

* Add debug command tests that don't require yamatanooroti

* Remove debug command related yamatanooroti tests

As discussed in https://github.com/ruby/irb/pull/449#pullrequestreview-1187255149,
we should avoid adding new tests that need yamatanooroti because it's
not maintained by the Ruby org. And since debug commands are now tested
in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.

* Test against latest debug gem

https://github.com/ruby/irb/commit/78a8aa8834
2022-12-02 01:05:22 +00:00
schneems
85a1c67a65 [ruby/syntax_suggest] Add temp support for 3.2.0-preview{3,2,1}
This SyntaxError#path feature only exists in Ruby HEAD. Until it is released in a preview I want to continue to support existing releases of 3.2.0 (and also so CI will continue to work, as it still uses a preview version to execute tests).

https://github.com/ruby/syntax_suggest/commit/9862032465
2022-12-02 09:36:40 +09:00
Hiroshi SHIBATA
652e2d8f5d [ruby/syntax_suggest] No longer need PathnameFromMessage with SyntaxError#path.
https://bugs.ruby-lang.org/issues/19138

  Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

https://github.com/ruby/syntax_suggest/commit/8e1e7b3298
2022-12-02 09:36:39 +09:00
John Hawthorn
def258e775 Improve packing of iseq_constant_body struct
By moving the two bools into a packing gap above the mark_bits
pointer/union we can save 8 bytes in the struct and avoid an extra cache
line (328 bytes vs 320 bytes).

Co-authored-by: Adam Hess <HParker@github.com>
2022-12-01 16:31:54 -08:00
Takashi Kokubun
dcbea7671b
YJIT: Respect destination num_bits on STUR (#6848) 2022-12-01 16:13:38 -08:00
Takashi Kokubun
8ffa8fc192
Relax the timeout of a YAML test
https://cirrus-ci.com/task/4752663775019008
2022-12-01 15:37:41 -08:00
John Hawthorn
f0cf70c840 Add a macro for SHAPE_DEBUG
Like before, default to VM_CHECK_MODE > 0, but this allows just enabling
shape debug helpers without the rest of VM_CHECK_MODE.
2022-12-01 15:37:15 -08:00
John Hawthorn
da204d2eee Inherit max_iv_count from superclass
In 274870bd5434ab64ac3a3c9db9aa27d262c1d6d6 we gained the ability to
make an educated guess at the max_iv_count of a class based on its
initialize method. This commit makes subclasses inherit their super's
max_iv_count, which makes the estimate work in cases that the subclass
does not have an initialize method.
2022-12-01 15:37:15 -08:00
Burdette Lamar
171e94bd95 [ruby/net-http] [DOC] Enhanced RDoc for Net::HTTPHeader
(https://github.com/ruby/net-http/pull/83)

https://github.com/ruby/net-http/commit/1ea5004098
2022-12-01 23:17:47 +00:00
Jean byroot Boussier
3d272b0fc8
Module#remove_method: Check frozen on the right object
Previously, the frozen check happened on `RCLASS_ORIGIN(self)`, which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.

Fixes [Bug #19164] and [Bug #19166].

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2022-12-01 17:32:41 -05:00
Nobuyoshi Nakada
9da2a5204f
[Bug #19087] Merge to "trailing garbage" case 2022-12-02 01:50:48 +09:00
Nobuyoshi Nakada
c94cd8534a
[Bug #19087] Fix an assertion of String#to_c 2022-12-02 01:47:30 +09:00
Nobuyoshi Nakada
c0dc717c45 [Bug #19087] Disallow successive underscores in Complex string 2022-12-02 01:35:45 +09:00
S-H-GAMELINKS
914cf26d6e parenthesize to macro 2022-12-02 01:31:27 +09:00
S-H-GAMELINKS
1a64d45c67 Introduce encoding check macro 2022-12-02 01:31:27 +09:00
S-H-GAMELINKS
7bc63d6f43 Introduce argf_encoding function 2022-12-02 01:30:01 +09:00
S-H-GAMELINKS
040e0c8d67 Reuse NIL_OR_UNDEF_P macro 2022-12-02 01:19:55 +09:00
Takashi Kokubun
2c939458ca
YJIT: Reorder branches for Fixnum opt_case_dispatch (#6841)
* YJIT: Reorder branches for Fixnum opt_case_dispatch

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

* YJIT: Don't support too large values

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2022-12-01 10:59:56 -05:00
Nobuyoshi Nakada
5872fd6f6c [Feature #19163] Marshal-loaded Data object also should be frozen 2022-12-02 00:56:52 +09:00
Nobuyoshi Nakada
a14a1a5626 [Feature #19163] Data object should be frozen 2022-12-02 00:56:52 +09:00
Jemma Issroff
06a0c58016
YJIT: fix 32 and 16 bit register store (#6840)
* Fix 32 and 16 bit register store in YJIT

Co-Authored-By: Takashi Kokubun <takashikkbn@gmail.com>

* Remove an unnecessary diff

* Reuse an rm_num_bits result

* Use u16::MAX instead

* Update the link

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>

* Just use sturh for 16 bits

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2022-12-01 10:53:50 -05:00
Nobuyoshi Nakada
01790de9e6
Fix indents in NEWS [ci skip]
The MarkDown parser in RDoc requires 4 columns indentation for
paragraphs following list items.  Otherwise, the following paragraphs
are not interpreted as the part of the preceeding list item,
2022-12-01 23:01:28 +09:00
Samuel Williams
0436f1e15a
Introduce Fiber#storage for inheritable fiber-scoped variables. (#6612) 2022-12-01 23:00:33 +13:00
Nobuyoshi Nakada
9869bd1d61 [Bug #19108] Check for the encoding of pack/unpack format 2022-12-01 17:38:33 +09:00
Nobuyoshi Nakada
a1d341efaf [ruby/delegate] Revert "Fix DelegateClass block "method redefined" warning"
https://github.com/ruby/delegate/commit/2a91436284
2022-12-01 08:08:02 +00:00
Nobuyoshi Nakada
4e68b59431 [Feature #19138] Add SyntaxError#path 2022-12-01 17:05:41 +09:00
Alan Wu
5752d11f1f Use RTEST and add test for GH-6832
Technically we shouldn't see Qfalse now, but RTEST also compiles down to
just one branch anyways. Pretty contrived issue, but easy to fix.
2022-11-30 16:27:39 -05:00
Zack Deveau
4b9d10b833 struct.c (struct_ivar_get): add conditional for potential Qnil returned by rb_class_superclass
struct_ivar_get recently started using rb_class_superclass to
resolve super instead of RCLASS_SUPER. This change made
Qnil a possible case we need to return from within the
struct_ivar_get for loop.
2022-11-30 16:27:39 -05:00
Takashi Kokubun
0d3fc08ff4
YJIT: Optimize rb_int_equal (#6838) 2022-11-30 16:16:11 -05:00
Maxime Chevalier-Boisvert
d98d84b75d
YJIT: add new counters for deferred compilation and queued blocks (#6837) 2022-11-30 14:09:10 -05:00
Yusuke Endoh
ab4c7077cc Prevent segfault in String#scan with ObjectSpace.each_object
Calling `String#scan` without a block creates an incomplete MatchData
object whose `RMATCH(match)->str` is Qfalse. Usually this object is not
leaked, but it was possible to pull it by using ObjectSpace.each_object.

This change hides the internal MatchData object by using rb_obj_hide.

Fixes [Bug #19159]
2022-12-01 02:38:51 +09:00
Nobuyoshi Nakada
f0c9d2a0c8 [ruby/rdoc] Fix =end delimiter
https://github.com/ruby/rdoc/commit/e1679fa7e4
2022-12-01 02:36:20 +09:00
Nobuyoshi Nakada
99cad3fccd [ruby/rdoc] Non-RD part feature has not been imported to RDoc
https://github.com/ruby/rdoc/commit/fe0159de2f
2022-12-01 02:36:20 +09:00
Nobuyoshi Nakada
c87b3ee671 [ruby/rdoc] Use Tempfile
https://github.com/ruby/rdoc/commit/0b9dde5ab4
2022-12-01 02:36:20 +09:00
Nobuyoshi Nakada
d752cf7601 Use class methods of File over Kernel.open and IO.read 2022-12-01 02:28:49 +09:00
Alan Wu
a0b0365e90 YJIT: Deallocate struct Block to plug memory leaks
Previously we essentially never freed block even after invalidation.
Their reference count never reached zero for a couple of reasons:
1. `Branch::block` formed a cycle with the block holding the branch
2. Strong count on a branch that has ever contained a stub never
   reached 0 because we increment the `.clone()` call for
   `BranchRef::into_raw()` didn't have a matching decrement.

It's not safe to immediately deallocate blocks during
invalidation since `branch_stub_hit()` can end up
running with a branch pointer from an invalidated branch.
To plug the leaks, we wait until code GC or global invalidation and
deallocate the blocks for iseqs that are definitely not running.
2022-11-30 12:23:50 -05:00
Alan Wu
b30248f74a YJIT: Deallocate when assumptions tables are empty
When we run global invalidation for TracePoints or code GC, we clear out
all blocks in our assumptions table but we don't deallocate the backing
buffers. Let's reclaim some memory during these rare events.
2022-11-30 12:23:50 -05:00
Alan Wu
03f1e6a2aa YJIT: Fix IseqPayload::pages memory bloat
HashSet::clear() doesn't deallocate the backing buffer and shrink the
capacity. Replace with a 0-capcity set instead so we reclaim some memory
each code GC.
2022-11-30 12:23:50 -05:00
Nobuyoshi Nakada
817193104d
Enable to dispatch Code scanning [ci skip] 2022-11-30 20:03:54 +09:00