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

85191 Коммитов

Автор SHA1 Сообщение Дата
yui-knk 140c59c633 Set `SCRIPT_LINES__` outside of parser
Parser should not depend on functions defiend on "ruby_parser.c".
2024-04-26 20:34:49 +09:00
Nobuyoshi Nakada 500586b401
Set executable on rdoc-srcdir [ci skip] 2024-04-26 19:22:16 +09:00
Nobuyoshi Nakada 762491db82 [DOC] Caveat about "allocate then wrap" 2024-04-26 18:17:09 +09:00
dependabot[bot] 0907127f5a Bump github/codeql-action from 3.25.2 to 3.25.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.2 to 3.25.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](8f596b4ae3...d39d31e687)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-25 20:03:24 -07:00
HASUMI Hitoshi 2244c58b00 [Universal parser] Decouple IMEMO from rb_ast_t
This patch removes the `VALUE flags` member from the `rb_ast_t` structure making `rb_ast_t` no longer an IMEMO object.

## Background

We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby.
To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE.

## Summary (file by file)

- `rubyparser.h`
  - Remove the `VALUE flags` member from `rb_ast_t`
- `ruby_parser.c` and `internal/ruby_parser.h`
  - Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it
    - You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()`
  - Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE`
  - rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c
- `iseq.c` and `vm_core.h`
  - Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE`
  - This keeps the VALUE of AST on the machine stack to prevent being removed by GC
- `ast.c`
  - Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff)
  - Fix `node_memsize()`
    - Now it includes `rb_ast_local_table_link`, `tokens` and script_lines
- `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c`
  - Follow-up due to the above changes
- `imemo.{c|h}`
  - If an object with `imemo_ast` appears, considers it a bug

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-04-26 11:21:08 +09:00
Alan Wu 9b5bc8e6ea YJIT: Relax `--yjit-verify-ctx` after singleton class creation
Types like `Type::CString` really only assert that at one point the object had
its class field equal to `String`. Once a singleton class is created for any
strings, the type makes no assertion about any class field anymore, and becomes
the same as `Type::TString`.

Previously, the `--yjit-verify-ctx` option wasn't allowing objects of these
kind that have have singleton classes to pass verification even though the code
generators handle it just fine.

Found through `ruby/spec`.
2024-04-25 18:38:14 -04:00
Peter Zhu 49753cd082 Use xcalloc for allocating shape tree
The GC is initialized by this point, so we can use xcalloc instead of
ruby_mimcalloc.
2024-04-25 17:11:34 -04:00
Kevin Newton af24ba4034 [PRISM] Raise LoadError when file cannot be read 2024-04-25 14:59:48 -04:00
Josh Nichols 6f4f360fc4 [rubygems/rubygems] Add auto_install support to require "bundler/setup"
We have some places that already use `bundle config auto_install true`,
ie:

7a144f3374/bundler/lib/bundler/cli.rb (L11)

This applies the same logic (copy and pasted) to happen when you
`require "bundler/setup"`.

https://github.com/rubygems/rubygems/commit/bb3c922341
2024-04-25 18:46:05 +00:00
Kevin Newton b6489e9f62 [ruby/prism] Remove need for Natalie patches
https://github.com/ruby/prism/commit/7fc7e13476
2024-04-25 18:00:09 +00:00
Takashi Kokubun 444553b528 Use -v to investigate which test is stuck 2024-04-25 10:38:56 -07:00
tomoya ishida 4ff249363d [ruby/reline] Fix inputrc nested $if $else $endif bug
(https://github.com/ruby/reline/pull/689)

https://github.com/ruby/reline/commit/0d8aea26ec
2024-04-25 16:12:50 +00:00
Daniel Colson 3a5d9553a7 Don't use assert_separately in Bug 20453 test
https://github.com/ruby/ruby/pull/10630#discussion_r1579565056

The PR was merged before I had a chance to address this feedback.
`assert_separately` is not necessary for this test if I don't use a
global timeout.
2024-04-25 11:28:56 -04:00
Daniel Colson d292a9b98c [Bug #20453] segfault in Regexp timeout
https://bugs.ruby-lang.org/issues/20228 started freeing `stk_base` to
avoid a memory leak. But `stk_base` is sometimes stack allocated (using
`xalloca`), so the free only works if the regex stack has grown enough
to hit `stack_double` (which uses `xmalloc` and `xrealloc`).

To reproduce the problem on master and 3.3.1:

```ruby
Regexp.timeout = 0.001
/^(a*)x$/ =~ "a" * 1000000 + "x"'
```

Some details about this potential fix:

`stk_base == stk_alloc` on
[init](dde99215f2/regexec.c (L1153)),
so if `stk_base != stk_alloc` we can be sure we called
[`stack_double`](dde99215f2/regexec.c (L1210))
and it's safe to free. It's also safe to free if we've
[saved](dde99215f2/regexec.c (L1187-L1189))
the stack to `msa->stack_p`, since we do the `stk_base != stk_alloc`
check before saving.

This matches the check we do inside
[`stack_double`](dde99215f2/regexec.c (L1221))
2024-04-25 10:28:18 -04:00
Takashi Kokubun 7ab1a608e7
YJIT: Optimize local variables when EP == BP (take 2) (#10607)
* Revert "Revert "YJIT: Optimize local variables when EP == BP" (#10584)"

This reverts commit c878344195.

* YJIT: Take care of GC references in ISEQ invariants

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>

---------

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2024-04-25 10:04:53 -04:00
Peter Zhu f248e1008a Embed rb_gc_function_map_t in rb_vm_t
Avoids a pointer indirection and memory allocation.
2024-04-25 09:25:33 -04:00
Kevin Newton b50e1e68b6 [PRISM] Enable more passing tests 2024-04-25 08:14:56 -04:00
David Rodriguez 5d2fb5d76b [rubygems/rubygems] Don't upcase Windows ENV when backing it up
I apparently did that to fix some issue with case insensitivity but I
didn't add a spec, and I think not upcasing should not cause issues.

https://github.com/rubygems/rubygems/commit/1b6f23275a
2024-04-25 10:35:47 +00:00
David Rodriguez 2871376510 [rubygems/rubygems] Remove unnecessary workaround
All supported rubies include the fix.

https://github.com/rubygems/rubygems/commit/9d74b699f5
2024-04-25 10:35:46 +00:00
David Rodríguez 5577f138b4 [rubygems/rubygems] Properly resolve aliases when `bundle help` is run
https://github.com/rubygems/rubygems/commit/5d9bf03c59
2024-04-25 10:35:02 +00:00
卜部昌平 64bd8e41df false is not a pointer
This function returned VALUE before.  False made sense back then.
Now that it returns a pointer.  NULL should be used instead.
2024-04-25 10:12:47 +02:00
Xi Ruoyao 03f8477566 [ruby/net-http] Skip test_session_reuse_but_expire with OpenSSL 3.3
OpenSSL 3.3.0 9 Apr 2024 is also broken.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>

https://github.com/ruby/net-http/commit/ab525c956d
2024-04-25 08:01:53 +00:00
Eugene Kenny 67dd9af17e [Bug #20450] Remove rubyarchdir from bootsnap paths 2024-04-25 13:29:28 +09:00
dependabot[bot] 01f6ea1583 Bump actions/checkout in /.github/actions/setup/directories
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.3 to 4.1.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1d96c772d1...0ad4b8fada)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-24 20:18:35 -07:00
dependabot[bot] d1813609d0 Bump actions/checkout from 4.1.3 to 4.1.4
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.3 to 4.1.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1d96c772d1...0ad4b8fada)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-24 20:04:36 -07:00
dependabot[bot] e8bc8f6024 Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](0fb21704c1...5e5f99653a)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-24 20:04:31 -07:00
Aaron Patterson 0434dfb76b We don't need to check if the ci is markable anymore
It doesn't matter if CI's are stack allocated or not.
2024-04-24 15:09:06 -07:00
Kevin Newton d3a7e55542
Update common.mk dependencies 2024-04-24 15:45:23 -04:00
Kevin Newton 4c431744b7 [ruby/prism] Warn for nested hashes as well
https://github.com/ruby/prism/commit/76e802f59e
2024-04-24 19:39:42 +00:00
Kevin Newton 7d64fbda53 [ruby/prism] Remove static literals dependence on parser definition
https://github.com/ruby/prism/commit/b3e104e8a2
2024-04-24 19:39:41 +00:00
Peter Zhu 214811974b Add ruby_mimcalloc
Many places call ruby_mimmalloc then MEMZERO. This can be reduced by
using ruby_mimcalloc instead.
2024-04-24 15:30:43 -04:00
Stan Lo 4349c7909f [ruby/irb] Memoize helper method instances with Singleton module
(https://github.com/ruby/irb/pull/931)

Some helpers, like Rails console's `app`, requires memoization of the
helper's ivars. To support it IRB needs to memoize helper method instances
as well.

https://github.com/ruby/irb/commit/a96c7a6668
2024-04-24 18:32:55 +00:00
Aaron Patterson 73a7e51535 Pass a callinfo object to global call cache search
Global call cache can be used with only a CI
2024-04-24 11:21:18 -07:00
Aaron Patterson 2cc59c1b31 pass CI to gccct_method_search_slowpath
Also the slow path only needs to look up the method once: via
vm_search_method_slowpath0.  gccct just returns whatever cc normal
method lookup does.
2024-04-24 11:21:18 -07:00
Kevin Newton 58847b7df8 [PRISM] Generate inspect_visitor in common.mk 2024-04-24 14:16:42 -04:00
Kevin Newton 6d9ba1e014 [ruby/prism] Change inspect from recursive to a queue
We would previously cause a stack overflow if we parsed a file that
was too deeply nested when we were calling inspect. Instead, we now
use a queue of commands to do it linearly so we don't.

https://github.com/ruby/prism/commit/0f21f5bfe1
2024-04-24 14:16:42 -04:00
tomoya ishida cf24a0483e [ruby/reline] Long line performance
(https://github.com/ruby/reline/pull/688)

* Improve C-e (ed_move_to_end) performance for long line

* Reline::Unicode.split_by_width optimization for RESET_SGR

https://github.com/ruby/reline/commit/0c8d3c827a
2024-04-24 17:33:40 +00:00
Peter Zhu 5c32a1503f Change dln_open in dmydln.c to return error instead of raise 2024-04-24 13:10:06 -04:00
Peter Zhu 057b69cfdf Pass string error buffer into dln_open
On Windows, the error exists on the stack so we should pass an error
buffer from the caller.
2024-04-24 13:10:06 -04:00
Aaron Patterson 853c0b1a77 Reuse slow path method search for gccct
This way all code paths use the same search code for finding call caches
for a particular method.
2024-04-24 09:30:59 -07:00
Stan Lo 9bba999be7 [ruby/irb] Revert "Memoize helper method instances with Singleton module"
This reverts commit https://github.com/ruby/irb/commit/169a9a2c3097.

https://github.com/ruby/irb/commit/221b0a4928
2024-04-24 16:01:23 +00:00
Stan Lo e5ca3d072f [ruby/irb] Memoize helper method instances with Singleton module
Some helpers, like Rails console's `app`, requires memoization of the
helper's ivars. To support it IRB needs to memoize helper method instances
as well.

https://github.com/ruby/irb/commit/169a9a2c30
2024-04-24 16:01:02 +00:00
Kevin Menard afc7799c32
YJIT: Add a specialized codegen function for `Class#superclass`. (#10613)
Add a specialized codegen function for `Class#superclass`.

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Takashi Kokubun (k0kubun) <takashikkbn@gmail.com>
Co-authored-by: Randy Stauner <randy.stauner@shopify.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2024-04-24 10:31:35 -04:00
Peter Zhu 480287d140 Add macro load_external_gc_func for loading functions from external GC 2024-04-24 10:31:03 -04:00
Nobuyoshi Nakada 91ff2fd9b5 Fix dllimport warnings
From Visual C:
```
../../../../../src/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c(5): warning C4273: 'rst_any_method': inconsistent dll linkage
D:\a\ruby\ruby\src\ext\-test-\load\resolve_symbol_target\resolve_symbol_target.h(4): note: see previous definition of 'rst_any_method'
../../../../../src/ext/-test-/load/stringify_target/stringify_target.c(5): warning C4273: 'stt_any_method': inconsistent dll linkage
D:\a\ruby\ruby\src\ext\-test-\load\stringify_target\stringify_target.h(4): note: see previous definition of 'stt_any_method'
```

