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

77196 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun ff44e32f92 RJIT: Store caller sp after stack overflow check
and share some code between ISEQ and C calls.
2023-03-26 18:32:01 -07:00
Takashi Kokubun dc270fc632 RJIT: Implement attr_writer 2023-03-26 18:02:25 -07:00
Nobuyoshi Nakada ac458f6bc3
Historical timezones of Lisbon in tzdata are unstable 2023-03-26 23:10:50 +09:00
Kazuki Tsujimoto d51529244f
[Bug #19175] p_kw without a sub pattern should be `assignable' 2023-03-26 18:57:34 +09:00
Kazuki Tsujimoto 6c0925ba70
[Bug #19175] p_rest should be `assignable'
It should also check for duplicate names.
2023-03-26 18:56:21 +09:00
Takashi Kokubun 2f916812a9 Skip test_europe_lisbon on macOS
until we figure out why it's failing.
2023-03-25 23:23:11 -07:00
Takashi Kokubun ddb77dd11e RJIT: Put a guard for splat w/ var-arg cfunc 2023-03-25 22:14:07 -07:00
Takashi Kokubun a624a5d709 RJIT: Scope down send_iseq_complex_has_block exit 2023-03-25 21:57:04 -07:00
Takashi Kokubun 1396b83153 RJIT: Fix jit_array_ptr
array_reg was clobbered before being used by heap_ptr_opnd.
heap_ptr_opnd should be loaded before array_reg is clobbered.
2023-03-25 21:43:15 -07:00
tomoya ishida 60ca800d4f [ruby/reline] Fix split_by_width to retain color sequences
(https://github.com/ruby/reline/pull/490)

* Fix split_by_width to retain color sequences

* Add OSC escape sequence testcase of Reline::Unicode.split_by_width
2023-03-25 15:01:35 +00:00
Takashi Kokubun 9bc2dbd33c RJIT: Support optional params on splat 2023-03-25 01:17:05 -07:00
Takashi Kokubun 85a55d3e75 RJIT: Remove send_iseq_complex_splat exit 2023-03-25 00:59:47 -07:00
Takashi Kokubun 314c7dd6d1 RJIT: Support splat for cfunc 2023-03-25 00:52:07 -07:00
Takashi Kokubun 1dd65f7c55 RJIT: Initial support of splat 2023-03-25 00:31:11 -07:00
Samuel Williams 466aa8010f
Fix incorrect usage of `rb_fiber_scheduler_io_(p)(read|write)`. (#7593) 2023-03-25 18:36:27 +13:00
Jean Boussier 276f4be96d [rubygems/rubygems] Generate native gems with `-fvisibility=hidden`
I recently ran into very nasty issues with dynamic symbols clashing between
two native gems.

I believe the overwhelming majority of native gems don't want to export
their symbols, so hidding them by default would make sense to me.

https://github.com/rubygems/rubygems/commit/449624aa54
2023-03-25 00:31:46 +00:00
Jeremy Evans c08fe40872 Fix Dir.for_fd call-seq 2023-03-24 16:16:32 -07:00
Kasumi Hanazuki 09295ea796
IO::Buffer#resize: Free internal buffer if new size is zero (#7569)
`#resize(0)` on an IO::Buffer with internal buffer allocated will
result in calling `realloc(data->base, 0)`. The behavior of `realloc`
with size = 0 is implementation-defined (glibc frees the object
and returns NULL, while BSDs return an inaccessible object). And
thus such usage is deprecated in standard C (upcoming C23 will make it
UB).

To avoid this problem, just `free`s the memory when the new size is zero.
2023-03-25 12:12:23 +13:00
Jimmy Miller 59c3fac6c4
YJIT: Rest and block_arg support (#7584) 2023-03-24 17:01:59 -04:00
Nobuyoshi Nakada 27b1a2992f Adjust SHAPE_BUFFER_SIZE with shape_id_t
On platforms where `shape_id_t` is 16-bits, 0x80000 is out of range of
this type.

```
../src/shape.c: In function ‘shape_alloc’:
../src/shape.c:129:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  129 |     if (shape_id == MAX_SHAPE_ID) {
      |                  ^~
```
2023-03-24 13:52:55 -07:00
Jeremy Evans 6c60006de5 Raise ArgumentError if IO.read is provided negative offset
Fixes [Bug #19380]
2023-03-24 12:29:00 -07:00
Jeremy Evans 836e9a192b Add Dir.for_fd
This returns a Dir instance for the given directory file descriptor.
If fdopendir is not supported, this raises NotImplementedError.

Implements [Feature #19347]
2023-03-24 11:18:57 -07:00
Jeremy Evans 3be65f63c7 Add Dir#chdir
This uses Dir.fchdir if supported, or Dir.chdir otherwise.

Implements [Feature #19347]
2023-03-24 11:18:57 -07:00
Jeremy Evans 466ca7ae20 Add Dir.fchdir
This is useful for passing directory file descriptors over UNIX
sockets or to child processes to avoid TOCTOU vulnerabilities.

The implementation follows the Dir.chdir code.

This will raise NotImplementedError on platforms not supporting
both fchdir and dirfd.

Implements [Feature #19347]
2023-03-24 11:18:57 -07:00
Jeremy Evans 5d6579bd91 Change Hash#compact to keep default values and compare_by_identity flag
The documentation states it returns a copy of self with nil value
entries removed.  However, the previous behavior was creating a
plain new hash with non-nil values copied into it.  This change
aligns the behavior with the documentation.

Fixes [Bug #19113]
2023-03-24 10:55:13 -07:00
Jeremy Evans 1b13db25d8 Copy compare_by_identity flag for empty hashes in Hash.ruby2_keywords_hash
This was already copied for non-empty hashes.  As Hash.ruby2_keywords_hash
copies default values, it should also copy the compare_by_identity flag.

Partially Fixes [Bug #19113]
2023-03-24 10:55:13 -07:00
Jeremy Evans d3197def88 Do not copy compare_by_identity flag for non-empty hashes in Hash.[]
It wasn't copied for empty hashes, and Hash.[] doesn't copy the
default value, so copying the compare_by_identity flag does not
make sense.

Partially Fixes [Bug #19113]
2023-03-24 10:55:13 -07:00
Alan Wu 35e9b5348d
YJIT: Constify EC to avoid an `as` pointer cast (#7591) 2023-03-24 12:36:06 -04:00
MSP-Greg 7149f5763e [rubygems/rubygems] remove test skips/pends on mswin platform
https://github.com/rubygems/rubygems/commit/1d52eff8bf
2023-03-24 13:00:53 +00:00
Nobuyoshi Nakada 2759cf46f2 Write keyword arguments directly
`assert_normal_exit` uses keyword arguments since 2013, commit
05dd6b194c.
2023-03-24 15:41:37 +09:00
Nobuyoshi Nakada 3e7d1cbceb Cache pid itself instead of converted VALUE 2023-03-24 14:22:02 +09:00
Hiroshi SHIBATA df21e7ebab
Added sync tools for test libraries like core_assertions.rb to default gems repositories 2023-03-24 13:31:32 +09:00
Takashi Kokubun b4e438d8aa
YJIT: Save PC on rb_str_concat (#7586)
[Bug #19483]

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2023-03-23 13:42:49 -07:00
Jimmy Miller 8286544dc5
YJIT: Use starting context for status === CantCompile (#7583) 2023-03-23 13:11:46 -04:00
Nobuyoshi Nakada ed4dc1c33d
Fix ENABLE_MULTIARCH
This macro is used in `ruby_init_loadpath()`, but was removed
mistakenly at 31f4b2d86b.
2023-03-24 01:46:59 +09:00
Ole Friis Østergaard e950781880
Use shape information in YJIT's definedivar implementation (#7579)
* Use shape information in YJIT's definedivar implementation

* Handle complex shape for definedivar
2023-03-23 11:04:30 -04:00
Nobuyoshi Nakada b738cb01b6
Suppress -Wsign-compare warning 2023-03-23 23:31:46 +09:00
Nobuyoshi Nakada 310af50c3b [ruby/time] Update required ruby version
`Regexp#match?` which is introduced at ruby 2.4 is used since https://github.com/ruby/time/pull/1852.

https://github.com/ruby/time/commit/b0a965dcaa
2023-03-23 11:45:58 +00:00
Jean Boussier 3563e1383f thread_pthread.c: Use a `fork_gen` to protect against fork instead of getpid()
[Feature #19443]

Until recently most libc would cache `getpid()` so this was a cheap check to make.

However as of glibc version 2.25 the PID cache is removed and calls to getpid() always
invoke the actual system call which significantly degrades the performance of existing applications.

The reason glibc removed the cache is that some libraries were bypassing fork(2)
by issuing system calls themselves, causing stale cache issues.

That isn't a concern for Ruby as bypassing MRI's primitive for forking would
render the VM unusable, so we can safely cache the PID.
2023-03-23 09:08:19 +00:00
David Rodríguez a9146bd81e Don't suggest `--full-index` on API Response mismatch errors
I've never seen this error in real life, and if it was happening, I
think it's either some server side issue that would need to be fixed or
some transient issue. We should move away from the full index, since
it's slow, so let's stop recommending it.
2023-03-23 17:18:49 +09:00
David Rodríguez c3fa6679e6 Don't suggest retrying with `--full-index` on gemspec errors
We're actually already using the full index here, so it makes no sense
to suggest retrying the same thing.
2023-03-23 17:18:49 +09:00
David Rodríguez 164dc58008 Fix logging the fallback to the full index on GemspecError's
The debug message suggests retrying using `--full-index`, but the retry
is happening automatically. Just log that we are falling back to the
full index, like we do with other errors.
2023-03-23 17:18:49 +09:00
Mau Magnaguagno 069640d355 Avoid intermediate array in TarHeader#calculate_checksum
String#sum(0) sums the character bytes without a modulo.
Follow-up of #6476 based on comment from @nobu.
2023-03-23 17:18:49 +09:00
David Rodríguez a9fd1860dd Fix flaky when making materialized specs uniq
Sometimes we'll have an heterogenous array of specs which include
`Gem::Specification` objects, which don't define `#identifier`. Let's
use `#full_name` consistently.
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA 6ad6ae680a Skip test_gem_with_platform_and_platform_dependencies only ruby/ruby repository 2023-03-23 17:18:49 +09:00
なつき 1b408e659a Refactor and fix usage of Gem.ruby 2023-03-23 17:18:49 +09:00
なつき 22d037f4cc Move duplicated logic to parent class 2023-03-23 17:18:49 +09:00
なつき e46d473396 Make sure native extensions are loaded correctly in ext_conf builder 2023-03-23 17:18:49 +09:00
なつき f8ecf145ce Make sure native extensions are loaded correctly in rake builder 2023-03-23 17:18:49 +09:00
David Rodríguez a757e21bc0 Reuse `SpecSet#materialize` logic 2023-03-23 17:18:49 +09:00