summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2025-11-26Clear fields obj when removingJohn Hawthorn
This fixes a bug where the gen_fields_cache could become invalid when the last ivar was removed. Also adds more assertions.
2025-11-26Revert miscommit at "Reset the cache variable before retrying"Nobuyoshi Nakada
This reverts commit 26a9e0b4e31f7b5a9cbd755e0a15823a8fa51bae partially.
2025-11-26Reset the cache variable before retryingNobuyoshi Nakada
2025-11-26Box: Add a test to drop the reference to a boxSatoshi Tagomori
2025-11-25vm_cc_new: don't assume `cme` is present.Jean Boussier
[Bug #21694] `vm_search_super_method` explictly calls `vm_cc_new` with `cme=NULL` when there is no super class.
2025-11-23Don't use non blocking pipes for RUBY_CRASH_REPORTPeter Zhu
[Bug #21703] RUBY_CRASH_REPORT does not work in some cases when shelling out on Linux. For example, given the following shell script dump.sh: #!/usr/bin/env bash cat > /tmp/crash And we see it fails like this: $ RUBY_CRASH_REPORT="|dump.sh" ruby -rfiddle -e "Fiddle::Pointer.new(1, 10)[0]" cat: -: Resource temporarily unavailable
2025-11-21Fix multiple bugs in `IO::Buffer.map` and update its documentation. (#15264)Alexander Bulancov
- Buffer's size did not account for offset when mapping the file, leading to possible crashes. - Size and offset were not checked properly, leading to many situations raising EINVAL errors with generic messages. - Documentation was wrong.
2025-11-20ZJIT: Change the output on redefined method tests to verify the new ↵Kevin Menard
definition is used
2025-11-20ZJIT: Update test names to use the same convention as the HIR testsKevin Menard
2025-11-20ZJIT: Add tests for `opt_newarray_send` with target methods redefinedKevin Menard
2025-11-20ZJIT: Compile the VM_OPT_NEWARRAY_SEND_HASH variant of opt_newarray_sendKevin Menard
2025-11-20Support backwards compatibility for Set subclassesJeremy Evans
For subclasses from Set, require `set/subclass_compatible`, and extend the subclass and include a module in it that makes it more backwards compatible with the pure Ruby Set implementation used before Ruby 4. The module included in the subclass contains a near-copy of the previous Set implementation, with the following changes: * Accesses to `@hash` are generally replaced with `super` calls. In some cases, they are replaced with a call to another instance method. * Some methods that only accessed `@hash` and nothing else are not defined, so they inherit behavior from core Set. * The previous `Set#divide` implementation is not used, to avoid depending on tsort. This fixes the following two issues: * [Bug #21375] Set[] does not call #initialize * [Bug #21396] Set#initialize should call Set#add on items passed in It should also fix the vast majority of backwards compatibility issues in other cases where code subclassed Set and depended on implementation details (such as which methods call which other methods). This does not affect Set internals, so Set itself remains fast. For users who want to subclass Set but do not need to worry about backwards compatibility, they can subclass from Set::CoreSet, a Set subclass that does not have the backward compatibility layer included.
2025-11-19Implement heap_final_slots in GC.stat_heapPeter Zhu
[Feature #20408]
2025-11-19Implement heap_free_slots in GC.stat_heapPeter Zhu
[Feature #20408]
2025-11-19Implement heap_live_slots in GC.stat_heapPeter Zhu
[Feature #20408]
2025-11-18Fix crash in optimal size for large T_OBJECTJohn Hawthorn
Previously any T_OBJECT with >= 94 IVARs would crash during compaction attempting to make an object too large to embed.
2025-11-18ZJIT: Inline setting Struct fieldsBenoit Daloze
* Add Insn::StoreField and Insn::WriteBarrier
2025-11-18ZJIT: add support for lazy `RubyVM::ZJIT.enable`Godfrey Chan
This implements Shopify#854: - Splits boot-time and enable-time initialization, tracks progress with `InitializationState` enum - Introduces `RubyVM::ZJIT.enable` Ruby method for enabling the JIT lazily, if not already enabled - Introduces `--zjit-disable` flag, which can be used alongside the other `--zjit-*` flags but prevents enabling the JIT at boot time - Adds ZJIT infra to support JIT hooks, but this is not currently exercised (Shopify/ruby#667) Left for future enhancements: - Support kwargs for overriding the CLI flags in `RubyVM::ZJIT.enable` Closes Shopify#854
2025-11-16Handle deeply nested capture variables syntax errKevin Newton
When there are nested capture variables inside of a pattern match that has an alternation pattern, it is a syntax error. Currently it only adds a syntax error when it is at the top level of the pattern.
2025-11-14ZJIT: Add tests for sending to methods with keyword args (#15183)Randy Stauner
2025-11-14[Feature #21572] Syntax error at capture in alternation patternNobuyoshi Nakada
Should fail even with `-c` option.
2025-11-14Adapt to Unicode directory changesMari Imaizumi
https://www.unicode.org/Public/emoji/ReadMe.txt > This directory contains data files for versions 1.0 to 16.0 of Unicode Emoji. > Starting with Unicode 17.0.0, the data files for Unicode Emoji are published in > https://www.unicode.org/Public/<version>/emoji/ > together with the related files in > https://www.unicode.org/Public/<version>/ucd/emoji/
2025-11-13Add size checks to Range#to_set and Enumerator#to_set [Bug #21654]Akinori Musha
These two class are most common sources of infinite sequences. This change should effectively prevent accidental infinite loops when calling to_set on them. [Bug #21513]
2025-11-13Revert "[Bug #21513] Raise on converting endless range to set"Akinori Musha
This reverts commit d4020dd5faf28486123853e7f00c36139fc07793, which introduced performance regression for objects like ActiveRecord::Relation by calling the costly #size method on them.
2025-11-13[Bug #21683] Respect reading encoding at `each_codepoint`Nobuyoshi Nakada
2025-11-12[Bug #21680] Fix (base**power_of_two).digits(base) bug (#15144)tomoya ishida
Fix wrong condition in base multiplying loop.
2025-11-11test_ractor.rb: Delete unnecessary GC.stress fiddlingAlan Wu
assert_ractor() runs in a subprocess.
2025-11-11[Bug #21666] Get rid of use of unspecified valuesNobuyoshi Nakada
2025-11-10ZJIT: Set cfp->sp on leaf calls with GC (#15137)Takashi Kokubun
Co-authored-by: Randy Stauner <randy@r4s6.net>
2025-11-10Add test for [Bug #21265]Alan Wu
The crash was fixed by a4dff09be79b52288a47658964d25e5aa84fc960 ("Fix resolving refined module-defined method"). I had a patch for this around for a few months but never merged it. Oops!
2025-11-11Revert "ns_subclasses refcount accesses need to be atomic (#15083)" (#15138)Luke Gruber
This reverts commit 2998c8d6b99ec49925ebea42198b29c3e27b34a7. We need to find a better way to fix this bug. Even with this refcount change, errors were still being seen in CI. For now we need to remove this failing test.
2025-11-09[Bug #21673] Fix resolving refined module-defined methodNobuyoshi Nakada
A method defined in a module has no `defined_class`, use the ICLASS for it as the `defined_class`.
2025-11-07Don't modify fstrings in rb_str_tmp_frozen_no_embed_acquireJohn Hawthorn
[Bug #21671]
2025-11-07Depricate IO operation with `|`Nobuyoshi Nakada
2025-11-07Apply renaming to Ruby::Box in test codesSatoshi Tagomori
2025-11-07Re-rename files wrongly renamedSatoshi Tagomori
2025-11-07rename namespace.c (and others) to box.cSatoshi Tagomori
2025-11-07Add namespace tests about global variables, toplevel methodsSatoshi Tagomori
2025-11-06ns_subclasses refcount accesses need to be atomic (#15083)Luke Gruber
We were seeing errors like: ``` * thread #8, stop reason = EXC_BAD_ACCESS (code=1, address=0x803) * frame #0: 0x00000001001fe944 ruby`rb_st_lookup(tab=0x00000000000007fb, key=1, value=0x00000001305b7490) at st.c:1066:22 frame #1: 0x000000010002d658 ruby`remove_class_from_subclasses [inlined] class_get_subclasses_for_ns(tbl=0x00000000000007fb, ns_id=1) at class.c:604:9 frame #2: 0x000000010002d650 ruby`remove_class_from_subclasses(tbl=0x00000000000007fb, ns_id=1, klass=4754039232) at class.c:620:34 frame #3: 0x000000010002c8a8 ruby`rb_class_classext_free_subclasses(ext=0x000000011b5ce1d8, klass=4754039232, replacing=<unavailable>) at class.c:700:9 frame #4: 0x000000010002c760 ruby`rb_class_classext_free(klass=4754039232, ext=0x000000011b5ce1d8, is_prime=true) at class.c:105:5 frame #5: 0x00000001000e770c ruby`classext_free(ext=<unavailable>, is_prime=<unavailable>, namespace=<unavailable>, arg=<unavailable>) at gc.c:1231:5 [artificial] frame #6: 0x000000010002d178 ruby`rb_class_classext_foreach(klass=<unavailable>, func=(ruby`classext_free at gc.c:1228), arg=0x00000001305b75c0) at class.c:518:5 frame #7: 0x00000001000e745c ruby`rb_gc_obj_free(objspace=0x000000012500c400, obj=4754039232) at gc.c:1282:9 frame #8: 0x00000001000e70d4 ruby`gc_sweep_plane(objspace=0x000000012500c400, heap=<unavailable>, p=4754039232, bitset=4095, ctx=0x00000001305b76e8) at default.c:3482:21 frame #9: 0x00000001000e6e9c ruby`gc_sweep_page(objspace=0x000000012500c400, heap=0x000000012500c540, ctx=0x00000001305b76e8) at default.c:3567:13 frame #10: 0x00000001000e51d0 ruby`gc_sweep_step(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:3848:9 frame #11: 0x00000001000e1880 ruby`gc_continue [inlined] gc_sweep_continue(objspace=0x000000012500c400, sweep_heap=0x000000012500c540) at default.c:3931:13 frame #12: 0x00000001000e1754 ruby`gc_continue(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2037:9 frame #13: 0x00000001000e10bc ruby`newobj_cache_miss [inlined] heap_prepare(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2056:5 frame #14: 0x00000001000e1074 ruby`newobj_cache_miss [inlined] heap_next_free_page(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2280:9 frame #15: 0x00000001000e106c ruby`newobj_cache_miss(objspace=0x000000012500c400, cache=0x0000600001b00300, heap_idx=2, vm_locked=false) at default.c:2387:38 frame #16: 0x00000001000e0d28 ruby`newobj_alloc(objspace=<unavailable>, cache=<unavailable>, heap_idx=<unavailable>, vm_locked=<unavailable>) at default.c:2411:15 [artificial] frame #17: 0x00000001000d7214 ruby`newobj_of [inlined] rb_gc_impl_new_obj(objspace_ptr=<unavailable>, cache_ptr=<unavailable>, klass=<unavailable>, flags=<unavailable>, wb_protected=<unavailable>, alloc_size=<unavailable>) at default.c:2490:15 frame #18: 0x00000001000d719c ruby`newobj_of(cr=<unavailable>, klass=4313971728, flags=258, wb_protected=<unavailable>, size=<unavailable>) at gc.c:995:17 frame #19: 0x00000001000d73ec ruby`rb_wb_protected_newobj_of(ec=<unavailable>, klass=<unavailable>, flags=<unavailable>, size=<unavailable>) at gc.c:1044:12 [artificial] frame #20: 0x0000000100032d34 ruby`class_alloc0(type=<unavailable>, klass=4313971728, namespaceable=<unavailable>) at class.c:803:5 ```
2025-11-05Extend timeout for unstable testsTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/19111531630/job/54609629054
2025-11-04ZJIT: Add test to reproduce binarytrees crash (#15054)Randy Stauner
2025-11-04Release VM lock before running finalizers (#15050)Luke Gruber
We shouldn't run any ruby code with the VM lock held.
2025-11-03ZJIT: Inline String#bytesize (#15033)Max Leopold
Inline the `String#bytesize` function and remove the C call.
2025-11-03ZJIT: Implement include_p for opt_(new|dup)array_send YARV insns (#14885)Randy Stauner
These just call to the C functions that do the optimized test but this avoids the side exit. See https://github.com/ruby/ruby/pull/12123 for the original CRuby/YJIT implementation.
2025-11-03pend on Windows for timeoutsSatoshi Tagomori
2025-11-03Use CFUNC namespace only for IFUNC frames, its behavior should be unchangedSatoshi Tagomori
2025-11-03Add flag to ignore EXPERIMENTAL warningsSatoshi Tagomori
2025-11-03No need to call rb_define_class/module_under_idSatoshi Tagomori
Classes/modules defined in a namespace are defined under ::Object as usual (as without namespaces), and it'll be set into the const_tbl of ::Object. In namespaces, namespace objects' const_tbl is equal to the one of ::Object. So constants of ::Object are just equal to constants of the namespace. That means, top level classes/modules in a namespace can be referred as namespace::KlassName without calling rb_define_class_under_id().
2025-11-03Add basic namespace testsSatoshi Tagomori
2025-11-01Fix memory leak in String#encode when StringValue raisesPeter Zhu
The following script leaks memory: 10.times do 100_000.times do "\ufffd".encode(Encoding::US_ASCII, fallback: proc { Object.new }) rescue end puts `ps -o rss= -p #{$$}` end Before: 450244 887748 1325124 1762756 2200260 2637508 3075012 3512516 3950020 4387524 After: 12236 12364 12748 13004 13388 13516 13772 13772 13772 13772