From MinGW gcc:
```
../../../../../src/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c:5:1: warning: 'rst_any_method' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
compiling ../../../../../src/ext/-test-/marshal/compat/usrcompat.c
    5 | rst_any_method(VALUE klass)
      | ^~~~~~~~~~~~~~
../../../../../src/ext/-test-/load/stringify_target/stringify_target.c:5:1: warning: 'stt_any_method' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
    5 | stt_any_method(VALUE klass)
      | ^~~~~~~~~~~~~~
```
2024-04-24 18:02:09 +09:00
Hiroshi SHIBATA 7e8d8f250d
Removed obsoleted section because make docs is removed from default make task 2024-04-24 17:19:04 +09:00
dependabot[bot] 0b3bc7232a Bump ruby/setup-ruby from 1.174.0 to 1.175.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.174.0 to 1.175.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Commits](6bd3d993c6...70da3bbf44)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-23 20:22:22 -07:00
Nobuyoshi Nakada 66edc33f4e
[DOC] Wait for `docs` to complete before installing all
The document directories may be incomplete or empty before `docs` is
completed.
2024-04-24 12:06:20 +09:00
yui-knk 813e12557a Remove unused functions from `struct rb_parser_config_struct` 2024-04-24 07:59:51 +09:00
Stan Lo e11237904c
Sync IRB f9347b1 (#10611) 2024-04-23 21:00:56 +00:00