85233 Commits

Author SHA1 Message Date
卜部昌平
c844968b72 ruby tool/update-deps --fix 2024-04-27 21:55:28 +09:00
卜部昌平
bb5a538207 use of stdckdint.h
C23 is going to have this header.  The industry is already moving
towards accepting it; OSes and compilers started to implement theirs.

Why not detect its presence and if any, prefer over other ways.

See also:

- https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2683.pdf
- https://reviews.freebsd.org/D41734
- https://reviews.llvm.org/D157331
- https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8441841a1b985d68245954af1ff023db121b0635
2024-04-27 21:55:28 +09:00
HASUMI Hitoshi
9ea77cb351 Remove unnecessary assignment to ast->body.line_count
This patch removes a code that assigns `-1` to `ast->body.line_count` because, at least as of now, it looks not necessary.
I made this commit atomically revertable if I was wrong.

## Relevant commits

- The preparation for this PR: https://github.com/ruby/ruby/pull/10655/files#diff-2af2e7f2e1c28da5e9d99ad117cba1c4dabd8b0bc3081da88e414c55c6aa9549R1484-R1493
- The original commit that introduced the code: d65f7458bc
2024-04-27 17:56:20 +09:00
jinroq
ef3e3e9a2f
Fixed a value specified for OPT_THREADED_CODE (#10657)
Values defined for OPT_THREADED_CODE are 0,1,2. However, 1,2,3 are set in workflow. It seems that case 3 does not exist, so 0 is specified instead.

Co-authored-by: jinroq <jinroq@users.noreply.github.com>
2024-04-26 20:47:45 -07:00
Takashi Kokubun
8089faee45 Revert "YJIT: Try splitting getlocal/setlocal blocks (#10648)"
This reverts commit ab228bd0844758a1c444e39030c153874adf9120.
2024-04-26 20:43:22 -07:00
HASUMI Hitoshi
55a402bb75 Add line_count field to rb_ast_body_t
This patch adds `int line_count` field to `rb_ast_body_t` structure.
Instead, we no longer cast `script_lines` to Fixnum.

## Background

Ref https://github.com/ruby/ruby/pull/10618

In the PR above, we have decoupled IMEMO from `rb_ast_t`.
This means we could lift the five-words-restriction of the structure
that forced us to unionize `rb_ast_t *` and `FIXNUM` in one field.

## Relating refactor

- Remove the second parameter of `rb_ruby_ast_new()` function

## Attention

I will remove a code that assigns -1 to line_count, in `rb_binding_add_dynavars()`
of vm.c, because I don't think it is necessary.
But I will make another PR for this so that we can atomically revert
in case I was wrong (See the comment on the code)
2024-04-27 12:08:26 +09:00
yui-knk
bf1f16ef47 Lrama v0.6.6 2024-04-27 10:06:09 +09:00
Alan Wu
2ba7c1b142 YJIT: Correct signature of rb_yjit_root_mark()
Even though unused, it's supposed to take a pointer like the C side
expects.
2024-04-26 18:03:26 -07:00
Alan Wu
83c03cc73a YJIT: Stop asserting rb_objspace_markable_object_p()
Because of the way things are sequenced, it doesn't work properly during
auto-compaction.
2024-04-26 18:03:26 -07:00
Alan Wu
73eeb8643b YJIT: Fix reference update for Invariants::no_ep_escape_iseqs
Previously, the update was done in the ISEQ callback. That effectively
never updated anything because the callback itself is given an intact
reference, so it could update its content, and `rb_gc_location(iseq)`
never returned a new address. Update the whole table once in the YJIT
root instead.
2024-04-26 18:03:26 -07:00
Takashi Kokubun
c746332c79 Revert "Use -v to investigate which test is stuck"
This reverts commit 444553b528a54a97e539de212ffc4c6466a6db20.

At least it should no longer timeout.
2024-04-26 17:35:52 -07:00
Takashi Kokubun
c32366ff79 Avoid overriding GNUMAKEFLAGS's -j
.github/actions/setup/directories/action.yml sets GNUMAKEFLAGS. Having
-j here is rather harmful.

Partly reverts f8dad616c2ee2d83b3162da8d86865b0f2a782de.
2024-04-26 17:18:49 -07:00
Peter Zhu
f64c97418b Allow RUBY_GC_LIBRARY_PATH to be set in miniruby
miniruby is used by tool/runruby.rb, so we need to ensure we don't rb_bug
when RUBY_GC_LIBRARY_PATH is set so we can run tests using the make
commands. This commit changes it to warn instead.
2024-04-26 17:02:08 -04:00
git
392b811baf Update default gems list at 3872e54039f467cdab5c9a0e384d91 [ci skip] 2024-04-26 21:01:55 +00:00
Kevin Newton
ddce8ca831 [PRISM] Enable integer test 2024-04-26 17:01:13 -04:00
Kevin Newton
3872e54039 [ruby/prism] Bump to v0.27.0
https://github.com/ruby/prism/commit/c9edeef91a
2024-04-26 17:01:03 -04:00
Kevin Newton
bb3dd5b808 [PRISM] Sync latest config.yml documentation updates 2024-04-26 17:01:03 -04:00
Peter Zhu
41e17f5624 Fix compiler warning for ruby_external_gc_init
Fixes:

    warning: old-style function definition [-Wold-style-definition]
2024-04-26 16:58:20 -04:00
Takashi Kokubun
ab228bd084
YJIT: Try splitting getlocal/setlocal blocks (#10648) 2024-04-26 13:02:22 -07:00
Kevin Newton
46480e3042 [PRISM] Use redundant return flag 2024-04-26 15:16:58 -04:00
Kevin Newton
9688093124 [ruby/prism] Location#slice_lines, Node#slice_lines
https://github.com/ruby/prism/commit/9b61f6fdb3
2024-04-26 19:05:32 +00:00
Kevin Newton
0599184a18 [ruby/prism] Match CRuby error messages for invalid numerics
https://github.com/ruby/prism/commit/be21a1bd1d
2024-04-26 18:55:27 +00:00
Takashi Kokubun
a1db69f0c9 Skip a flaky Ractor test for YJIT
https://github.com/ruby/ruby/actions/runs/8852277192/job/24310631888
https://github.com/ruby/ruby/actions/runs/8851325573/job/24307638329

This seems like an existing, separate issue from what we're currently
investigating. The `iseq->body->jit_entry` setup is not Ractor-safe?
Let me suppress this for now and revisit this after resolving the
ongoing issue.
2024-04-26 11:11:30 -07:00
Kevin Newton
6a296089c6 [ruby/prism] Add a flag on returns when they are redundant
https://github.com/ruby/prism/commit/450541d2c3
2024-04-26 18:10:42 +00:00
Stan Lo
148518baa0 [ruby/irb] Suppress command return values
(https://github.com/ruby/irb/pull/934)

Since commands can't be chained with methods, their return values are
not intended to be used. But if IRB keeps storing command return values
as the last value, and print them, users may rely on such implicit
behaviour.

So to avoid such confusion, this commit suppresses command's
return values. It also updates some commands that currently rely on
this implicit behaviour.

https://github.com/ruby/irb/commit/fa96bea76f
2024-04-26 17:52:12 +00:00
Job Snijders
6b120135af [ruby/openssl] Only CSR version 1 (encoded as 0) is allowed by PKIX standards
RFC 2986, section 4.1 only defines version 1 for CSRs. This version
is encoded as a 0. Starting with OpenSSL 3.3, setting the CSR version
to anything but 1 fails.

Do not attempt to generate a CSR with invalid version (which now fails)
and invalidate the CSR in test_sign_and_verify_rsa_sha1 by changing its
subject rather than using an invalid version.

This commit fixes the following error.

```
 2) Error: test_version(OpenSSL::TestX509Request): OpenSSL::X509::RequestError:
X509_REQ_set_version: passed invalid argument
/home/runner/work/openssl/openssl/test/openssl/test_x509req.rb:18:in `version='
/home/runner/work/openssl/openssl/test/openssl/test_x509req.rb:18:in `issue_csr'
/home/runner/work/openssl/openssl/test/openssl/test_x509req.rb:43:in
`test_version'
     40:     req = OpenSSL::X509::Request.new(req.to_der)
     41:     assert_equal(0, req.version)
     42:
  => 43:     req = issue_csr(1, @dn, @rsa1024, OpenSSL::Digest.new('SHA256'))
     44:     assert_equal(1, req.version)
     45:     req = OpenSSL::X509::Request.new(req.to_der)
     46:     assert_equal(1, req.version)
```

https://github.com/ruby/openssl/commit/c06fdeb091
2024-04-26 16:55:15 +00:00
Kevin Newton
9aecff2530 [PRISM] Fix up if condition branch coverage location 2024-04-26 12:25:45 -04:00
Kevin Newton
c46e32e342 [PRISM] Fix up branch coverage for &. with block 2024-04-26 12:25:45 -04:00
Kevin Newton
d06bbafd3f [PRISM] Enable branch coverage for if/unless conditionals 2024-04-26 12:25:45 -04:00
Kevin Newton
881c450135 [PRISM] Enable branch coverage for while/until loops 2024-04-26 12:25:45 -04:00
Kevin Newton
43076bf9d1 [PRISM] Enable branch coverage for case pattern matching 2024-04-26 12:25:45 -04:00
Kevin Newton
e5bd4c78b2 [PRISM] Enable branch coverage for case 2024-04-26 12:25:45 -04:00
Kevin Newton
235a3f3b7c [PRISM] Enable branch coverage for &. 2024-04-26 12:25:45 -04:00
Kevin Newton
6509634eba [PRISM] Modify test_coverage to take prism into account 2024-04-26 12:25:45 -04:00
Kevin Newton
94d6295b2d [PRISM] Enable coverage in eval ISEQs 2024-04-26 12:25:45 -04:00
Kevin Newton
49764869af [PRISM] Enable coverage in top and main iseqs 2024-04-26 12:25:45 -04:00
Kevin Newton
af800bef21 Remove dependency on NODE from coverage structure 2024-04-26 12:25:45 -04:00
Peter Zhu
353cba4955 Use fprintf for error message when loading external GC
The error message is often long, so using a small buffer could cause it
to be truncated. rb_bug also has a 256 byte message buffer, so it could
also be truncated.
2024-04-26 11:43:14 -04:00
Sam Aaron
67b79d484f
Enable Ruby to run on Windows with frozen string literals 2024-04-26 15:10:42 +00:00
Diego Henrique
69c1bd90be
[DOC] Fix a typo in globals.rdoc
Noticed this small type while reading the docs.
2024-04-26 14:31:36 +00:00
Artur
dd578cf2f1
[DOC] Enhance Numeric#nonzero? doc
Add `zero?` as a related method
2024-04-26 12:33:41 +00:00
Stan Lo
25a8b76c76 [ruby/irb] Command registration should take both strings and symbols
as names
(https://github.com/ruby/irb/pull/932)

This will save users some heads scratching when they try to register a
command with a string name and found that it doesn't work.

I also rewrote converted custom command tests into integration tests to
make test setup/cleanup easier.

https://github.com/ruby/irb/commit/a91a212dbe
2024-04-26 12:12:31 +00:00
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