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

82882 Коммитов

Автор SHA1 Сообщение Дата
David Rodríguez db44088c2a [rubygems/rubygems] Fix activation conflicts when circularly requiring a gem
If a gem is required circular, and there are unresolved specs depending
on it, we may end up in an activation conflict.

The solution is to not try to activate unresolved gems when requiring a
default gem, regardless of it having already been activated or not.

https://github.com/rubygems/rubygems/commit/3b2b8f4e3e
2024-01-19 11:28:11 +09:00
David Rodríguez f1f5f22d22 [rubygems/rubygems] Fix `require` of a default gem when unresolved gems depend on it
The following conditions must be met:

* A default gem is required.
* A previous require left some gems unresolved, and those dependencies
  themselves depend on the default gem.

In this case, rubygems require will first activate the default version
of the gem, then try to activate another unresolved version of the
default gem that conflicts with the first activation.

The solution is, if we are in the middle of requiring a default gem,
skip this step, because we have already activated it successfully.

https://github.com/rubygems/rubygems/commit/8cd5608db5

Co-authored-by: Stan Hu <stanhu@gmail.com>
2024-01-19 11:28:11 +09:00
David Rodríguez 8044e57907 [rubygems/rubygems] Add a comment to explain default gem activation
https://github.com/rubygems/rubygems/commit/291128268f
2024-01-19 11:28:10 +09:00
git 74e5665ec1 Update default gems list at b2ec4308d6 [ci skip] 2024-01-19 02:16:35 +00:00
Stan Lo b2ec4308d6
[ruby/irb] Bump version to v1.11.1
(https://github.com/ruby/irb/pull/837)

https://github.com/ruby/irb/commit/f052097c4b
2024-01-19 10:49:12 +09:00
NAITOH Jun 91f3530580
[ruby/strscan] Add test to check encoding for empty string
(https://github.com/ruby/strscan/pull/80)

See: https://github.com/ruby/strscan/issues/78#issuecomment-1890849891

https://github.com/ruby/strscan/commit/d0508518a9
2024-01-19 10:49:12 +09:00
Sutou Kouhei ac636f5709
[ruby/strscan] Bump version
https://github.com/ruby/strscan/commit/d6f97ec102
2024-01-19 10:49:12 +09:00
David Rodríguez 4e47671073
[rubygems/rubygems] Test that regular gems don't shadow default gems
https://github.com/rubygems/rubygems/commit/b8ca5950a6
2024-01-19 10:49:12 +09:00
Alan Wu 7b253cfea4 RJIT: Properly reject keyword splat with `yield`
See the fix for YJIT.
2024-01-18 20:22:40 -05:00
Alan Wu bbd249e351 YJIT: Properly reject keyword splat with `yield`
We don't have support for keyword splat anywhere, but we tried to
compile these anyways in case of `invokeblock`. This led to bad things
happening such as passing the wrong value and passing a hash into
rb_yjit_array_len(), which raised in the middle of compilation.

[Bug #20192]
2024-01-18 20:22:40 -05:00
KJ Tsanaktsidis 61da90c1b8 Mark asan fake stacks during machine stack marking
ASAN leaves a pointer to the fake frame on the stack; we can use the
__asan_addr_is_in_fake_stack API to work out the extent of the fake
stack and thus mark any VALUEs contained therein.

[Bug #20001]
2024-01-19 09:55:12 +11:00
KJ Tsanaktsidis 3cfcb45ecf Define special macros for asan/msan being enabled
__has_feature is a clang-ism, and GCC has a different way to tell if
sanitizers are enabled. For this reason, I don't want to spray
__has_feature all over the codebase for other places where conditional
compilation based on sanitizers is required.

[Bug #20001]
2024-01-19 09:55:12 +11:00
KJ Tsanaktsidis cabdaebc70 Make stack bounds detection work with ASAN
Where a local variable is used as part of the stack bounds detection, it
has to actually be on the stack. ASAN can put local variable on "fake
stacks", however, with addresses in different memory mappings. This
completely destroys the stack bounds calculation, and can lead to e.g.
things not getting GC marked on the machine stack or stackoverflow
checks that always fail.

The __asan_addr_is_in_fake_stack helper can be used to get the _real_
stack address of such variables, and thus perform the stack size
calculation properly

[Bug #20001]
2024-01-19 09:55:12 +11:00
KJ Tsanaktsidis 807714447e Pass down "stack start" variables from closer to the top of the stack
This commit changes how stack extents are calculated for both the main
thread and other threads. Ruby uses the address of a local variable as
part of the calculation for machine stack extents:

* pthreads uses it as a lower-bound on the start of the stack, because
  glibc (and maybe other libcs) can store its own data on the stack
  before calling into user code on thread creation.
* win32 uses it as an argument to VirtualQuery, which gets the extent of
  the memory mapping which contains the variable

However, the local being used for this is actually too low (too close to
the leaf function call) in both the main thread case and the new thread
case.

In the main thread case, we have the `INIT_STACK` macro, which is used
for pthreads to set the `native_main_thread->stack_start` value. This
value is correctly captured at the very top level of the program (in
main.c). However, this is _not_ what's used to set the execution context
machine stack (`th->ec->machine_stack.stack_start`); that gets set as
part of a call to `ruby_thread_init_stack` in `Init_BareVM`, using the
address of a local variable allocated _inside_ `Init_BareVM`. This is
too low; we need to use a local allocated closer to the top of the
program.

In the new thread case, the lolcal is allocated inside
`native_thread_init_stack`, which is, again, too low.

In both cases, this means that we might have VALUEs lying outside the
bounds of `th->ec->machine.stack_{start,end}`, which won't be marked
correctly by the GC machinery.

To fix this,

* In the main thread case: We already have `INIT_STACK` at the right
  level, so just pass that local var to `ruby_thread_init_stack`.
* In the new thread case: Allocate the local one level above the call to
  `native_thread_init_stack` in `call_thread_start_func2`.

[Bug #20001]

fix
2024-01-19 09:55:12 +11:00
Olle Jonsson 08edad31a6 [rubygems/rubygems] Drop two TODOs from specification.rb
These were introduced 13 years ago, in a documentation update. Perhaps we can let the TODOs go, without taking any action?

https://github.com/rubygems/rubygems/commit/fb23fa84f9
2024-01-18 22:49:32 +00:00
Peter Zhu c28094d385 [PRISM] Add function to free scope node
pm_scope_node_destroy frees the scope node after we're done using it to
make sure that the index_lookup_table is not leaked.

For example:

    10.times do
      100_000.times do
        RubyVM::InstructionSequence.compile_prism("begin; 1; rescue; 2; end")
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    33056
    50304
    67776
    84544
    101520
    118448
    135712
    152352
    169136
    186656

After:

    15264
    15296
    15408
    17040
    17152
    17152
    18320
    18352
    18400
    18608
2024-01-18 16:33:25 -05:00
Peter Zhu 47081c3ee3 [PRISM] Pass pm_scope_node_t by reference
We can pass pm_scope_node_t by reference to pm_new_child_iseq rather
than by value.
2024-01-18 16:33:25 -05:00
Matt Valentine-House 60dd731125 [PRISM] Correct checkmatch flags for splat in rescue 2024-01-18 20:25:28 +00:00
Matt Valentine-House 8a3e7f08b8 [PRISM] Fix case splat with no predicate 2024-01-18 20:03:27 +00:00
Peter Zhu 686b1655a0 [PRISM] Fix indentation in switch [ci skip] 2024-01-18 14:59:59 -05:00
Takashi Kokubun 33306a08d1
YJIT: Stop incrementing chain_depth on defer_compilation (#9597) 2024-01-18 11:40:11 -08:00
Peter Zhu d8ac96efc5 [PRISM] Fix memory leak in case nodes
The temporary array conditions_labels is heap allocated and never freed.
We can use alloca instead to stack allocate it so that we don't need to
manually free it.

For example:

    code = "case; #{100.times.map { "when #{it}; " }.join}; end"

    10.times do
      10_000.times do
        RubyVM::InstructionSequence.compile_prism(code)
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    21376
    30304
    38800
    47184
    55456
    64192
    72288
    80400
    89040
    97104

After:

    13088
    13632
    13760
    14016
    14688
    14992
    15120
    15232
    15744
    15744
2024-01-18 13:40:14 -05:00
Robert Schulze d3b07b9845 [ruby/psych] Add :stringify_names option to convert symbol keys to string for dumping
https://github.com/ruby/psych/commit/3d051d89aa
2024-01-18 17:32:34 +00:00
Peter Zhu 00814fd672 [PRISM] Fix memory leak in iseq
rb_iseq_compile_prism_node calls both rb_translate_prism and iseq_setup.
Both of these functions call iseq_set_sequence. This means that the first
iseq_set_sequence will leak because the iseq will be overwritten.

For example:

    10.times do
      100_000.times do
        RubyVM::InstructionSequence.compile_prism("")
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    20528
    27328
    33840
    40208
    46400
    52960
    59168
    65600
    71888
    78352

After:

    13696
    13712
    13712
    13712
    13712
    14352
    14352
    14992
    14992
    14992
2024-01-18 10:35:46 -05:00
Burdette Lamar ef685554c9
[DOC] RDoc for ARGF (#9558) 2024-01-18 10:15:25 -05:00
Nobuyoshi Nakada 97721fa4e1
Old sh does not allow `:` in function names [ci skip] 2024-01-18 19:56:52 +09:00
Nobuyoshi Nakada 264b7363aa
Preserve spaces in messages [ci skip] 2024-01-18 18:09:42 +09:00
Nobuyoshi Nakada a3e6546e7e
Print error messages to the stderr [ci skip] 2024-01-18 16:36:09 +09:00
git 74ce7905d7 Update bundled gems list at 419f4260aa [ci skip] 2024-01-18 07:23:49 +00:00
Hiroshi SHIBATA 419f4260aa
Use released version of bigdecimal 2024-01-18 16:01:02 +09:00
Edwing123 a660e1de18
[DOC] correct doc comment for rb_ary_aset
Signed-off-by: Edwin Garcia <egarciavalle2014@gmail.com>
2024-01-18 06:56:42 +00:00
tomoya ishida fd1bafc11f [ruby/stringio] Fix ascii_only? flag in strio_write
(https://github.com/ruby/stringio/pull/77)

Followup of #79

`rb_str_resize()` was changed by b0b9f7201a  .

```c
rb_str_resize(string, shorter) // clear ENC_CODERANGE in some case
rb_str_resize(string, longer) // does not clear ENC_CODERANGE anymore
```

```c
// rb_str_resize in string.c
if (slen > len && ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
  ENC_CODERANGE_CLEAR(str);
}
```

I think this change is based on an assumption that appending null bytes
will not change flag `ascii_only?`.

`strio_extend()` will make the string longer if needed, and update the
flags correctly for appending null bytes.
Before `memmove()`, we need to `rb_str_modify()` because updated flags are not
updated for `memmove()`.

https://github.com/ruby/stringio/commit/b31a538576
2024-01-18 03:42:21 +00:00
git 4095191f2c Update default gems list at af60cdf674 [ci skip] 2024-01-18 01:37:52 +00:00
Hiroshi SHIBATA af60cdf674 [ruby/io-console] Bump up version to 0.7.2
https://github.com/ruby/io-console/commit/1f2877a185
2024-01-18 01:36:52 +00:00
Kazuhiro NISHIYAMA 42177a8987
[DOC] Update ruby version in Building Ruby Dependencies 2024-01-18 08:45:09 +09:00
Kazuhiro NISHIYAMA 8370b3bc32
Add baseruby version message
Because `--with-baseruby=/usr/bin/ruby` on macOS is Ruby 2.6,
I was confused why `--with-baseruby` was ignored.
2024-01-18 08:40:16 +09:00
git 6ddd583ad2 Update bundled gems list at fd81c887f9 [ci skip] 2024-01-17 22:44:42 +00:00
Hiroshi SHIBATA fd81c887f9 Use fixed commit for failing result of test-bundled-gems
https://github.com/ruby/ruby/actions/runs/7550805131/job/20557022764?pr=9573
  338e896234
2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 7cb1125446 spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/core/rational/coerce_spec.rb 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 44d74f22c8 Guard bigdecimal related examples
spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/core/integer/coerce_spec.rb
  spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/shared/rational/coerce.rb
  spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/bigmath/log_spec.rb

  and example of at_spec.rb
2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 4328f190ea spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/bigdecimal/**/*_spec.rb 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 9f729cf36a Skip bigdecimal extension on TestExtLibs 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 0bdab1a784 Load Rake::TaskLib when missing it 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 4dde4d1437 Stop sync commits from bigdecimal repo 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 272b1c92cc Document about bigdecimal at Ruby 3.4 2024-01-18 07:44:13 +09:00
Hiroshi SHIBATA 2b0766113b Extract bigdecimal as bundled gems 2024-01-18 07:44:13 +09:00
eileencodes db9f5fc916 [Prism] Implement defined? for PM_UNLESS_NODE
Ruby code:

```ruby
defined?(unless true; 1; end)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,16)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,16)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 17:21:29 -05:00
eileencodes 555af5e599 [Prism] Implement defined? for PM_UNTIL_NODE
Ruby code:

```ruby
defined?(until a == 1; end)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,16)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,16)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 17:21:29 -05:00
eileencodes 24d02cd485 [Prism] Implement defined? for PM_WHILE_NODE
Ruby code:

```ruby
defined?(while a != 1; end)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,16)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,16)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 17:21:29 -05:00
eileencodes b5d3d61130 [Prism] Implement defined? for PM_SINGLETON_CLASS_NODE
Ruby code:

```ruby
defined?(class << self; end)
```

Instructions:

```
"********* Ruby *************"
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(59,16)>
0000 putobject                              "expression"              (  59)[Li]
0002 leave
"********* PRISM *************"
== disasm: #<ISeq:<compiled>@<compiled>:58 (58,0)-(58,16)>
0000 putobject                              "expression"              (  58)[Li]
0002 leave
```

Related: ruby/prism#2188
2024-01-17 17:21:29 -05:00