79677 Commits

Author SHA1 Message Date
Maxime Chevalier-Boisvert
8d7861e3da
YJIT: expand bitwise shift support in x86 assembler (#8174) 2023-08-04 14:57:56 -04:00
Stan Lo
c4066af35e [ruby/irb] Store integration tests' envs in an ivar
(https://github.com/ruby/irb/pull/668)

https://github.com/ruby/irb/commit/bbd20445ea
2023-08-04 17:13:55 +00:00
Maxime Chevalier-Boisvert
fc0b2a8df2
YJIT: guard for array_len >= num in expandarray (#8169)
Avoid generating long dispatch chains for all array lengths seen.
2023-08-04 10:09:43 -04:00
Peter Zhu
61b76e74af Revert "Tests to move between size pools are flaky on Windows too"
This reverts commit c5abe0d08f8f7686422e6eef374cf8c78aefacb6.
2023-08-04 09:13:57 -04:00
Peter Zhu
4b45b2764b Don't check stack for moved after compaction
We don't need to check stack for moved objects after compaction because
the mutator cannot run between marking the stack and the end of
compaction. However, the stack may have moved objects leftover from
marking and sweeping phases. This means that their pages will be
invalidated and all objects moved back. We don't need to move these
objects back.

This also fixes the issue on Windows where some compaction tests
sometimes fail due to the page of the object being invalidated.
2023-08-04 09:13:57 -04:00
Hiroshi SHIBATA
6b570ff2c0 Display call location with bundled gems warning 2023-08-04 21:12:09 +09:00
Hiroshi SHIBATA
ae8fd392d5 Fixed worng key of bundled_gems list 2023-08-04 21:12:09 +09:00
Hiroshi SHIBATA
a0b695b4e6 Also decorate warning message with future tense for bundler 2023-08-04 21:12:09 +09:00
Hiroshi SHIBATA
ede3c5ee0f Use future tense if current version is older than list version 2023-08-04 21:12:09 +09:00
Nobuyoshi Nakada
48f0352280 Fetch the last element only when not empty
Also `flag_keyword_hash` sets to 0 or a hash object.
2023-08-04 20:59:46 +09:00
Stan Lo
0dc0c24cad [ruby/irb] Fix IntegrationTestCase
(https://github.com/ruby/irb/pull/667)

https://github.com/ruby/irb/commit/79fc6dcf5f
2023-08-04 11:16:04 +00:00
Maxime Chevalier-Boisvert
4f99240b2e
YJIT: add jb (unsigned less-than) instruction to backend (#8168) 2023-08-03 16:14:44 -04:00
Maxime Chevalier-Boisvert
98b4256aa7
YJIT: handle expandarray_rhs_too_small case (#8161)
* YJIT: handle expandarray_rhs_too_small case

YJIT: fix csel bug in x86 backend, add test

Remove commented out lines

Refactor expandarray to use chain guards

Propagate Type::Nil when known

Update yjit/src/codegen.rs

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

* Add missing counter, use get_array_ptr() in expandarray

* Make change suggested by Kokubun to reuse loop

---------

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-08-03 16:09:18 -04:00
Kunshan Wang
132f097149 No computing embed_capa_max in str_subseq
Fix str_subseq so that it does not attempt to predict the size of the
object returned by str_alloc_heap.
2023-08-03 14:52:44 -04:00
Takashi Kokubun
b35a222348 gdb.py: Support dumping a dummy frame [ci skip] 2023-08-03 09:55:37 -07:00
Peter Zhu
c65856d44f Remove unneeded function prototype
Function prototype for gc_mode_transition is not needed as it's not
used before the implementation.
2023-08-03 11:12:07 -04:00
Kunshan Wang
aeff31168a No computing embed_capa_max in ary_make_partial
ary_make_partial now uses the actual embed_capa of an allocated heap
array to guide whether make an embedded copy or a slice view.
2023-08-03 08:34:24 -04:00
Nobuyoshi Nakada
5336b2f0db
Move a local variable declaration after the protected region 2023-08-03 13:43:04 +09:00
Nobuyoshi Nakada
8f2bbbbcaf
Add assertion in RHASH_AR_TABLE_BOUND 2023-08-03 13:17:41 +09:00
Nobuyoshi Nakada
fe977314d5
Check if reader members are set 2023-08-03 09:51:52 +09:00
Peter Zhu
4b6c584023 Remove --disable-gems for assert_separately
assert_separately adds --disable=gems so we don't need to add
--disable-gems when calling assert_separately.
2023-08-03 09:11:08 +09:00
git
29fd05036b * remove trailing spaces. [ci skip] 2023-08-02 23:43:29 +00:00
Takashi Kokubun
192ed8e70f gdb.py: Add -a option to dump all frames [ci skip] 2023-08-02 16:43:12 -07:00
Takashi Kokubun
5f5cc22b5f gdb.py: Print Env based on EP instead of BP
because EP could be escaped.
2023-08-02 16:23:55 -07:00
Stan Lo
32e828bb4a [ruby/irb] Deprecate multi-irb commands
(https://github.com/ruby/irb/pull/654)

* Deprecate multi-irb commands

- Print deprecated message when any of the commands are used
- Put related commands under `Multi-irb` category with a deprecated
  label

* Update readme

https://github.com/ruby/irb/commit/861731ac12
2023-08-02 18:35:08 +00:00
Stan Lo
8ecd300e1e [ruby/irb] Extract integration testing helpers out of debug command
tests
(https://github.com/ruby/irb/pull/660)

The ability to run a test case in a subprocess is useful for testing
many other features, like nested IRB sessions. So I think it's worth
extracting them into a new test case class.

https://github.com/ruby/irb/commit/73b7a895f8
2023-08-02 18:33:43 +00:00
Benoit Daloze
dc54574ade Update to ruby/spec@9e278f5 2023-08-02 18:53:03 +02:00
Jean byroot Boussier
e20f1e443f
YJIT: Fallback setivar if the receiver isn't T_OBJECT (#8160)
Followup: https://github.com/ruby/ruby/pull/8152

If the receiver is a T_MODULE or T_CLASS and has a lot of
ivars, `get_next_shape_internal` will return `NULL`.

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2023-08-02 11:33:12 -04:00
Benoit Daloze
3c41a04b6c Fix encoding switches when RUBYOPT is empty or only spaces
* Follow-up of dbbc3583ba432c279f07b1fa0afb0a8a9ba50c91 which broke this.
2023-08-02 17:13:38 +02:00
Nobuyoshi Nakada
a502cd80a5
Fix wrong assignment 2023-08-02 23:55:07 +09:00
Takashi Kokubun
81c198b5cf
YJIT: Distinguish exit and fallback reasons for send (#8159) 2023-08-02 10:19:39 -04:00
Takashi Kokubun
452debba22
YJIT: Fix --yjit-dump-disasm coloring on less(1) (#8158) 2023-08-02 10:16:37 -04:00
Takashi Kokubun
d405410e3c
YJIT: Move ROBJECT_OFFSET_* to yjit.c (#8157) 2023-08-02 10:15:29 -04:00
Peter Zhu
1d096c1e53 Fix crash in NoMethodError for dummy frames
[Bug #19793]

Dummy frames are created at the top level when requiring another file.
While requiring a file, it will try to convert using encodings. Some of
these encodings will not respond to to_str. If method_missing is
redefined on Object, then it will call method_missing and attempt raise
an error. However, the iseq is invalid as it's a dummy frame so it will
write an invalid iseq to the created NoMethodError.

The following script crashes:

```
GC.stress = true

class Object
  public :method_missing
end

File.write("/tmp/empty.rb", "")
require "/tmp/empty.rb"
```

With the following backtrace:

```
frame #0: 0x00000001000fa8b8 miniruby`RVALUE_MARKED(obj=4308637824) at gc.c:1638:12
frame #1: 0x00000001000fb440 miniruby`RVALUE_BLACK_P(obj=4308637824) at gc.c:1763:12
frame #2: 0x00000001000facdc miniruby`gc_writebarrier_incremental(a=4308637824, b=4308332208, objspace=0x000000010180b000) at gc.c:8822:9
frame #3: 0x00000001000faad8 miniruby`rb_gc_writebarrier(a=4308637824, b=4308332208) at gc.c:8864:17
frame #4: 0x000000010016aff0 miniruby`rb_obj_written(a=4308637824, oldv=36, b=4308332208, filename="../iseq.c", line=1279) at gc.h:804:9
frame #5: 0x0000000100162a60 miniruby`rb_obj_write(a=4308637824, slot=0x0000000100d09888, b=4308332208, filename="../iseq.c", line=1279) at gc.h:837:5
frame #6: 0x0000000100165b0c miniruby`iseqw_new(iseq=0x0000000100d09880) at iseq.c:1279:9
frame #7: 0x0000000100165a64 miniruby`rb_iseqw_new(iseq=0x0000000100d09880) at iseq.c:1289:12
frame #8: 0x00000001000d8324 miniruby`name_err_init_attr(exc=4309777920, recv=4304780496, method=827660) at error.c:1830:35
frame #9: 0x00000001000d1b80 miniruby`name_err_init(exc=4309777920, mesg=4308332496, recv=4304780496, method=827660) at error.c:1869:12
frame #10: 0x00000001000d1bd4 miniruby`rb_nomethod_err_new(mesg=4308332496, recv=4304780496, method=827660, args=4308332448, priv=0) at error.c:1957:5
frame #11: 0x000000010039049c miniruby`rb_make_no_method_exception(exc=4304914512, format=4308332496, obj=4304780496, argc=1, argv=0x000000016fdfab00, priv=0) at vm_eval.c:959:16
frame #12: 0x00000001003b3274 miniruby`raise_method_missing(ec=0x0000000100b06f40, argc=1, argv=0x000000016fdfab00, obj=4304780496, last_call_status=MISSING_NOENTRY) at vm_eval.c:999:15
frame #13: 0x00000001003945d4 miniruby`rb_method_missing(argc=1, argv=0x000000016fdfab00, obj=4304780496) at vm_eval.c:944:5
...
frame #23: 0x000000010038f5e4 miniruby`rb_vm_call_kw(ec=0x0000000100b06f40, recv=4304780496, id=2865, argc=1, argv=0x000000016fdfab00, me=0x0000000100cbfcf0, kw_splat=0) at vm_eval.c:326:12
frame #24: 0x00000001003c18e4 miniruby`call_method_entry(ec=0x0000000100b06f40, defined_class=4304927952, obj=4304780496, id=2865, cme=0x0000000100cbfcf0, argc=1, argv=0x000000016fdfab00, kw_splat=0) at vm_method.c:2720:20
frame #25: 0x00000001003c440c miniruby`check_funcall_exec(v=6171896792) at vm_eval.c:589:12
frame #26: 0x00000001000dec00 miniruby`rb_vrescue2(b_proc=(miniruby`check_funcall_exec at vm_eval.c:587), data1=6171896792, r_proc=(miniruby`check_funcall_failed at vm_eval.c:596), data2=6171896792, args="Pȗ") at eval.c:919:18
frame #27: 0x00000001000deab0 miniruby`rb_rescue2(b_proc=(miniruby`check_funcall_exec at vm_eval.c:587), data1=6171896792, r_proc=(miniruby`check_funcall_failed at vm_eval.c:596), data2=6171896792) at eval.c:900:17
frame #28: 0x000000010039008c miniruby`check_funcall_missing(ec=0x0000000100b06f40, klass=4304923536, recv=4304780496, mid=3233, argc=0, argv=0x0000000000000000, respond=-1, def=36, kw_splat=0) at vm_eval.c:666:15
frame #29: 0x000000010038fa60 miniruby`rb_check_funcall_default_kw(recv=4304780496, mid=3233, argc=0, argv=0x0000000000000000, def=36, kw_splat=0) at vm_eval.c:703:21
frame #30: 0x000000010038fb04 miniruby`rb_check_funcall(recv=4304780496, mid=3233, argc=0, argv=0x0000000000000000) at vm_eval.c:685:12
frame #31: 0x00000001001c469c miniruby`convert_type_with_id(val=4304780496, tname="String", method=3233, raise=0, index=-1) at object.c:3061:15
frame #32: 0x00000001001c4a4c miniruby`rb_check_convert_type_with_id(val=4304780496, type=5, tname="String", method=3233) at object.c:3153:9
frame #33: 0x00000001002d59f8 miniruby`rb_check_string_type(str=4304780496) at string.c:2571:11
frame #34: 0x000000010014b7b0 miniruby`io_encoding_set(fptr=0x0000000100d09ca0, v1=4304780496, v2=4, opt=4) at io.c:11655:19
frame #35: 0x0000000100139a58 miniruby`rb_io_set_encoding(argc=1, argv=0x000000016fdfb450, io=4308334032) at io.c:13497:5
frame #36: 0x00000001003c0004 miniruby`ractor_safe_call_cfunc_m1(recv=4308334032, argc=1, argv=0x000000016fdfb450, func=(miniruby`rb_io_set_encoding at io.c:13487)) at vm_insnhelper.c:3271:12
...
frame #43: 0x0000000100390b08 miniruby`rb_funcall(recv=4308334032, mid=16593, n=1) at vm_eval.c:1137:12
frame #44: 0x00000001002a43d8 miniruby`load_file_internal(argp_v=6171899936) at ruby.c:2500:5
...
```
2023-08-02 09:08:12 -04:00
Nobuyoshi Nakada
85ee4a65a2
Allow to override environment variables for debug 2023-08-02 19:55:31 +09:00
Nobuyoshi Nakada
ffe0f9eb6c
EnvUtil.invoke_ruby also passes ASAN options 2023-08-02 19:55:30 +09:00
Hiroshi SHIBATA
28c2136722 [rubygems/rubygems] Replaced remained local to lockfile
https://github.com/rubygems/rubygems/commit/6ed69223d4
2023-08-02 09:56:13 +00:00
Jean byroot Boussier
fd8dd71996
Implement StringIO#pread (#56)
Both for being closer to real IOs and also because it's a convenient API
in multithreaded scenarios.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-08-02 18:18:17 +09:00
Stan Lo
201fd57518 [ruby/irb] Drop src_encoding.rb
(https://github.com/ruby/irb/pull/634)

Its method `IRB.default_src_encoding` was only used in `magic-file.rb`,
which has been removed.

https://github.com/ruby/irb/commit/ed98983b1f
2023-08-02 18:17:27 +09:00
Sutou Kouhei
fe25527781 [ruby/fiddle] Include stdbool.h explicitly
https://github.com/ruby/fiddle/commit/c313a74632
2023-08-02 18:17:20 +09:00
Sutou Kouhei
673f4493b0 [ruby/fiddle] Include stdbool.h explicitly
https://github.com/ruby/fiddle/commit/69ff680bf6
2023-08-02 18:17:19 +09:00
Sutou Kouhei
15e8cf7ad9 [ruby/fiddle] Add support for bool
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

https://github.com/ruby/fiddle/commit/bc6c66bbb9
2023-08-02 18:17:18 +09:00
Sutou Kouhei
10588fa121 [ruby/fiddle] Use ifdef
https://github.com/ruby/fiddle/commit/6cdf53726d
2023-08-02 18:17:16 +09:00
Hiroshi SHIBATA
fd782dcd1e
Revert "YJIT: implement expandarray_rhs_too_small case (#8153)"
This reverts commit 3b88a0bee841aee77bee306d9d34e587561515cf.

  This commit break aarch64 platform and Apple Silicon
2023-08-02 14:25:16 +09:00
Nobuyoshi Nakada
c5abe0d08f
Tests to move between size pools are flaky on Windows too [ci skip]
Needs more investigations.
2023-08-02 14:19:44 +09:00
Nobuyoshi Nakada
e4fcac42d2
Find paths of tools [ci skip]
Recent GitHub Actions Windows containers seem having Strawberry tools.
2023-08-02 13:48:43 +09:00
Nobuyoshi Nakada
15b2e91230 Remove kprintf in addr2line.c
According to @naruse, this `kprintf` was to avoid some segfaults, but
turned out it seemed another issue after all.
2023-08-02 13:21:20 +09:00
Nobuyoshi Nakada
31d1226763 Avoid aborting inside addr2line.c 2023-08-02 13:21:20 +09:00
Takashi Kokubun
df6071c49f Do not auto-cancel builds on pull requests
For some reason, there was a pull request that contains a YJIT change
but did not run Cirrus CI, which ended up failing Cirrus CI on master.

This `auto_cancellation` config seems suspicious. Now that we have
`only_if`, I don't think we need an extra guard besides that.
2023-08-01 15:36:27 -07:00
Takashi Kokubun
5ff1c00e17
YJIT: Let local yjit-bindgen exit successfully (#8156) 2023-08-01 14:46:14 -07:00