summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-09-05Fix a missing write barrier to mandatory_only_iseqJohn Hawthorn
Found by wbcheck
2025-09-05Add write barrier on tm_from_time->timewJohn Hawthorn
We want to always use time_set_timew, as timew is 64-bit even on 32-bit platforms so we need to be careful to both write that size, but still trigger write barriers if we end up with a heap object.
2025-09-05Add missing write barrier to time_init_copyJohn Hawthorn
2025-09-05Write barrier for zone on timeJohn Hawthorn
2025-09-05Add write barrier for hash in obj_traverse_iJohn Hawthorn
We are inserting directly into the st_table, so we need to issue a write barrier from the hash.
2025-09-05Fix early write barrier rb_marshal_define_compatJohn Hawthorn
This write barrier occurred before the entry was added to the table, so if GC occurred when inserting into the table, the write could be missed.
2025-09-05Fix too early writebarrier in tally_upJohn Hawthorn
After returning from the callback in st_update is the point that the hash table may be resized, which could trigger a GC and mark the table being used for the tally. RUBY_GC_LIBRARY=wbcheck WBCHECK_VERIFY_AFTER_WB=1 ./miniruby -e '(0...100).map(&:to_s).tally'
2025-08-27CI: windows: Skip rebuilding vcpkg packages when cache restoredNobuyoshi Nakada
2025-08-27CI: windows: Use possibly faster device for TMP/TEMPNobuyoshi Nakada
2025-08-27Save vcpkg cache with master and stable branchesHiroshi SHIBATA
2025-08-27Fix bad NameError raised using sendforward instruction through vcallLuke Gruber
If you called a VCALL method and the method takes forwarding arguments and then you forward those arguments along using the sendforward instruction, the method_missing class was wrongly chosen as NameError instead of NoMethodError. This is because the VM looked at the CallInfo of the vcall and determined it needed to raise NameError. Now we detect that case and raise NoMethodError. [Backport #21535]
2025-08-27Make word prop match join_control to conform to UTS 18Janosch Müller
See <https://bugs.ruby-lang.org/issues/19417#note-3>. https://unicode.org/reports/tr18/#word states word should match join_control chars. It did not previously: ```ruby [*0x0..0xD799, *0xE000..0x10FFFF].map { |n| n.chr 'utf-8' } => all_chars all_chars.grep(/\p{join_control}/) => jc jc.count # => 2 jc.grep(/\p{word}/).count # => 0 ``` [Backport #19417] --- Backporting note: I regenerated `enc/unicode/15.0.0/name2ctype.h` using `make update-unicode`.
2025-08-27Do not respect ruby2_keywords on method/proc with post argumentsJeremy Evans
Previously, ruby2_keywords could be used on a method or proc with post arguments, but I don't think the behavior is desired: ```ruby def a(*c, **kw) [c, kw] end def b(*a, b) a(*a, b) end ruby2_keywords(:b) b({foo: 1}, bar: 1) ``` This changes ruby2_keywords to emit a warning and not set the flag on a method/proc with post arguments. While here, fix the ruby2_keywords specs for warnings, since they weren't testing what they should be testing. They all warned because the method didn't accept a rest argument, not because it accepted a keyword or keyword rest argument. [Backport #21402]
2025-08-27[Backport #21546] Make the generated pc file relocatableNobuyoshi Nakada
2025-08-27Bump PRISM version number to avoid collision with RubyGems versionAlan Wu
2025-08-27When reading from stdin, put a wrapper around the IO objectAaron Patterson
The purpose of this commit is to fix Bug #21188. We need to detect when stdin has run in to an EOF case. Unfortunately we can't _call_ the eof function on IO because it will block. Here is a short script to demonstrate the issue: ```ruby x = STDIN.gets puts x puts x.eof? ``` If you run the script, then type some characters (but _NOT_ a newline), then hit Ctrl-D twice, it will print the input string. Unfortunately, calling `eof?` will try to read from STDIN again causing us to need a 3rd Ctrl-D to exit the program. Before introducing the EOF callback to Prism, the input loop looked kind of like this: ```ruby loop do str = STDIN.gets process(str) if str.nil? p :DONE end end ``` Which required 3 Ctrl-D to exit. If we naively changed it to something like this: ```ruby loop do str = STDIN.gets process(str) if STDIN.eof? p :DONE end end ``` It would still require 3 Ctrl-D because `eof?` would block. In this patch, we're wrapping the IO object, checking the buffer for a newline and length, and then using that to simulate a non-blocking eof? method. This commit wraps STDIN and emulates a non-blocking `eof` function. [Backport #21188]
2025-08-11YJIT: Fix `mismatched_lifetime_syntaxes`, new in Rust 1.89.0Alan Wu
2025-08-05Fix missing write barrier through M_TBLJohn Hawthorn
When creating a new origin in ensure_origin, we need to fire a write barrier after RCLASS_SET_ORIGIN. rb_class_set_super allocates, so GC could happen there, either incrementally marking or promoting the newly allocated class, and only after RCLASS_SET_ORIGIN will origin mark object in the M_TBL.
2025-07-31Correct castings to use OnigDistanceTSUYUSATO Kitsune
2025-07-31Add castings to prevent warningsTSUYUSATO Kitsune
2025-07-31Port a Oniguruma patch: Integer overflow in onig_search_gpos()TSUYUSATO Kitsune
https://github.com/kkos/oniguruma/commit/778a43dd56925ed58bbe26e3a7bb8202d72c3f3f It differs from the Oniguruma patch in that it dosen't use `onigenc_get_prev_char_head()` because this function's signature has been changed by Oniguruma and the change is not ported in Onigmo for now. This patch respects the current Onigmo implementation. Co-Authored-By: K.Kosako <kkos@users.noreply.github.com>
2025-07-31Port a Oniguruma patch: Integer overflow in backward_search_range() and ↵TSUYUSATO Kitsune
onig_search_gpos() https://github.com/kkos/oniguruma/commit/bfc36d3d8139b8be4d3df630d625c58687b0c7d4 Co-Authored-By: K.Kosako <kkos@users.noreply.github.com>
2025-07-31Port a Oniguruma patch: Integer overflow in forward_search_range()TSUYUSATO Kitsune
https://github.com/kkos/oniguruma/commit/db64ef3189f54917a5008a02bdb000adc514a90a Co-Authored-By: K.Kosako <kkos@users.noreply.github.com>
2025-07-21merge revision(s) 148db9c80f11af1780f0f3685201f28de8f6b47a: [Backport #21259]Takashi Kokubun
Fix flipflop line numbers [ruby-core:121605]
2025-07-17YJIT: Explicitly specify C ABI to fix Rust warningAlan Wu
Backport of 7e733ca55168e3b1f10b685f6e9a52cf1deb5aff to fix [Bug #21514].
2025-07-15v3.4.5v3_4_5Takashi Kokubun
2025-07-15[ruby/etc] Alias value or join to take in old RubyHiroshi SHIBATA
https://github.com/ruby/etc/commit/3dbe760bed
2025-07-15[ruby/json] [ruby/json] Run `have_func` with the header providing the ↵Nobuyoshi Nakada
declarations https://github.com/ruby/json/commit/95fb084027 https://github.com/ruby/json/commit/9d080765cc
2025-07-15[ruby/strscan] Run `have_func` with the header providing the declarationsNobuyoshi Nakada
https://github.com/ruby/strscan/commit/18c0a59b65
2025-07-15[ruby/strscan] Update extconf.rbNobuyoshi Nakada
(https://github.com/ruby/strscan/pull/158) - `have_func` includes "ruby.h" by default. - include "ruby/re.h" where `rb_reg_onig_match` is declared. https://github.com/ruby/strscan/commit/1ac96f47e9
2025-07-15[ruby/openssl] [ruby/openssl] Run `have_func` with the header providing the ↵Nobuyoshi Nakada
declarations https://github.com/ruby/openssl/commit/b6f56c4540 https://github.com/ruby/openssl/commit/5277ca1431
2025-07-15Merge etc 1.4.6Hiroshi SHIBATA
2025-07-15Merge io-nonblock 0.3.2Hiroshi SHIBATA
2025-07-15Merge io-wait 0.3.2Hiroshi SHIBATA
2025-07-15Merge io-console 0.8.1Hiroshi SHIBATA
2025-07-15Split restore and save actions from action/cache. We need to save always ↵Hiroshi SHIBATA
vcpkg cache
2025-07-14merge revision(s) b42afa1dbcbb91e89852b3b3bc72484d7f0a5528, ↵Takashi Kokubun
f1f0cc14cc7d3f9be35b203e5583f9224b1e2387, 543e3a1896ae2fe3b5b954f6497d261ab5663a15, ed2806117a0b76e4439ce1a061fae21d9e116d69, 46e4c8673747de96838d2c5dec37446d23d99d88: [Backport #21500] Suppress gcc 15 unterminated-string-initialization warnings Separate `__has_attribute` from `defined(__has_attribute)` Fix Visual C warnings: ``` regenc.h(121): warning C4067: unexpected tokens following preprocessor directive - expected a newline ``` Cast up `int` instruction code to `VALUE` Fix Visual C warnings: ``` iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size ``` Do not let files depend on a phony target Detect `clock_gettime` and `clock_getres` for winpthreads
2025-07-14merge revision(s) d77e02bd85ab7f841df8d473bac214b9a92a3506: [Backport #21497]Takashi Kokubun
[Bug #21497] [ruby/socket]: add full prototype MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit otherwise, gcc 15 will complain: > init.c:573:19: error: too many arguments to function ‘Rconnect’; expected 0, have 3 > 573 | return (VALUE)Rconnect(arg->fd, arg->sockaddr, arg->len); > | ^~~~~~~~ ~~~~~~~ > In file included from init.c:11: > rubysocket.h:294:5: note: declared here > 294 | int Rconnect(); > | ^~~~~~~~ > sockssocket.c:33:9: error: too many arguments to function ‘SOCKSinit’; expected 0, have 1 > 33 | SOCKSinit("ruby"); > | ^~~~~~~~~ ~~~~~~ > In file included from sockssocket.c:11: > rubysocket.h:293:6: note: declared here > 293 | void SOCKSinit(); > | ^~~~~~~~~ Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
2025-07-14merge revision(s) c1877d431e76f4a782d51602fa8487e98d302956: [Backport #21437]Takashi Kokubun
[ruby/date] [Bug #21437] Date#hash for large years Addresses https://bugs.ruby-lang.org/issues/21437 Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com> https://github.com/ruby/date/commit/31f07bc576
2025-07-14merge revision(s) 2e7e78cd590d20aa9d41422e96302f3edd73f623: [Backport #21440]Takashi Kokubun
[Bug #21440] Stop caching member list in frozen Data/Struct class
2025-07-14merge revision(s) 1181a682a6c314c92686e3701defa1eb44068c4e, ↵Takashi Kokubun
d84a811f31a65821642b165d712f380c0cc060e0: [Backport #21448] [Bug #21448] Use `getentropy(2)` only on macOS If this is not a system call, then it is using getrandom (which would have been tried already), and cannot be used as a replacement for the random devices. [Bug #21448] Reorder trials in `fill_random_bytes` First try dedicated system calls, such as `getrandom` or `getentropy`, next possible libraries, then fallback to `/dev/urandom`.
2025-07-14merge revision(s) 1d94a9e1a4351e01f851dad250ba97dad859ee70: [Backport #21447]Takashi Kokubun
Fix handling of PM_CONSTANT_PATH_NODE node in keyword arguments with ARGS_SPLAT This was handled correctly in parse.y (NODE_COLON2), but not in prism. This wasn't caught earlier, because I only added tests for the optimized case and not the unoptimized case. Add tests for the unoptimized case. In code terms: ```ruby m(*a, kw: lvar::X) # Does not require allocation for *a m(*a, kw: method()::X) # Requires allocation for *a ``` This commit fixes the second case when prism is used.
2025-07-14merge revision(s) fa85d23ff4a02985ebfe0716b0ff768f5b4fe13d: [Backport #21380]Takashi Kokubun
[Bug #21380] Prohibit modification in String#split block Reported at https://hackerone.com/reports/3163876
2025-07-14Revert "merge revision(s) ff222ac27afe712ef6ec2bb74c81cdde1a1fa176: ↵Takashi Kokubun
[Backport #21370]" This reverts commit acb19e8707093593e967b6af03d92da5c570ffc6.
2025-07-14merge revision(s) 097d742a1ed53afb91e83aef01365d68b763357b: [Backport #20009]Takashi Kokubun
[Bug #20009] Support marshaling non-ASCII name class/module
2025-07-14merge revision(s) f6cbf499bc98b851034fffb49fcbb59d495f6f7b: [Backport #21354]Takashi Kokubun
Fix Symbol#to_proc (rb_sym_to_proc) to be ractor safe In non-main ractors, don't use `sym_proc_cache`. It is not thread-safe to add to this array without a lock and also it leaks procs from one ractor to another. Instead, we create a new proc each time. If this results in poor performance we can come up with a solution later. Fixes [Bug #21354]
2025-07-14merge revision(s) 5ec9a392cdf7f971221dc073dd466bce877d8acb: [Backport #21439]Takashi Kokubun
[Bug #21439] Fix `PM_SPLAT_NODE` compilation error in for loops (#13597) [Bug #21439] Fix PM_SPLAT_NODE compilation error in for loops This commit fixes a crash that occurred when using splat nodes (*) as the index variable in for loops. The error "Unexpected node type for index in for node: PM_SPLAT_NODE" was thrown because the compiler didn't know how to handle splat nodes in this context. The fix allows code like `for *x in [[1,2], [3,4]]` to compile and execute correctly, where the splat collects each sub-array.
2025-07-14merge revision(s) 8d49c05c134702c321198b70fbbf34dd80cc1ba6: [Backport #21395]Takashi Kokubun
Use the edge version of debug gem
2025-07-14merge revision(s) a084fef9afc7713aa4f4111f7e826c7ca1a607c7: [Backport #21099]Takashi Kokubun
[Bug #21099] Fix GC when Ractor list not initialized When the Ractor list is not initialized and a GC is ran at boot, then it would crash because the newobj_cache of the main Ractor is not cleared. This commit changes it to use ruby_single_main_ractor when it's available and iterate over the Ractor list when we have multiple Ractors.
2025-07-14merge revision(s) 34b407a4a89e69dd04f692e2b29efa2816d4664a: [Backport #21394]Takashi Kokubun
Fix memory leak in Prism's RubyVM::InstructionSequence.new [Bug #21394] There are two ways to make RubyVM::InstructionSequence.new raise which would cause the options->scopes to leak memory: 1. Passing in any (non T_FILE) object where the to_str raises. 2. Passing in a T_FILE object where String#initialize_dup raises. This is because rb_io_path dups the string. Example 1: 10.times do 100_000.times do RubyVM::InstructionSequence.new(nil) rescue TypeError end puts `ps -o rss= -p #{$$}` end Before: 13392 17104 20256 23920 27264 30432 33584 36752 40032 43232 After: 9392 11072 11648 11648 11648 11712 11712 11712 11744 11744 Example 2: require "tempfile" MyError = Class.new(StandardError) String.prepend(Module.new do def initialize_dup(_) if $raise_on_dup raise MyError else super end end end) Tempfile.create do |f| 10.times do 100_000.times do $raise_on_dup = true RubyVM::InstructionSequence.new(f) rescue MyError else raise "MyError was not raised during RubyVM::InstructionSequence.new" end puts `ps -o rss= -p #{$$}` ensure $raise_on_dup = false end end Before: 14080 18512 22000 25184 28320 31600 34736 37904 41088 44256 After: 12016 12464 12880 12880 12880 12912 12912 12912 12912 12912