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

81882 Коммитов

Автор SHA1 Сообщение Дата
John Hawthorn ab40dc5d09 Use xcalloc for id table in prism
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-12 18:35:34 -08:00
John Hawthorn 5e710e68fb Fix memory leak in prism
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-12 18:35:31 -08:00
John Hawthorn eb807a4008 Add GC_CHECK_XFREE
Co-authored-by: Matthew Draper <matthew@trebex.net>
2023-12-12 18:35:28 -08:00
Ufuk Kayserilioglu e96f6126f2 [ruby/prism] Fix hash deopt based on contents
The previous implementation of hash deopt was based on clearing the static literal flag on a hash node if the element that was being added was an array, hash or range node, or if the element was not a static literal in the first place.

However, this is not correct. First of all, the elements added to a hash node will primarily be assoc nodes, but never array, hash or range nodes. Secondly, the static literal flag is set on assoc nodes, only if the value in an assoc node is a static literal, so the key is never checked. As a result, the static literal flag on a hash node would never be cleared if the key wasn't a static literal.

This commit fixes this by clearing the static literal flag if:
1. the element is not an assoc node,
2. the element is an assoc node, but the key is not a static literal, or
3. the element is an assoc node, the key is a static literal, but assoc node (and thus the value in assoc node) is not a static literal.

https://github.com/ruby/prism/commit/7f67109b36
2023-12-13 00:21:42 +00:00
Peter Zhu 2350c79462 Use xfree for IO::Buffer
Since IO::Buffer is allocated using TypedData_Make_Struct, it must use
xfree to free the buffer otherwise it will cause more major GC to run.

Example:

```
10.times do
  1_000_000.times { IO::Buffer.new(0) }

  puts "oldmalloc_increase_bytes: #{GC.stat(:oldmalloc_increase_bytes)}, major_gc_count: #{GC.stat(:major_gc_count)}"
end
```

Before:

```
oldmalloc_increase_bytes: 14904176, major_gc_count: 3
oldmalloc_increase_bytes: 2399424, major_gc_count: 5
oldmalloc_increase_bytes: 5204640, major_gc_count: 6
oldmalloc_increase_bytes: 2199936, major_gc_count: 7
oldmalloc_increase_bytes: 34199936, major_gc_count: 7
oldmalloc_increase_bytes: 24223360, major_gc_count: 8
oldmalloc_increase_bytes: 5967616, major_gc_count: 9
oldmalloc_increase_bytes: 37967616, major_gc_count: 9
oldmalloc_increase_bytes: 9689792, major_gc_count: 10
oldmalloc_increase_bytes: 41689792, major_gc_count: 10
```

After:

