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

78433 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada f1f84ca71c [flori/json] Remove `HAVE_RB_SCAN_ARGS_OPTIONAL_HASH` check
This macro is defined since ruby 2.1, which is older than the required
ruby version.

https://github.com/flori/json/commit/dd1d54e78a
2023-07-19 00:02:58 +09:00
Stan Lo 0db58dd0db [ruby/irb] Declare rdoc as dependency
(https://github.com/ruby/irb/pull/648)

IRB already has several features that rely on rdoc, such as:

- Autocompletion's document dialog
- Autocompletion's `PerfectMatchedProc`
- The `show_doc` command
- Easter egg

And we could use its pager more in the future too. So it makes sense to
declare rdoc as a dependency instead of relying on the one bundled with
Ruby.

https://github.com/ruby/irb/commit/4dffbb1dd3
2023-07-18 13:53:31 +00:00
Ivanov-Anton b89b7d8fdc
[DOC] Fix a magic comment in the section for `experimental_copy` 2023-07-18 19:23:27 +09:00
Hiroshi SHIBATA 56c8dab468 [flori/json] Skip BigDecimal tests when it's missing to load
https://github.com/flori/json/commit/3dd36c6077
2023-07-18 12:25:55 +09:00
Nobuyoshi Nakada 9f51810f34 [flori/json] Skip unsupported test on JRuby
https://github.com/flori/json/commit/7138bf32c7
2023-07-18 12:25:54 +09:00
Dimitar Haralanov 9977462fd9 [flori/json] Rename JSON::ParseError to JSON:ParserError
https://github.com/flori/json/commit/20b80ca317
2023-07-18 12:25:54 +09:00
Hiroshi SHIBATA b368990ce6 [ruby/psych] Skip BigDecimal tests when it's missing to load
https://github.com/ruby/psych/commit/e1dbfae7a6
2023-07-18 02:55:47 +00:00
Alan Wu f302e725e1
Remove __bp__ and speed-up bmethod calls (#8060)
Remove rb_control_frame_t::__bp__ and optimize bmethod calls

This commit removes the __bp__ field from rb_control_frame_t. It was
introduced to help MJIT, but since MJIT was replaced by RJIT, we can use
vm_base_ptr() to compute it from the SP of the previous control frame
instead. Removing the field avoids needing to set it up when pushing new
frames.

Simply removing __bp__ would cause crashes since RJIT and YJIT used a
slightly different stack layout for bmethod calls than the interpreter.
At the moment of the call, the two layouts looked as follows:

                   ┌────────────┐    ┌────────────┐
                   │ frame_base │    │ frame_base │
                   ├────────────┤    ├────────────┤
                   │    ...     │    │    ...     │
                   ├────────────┤    ├────────────┤
                   │    args    │    │    args    │
                   ├────────────┤    └────────────┘<─prev_frame_sp
                   │  receiver  │
    prev_frame_sp─>└────────────┘
                     RJIT & YJIT      interpreter

Essentially, vm_base_ptr() needs to compute the address to frame_base
given prev_frame_sp in the diagrams. The presence of the receiver
created an off-by-one situation.

Make the interpreter use the layout the JITs use for iseq-to-iseq
bmethod calls. Doing so removes unnecessary argument shifting and
vm_exec_core() re-entry from the interpreter, yielding a speed
improvement visible through `benchmark/vm_defined_method.yml`:

     patched:   7578743.1 i/s
      master:   4796596.3 i/s - 1.58x  slower

C-to-iseq bmethod calls now store one more VALUE than before, but that
should have negligible impact on overall performance.

Note that re-entering vm_exec_core() used to be necessary for firing
TracePoint events, but that's no longer the case since
9121e57a5f.

Closes ruby/ruby#6428
2023-07-17 13:57:58 -04:00
Nobuyoshi Nakada 105bdba899
Fix logarithm of 0 with base 2023-07-17 23:57:11 +09:00
Maxime Chevalier-Boisvert d70484f0eb
YJIT: refactoring to allow for fancier call threshold logic (#8078)
* YJIT: refactoring to allow for fancier call threshold logic

* Avoid potentially compiling functions multiple times.

* Update vm.c

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

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2023-07-17 10:41:18 -04:00
Nobuyoshi Nakada 1c4a523006
Move `posix_signal` declaration internal with prefix `ruby_` 2023-07-17 21:31:59 +09:00
Nobuyoshi Nakada 2476b1ee0b
objspace is not used in parent process [ci skip] 2023-07-17 20:44:35 +09:00
Nobuyoshi Nakada f1adc5866a
Fix up to require objspace 2023-07-17 19:50:47 +09:00
Nobuyoshi Nakada b998e6b79d
Run `Process.warmup` tests in separate processes 2023-07-17 19:49:00 +09:00
Jean Boussier fa30b99c34 Implement Process.warmup
[Feature #18885]

For now, the optimizations performed are:

  - Run a major GC
  - Compact the heap
  - Promote all surviving objects to oldgen

Other optimizations may follow.
2023-07-17 11:20:15 +02:00
Nobuyoshi Nakada d3bcff0158
Fix a typo [ci skip] 2023-07-17 00:15:05 +09:00
yui-knk 0a570a0069 Fix `#line` directive filename of ripper.c
Before:

```c
/* First part of user prologue.  */
#line 14 "parse.y"
```

After:

```c
/* First part of user prologue.  */
#line 14 "ripper.y"
```
2023-07-16 19:27:08 +09:00
Nobuyoshi Nakada 5c77402d88
Fix null pointer access in Ripper#initialize
In `rb_ruby_ripper_parser_allocate`, `r->p` is NULL between creating
`self` and `parser_params` assignment.  As GC can happen there, the
typed-data functions for it need to consider the case.
2023-07-16 15:41:10 +09:00
Nobuyoshi Nakada da39936ce1
Prefer integer as base of intermediate logarithms
As long as "floating point numbers" cannot accurately represent an
irrational number, the result of the natural logarithm cannot be
accurate.  Logarithms with an integer base may have the possibility to
represent more accurately.
2023-07-16 01:24:44 +09:00
tomoya ishida be98bfc4ee [ruby/irb] Indent multiline percent literals
(https://github.com/ruby/irb/pull/643)

https://github.com/ruby/irb/commit/18bb4022a9
2023-07-15 18:12:05 +00:00
git baf70c7dfe Update default gems list at 7ffb995f5e [ci skip] 2023-07-15 15:59:56 +00:00
ima1zumi 7ffb995f5e [ruby/irb] Bump 1.7.4 (https://github.com/ruby/irb/pull/645)
https://github.com/ruby/irb/commit/b0f650a766
2023-07-15 15:59:18 +00:00
Tom Stuart c32b608e76 Add `--backtrace-limit` option to the man page 2023-07-16 00:39:01 +09:00
Tom Stuart de68e240c7 Allow -1 as the value of `--backtrace-limit` option
-1 is a legitimate backtrace limit — in fact, it’s the default — so it
should be possible to provide it with the `--backtrace-limit` option.
2023-07-16 00:39:01 +09:00
Nobuyoshi Nakada 125b4461df Test that command line `--backtrace-limit` overrides RUBYOPT
Co-authored-by: Tom Stuart <hi@tomstu.art>
2023-07-16 00:39:01 +09:00
Tom Stuart 72a3bb7edc Allow `--backtrace-limit` option to appear in RUBYOPT
There’s no reason to prevent RUBYOPT from controlling the backtrace
limit. In fact, Matz said [0] he was expecting this to be possible.

[0] https://bugs.ruby-lang.org/issues/8661#note-27
2023-07-16 00:39:01 +09:00
alexandre184 e5825de7c9
[Bug #19769] Fix range of size 1 in `String#tr` 2023-07-15 16:36:53 +09:00
Marcelo Pereira f15123c34c Fix stack trace for rescued StopIteration 2023-07-15 15:24:43 +09:00
yui-knk 82cd70ef93 Use functions defined by parser_st.c to reduce dependency on st.c 2023-07-15 12:50:40 +09:00
Jemma Issroff 6d2174477b [ruby/yarp] Remove pattern matching pinning to enable support for <= Ruby 3.0
Pattern matching variable pinning was introduced in Ruby 3.1. We
need to remove it from YARP to support earlier rubies.

https://github.com/ruby/yarp/commit/b792c58e3b
2023-07-14 21:00:51 +00:00
Peter Zhu 4e0b287912 Remove RGENGC_OLD_NEWOBJ_CHECK
The code doesn't compile, so probably nobody is using this.
2023-07-14 13:53:34 -04:00
Peter Zhu 914b657a2b Remove unused branch in write barrier
The branch doesn't compile, so it's probably not used.
2023-07-14 13:53:20 -04:00
jinroq ebb7552e6d
[Doc] Make build instructions easier to copy-and-paste 2023-07-14 12:52:33 -04:00
Stan Lo 174bc22570 [ruby/irb] Fix history-saving feature
(https://github.com/ruby/irb/pull/642)

* Define RelineInputMethod::HISTORY

The HistorySavingAbility module doesn't do anything if the input method
class doesn't define HISTORY.

- 3ac96be660/lib/irb/history.rb (L10)
- 3ac96be660/lib/irb/history.rb (L34)

This patch defines RelineInputMethod::HISTORY to avoid this.

* Improve history-saving's ability check

Instead of checking the existence of `input_method_class::HISTORY`, we should
make every input method class declare if it supports history saving or not.

Since the default value is `false`, it shouldn't break any custom input method
that inherits from `IRB::InputMethod`.

https://github.com/ruby/irb/commit/aec7a5b3f5
2023-07-14 15:45:09 +00:00
Nobuyoshi Nakada bc8cc68aef Make dtoa.c buildable alone 2023-07-14 18:35:23 +09:00
Nobuyoshi Nakada cfc564ac40 Include headers for `ruby_qsort` only if needed
If GNU `qsort_r` is available, we use the function and these headers
are not used.
2023-07-14 18:35:23 +09:00
Nobuyoshi Nakada ed3d8f74ec Delete a macro that has never been used, probably added by mistake 2023-07-14 18:35:23 +09:00
Kazuhiro NISHIYAMA c227ae7e64
Sort by URL [ci skip] 2023-07-14 09:01:38 +09:00
Jeremy Evans 5d4fff8456 Tighten Time.new(string) parsing
Disallow:

* Only year-month
* Only year-month-day
* Preceding whitespace
* Trailing whitespace

Fixes [Bug #19293]
2023-07-13 16:49:39 -07:00
Takashi Kokubun d814722fb8
YJIT: Make ratio_in_yjit always available (#8064) 2023-07-13 18:14:43 -04:00
Takashi Kokubun e850181acf Fix a CI failure on rbs
This commit applies https://github.com/ruby/rbs/pull/1374.
2023-07-13 13:41:41 -07:00
Peter Zhu 62ecf78b87 Don't pass array into ary_heap_alloc
We no longer need a reference to the array when allocating the buffer
because we no longer allocate through the transient heap.
2023-07-13 14:48:14 -04:00
Peter Zhu 87e1486d31 Remove unused references to the transient heap 2023-07-13 14:48:14 -04:00
Peter Zhu 3223181284 Remove RARRAY_CONST_PTR_TRANSIENT
RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT.
2023-07-13 14:48:14 -04:00
Peter Zhu de327ccb63 Remove RARRAY_PTR_USE_TRANSIENT
RARRAY_PTR_USE now does the same things as RARRAY_PTR_USE_TRANSIENT.
2023-07-13 14:48:14 -04:00
Peter Zhu 5ebc133116 Remove rb_array_ptr_use_{start,end} 2023-07-13 14:48:14 -04:00
Stan Lo 4999a53fe9 [ruby/irb] Unpend RDoc dialog related tests
(https://github.com/ruby/irb/pull/640)

* Unpend rdoc dialog tests

Without these tests, we don't have any coverage on autocompletion's rdoc
dialog, which is what caused #638 to happen.

* Pull ri doc on CI for the doc dialog test

* Assert different screen result on CI and local machine

https://github.com/ruby/irb/commit/3ac96be660
2023-07-13 16:52:13 +00:00
Matt Valentine-House 6a62b9b200 Remove unused forward declarations 2023-07-13 15:30:33 +01:00
Nobuyoshi Nakada db3b8f84f5 Set backtrace length limit at last
Command line options should have higher precedence than the same
options in shebang and `RUBYOPT`.
2023-07-13 22:59:26 +09:00
Nobuyoshi Nakada dbbc3583ba Preserve already set options in `moreswitches` 2023-07-13 22:59:26 +09:00