summaryrefslogtreecommitdiff
path: root/test/ruby/test_box.rb
AgeCommit message (Collapse)Author
37 hoursmerge revision(s) ↵Takashi Kokubun
c0d86a0103de7130943d54b4a290b76ec7e0c135,47e061277ac194a36659510bcf4f3190bde629a6: [Backport #21952] class.c: rb_class_duplicate_classext also dup content of cvc_tbl [Bug #21952] Shallow copying the table result in the same memory being shared between multiple box, causing double free when one of the box is garbage collected. --- class.c: Make cvc_tbl a managed object [Bug #21952] Solves the double-free or use after-free concern with boxes. Now entries can safely be used for copy-on-write. Also is likely necessary to make it save to read cvar from secondary ractors, as allowed since: ab32c0e690b805cdaaf264ad4c3421696c588204
37 hoursmerge revision(s) f89b07ef0046257dd796a2e615cc063072114f16: [Backport #21940]Takashi Kokubun
[PATCH] Mark `$_` as box-dynamic to bypass Box gvar_tbl cache `$_` is updated through svar (rb_lastline_set), bypassing rb_gvar_set, so the Box gvar_tbl cache is never invalidated and returns a stale value. Call rb_gvar_box_dynamic so gvar_use_box_tbl() skips the cache. Fixes [Bug #21940](https://bugs.ruby-lang.org/issues/21940)
37 hoursmerge revision(s) 526344b56ea968d5704bdefe6e10bb3cf7f4f569, ↵Takashi Kokubun
8ad6baa01746e8de0460f0ccdaee69953a70af17: [Backport #21933] [PATCH] Fix Box regexp match vars after non-match [PATCH] Use box_ready for $&, $`, $\', $+ These variables have rb_gvar_readonly_setter, so box_ready is sufficient. Only $~ needs box_dynamic due to its custom match_setter.
2026-03-19Simplify subclasses list, remove from BoxJohn Hawthorn
Currently we maintain the subclasses list for two separate purposes (we essentially have to different relationships we're putting into the same list): 1. On a T_MODULE, we track the T_ICLASSes created to include it into other classes. Used for method invalidation and propagating includes on the module that happen after it's been used 2. On a T_CLASS/T_ICLASS, we track the T_CLASS/T_ICLASS which are the immediate children of the class. We use this for method invalidation, some cvar things, and to iterate through subclasses. Purpose 1 does not have any issues with box, the T_ICLASS always belongs to one specific module and that's immutable. This list can be box-global (always use the prime classext or hoist it out) and only needs to be pruned during free. If we care about behaviour under a particular box (ie. the propagating includes), we should look up the current box being modified on the ICLASS itself. Purpose 2 is more complicated. It currently tracks the immediate children, the T_CLASS or T_ICLASS whose super points back. Because super is per-box and is mutable (include/prepend insert ICLASSes into the chain) we need to update the list on include/prepend, entries must be per-box, and we can have multiple entries per-box. *I propose we simplify this by no longer tracking the immediate subclass*, but instead tracking the T_CLASS -> ... -> T_CLASS relationship, ie. the inverse of rb_class_superclass. That relationship is the same across all boxes and immutable after Class creation. As a special case the ICLASS for refinements are also added to the purpose 2 list (on T_CLASS). As those ICLASS do not chain to an eventual leaf T_CLASS. When we need to find the classes which have included a module, we can use the module subclasses list to find the ICLASS and then use RCLASS_INCLUDER. If we needed to iterate all T_ICLASS, we could then walk up the CLASS_SUPER chain, but I didn't find anywhere we needed to do that.
2026-01-05Box: allocate classes as boxable when it happens in the root boxSatoshi Tagomori
Without this change, classes (including iclass) are allocated as un-boxable classes after initializing user boxes (after starting script evaluation). Under this situation, iclasses are created as un-boxabled class when core modules are included by a class in the root box, then it causes problems because it's in the root box but it can't have multiple classexts. This change makes it possible to allocate boxable classes even after initializing user boxes. Classes create in the root box will be boxable, and those can have 2 or more classexts.
2025-12-24Remove unintentional returnYusuke Endoh
2025-12-24Box: show the fully qualified URL of the Ruby::Box docSatoshi Tagomori
2025-12-23Box: split the test for CI timeoutsSatoshi Tagomori
2025-12-16Box: fix the class name in testsNobuyoshi Nakada
2025-12-16Box: fix the environment variable nameNobuyoshi Nakada
2025-12-09Box: relax the condition of clean upNobuyoshi Nakada
It is impossible to delete DLLs being loaded on Windows. I guess that unnamed (no accessible path on the filesystem) files are not allowed essentially. The only way is to relax the condition, such as no files are left after the process terminated, probably.
2025-12-09Box: add a test case about deleting .so/.dll filesSatoshi Tagomori
2025-12-09Box: remove copied extension filesNobuyoshi Nakada
2025-11-27Reorganize page documentations (#15154)Stan Lo
Re-organize page docs
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-07Apply renaming to Ruby::Box in test codesSatoshi Tagomori
2025-11-07Re-rename files wrongly renamedSatoshi Tagomori