```
oldmalloc_increase_bytes: 117392, major_gc_count: 2
oldmalloc_increase_bytes: 26128, major_gc_count: 2
oldmalloc_increase_bytes: 71600, major_gc_count: 2
oldmalloc_increase_bytes: 117072, major_gc_count: 2
oldmalloc_increase_bytes: 17296, major_gc_count: 2
oldmalloc_increase_bytes: 62768, major_gc_count: 2
oldmalloc_increase_bytes: 108240, major_gc_count: 2
oldmalloc_increase_bytes: 153712, major_gc_count: 2
oldmalloc_increase_bytes: 53936, major_gc_count: 2
oldmalloc_increase_bytes: 99408, major_gc_count: 2
```
2023-12-12 18:47:58 -05:00
BurdetteLamar 18a5b6b7e9 [DOC] RDoc for Complex 2023-12-12 17:32:59 -05:00
Alan Wu 9f77eb1f5a Remove unused macros 2023-12-12 17:24:17 -05:00
Alan Wu d4bbee7475
YJIT: Fix off-by-one in Kernel#send type handling (#9212)
Previously, if the method ID argument happens to be on one below the top
of the stack, we didn't overwrite the type of the stack slot, which
leaves an incorrect type for the stack slot. The included script tripped
asserts both with and without --yjit-verify-ctx.
2023-12-12 22:10:14 +00:00
Takashi Kokubun 6e491cae5d
Move --repeat-count=2 job to macos-arm-oss (#9208) 2023-12-12 13:01:09 -08:00
eileencodes a6526342f3 [PRISM] Fix segv with regex once flag
When you have an interpolated regex with a `once` flag and local
variable is outside the block created by the `once` flag, Prism would
see a segv. This is because it was not taking the depth into account.

To fix this, we need to add 1 to the `local_depth_offset` on the
`scope`.

Fixes: ruby/prism#2047
2023-12-12 15:15:02 -05:00
David Rodríguez 1572322e17
Sync with upstream rubygems (#9206) 2023-12-12 11:49:25 -08:00
Takashi Kokubun 0366c424e5 Remove a duplicated job
This was first added in b481b673d7, but 197e91f357 added
-DUNIVERSAL_PARSER to the Compilers workflow as well.

Given the nature of this test and the fact that it also runs make
test-all besides make test, I think it's better to keep only the
Compilers one.
2023-12-12 11:45:48 -08:00
Takashi Kokubun fd7decbf04 Allow syncing tool/bundler 2023-12-12 11:19:02 -08:00
Matt Valentine-House 43ede3f26c [PRISM] Compile NextNode arguments 2023-12-12 13:46:36 -05:00
Stan Lo d1cf793adc [ruby/irb] Remove documents about deprecated/WIP features and some
slight adjustments
(https://github.com/ruby/irb/pull/811)

https://github.com/ruby/irb/commit/6a9193e88b
2023-12-12 18:46:07 +00:00
Jemma Issroff b9dfe04a73 [PRISM] Implementing forwarding of args for ForwardingSuperNode
ForwardingSuperNodes need to actually forward any applicable
arguments. This commit implements that logic, by using the data
stored on the local iseq about the parameters to forward the
appropriate arguments.
2023-12-12 13:45:21 -05:00
Jemma Issroff 68753e4408 [PRISM] Allow rest parameter to be `*`
Prior to this commit, if a rest parameters was `*`, we did not add
it to the locals table correctly. This commit fixes that.
2023-12-12 13:45:21 -05:00
Kevin Newton f61df27b4c [ruby/prism] Use new flag setters for attribute write
https://github.com/ruby/prism/commit/1e07832778
2023-12-12 18:43:59 +00:00
Kouhei Yanagita 06e2fbb826 [Bug #19114] Fix for multiple calls of TracePoint#enable 2023-12-12 09:36:37 -08:00
Ufuk Kayserilioglu 1f22245ed5 [ruby/prism] Start using flag macros/methods exclusively
https://github.com/ruby/prism/commit/5f05a6fe83
2023-12-12 17:35:53 +00:00
Ufuk Kayserilioglu bdb38dd9f2 [ruby/prism] Add methods for setting/unsetting and macros for testing a flags
https://github.com/ruby/prism/commit/e5f37d1407
2023-12-12 17:35:52 +00:00
David Rodríguez 67940b135c [rubygems/rubygems] Bump rake version used by tests
And make it easier to update next time.

https://github.com/rubygems/rubygems/commit/1ea4bfa5d8
2023-12-12 17:16:19 +00:00
Kevin Newton 278ce27ee4 [ruby/prism] Flag for attribute write on calls
https://github.com/ruby/prism/commit/465731969c
2023-12-12 15:55:54 +00:00
Jeremy Evans 2f1d6da8c4
Fix op asgn calls with keywords
Examples of such calls:

```ruby
obj[kw: 1] += fo
obj[**kw] &&= bar
```

Before this patch, literal keywords would segfault in the compiler,
and keyword splat usage would result in TypeError.

This handles all cases I can think of:

* literal keywords
* keyword splats
* combined with positional arguments
* combined with regular splats
* both with and without blocks
* both popped and non-popped cases

This also makes sure that to_hash is only called once on the keyword
splat argument, instead of twice, and make sure it is called before
calling to_proc on a passed block.

Fixes [Bug #20051]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-12-12 07:34:53 -08:00
Martin Emde f671c5d179 [rubygems/rubygems] Make RubyDsl a little easier to read; avoid a Hash sometimes
https://github.com/rubygems/rubygems/commit/2dca83722b
2023-12-12 15:26:01 +00:00
Nobuyoshi Nakada f466afa176
[PRISM] Do not hide syntactically required parentheses within macros
It makes code formatters confused when auto indenting.
2023-12-12 23:57:27 +09:00
Peter Zhu 185b7e92a3 Make WeakKeyMap safe for compaction during allocation
During allocation, the table may not have been allocated yet which would
crash in the st_foreach.
2023-12-12 09:01:21 -05:00
Peter Zhu 33cf8f640b Make WeakMap safe for compaction during allocation
During allocation, the table may not have been allocated yet which would
crash in the st_foreach.
2023-12-12 09:01:21 -05:00
Ufuk Kayserilioglu d313c82f79 [ruby/prism] Update tests and snapshots
https://github.com/ruby/prism/commit/0663e2bcfa
2023-12-12 13:05:09 +00:00
Ufuk Kayserilioglu 43229d531f [ruby/prism] Start `KeywordHashNode`s with `STATIC_KEYS` set, until hit an element that should clear it
https://github.com/ruby/prism/commit/7c7c486507
2023-12-12 13:05:09 +00:00
Ufuk Kayserilioglu 25b9a0cbc8 [ruby/prism] Add `STATIC_KEYS` flag for `KeywordHashNode`
https://github.com/ruby/prism/commit/aa83de39c1
2023-12-12 13:05:08 +00:00
Martin Emde d1c25605f6 [rubygems/rubygems] Resolve `ruby file: ".ruby-version"` relative to Gemfile
https://github.com/rubygems/rubygems/commit/0cbbaed8a5
2023-12-12 12:40:17 +00:00
Stan Lo 28a9a4275c [ruby/irb] Remove trailing space
This is required to fix ruby/ruby's CI

https://github.com/ruby/irb/commit/3c77213209
2023-12-12 11:27:39 +00:00
Burdette Lamar 35990cb38c [ruby/irb] [DOC] RDoc for module IRB
(https://github.com/ruby/irb/pull/738)

[DOC] RDoc for module IRB

https://github.com/ruby/irb/commit/f3a0626298
2023-12-12 10:34:38 +00:00
KJ Tsanaktsidis 25711e7063 Partially revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls"
This _partially_ reverts commit
d2ba8ea54a, but for UDP sockets only.

With TCP sockets (and other things which use `rsock_init_inetsock`), the
order of operations is to call `getaddrinfo(3)` with AF_UNSPEC, look at
the returned addresses, pick one, and then call `socket(2)` with the
family for that address (i.e. AF_INET or AF_INET6).

With UDP sockets, however, this is reversed; `UDPSocket.new` takes an
address family as an argument, and then calls `socket(2)` with that
family. A subsequent call to UDPSocket#connect will then call
`getaddrinfo(3)` with that family.

The problem here is that...

* If you are in a networking situation that _only_ has loopback addrs,
* And you want to look up a name like "localhost" (or NULL)
* And you pass AF_INET or AF_INET6 as the ai_family argument to
  getaddrinfo(3),
* And you pass AI_ADDRCONFIG to the hints argument as well,

then glibc on Linux will not return an address. This is because
AI_ADDRCONFIG is supposed to return addresses for families we actually
have an address for and could conceivably connect to, but also is
documented to explicitly ignore localhost in that situation.

It honestly doesn't make a ton of sense to pass AI_ADDRCONFIG if you're
explicitly passing the address family anyway, because you're not looking
for "an address for this name we can connect to"; you're looking for "an
IPv(4|6) address for this name". And the original glibc bug that
d2ba8ea5 was supposed to work around was related to parallel issuance of
A and AAAA queries, which of course won't happen if an address family is
explicitly specified.

So, we fix this by not passing AI_ADDRCONFIG for calls to
`rsock_addrinfo` that we also pass an explicit family to (i.e. for
UDPsocket).

[Bug #20048]
2023-12-12 20:05:21 +11:00
git f64485af7e Update bundled gems list as of 2023-12-12 2023-12-12 06:58:23 +00:00
Nobuyoshi Nakada e411bd5b36 [ruby/securerandom] [DOC] Satisfy RDoc coverage
https://github.com/ruby/securerandom/commit/ddf2672e47
2023-12-12 06:40:44 +00:00
Nobuyoshi Nakada dbd704ae6f [ruby/securerandom] [DOC] Add documents of methods and constants
https://github.com/ruby/securerandom/commit/9a99978135
2023-12-12 06:40:43 +00:00
Yusuke Endoh cb93d10ae5 [ruby/securerandom] [DOC] Improve the document about reproducibility of uuid_v7
https://github.com/ruby/securerandom/pull/19/files#r1329476195

https://github.com/ruby/securerandom/commit/156cbb8448
2023-12-12 06:36:10 +00:00
Jeremy Evans f49af3c969 Make Dir#chdir never yield args, and return block return value
If no block is given, return 0 instead of nil for consistency
with Dir.chdir and Dir.fchdir.
2023-12-11 22:31:16 -08:00
Takashi Kokubun 9f0065a077
Initialize interrupt queue before signal handlers (#9196) 2023-12-11 21:12:08 -08:00
Martin Emde 1e5c8afb15 [rubygems/rubygems] Ensure that the lockfile mtime is not altered on frozen install
https://github.com/rubygems/rubygems/commit/6847709ee0
2023-12-12 02:39:57 +00:00
NARUSE, Yui 6b3abcf462 fix regexp pattern of diff 2023-12-12 11:22:40 +09:00
Samuel Giddins e223dde329 [rubygems/rubygems] Allow bundle pristine to run in parallel
Also fix running when BUNDLE_NO_INSTALL happens to be set, same as with install/update commands

https://github.com/rubygems/rubygems/commit/a555fd6ccd
2023-12-12 02:10:53 +00:00
Nobuyoshi Nakada 305f66b859
Save $VERBOSE properly 2023-12-12 11:06:27 +09:00
Yusuke Endoh 73b43fffa1 Prevent a warning: assigned but unused variable - status 2023-12-12 10:31:37 +09:00
Yusuke Endoh 207dcf07e1 Prevent a warning: method redefined 2023-12-12 10:31:37 +09:00
Yusuke Endoh cfb8494d54 Prevent warning: possibly useless use of a literal in void context 2023-12-12 10:31:37 +09:00
Yusuke Endoh 0c287df3bc Prevent a warning: setting Encoding.default_external 2023-12-12 10:31:37 +09:00
Yusuke Endoh 535eb4de11 Remove unused statement
... to disable a warning: assigned but unused variable - expected
2023-12-12 10:31:37 +09:00