summaryrefslogtreecommitdiff
path: root/version.h
AgeCommit message (Collapse)Author
2023-11-18merge revision(s) 1f115f141dd17f75049a5e17107906c5bcc372e1:nagachika
Speed up rebuilding the loaded feature index Rebuilding the loaded feature index slowed down with the bug fix for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15. The slowdown was extreme if realpath emulation was used, but even when not emulated, it could be about 10x slower. This adds loaded_features_realpath_map to rb_vm_struct. This is a hidden hash mapping loaded feature paths to realpaths. When rebuilding the loaded feature index, look at this hash to get cached realpath values, and skip calling rb_check_realpath if a cached value is found. Fixes [Bug #19246] --- load.c | 27 +++++++++++++++++++++++---- vm.c | 2 ++ vm_core.h | 1 + 3 files changed, 26 insertions(+), 4 deletions(-)
2023-11-18Revert "merge revision(s) 9682275b5493439334fb3933ce2da3b95271eb1c: ↵nagachika
[Backport #19999]" This reverts commit 4b16259d1d6f408a88ac2c8d04ed78e87bdeda9f.
2023-11-18merge revision(s) 9682275b5493439334fb3933ce2da3b95271eb1c: [Backport #19999]nagachika
[Travis] make `.bundle` directory writable To create gem files from sources under `gems/src` for tests. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
2023-11-10merge revision(s) 17b0643392749f45b7aacb64fc1c1bd704d42b4c: [Backport #19924]nagachika
[Bug #19924] Source code should be unsigned char stream Use `peekc` or `nextc` to fetch the next character, instead of reading from `lex.pcur` directly, for compilers that plain char is signed. --- parse.y | 10 +++++----- test/ruby/test_parse.rb | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-)
2023-11-09merge revision(s) ↵nagachika
4329554f171fdb483cafa672df5f2a08741940c5,b5c74d548872388921402ff2db36be15e924a89b: [Backport #19985] [Bug #19985] Raise LoadError with the converted feature name `Kernel#require` converts feature name objects that have the `to_path` method such as `Pathname`, but had used the original object on error and had resulted in an unexpected `TypeError`. --- load.c | 14 +++++++++++--- test/ruby/test_require.rb | 26 +++++++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) Ease the `Encoding::CompatibilityError` test failure At the time this test first started using `assert_raise_with_message`, it did not touch `Encoding.default_internal`. --- test/ruby/test_require.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
2023-10-28merge revision(s) 19346c2336053b351673da030b00c704138252d8: [Backport #19754]nagachika
[Bug #19754] Make `IO::Buffer#get_string` check `offset` range (#8016) --- io_buffer.c | 3 +++ test/ruby/test_io_buffer.rb | 8 ++++++++ 2 files changed, 11 insertions(+)
2023-09-30merge revision(s) ↵nagachika
693e4dec236e14432df97010082917a3a48745cb,8d985b1855d5d5dca88edce32625440a6c123a16,82e480ff40cd41de993b92ddc42ef79a807ff2be,8f1b688177dba412821cbc01ef2cabdce385f7ba: Prohibit GIT after setting readonly --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) Clarify the actual Visual Studio version [ci skip] --- .appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Silent test-all on AppVeyor --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Revert vcpkg.exe to previous release [ci skip] The latest fails to extract downloaded zip files. --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+)
2023-09-30merge revision(s) 6b66b5fdedb2c9a9ee48e290d57ca7f8d55e01a2: [Backport #19902]nagachika
[Bug #19902] Update the coderange regarding the changed region --- ext/-test-/string/set_len.c | 10 ++++++++++ string.c | 27 +++++++++++++++++++++++++++ test/-ext-/string/test_set_len.rb | 29 +++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+)
2023-09-30merge revision(s) ef59175a68c448fe334125824b477a9e1d5629bc: [Backport #19903]nagachika
fix iseq kwargs table and original_iseq leaks [bug #19903] Co-authored-by: Peter Zhu <peter@peterzhu.ca> --- iseq.c | 4 ++++ 1 file changed, 4 insertions(+)
2023-09-30merge revision(s) c42261059dfebabbf0391327a5e077545a9bc438: [Backport #19901]nagachika
[Bug #19901] fix leak in module clone Co-authored-by: Peter Zhu <peter@peterzhu.ca> --- class.c | 1 + test/ruby/test_module.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+)
2023-09-30merge revision(s) 8b236e0c66da8f92e9fc33de66cfbc8e4b0c0763: [Backport #19896]nagachika
[Bug #19896] fix memory leak in vm_method This introduces a unified reference_count to clarify who is referencing a method. This also allows us to treat the refinement method as the def owner since it counts itself as a reference Co-authored-by: Peter Zhu <peter@peterzhu.ca> --- gc.c | 4 +- method.h | 6 +-- rjit_c.rb | 6 +-- test/ruby/test_module.rb | 4 +- vm_insnhelper.c | 2 +- vm_method.c | 105 +++++++++++++++++++---------------------------- 6 files changed, 54 insertions(+), 73 deletions(-)
2023-09-30merge revision(s) fe0225ff4d5af8b1f54009727b39d0d9b821eea3: [Backport #19778]nagachika
[Bug #19778] Add `-I` options for opt-dir to `$INCFLAGS` These options have been separated from `$CFLAGS` already in the other places. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
2023-09-30merge revision(s) d4c720a91bc7bb9ff31810e1720acffb939f7a2f: [Backport #19845]nagachika
Fix support for dynamic keys. (#8273) * Skip RBS test. --- cont.c | 8 +++----- spec/ruby/core/fiber/storage_spec.rb | 14 ++++++++++++++ tool/rbs_skip_tests | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-)
2023-09-30merge revision(s) 2214bcb70d9f9120f1f3790ca340236c8f080991: [Backport #19792]nagachika
Fix premature string collection during append Previously, the following crashed due to use-after-free with AArch64 Alpine Linux 3.18.3 (aarch64-linux-musl): ```ruby str = 'a' * (32*1024*1024) p({z: str}) ``` 32 MiB is the default for `GC_MALLOC_LIMIT_MAX`, and the crash could be dodged by setting `RUBY_GC_MALLOC_LIMIT_MAX` to large values. Under a debugger, one can see the `str2` of rb_str_buf_append() getting prematurely collected while str_buf_cat4() allocates capacity. Add GC guards so the buffer of `str2` lives across the GC run initiated in str_buf_cat4(). [Bug #19792] --- string.c | 2 ++ 1 file changed, 2 insertions(+)
2023-09-24merge revision(s) 96c5a4be7b0d72502001734770af0f4a735c544c: [Backport #19894]nagachika
Fix memory leak in complemented method entries [Bug #19894] When a copy of a complemented method entry is created, there are two issues: 1. IMEMO_FL_USER3 is not copied, so the complemented status is not copied over. 2. In rb_method_entry_clone we increment both alias_count and complemented_count. However, when we free the method entry in rb_method_definition_release, we only decrement one of the two counters, resulting in the rb_method_definition_t being leaked. Co-authored-by: Adam Hess <adamhess1991@gmail.com> --- method.h | 5 +++-- test/ruby/test_module.rb | 29 +++++++++++++++++++++++++++++ vm_method.c | 8 +++++--- 3 files changed, 37 insertions(+), 5 deletions(-)
2023-09-24merge revision(s) 901b6d9c5025a30b3d7a5ed0a2c00baf9cfb061d: [Backport #19853]nagachika
Validate the typed data before dereferencing the internal struct. (#8315) --- process.c | 5 +++-- test/fiber/test_process.rb | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-)
2023-09-24merge revision(s) 25711683e86271385e8abe09a9c03782000e48db: [Backport #19864]nagachika
Fix regression when testing inclusion in unbounded ranges Caused by 04a92a6764bf678919cf4b68a27496a39d6b886a. This treats unbounded ranges of arbitrary objects the same as how unbounded string ranges are treated: (..x) === y # (y <=> x) <= 0 (...x) === y # (y <=> x) < 0 (x..) === y # (x <=> y) <= 0 Fixes [Bug #19864] --- range.c | 9 +++++++++ test/ruby/test_range.rb | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+)
2023-09-09merge revision(s) 382678d4112f4afc6272244c22924d2b004274b1: [Backport #19788]nagachika
[Bug #19788] Use the result of `tCOLON2` event --- parse.y | 16 ++++++++-------- test/ripper/test_parser_events.rb | 17 +++++++++++++++++ test/ripper/test_scanner_events.rb | 5 +++++ 3 files changed, 30 insertions(+), 8 deletions(-)
2023-08-29merge revision(s) a28c5151f567cada0d2f5c0c3ec4df7f97b80784: [Backport #19855]nagachika
Fix Array#bsearch when block returns a non-integer numeric value --- array.c | 4 ++-- test/ruby/test_array.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-)
2023-08-13merge revision(s) 0b8f15575a440f85ac686f5b0eae8f8b7c2b72e7: [Backport #19836]nagachika
Fix memory leak for incomplete lambdas [Bug #19836] The parser does not free the chain of `struct vtable`, which causes memory leaks. The following script reproduces this issue: ``` 10.times do 100_000.times do Ripper.parse("-> {") end puts `ps -o rss= -p #{$$}` end ``` --- parse.y | 24 ++++++++++++++---------- test/ripper/test_ripper.rb | 7 +++++++ 2 files changed, 21 insertions(+), 10 deletions(-)
2023-08-13merge revision(s) 5bc8fceca8d47ed1ef9c603c6531a408de36b60c: [Backport #19835]nagachika
Fix memory leak in parser for incomplete tokens [Bug #19835] The parser does not free the `tbl` of the `struct vtable` when there are leftover `lvtbl` in the parser. This causes a memory leak. The following script reproduces this issue: ``` 10.times do 100_000.times do Ripper.parse("class Foo") end puts `ps -o rss= -p #{$$}` end ``` --- parse.y | 42 ++++++++++++++++++++++++++++-------------- test/ripper/test_ripper.rb | 7 +++++++ 2 files changed, 35 insertions(+), 14 deletions(-)
2023-08-12merge revision(s) 1b0da1e6236ad9a380abfe4ca8b51f06c34bb6f9:nagachika
Skip running brew upgrade (#8189) This has been unstable: https://github.com/ruby/ruby/actions/runs/5797755676/job/15713988590 and I'm not sure if we need that in the first place, assuming the OS image itself is maintained by GitHub. --- .github/actions/setup/macos/action.yml | 1 - 1 file changed, 1 deletion(-)
2023-08-12merge revision(s) 72d1a790cfe0e4a457db98c587f1acaa5e39f001: [Backport #19833]nagachika
[Bug #19833] Fix index underflow at superclasses of `BasicObject` --- object.c | 4 ++++ test/ruby/test_class.rb | 7 +++++++ 2 files changed, 11 insertions(+)
2023-08-12merge revision(s) 1d096c1e53581ed9fe94694c9760babd1e12e580: [Backport #19793]nagachika
Fix crash in NoMethodError for dummy frames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [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 ... ``` --- error.c | 4 +++- test/ruby/test_require.rb | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
2023-08-12merge revision(s) 954b7ac81ef503df3c1efc5566df985b08951d52: [Backport #19789]nagachika
addr2line.c: fix `DW_FORM_ref_addr` parsing for DWARF 2 (#8146) addr2line.c: fix DW_FORM_ref_addr parsing for DWARF 2 This fixes a crash when retrieving backtrace info with YJIT enabled on macOS with Rust 1.71.0. Since Rust 1.71.0, the DWARF info generated by the Rust compiler uses DW_FORM_ref_addr instead of DW_FORM_ref4 for pointers to other DIEs. DW_FORM_ref_addr representation in DWARF 2 is different from DWARF 3+, so we need to handle it separately. This patch fixes the parsing of DW_FORM_ref_addr for DWARF 2, which is the default DWARF version Rustc uses on macOS. See the DWARF 2.0.0 spec, section 7.5.4 Attribute Encodings https://dwarfstd.org/doc/dwarf-2.0.0.pdf https://bugs.ruby-lang.org/issues/19789 --- addr2line.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-)
2023-07-29merge revision(s) cada537040743cbe49aac6740816d648ca0d3fb: [Backport #19786]nagachika
[DOC] Fix call-seq for Data.define --- struct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
2023-07-29merge revision(s) 99162dee7aa478d8a65f028b098bdaa69e1ecad5: [Backport #19751]nagachika
[Bug #19751] Remove linemarkers in middle --- template/fake.rb.in | 1 + 1 file changed, 1 insertion(+)
2023-07-23merge revision(s) 5d4fff845602872eef072e7611558b5f8762efe0: [Backport #19293]nagachika
Tighten Time.new(string) parsing Disallow: * Only year-month * Only year-month-day * Preceding whitespace * Trailing whitespace Fixes [Bug #19293] --- test/ruby/test_time.rb | 13 +++++++++++++ time.c | 13 ++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-)
2023-07-23merge revision(s) 3874381c4483ba7794ac2abf157e265546f9bfa7: [Backport #19759]nagachika
Fix autosplat conditions to handle ruby2_keywords case Autosplat should not occur if there are two arguments but second argument is an array containing a ruby2_keywords splat. Only autosplat if a single argument to be yielded to the block, and there is no splatted flagged keyword hash passed. Fixes [Bug #19759] --- test/ruby/test_proc.rb | 26 ++++++++++++++++++++++++++ vm_args.c | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-)
2023-07-22merge revision(s) ↵nagachika
9c94db7cfc584e982a6449b72e58a1cf25024177,fe4d906f5fbacbe6e9267af3bd3503339bad63a9: [Backport #19774] Add tests for `return` in `BEGIN` and `END` blocks --- spec/ruby/language/return_spec.rb | 15 +++++++++++++++ test/ruby/test_syntax.rb | 1 + 2 files changed, 16 insertions(+) [Bug #19774] Fix segfault at `return` in `END` --- eval_error.c | 7 ++++++- test/ruby/test_syntax.rb | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-)
2023-07-22merge revision(s) bc3ac1872e4523334e3ed04c2bb70a55c4c43f98: [Backport #19748]nagachika
[Bug #19748] Fix out-of-bound access in `String#byteindex` --- string.c | 17 +++++++---------- test/ruby/test_string.rb | 3 +++ 2 files changed, 10 insertions(+), 10 deletions(-)
2023-07-22merge revision(s) 038f9ade3c4d965415e4956561975454cf9eeb21: [Backport #19585]nagachika
Use tools appropriate with CC To get rid of mysterious errors such as: ``` /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: error: libruby.3.3-static.a(/): The end of the file was unexpectedly encountered ``` and ``` ld: warning: ignoring file ../../libruby.3.3-static.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64 Undefined symbols for architecture x86_64: "_rb_rational_num", referenced from: ``` --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+)
2023-07-22merge revision(s) 2c8f2871a8aeff592369a993b1d69557160cfa61: [Backport #19532]nagachika
Fix handling of 6-byte codepoints in left_adjust_char_head in CESU-8 encoding --- enc/cesu_8.c | 23 +++++++++++++++++++---- test/ruby/enc/test_cesu8.rb | 4 ++++ 2 files changed, 23 insertions(+), 4 deletions(-)
2023-07-22merge revision(s) 54dbd8bea8a79bfcdefa471c1717c6cd28022f33: [Backport #19535]nagachika
Use an st table for "too complex" objects st tables will maintain insertion order so we can marshal dump / load objects with instance variables in the same order they were set on that particular instance [ruby-core:112926] [Bug #19535] Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com> --- gc.c | 10 ++++------ include/ruby/st.h | 2 ++ object.c | 2 +- ractor.c | 43 ++++++++++++++++++++++--------------------- shape.h | 6 +++--- st.c | 6 ++++++ test/ruby/test_shapes.rb | 21 +++++++++++++++++++++ variable.c | 28 ++++++++++++++-------------- vm_insnhelper.c | 2 +- 9 files changed, 74 insertions(+), 46 deletions(-)
2023-07-22merge revision(s) 0402193723647b8c4f57b1453fe2192ad2788d12: [Backport #19709]nagachika
Fix `Thread#join(timeout)` when running inside the fiber scheduler. (#7903) --- test/fiber/test_thread.rb | 22 ++++++++++++++++++++++ thread.c | 5 +++++ 2 files changed, 27 insertions(+)
2023-07-22merge revision(s) 0b2613f44309bddae45562c9f3a14ed43e56959b: [Backport #19640]nagachika
`rb_io_puts` should not write zero length strings. (#7806) --- io.c | 40 ++++++++++++++++++++++++---------------- test/fiber/test_io.rb | 28 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 16 deletions(-)
2023-07-22merge revision(s) 91c004885fc75a93cadf0094fa86ec3bd0ec25f5: [Backport #19025]nagachika
[Bug #19025] Numbered parameter names are always local variables --- parse.y | 2 +- test/ruby/test_syntax.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
2023-07-22merge revision(s) fac814c2dc31afef272b45392a7389ef0bfa3a4f: [Backport #19602]nagachika
Fix `PLATFORM_GET_INC` On platforms where unaligned word access is not allowed, and if `sizeof(val)` and `sizeof(type)` differ: - `val` > `type`, `val` will be a garbage. - `val` < `type`, outside `val` will be clobbered. --- regexec.c | 2 +- regint.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
2023-07-22merge revision(s) 3592b24cdc07ed89eecb39161f21fe721a89a5de: [Backport #19531]nagachika
ObjectSpace::WeakMap: clean inverse reference when an entry is re-assigned [Bug #19531] ```ruby wmap[1] = "A" wmap[1] = "B" ``` In the example above, we need to remove the `"A" => 1` inverse reference so that when `"A"` is GCed the `1` key isn't deleted. --- test/ruby/test_weakmap.rb | 17 +++++++++ weakmap.c | 91 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 91 insertions(+), 17 deletions(-)
2023-07-17merge revision(s) 1bc8838d60ef3fc6812d3b64ed87caaf0ae943d9: [Backport #19750]nagachika
Handle unterminated unicode escapes in regexps This fixes an infinite loop possible after ec3542229b29ec93062e9d90e877ea29d3c19472. For \u{} escapes in regexps, skip validation in the parser, and rely on the regexp code to handle validation. This is necessary so that invalid unicode escapes in comments in extended regexps are allowed. Fixes [Bug #19750] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> --- parse.y | 97 ++++++++++++++++++++++++++++++++----------------- test/ruby/test_parse.rb | 16 ++++++++ 2 files changed, 79 insertions(+), 34 deletions(-)
2023-07-17Fixup be09d77b966c7bcc77957927f16cefe66b365495.nagachika
2023-07-17merge revision(s) a8ba1ddd78544b4bda749051d44f7b2a8a0ec5ff: [Backport #19455]nagachika
Use UTF-8 encoding for literal extended regexps with UTF-8 characters in comments Fixes [Bug #19455] --- re.c | 9 ++++++++- test/ruby/test_regexp.rb | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
2023-07-17merge revision(s) ↵nagachika
31e67a476f2262e01a0829e8ab5e6d8a97e0724e,0b95cbcbde8875effdbcbb676cb0a7f751a1d4c1: [Backport #19601] YJIT: Fix false object collection when setting ivar Previously, setinstancevariable could generate code that calls `rb_ensure_iv_list_size()` without first updating `cfp->sp`. This means in the event that a GC start from within said routine the top few objects would not be marked, causing them to be falsly collected. Call `jit_prepare_routine_call()` first. [Bug #19601] --- bootstraptest/test_yjit.rb | 20 ++++++++++++++++++++ yjit/src/codegen.rs | 5 +++++ 2 files changed, 25 insertions(+) YJIT: Remove duplicate `asm.spill_temps()` `jit_prepare_routine_call()` calls it, and there is another call above on line 2302. Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> --- yjit/src/codegen.rs | 1 - 1 file changed, 1 deletion(-)
2023-07-17merge revision(s) 02a7e12b80823919fb614ad3ea6241d5115d14fe: [Backport #19593]nagachika
Ensure throw data is not set as cause [Bug #19593] rb_ec_setup_exception did not check if errinfo is a throw_data. This can cause crashes in code since it is assumed that id_cause is an object. We saw a crash in show_cause due to id_cause of errinfo being a throw_data. It crashes on rb_obj_is_kind_of since it cannot be called on T_IMEMO objects. Unfortunately, we couldn't find a reproduction script, however we debugged the core dump and rb_ec_setup_exception is the only place where id_cause is assigned from errinfo without checking if it is a throw_data. ``` 0x0000556c5708e6dd in sigsegv (sig=11, info=0x7f301befa3f0, ctx=0x7f301befa2c0) at signal.c:964 0x00007f301d046420 in <signal handler called> () at /lib/x86_64-linux-gnu/libpthread.so.0 class_search_class_ancestor (c=139844586301760, cl=<optimized out>) at object.c:810 rb_obj_is_kind_of (obj=obj@entry=139839221734880, c=139844586301760) at object.c:861 0x0000556c56f2f00f in show_cause (errinfo=errinfo@entry=139838840645160, str=str@entry=139839221730520, opt=139839221730480, highlight=0, reverse=reverse@entry=0, backtrace_limit=backtrace_limit@entry=-1, shown_causes=0x7ffe9d1a2d68) at ./include/ruby/internal/special_consts.h:175 ``` Co-Authored-By: Jean Boussier <byroot@ruby-lang.org> --- eval.c | 4 ++++ 1 file changed, 4 insertions(+)
2023-07-17merge revision(s) ↵nagachika
1a149aab776aa6741628eb35482eff1ded197fd2,fb17c833f542222afdf482924877d43aa577782d,60f22ebf86248388b41b4ec751d16700f2b4b621: [Backport #19533] Extract range type check functions --- range.c | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) [Bug #19533] Fix infinite range inclusion with numeric value --- range.c | 10 +++++++--- test/ruby/test_range.rb | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) [Bug #19533] Add spec of infinite range inclusion --- spec/ruby/core/range/case_compare_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+)
2023-07-17merge revision(s) 8c360ce713f57d4177de833297364f6f6d950420: [Backport #19589]nagachika
hash.c: Fix hash_iter_lev_dec corrupting shape [Bug #19589] When decrementing `iter_lev` from `65` to `64` the flags would be corrupted, causing the shape_id to be invalid. --- hash.c | 12 +++++++++--- test/ruby/test_hash.rb | 11 +++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-)
2023-07-17merge revision(s) 0ac3f2c20e50c22d298238f602f25f84248ac7a5: [Backport #19587]nagachika
[Bug #19587] Fix `reset_match_cache` arguments --- regexec.c | 2 +- test/ruby/test_regexp.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
2023-07-17Fixup the latest commits.nagachika
2023-07-17merge revision(s) 0ce2bdc76dd17aa3d42a352a6244c87a51e7606d: [Backport #19595]nagachika
YJIT: Fix missing argc check in known cfuncs Previously we were missing a compile-time check that the known cfuncs receive the correct number of arguments. We noticied this because in particular when using ARGS_SPLAT, which also wasn't checked, YJIT would crash on code which was otherwise correct (didn't raise exceptions in the VM). This still supports vararg (argc == -1) cfuncs. I added an additional assertion that when we use the specialized codegen for one of these known functions that the argc are popped off the stack correctly, which should help ensure they're implemented correctly (previously the crash was usually observed on a future `leave` insn). [Bug #19595] --- bootstraptest/test_yjit.rb | 32 ++++++++++++++++++++++++++++++++ yjit/src/codegen.rs | 4 +++- 2 files changed, 35 insertions(+), 1 deletion(-)
2023-07-17merge revision(s) ↵nagachika
f6adc5be94a9f70a5b9897b81dabdeb49b573393,bccdc041665032b819fab1c04ed4dbdfeeeb366b: [Backport #19582] Check if Bundler is defined --- tool/lib/leakchecker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Check if `Bundler::EnvironmentPreserver` is defined Only `Bundler` might be defined. `EnvironmentPreserver` and its `BUNDLER_PREFIX` would be defined together in the same file. --- tool/lib/leakchecker.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)