79041 Commits

Author SHA1 Message Date
Takashi Kokubun
c6a07cc33f Ignore more files for other gems as well
e.g. bin/ for reline that was included in its last commit.
2023-08-23 13:43:47 -07:00
Takashi Kokubun
eb795b0325 Avoid sync rule duplication between YARP and others 2023-08-23 13:35:41 -07:00
Kevin Newton
f33c412ebc [ruby/yarp] Constant paths followed by an & should be lexed as a call
https://github.com/ruby/yarp/commit/b0a2ba2c4d
2023-08-23 18:29:25 +00:00
Jean Boussier
cedb333063 Stop incrementing jit_entry_calls once threshold is hit
Otherwise the ISeq page will constantly be written
into preventing it from being shared.
2023-08-23 20:20:17 +02:00
Kevin Newton
24bcd49473 [ruby/yarp] Fix first method param lex failures
When Ripper encounters a method parameter that is the first
parameter and is an identifier and it shadows a local scope, it
incorrectly marks it as END|LABEL (because it think it's a local).

We need to account for that in the lex compat in order to properly
compare.

https://github.com/ruby/yarp/commit/15f725a1b1
2023-08-23 18:06:49 +00:00
Takashi Kokubun
5766fb7266 Fix gdb.py for C frames [ci skip] 2023-08-23 10:59:23 -07:00
HParker
9aca3528aa [ruby/yarp] Match EOF after newline behavior
in Ripper EOL after whitespace is returned as a on_nl node with the whitespace as the content

https://github.com/ruby/yarp/commit/be16d1deed
2023-08-23 17:23:15 +00:00
Rafael Mendonça França
774845284f Change yjit stats list to be a unordered list
Without using a list, this show as a single paragraph with all stats descriptions being in one single line
2023-08-23 19:20:55 +02:00
Kevin Newton
c837e1adfb [ruby/yarp] Add LABEL lex state when lexing a keyword params
https://github.com/ruby/yarp/commit/422bcd0ebf
2023-08-23 16:07:37 +00:00
Mike Dalessio
9c43ec621d [ruby/yarp] fix: newline tracking for a comment at EOF
https://github.com/ruby/yarp/commit/62fb0bddf5
2023-08-23 15:42:20 +00:00
Mike Dalessio
8f0a8e579d [ruby/yarp] Remove unnecessary loop
https://github.com/ruby/yarp/commit/86e8741ee3
2023-08-23 15:40:21 +00:00
Alan Wu
b4bc047f2f
YJIT: Implement VM_CALL_ARGS_BLOCKARG with Proc for ISeq calls
Rack uses this. Speculate that the `obj` in `the_call(&obj)`
will be a proc when the compile-time sample is a proc.

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2023-08-23 11:10:52 -04:00
Mike Dalessio
f902df128d [ruby/yarp] refactor: extract peek_addr()
In many places in the code we use the idiom:

    x < parser->end && *x == 'y'

which is essentially an extension of an existing pattern:

- `peek()` looks at `parser->current.end`
- `peek_at()` looks at `(parser->current.end + offset)`

This commit introduces a new inline function, `peek_addr`, which
accepts a pointer and encapsulates the address value check and
conditional dereferencing. The result is more readable code, and more
ubiquitous safety checks on pointer values, allowing us to rewrite the
above as:

    peek_addr(parser, x) == 'y'

Also:

- change the type of `peek_at()`'s offset argument from `size_t` to
  `ptrdiff_t` so that it can accept negative offsets.
- use `current_token_starts_line` in one place where the equivalent
  code is inline.
- use `peek` or `peek_at` to replace inline code in a few places

These changes simplify the code and make it easier to visually spot
patterns, particularly around line-endings (which will be a subject of
a future pull request).

https://github.com/ruby/yarp/commit/4c608d53ea
2023-08-23 15:08:35 +00:00
Aaron Patterson
58c1ebb634
Fix guard-heap upgrades (#8264)
* Fix guard-heap upgrades

`getinstancevariable` was generating more heap guards than I thought.
It turns out that the upgrade code has a bug in it.

Given the following Ruby code:

```ruby
class Foo
  def initialize
    @a = 1
    @b = 1
  end

  def foo
    [@a, @b]
  end
end

foo = Foo.new
10.times { foo.foo }

puts RubyVM::YJIT.disasm Foo.instance_method(:foo)
```

Before this commit, the machine code was like this:

```
== BLOCK 1/4, ISEQ RANGE [0,3), 36 bytes ======================
  # Insn: 0000 getinstancevariable (stack_size: 0)
  0x5562fb831023: mov rax, qword ptr [r13 + 0x18]
  # guard object is heap
  0x5562fb831027: test al, 7
  0x5562fb83102a: jne 0x5562fb833080
  0x5562fb831030: test rax, rax
  0x5562fb831033: je 0x5562fb833080
  # guard shape
  0x5562fb831039: cmp dword ptr [rax + 4], 0x18
  0x5562fb83103d: jne 0x5562fb833062
  # reg_temps: 00000000 -> 00000001
  0x5562fb831043: mov rsi, qword ptr [rax + 0x10]

== BLOCK 2/4, ISEQ RANGE [3,6), 0 bytes =======================
== BLOCK 3/4, ISEQ RANGE [3,6), 36 bytes ======================
  # regenerate_branch
  # Insn: 0003 getinstancevariable (stack_size: 1)
  # regenerate_branch
  0x5562fb831047: mov rax, qword ptr [r13 + 0x18]
  # guard object is heap
  0x5562fb83104b: test al, 7
  0x5562fb83104e: jne 0x5562fb8330db
  0x5562fb831054: test rax, rax
  0x5562fb831057: je 0x5562fb8330db
  # guard shape
  0x5562fb83105d: cmp dword ptr [rax + 4], 0x18
  0x5562fb831061: jne 0x5562fb8330ba
  # reg_temps: 00000001 -> 00000011
  0x5562fb831067: mov rdi, qword ptr [rax + 0x18]
```

After this commit, the machine code has fewer guards for `self`:

```
== BLOCK 1/4, ISEQ RANGE [0,3), 36 bytes ======================
  # Insn: 0000 getinstancevariable (stack_size: 0)
  0x55cb5db5f023: mov rax, qword ptr [r13 + 0x18]
  # guard object is heap
  0x55cb5db5f027: test al, 7
  0x55cb5db5f02a: jne 0x55cb5db61080
  0x55cb5db5f030: test rax, rax
  0x55cb5db5f033: je 0x55cb5db61080
  # guard shape
  0x55cb5db5f039: cmp dword ptr [rax + 4], 0x18
  0x55cb5db5f03d: jne 0x55cb5db61062
  # reg_temps: 00000000 -> 00000001
  0x55cb5db5f043: mov rsi, qword ptr [rax + 0x10]

== BLOCK 2/4, ISEQ RANGE [3,6), 0 bytes =======================
== BLOCK 3/4, ISEQ RANGE [3,6), 18 bytes ======================
  # regenerate_branch
  # Insn: 0003 getinstancevariable (stack_size: 1)
  # regenerate_branch
  0x55cb5db5f047: mov rax, qword ptr [r13 + 0x18]
  # guard shape
  0x55cb5db5f04b: cmp dword ptr [rax + 4], 0x18
  0x55cb5db5f04f: jne 0x55cb5db610ba
  # reg_temps: 00000001 -> 00000011
  0x55cb5db5f055: mov rdi, qword ptr [rax + 0x18]
```

Co-Authored-By: Takashi Kokubun <takashikkbn@gmail.com>

* Fix array/string guards as well

---------

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-08-23 10:34:03 -04:00
Burdette Lamar
448ff162c4
[DOC] Adding font usage to doc guide (#8255) 2023-08-23 10:09:24 -04:00
Nobuyoshi Nakada
129663c4a8
tool/lib/output.rb: Make --color option like GNU coreutils 2023-08-23 19:40:56 +09:00
Nobuyoshi Nakada
de4a1ca792
tool/lib/output.rb: Add --create-only and --overwrite options 2023-08-23 19:40:56 +09:00
Nobuyoshi Nakada
f1c6da65f4
tool/lib/output.rb: Add --no-color option 2023-08-23 19:40:55 +09:00
Takashi Kokubun
e89150b1d4
Render YARP templates into the build directory (#8266) 2023-08-22 21:56:51 -07:00
Jeremy Evans
347993e95c Call ruby_init_setproctitle before process_options
Fixes [Bug #11269]
2023-08-22 21:45:20 -07:00
eileencodes
b92d599eec Fix typo in anonymous class string
If anonymous was shorted it should be `anon` not `annon`. Fixes typo in
APPEND_S for anonymous classes.
2023-08-23 13:09:18 +09:00
yui-knk
00054de6b5 Remove nd_entry from NODE_GASGN and NODE_GVAR
After a0f12a0258e4020bd657ee80b7d8f22bd33ea223 NODE_GASGN and
NODE_GVAR hold same value on both nd_vid and nd_entry.
This commit stops setting value to nd_entry and makes to use only
nd_vid.
2023-08-23 07:59:54 +09:00
Alan Wu
ff55238913
YJIT: x64: Split mem-to-mem Insn::Store like Insn::Mov
The ARM backend allows for this so let's make x64 consistent.
2023-08-22 18:43:56 -04:00
Maxime Chevalier-Boisvert
c23e2e19b7
YJIT: add code_region_overhead stat output (#8262) 2023-08-22 17:36:12 -04:00
Benoit Daloze
2d75069779 [ruby/yarp] Use require_relative for yarp/ffi
https://github.com/ruby/yarp/commit/c0598f8805
2023-08-22 21:19:09 +00:00
Peter Zhu
837c12b0c8 Use STR_EMBED_P instead of testing STR_NOEMBED 2023-08-22 16:31:36 -04:00
Jemma Issroff
9b373fb428 [ruby/yarp] Fix small typo in templating to specify where template comes from
https://github.com/ruby/yarp/commit/96d69ceef6
2023-08-22 18:04:59 +00:00
Nobuyoshi Nakada
7127f39bac
Add notes and name a magic number 2023-08-22 23:46:32 +09:00
yui-knk
0ed3624c62 Wrap nd_head in node dump message with brackets 2023-08-22 20:01:25 +09:00
Hiroshi SHIBATA
1c93288f8b
Added bigdecimal to warning targets for the bundled gems.
[Bug #19843]
2023-08-22 14:35:25 +09:00
Takashi Kokubun
ceafdb5a23 Place -a in the correct location [ci skip]
It doesn't use optparse, so the location is not flexible.
2023-08-21 21:46:53 -07:00
git
ccc80043db Update default gems list at eec7a3f9ee0a40f4f5e22e0131c3ac [ci skip] 2023-08-22 04:46:44 +00:00
Takashi Kokubun
eec7a3f9ee [ruby/erb] Version 4.0.3
https://github.com/ruby/erb/commit/c594f2fb86
2023-08-21 21:45:55 -07:00
Takashi Kokubun
be889b6d6c Add a forgotten default value for ignored_paths 2023-08-21 21:45:33 -07:00
Josh Nichols
0955ca342e [ruby/erb] Enable frozen_string_literal in all files
(https://github.com/ruby/erb/pull/49)

I was surprised to see erb show up when I was using memory_profiler on
my app. ERB::Compiler#compile has a blank string literal, and it
ended up allocating some 41532 blank strings for a relatively small surface
area.

https://github.com/ruby/erb/commit/b7e45c2bdc
2023-08-22 04:41:22 +00:00
Takashi Kokubun
925ce3f4fb Skip commits that are empty after conflict resolution 2023-08-21 13:30:41 -07:00
Maxime Chevalier-Boisvert
eee83af34c
Update yjit.md, document --yjit-stats=quiet 2023-08-21 16:24:06 -04:00
Takashi Kokubun
2502821abb Exclude docs/ from YARP sync 2023-08-21 13:17:59 -07:00
Gaurav Khanna
b9ef819116 [rubygems/rubygems] Support ruby file: ".tool-versions" in Gemfile
(https://github.com/rubygems/rubygems/pull/6898)

Supports .tool-versions (ASDF) by checking for a line starting with "ruby"
before falling back to reading the entire file, as in .ruby-version.

https://github.com/rubygems/rubygems/commit/6c0a3e793a
2023-08-21 20:14:35 +00:00
Mike Dalessio
95e29b0423 [ruby/yarp] fix: avoid invalid memory read when CR is present without LF
https://github.com/ruby/yarp/commit/2296c037de
2023-08-21 19:00:55 +00:00
Mike Dalessio
461f8eaba7 [ruby/yarp] fix: parsing a '%' expression with a CR but not a newline
Previously this failed an assertion and aborted.

https://github.com/ruby/yarp/commit/a037d942a8
2023-08-21 19:00:52 +00:00
Stan Lo
ca6db02c2a [ruby/irb] Avoid overriding user's irb_name setting in debugger
integration
(https://github.com/ruby/irb/pull/688)

* Avoid overriding user's irb_name setting in debugger integration

Instead of always setting `irb_name` to `irb:rdbg`, it should respect
the user's setting and only append `:rdbg` to it.

* Introduce write_rc test helper

https://github.com/ruby/irb/commit/2ce7593351
2023-08-21 18:23:32 +00:00
Jemma Issroff
7d26c03267
Manually resync YARP
YARP commits were synced out of order. We are doing this reset
commit to ensure that all files are currently correct and we can
proceed with monitoring syncs so this doesn't happen again.
2023-08-21 10:45:56 -07:00
Mike Dalessio
2cecd3c8c1 [ruby/yarp] fix: newline tracking for nl-terminated % %q %Q
https://github.com/ruby/yarp/commit/1e4940864b
2023-08-21 10:43:25 -07:00
Mike Dalessio
9ca547b9fe [ruby/yarp] prefactor: extract yp_newline_list_check_append
https://github.com/ruby/yarp/commit/149c74291b
2023-08-21 10:43:24 -07:00
Mike Dalessio
926857eb1e [ruby/yarp] fix: support newline-terminated regular expressions
Previously, parsing a snippet like this:

    %r\nfoo\n

would result in tracking the second newline twice, resulting in a
failed runtime assertion.

Fixing that issue reveals another bug, which is that the _first_
newline was not being tracked at all. So we introduce a call to
yp_newline_list right when we construct the REGEXP_BEGIN token.

https://github.com/ruby/yarp/commit/0d5d759091
2023-08-21 10:43:23 -07:00
Kevin Newton
e63bac3128 [ruby/yarp] Rename statements to body where appropriate
https://github.com/ruby/yarp/commit/0aa7d9d10c
2023-08-21 10:43:21 -07:00
Kevin Newton
a7f40fc2d7 [ruby/yarp] Change AndWriteNode, OrWriteNode, OperatorWriteNode to contain write nodes
It makes it more difficult to find all locations where a variable
is written to if they're just read nodes. To keep things consistent
we should make them write nodes.

https://github.com/ruby/yarp/commit/840e094045
2023-08-21 10:43:18 -07:00
Kevin Newton
988b0108fb [ruby/yarp] Consolidate OperatorAndWrite and OperatorOrWrite nodes
https://github.com/ruby/yarp/commit/9e680a7598
2023-08-21 10:43:16 -07:00
HParker
339b34be47 [ruby/yarp] handle missing HEREDOC endline at start of heredoc
https://github.com/ruby/yarp/commit/7b72493b6d
2023-08-21 10:43:15 -07:00