79677 Commits

Author SHA1 Message Date
Benoit Daloze
4172036bc6 [ruby/yarp] Do not desugar Foo::Bar {||,&&,+}= baz as it is incorrect without a temporary variable
* See https://github.com/ruby/yarp/pull/1329#discussion_r1310775433 for details.

https://github.com/ruby/yarp/commit/f0fdcba0c3
2023-09-01 13:18:29 +00:00
Benoit Daloze
7fb56df726 [ruby/yarp] Fix comments for methods using desugar_or_write_defined_node
https://github.com/ruby/yarp/commit/a39147736e
2023-09-01 13:18:29 +00:00
Hiroshi SHIBATA
2efd59e2eb [rubygems/rubygems] Use assertion message strictly
https://github.com/rubygems/rubygems/commit/98da5b9826
2023-09-01 07:04:43 +00:00
Nobuyoshi Nakada
4c040fe850
Copy compile options from AST directly without intermediate Hash 2023-09-01 14:06:42 +09:00
Nobuyoshi Nakada
1fbc8cdf06
Copy rb_compile_option_t only if needed
Use `COMPILE_OPTION_DEFAULT` if nothing to change.
2023-09-01 13:39:36 +09:00
Nobuyoshi Nakada
61f1657f68
Use macro argument not the variable directly 2023-09-01 13:36:15 +09:00
yui-knk
45cd011d73 [Bug #19281] Allow semicolon in parenthesis at the first argument of command call
Allow compstmt in the first argument of command call wrapped with parenthesis
like following arguments with parenthesis.
2023-09-01 12:55:09 +09:00
Mike Dalessio
df4c77608e [ruby/yarp] fix: octal, hex, and unicode strings at the end of a
file
(https://github.com/ruby/yarp/pull/1371)

* refactor: move EOF check into yp_unescape_calculate_difference

parser_lex is a bit more readable when we can rely on that behavior

* fix: octal and hex digits at the end of a file

Previously this resulted in invalid memory access.

* fix: unicode strings at the end of a file

Previously this resulted in invalid memory access.

* Unterminated curly-bracket unicode is a syntax error

https://github.com/ruby/yarp/commit/21cf11acb5
2023-08-31 22:40:35 +00:00
Nobuyoshi Nakada
9930363aab [Bug-18878] Parse qualified const with brace block as method call 2023-09-01 04:26:31 +09:00
Matt Valentine-House
945945dad4 Remove gc_mark_values
Now that gc_mark_values and rb_gc_mark_values are identical, we should
remove one.
2023-08-31 19:31:18 +01:00
Matt Valentine-House
322548180d Prevent rb_gc_mark_values from pinning objects
This is an internal only function not exposed to the C extension API.
It's only use so far is from rb_vm_mark, where it's used to mark the
values in the vm->trap_list.cmd array.

There shouldn't be any reason why these cannot move.

This commit allows them to move by updating their references during the
reference updating step of compaction.

To do this we've introduced another internal function
rb_gc_update_values as a partner to rb_gc_mark_values.

This allows us to refactor rb_gc_mark_values to not pin
2023-08-31 19:31:18 +01:00
Burdette Lamar
84fa8ae84e
[DOC] RDoc for #spawn (#8342) 2023-08-31 14:02:09 -04:00
Nathan Froyd
8470acc1ec [ruby/yarp] add some const qualifiers to local variables
https://github.com/ruby/yarp/commit/eb3c6eb928
2023-08-31 17:43:50 +00:00
Mau Magnaguagno
ace41c556a
[YARP] Avoid if-else in yp_compile_node (#8336)
Move last node case outside for loop.
2023-08-31 10:00:19 -07:00
Jemma Issroff
b90457b210
[YARP] Implement SourceNodes (File, Line, Encoding) (#8328)
* [YARP] Implement SourceNodes (File, Line, Encoding)
2023-08-31 09:56:13 -07:00
Stan Lo
3678734fac [ruby/irb] Drop rdoc's version requirement
(https://github.com/ruby/irb/pull/704)

1. The newer versions of rdoc requires pysch 4.0+, which could break apps
   using Ruby 3.0 or 2.7. #703 has more detailed explanation on this.
2. We actually don't use any version-specific rdoc APIs. So having a version
    requirement is not necessary atm.

https://github.com/ruby/irb/commit/3e6ba78c42
2023-08-31 15:44:17 +00:00
John Hawthorn
43825fba6e YJIT: Handle getblockparamproxy with ifunc
getblockparamproxy for "ifunc" behaves identically to iseq, in just
pushing rb_block_param_proxy.
2023-08-31 10:46:24 -04:00
Jean Boussier
0270210e49 TestSocket_UNIXSocket: stop testing empty packets
OpenBSD and Solaris behave differently here.

Linux does deliver the empty packet, which is questionable
as it's undistinguishable from a closed connection.

It seems that OpenBSD and Solaris simply drop it.

We could test the platform before doing the assertion, but
it would likely be fragile, and the entire web recommend
to not ever send an empty packet, so the value of this
assertion is low.
2023-08-31 16:43:58 +02:00
Burdette Lamar
b8e782c1b5
[DOC] Link fix (#8340) 2023-08-31 10:27:10 -04:00
Stan Lo
8804a70387 [ruby/irb] Require Reline 0.3.8+
(https://github.com/ruby/irb/pull/702)

Reline 0.3.8 reduces the chance of having a deadlock with the debugger
while using the new `irb:rdbg` integration.

https://github.com/ruby/irb/commit/9b8c56b7d4
2023-08-31 14:08:08 +00:00
Peter Zhu
4f0d58260a Correctly calculate initial pages
The old algorithm could calculate an undercount for the initial pages
due to two issues:

1. It did not take into account that some heap pages will have one less
   slot due to alignment. It assumed that every heap page would be able
   to be fully filled with slots. Pages that are unaligned with the slot
   size will lose one slot. The new algorithm assumes that every page
   will be unaligned.
2. It performed integer division, which truncates down. This means that
   the number of pages might not actually satisfy the number of slots.

This can cause the heap to grow in `gc_sweep_finish_size_pool` after
allocating all of the allocatable pages because the total number of
slots would be less than the initial configured number of slots.
2023-08-31 09:28:31 -04:00
Burdette Lamar
eb3d94f4ba
[DOC] RDoc for Kernel#system (#8309) 2023-08-31 09:06:11 -04:00
Nobuyoshi Nakada
c45176dbca
[Bug #19349] Respect #to_int of base argument 2023-08-31 16:49:58 +09:00
Nobuyoshi Nakada
24b2bb465f
Separate test for Kernel#Integer with base argument 2023-08-31 16:49:57 +09:00
Hiroshi SHIBATA
07ddb3589f [ruby/shellwords] omit blank line
https://github.com/ruby/shellwords/commit/b45de514ab
2023-08-31 07:35:45 +00:00
Nobuyoshi Nakada
b7364069bf
[YARP] Remove Java templates [ci skip] 2023-08-31 14:37:22 +09:00
Nobuyoshi Nakada
fa70e361e0
CodeQL: Increase memory size [ci skip]
Query evaluation ran out of Java heap frequently since CodeQL 2.14.3.
2023-08-31 14:06:35 +09:00
Nobuyoshi Nakada
2ce1b77ce0
sync_default_gems.rb: Discard some error messages
These messages are expected:
- `cat-file -e` at newly added entries.
- `commit --amend` when all changes removed.
2023-08-31 11:32:29 +09:00
Nobuyoshi Nakada
cbe36ef6cc
sync_default_gems.rb: Remove the pattern for yarp
Changes to `ext/yarp/extconf.rb` are detected as conflicts now, and
ignored.
2023-08-31 11:32:21 +09:00
Nobuyoshi Nakada
3d2a83b909
sync_default_gems.rb: Remove the pattern for bundler
The "bundler" directory at the top-level will be removed by more
generic rule for top-level new entries.
2023-08-31 10:54:26 +09:00
Nobuyoshi Nakada
97df09f276
sync_default_gems.rb: Refactor
- Filter out files to be ignored first, then resolve conflicts.
- Add "added by gem" files, instead of hard-code paths to add.
- Remove gem specific patterns covered by more generic rules.
2023-08-31 10:30:36 +09:00
Nobuyoshi Nakada
dc911a47ce
sync_default_gems.rb: Move ignored_paths to ignore_file_pattern_for 2023-08-31 10:30:35 +09:00
Peter Zhu
0aa404b957 Change heap init environment variable names
This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to
RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the
user does not need to determine the slot sizes (which can vary between
32 and 64 bit systems). They now just use the heap names
(`GC.stat_heap.keys`).
2023-08-30 19:37:11 -04:00
Kevin Newton
4aa98b2760 [ruby/yarp] Add a value to numbered references
https://github.com/ruby/yarp/commit/5d9b048971
2023-08-30 21:31:36 +00:00
Jemma Issroff
36786cc381
[YARP] Compile ProgramNode as ScopeNode (#8327)
* [YARP] Compile ProgramNode as ScopeNode
2023-08-30 14:30:42 -07:00
Jemma Issroff
0ec5021f3d
[YARP] Implement BreakNode, NextNode, RedoNode (#8334) 2023-08-30 14:27:08 -07:00
Jemma Issroff
f1790fa4e7
[YARP] Fix variables in compilation (#8326)
* [YARP] Fixed several popped instructions

* [YARP] Correctly compiling class path
2023-08-30 14:26:22 -07:00
Mike Dalessio
6599ca44bb [ruby/yarp] simplify the calling convention for unescape
We don't need to pass in a destination pointer _and_ a write_to_str
boolean flag.

https://github.com/ruby/yarp/commit/347cb29ebb
2023-08-30 20:51:49 +00:00
Mike Dalessio
bbaae3681c [ruby/yarp] fix: regular expression with start and end out of order
Also, a similar test and fix for interpolated regular expressions.

This snippet:

    <<-A.g//,
    A
    /{/, ''\

previously created a regular expression node with inverted start and
end:

    RegularExpressionNode(14...13)((14...15), (15...21), (12...13), ", ''", 0),

which failed an assertion during serialization.

After this change:

    RegularExpressionNode(12...15)((14...15), (15...21), (12...13), ", ''", 0),

Found by the fuzzer.

https://github.com/ruby/yarp/commit/5fef572f95
2023-08-30 20:46:09 +00:00
Mike Dalessio
6beaf010a4 [ruby/yarp] fix: binary CallNode with out-of-order arg and receiver
The snippet added in this commit previously resulted in a CallNode
with inverted start and end locations:

    >   AssocNode(15...13)(
    >     CallNode(15...13)(
            StringNode(15...17)((15...16), (16...16), (16...17), ""),
            nil,
            (12...13),
            nil,
            ArgumentsNode(12...13)([MissingNode(12...13)()]),
            nil,
            nil,
            0,
            "/"
          ),
          MissingNode(13...13)(),
          (13...13)
        ),

which failed an assertion during serialization.

After this change, it looks better:

    >   AssocNode(12...13)(
    >     CallNode(12...17)(
            StringNode(15...17)((15...16), (16...16), (16...17), ""),
            nil,
            (12...13),
            nil,
            ArgumentsNode(12...13)([MissingNode(12...13)()]),
            nil,
            nil,
            0,
            "/"
          ),
          MissingNode(13...13)(),
          (13...13)
        ),

Found by the fuzzer.

https://github.com/ruby/yarp/commit/040aa63ad6
2023-08-30 20:46:09 +00:00
Mike Dalessio
f80582cda8 [ruby/yarp] fix: StatementsNode with out-of-order body nodes
The presence of the heredocs in this snippet with invalid syntax:

    for <<A + <<B
    A
    B

causes the MissingNode to have a location after other nodes in the
list, resulting in a StatementsNode with inverted start and end
locations:

      [ForNode(0...14)(
         MultiWriteNode(4...7)([InterpolatedStringNode(4...7)((4...7), [], (14...16))], nil, nil, nil, nil),
         MissingNode(16...16)(),
    >    StatementsNode(16...14)(
           [MissingNode(16...16)(), InterpolatedStringNode(10...13)((10...13), [], (16...18)), MissingNode(13...14)()]
         ),
         (0...3),
         (16...16),
         nil,
         (14...14)
       )]

which failed an assertion during serialization.

With this fix, the node's locations are:

      [ForNode(0...14)(
         MultiWriteNode(4...7)([InterpolatedStringNode(4...7)((4...7), [], (14...16))], nil, nil, nil, nil),
         MissingNode(16...16)(),
    >    StatementsNode(10...16)(
           [MissingNode(16...16)(), InterpolatedStringNode(10...13)((10...13), [], (16...18)), MissingNode(13...14)()]
         ),
         (0...3),
         (16...16),
         nil,
         (14...14)
       )]

Found by the fuzzer.

https://github.com/ruby/yarp/commit/09bcedc05e
2023-08-30 20:46:08 +00:00
Kevin Newton
209eda599a [ruby/yarp] BASERUBY fails because of .then not existing
https://github.com/ruby/yarp/commit/db925f2b88
2023-08-30 20:44:27 +00:00
Kevin Newton
cc71e2344b [ruby/yarp] Revisit lex.rake, make lex:rubygems more useable
https://github.com/ruby/yarp/commit/4c76f4a0c0
2023-08-30 20:42:01 +00:00
Kevin Newton
c46858fd6a [ruby/yarp] Nest all of the YARP tests under the YARP namespace
https://github.com/ruby/yarp/commit/440cf93a70
2023-08-30 20:41:59 +00:00
Kevin Newton
c0cb9efb16 [ruby/yarp] Fix up Rust config.yml reading
https://github.com/ruby/yarp/commit/087f367847
2023-08-30 20:41:40 +00:00
Kevin Newton
ff024150e7 [ruby/yarp] Rename child_nodes to fields
https://github.com/ruby/yarp/commit/715fce9264
2023-08-30 20:41:39 +00:00
Kevin Newton
f83070816d [ruby/yarp] Move templating logic until YARP
https://github.com/ruby/yarp/commit/8b7430dbc7
2023-08-30 20:41:39 +00:00
Jeremy Evans
ae609a995e Document that Kernel#p is for debugging and may be uninterruptible [ci skip]
Fixes [Bug #18810]
2023-08-30 21:21:02 +01:00
Kevin Newton
00dbee94ac [ruby/yarp] Add class variables to the constant pool
https://github.com/ruby/yarp/commit/be5cb60c83
2023-08-30 19:59:28 +00:00
Kevin Newton
151e94fee5 [ruby/yarp] Fix instance variable constant names
https://github.com/ruby/yarp/commit/1f94f55fcb
2023-08-30 19:59:26 +00:00