summaryrefslogtreecommitdiff
path: root/include/ruby
AgeCommit message (Collapse)Author
2025-11-19Win32: Drop support for older than MSVC 8.0/_MSC_VER 1400Nobuyoshi Nakada
Visual C++ 2005 (8.0): - _MSC_VER: 1400 - MSVCRT_VERSION: 80
2025-11-11simplify RSRING_GETMEM() definition.nagachika
2025-11-11include/ruby/internal/core/rstring.h: Remove rbimpl_rstring_getmem() definition.nagachika
2025-11-11Remove rbimpl_rstring_getmem() usage as workaround for GCC 15.2.1 ↵nagachika
optimization bug. [Bug #21655]
2025-11-07Remove `rb_path_check` declarationEarlopain
Implementation was removed in https://github.com/ruby/ruby/commit/a4c051b870ac7f7b3c5482baf05600e1f6751b47
2025-11-07Development of 4.0.0 started.Yukihiro "Matz" Matsumoto
2025-11-07Rename Namespace to Ruby::BoxSatoshi Tagomori
2025-10-25Use pointer to the memberNobuyoshi Nakada
Instead of the offset calculation.
2025-10-25[DOC] Follow up GH-14470Nobuyoshi Nakada
`IS_TYPED_DATA` is no longer a flag in `type`, and the "embedded" flag has been shifted accordingly. ruby/ruby#14470
2025-10-23add SET_SHAREABLE macrosKoichi Sasada
* `RB_OBJ_SET_SHAREABLE(obj)` makes obj shareable. All of reachable objects from `obj` should be shareable. * `RB_OBJ_SET_FROZEN_SHAREABLE(obj)` same as above but freeze `obj` before making it shareable. Also `rb_gc_verify_shareable(obj)` is introduced to check the `obj` does not violate shareable rule (an shareable object only refers shareable objects) strictly. The rule has some exceptions (some shareable objects can refer to unshareable objects, such as a Ractor object (which is a shareable object) can refer to the Ractor local objects. To handle such case, `check_shareable` flag is also introduced. `STRICT_VERIFY_SHAREABLE` macro is also introduced to verify the strict shareable rule at `SET_SHAREABLE`.
2025-10-17win32: Prefix `clock_getclock` and `clock_getres`Nobuyoshi Nakada
Get rid of conflict with inline versions provided in time.h.
2025-10-17win32: Support more `clockid_t`Nobuyoshi Nakada
Add `CLOCK_PROCESS_CPUTIME_ID` and `CLOCK_THREAD_CPUTIME_ID`.
2025-10-08[Bug #21629] Initialize `struct RString`Nobuyoshi Nakada
2025-10-08[Bug #21629] Enable `nonstring` attribute on clang 21Nobuyoshi Nakada
2025-09-15[DOC] Fix typos in commentsÉtienne Barrié
2025-09-08Bump ABI versionJean Boussier
Followup changes in https://github.com/ruby/ruby/pull/14470 / 03c86b053197f3cd6bece1925e634c1d74d196d0
2025-09-08Move `IS_TYPED_DATA` in RBasic.flagsJean Boussier
Ref: https://github.com/ruby/ruby/pull/14134#issuecomment-3207733725 We can't safely use low-bit pointer tagging anymore because `RTypedData.type` lines up with `RData.dfree` and there is no aligment guarantee on function pointers, as evidenced by `memcached` and `gpgme` gems. We also can't use FL_USER* for this, because extensions may use these for other purposes. Using a general flag for this is a bit unfortunate, as general flags are hard to come by, however I recently freed several of them, and we still have two or three free ones left.
2025-08-29[DOC] rb_str_resurrect(): Reword to remove wrong guess; used by zlibAlan Wu
2025-08-27Replace ROBJECT_EMBED by ROBJECT_HEAPJean Boussier
The embed layout is way more common than the heap one, especially since WVA. I think it makes for more readable code to inverse the flag.
2025-08-26Ensure T_OBJECT and T_IMEMO/fields have identical layoutJean Boussier
2025-08-14Fix a static assertion incompatible with C++98 (#14229)Takashi Kokubun
2025-08-14Fix documentation about struct RData's data fieldÉtienne Barrié
Also adds a static assertion to ensure the documented behavior stays true, namely that the data field is at the same position in the RData and RTypedData structs.
2025-08-12RTypedData: keep direct reference to IMEMO/fieldsJean Boussier
Similar to f3206cc79bec2fd852e81ec56de59f0a67ab32b7 but for TypedData. It's quite common for TypedData objects to have a mix of reference in their struct and some ivars. Since we do happen to have 8B free in the RtypedData struct, we could use it to keep a direct reference to the IMEMO/fields saving having to synchronize the VM and lookup the `gen_fields_tbl` on every ivar access. For old school Data classes however, we don't have free space, but this API is soft-deprecated and no longer very common.
2025-08-12Replace stdatomic ops with explicit mem orderJohn Hawthorn
My previous pass missed these atomic operations using operators.
2025-08-12Implement rbimpl_atomic_value_loadJohn Hawthorn
This only adds the rbimpl_ version to include/ruby/atomic.h so that it is not a new public interface. We were already using RUBY_ATOMIC_VALUE_LOAD in a few locations. This will allow us to use other memory orders internally when desired.
2025-08-12Update rbimpl_atomic_* to all take a memory orderJohn Hawthorn
2025-08-12Rename rbimpl_atomic.*_set to _storeJohn Hawthorn
"store" is the terminology the C11 standard uses, which allows us to use this as a fallback. This only changes the private rbimpl_ version of the method, RUBY_ATOMIC_SET et al. keep the same name.
2025-07-28[DOC] Fix return value of rb_str_hash_cmpPeter Zhu
rb_str_hash_cmp returns 0 if the two strings are identical and 1 if they are different.
2025-07-24Support `cause:` in `Thread#raise` and `Fiber#raise`. (#13967)Samuel Williams
* Add support for `cause:` argument to `Fiber#raise` and `Thread#raise`. The implementation behaviour is consistent with `Kernel#raise` and `Exception#initialize` methods, allowing the `cause:` argument to be passed to `Fiber#raise` and `Thread#raise`. This change ensures that the `cause:` argument is handled correctly, providing a more consistent and expected behavior when raising exceptions in fibers and threads. [Feature #21360] * Shared specs for Fiber/Thread/Kernel raise. --------- Co-authored-by: Samuel Williams <samuel.williams@shopify.com>
2025-07-17`atomic.h`: Add C11 <stdatomic.h> implementationfuhsnn
The implementation is only active if `HAVE_STDATOMIC_H` is defined, and only after the compiler fails to match all currently supported systems.
2025-07-17`atomic.h`: Use explicit logic for 32-bit #else branchesfuhsnn
These branches are only active for 32-bit Windows and Solaris platforms, codify the fact by changing `#else` to `#elif`'s that explicitly include those targets and `#error`-out otherwise.
2025-07-11Add Set C-APIJeremy Evans
This should be a minimal C-API needed to deal with Set objects. It supports creating the sets, checking whether an element is the set, adding and removing elements, iterating over the elements, clearing a set, and returning the size of the set. Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
2025-06-25Never use flags on T_NODEJohn Hawthorn
Previously, any time we used FL_TEST or variations we would need to add an additional test that it wasn't a T_NODE. I think that was only needed historically and we can avoid generating that extra code.
2025-06-13Get rid of FL_EXIVARJean Boussier
Now that the shape_id gives us all the same information, it's no longer needed. Notes: Merged: https://github.com/ruby/ruby/pull/13612
2025-06-06Fix `blocking_operation_wait` use-after-free bug.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/13437
2025-06-03Allow pass special constants to the write barrierPeter Zhu
Some GC implementations want to always know when an object is written to, even if the written value is a special constant. Checking special constants in rb_obj_written was a micro-optimization that made assumptions about the GC implementation. Notes: Merged: https://github.com/ruby/ruby/pull/13497
2025-06-02shape.c: Implement a lock-free version of get_next_shape_internalJean Boussier
Whenever we run into an inline cache miss when we try to set an ivar, we may need to take the global lock, just to be able to lookup inside `shape->edges`. To solve that, when we're in multi-ractor mode, we can treat the `shape->edges` as immutable. When we need to add a new edge, we first copy the table, and then replace it with CAS. This increases memory allocations, however we expect that creating new transitions becomes increasingly rare over time. ```ruby class A def initialize(bool) @a = 1 if bool @b = 2 else @c = 3 end end def test @d = 4 end end def bench(iterations) i = iterations while i > 0 A.new(true).test A.new(false).test i -= 1 end end if ARGV.first == "ractor" ractors = 8.times.map do Ractor.new do bench(20_000_000 / 8) end end ractors.each(&:take) else bench(20_000_000) end ``` The above benchmark takes 27 seconds in Ractor mode on Ruby 3.4, and only 1.7s with this branch. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/13441
2025-05-30[Feature #21205] Define File::Stat#birthtime by statxNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13474
2025-05-28Use flag for RCLASS_IS_INITIALIZEDJohn Hawthorn
Previously we used a flag to set whether a module was uninitialized. When checked whether a class was initialized, we first had to check that it had a non-zero superclass, as well as that it wasn't BasicObject. With the advent of namespaces, RCLASS_SUPER is now an expensive operation, and though we could just check for the prime superclass, we might as well take this opportunity to use a flag so that we can perform the initialized check with as few instructions as possible. It's possible in the future that we could prevent uninitialized classes from being available to the user, but currently there are a few ways to do that. Notes: Merged: https://github.com/ruby/ruby/pull/13443
2025-05-26Add shape_id to RBasic under 32 bitJohn Hawthorn
This makes `RBobject` `4B` larger on 32 bit systems but simplifies the implementation a lot. [Feature #21353] Co-authored-by: Jean Boussier <byroot@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/13341
2025-05-23Bump fiber scheduler version and add missing documentation. (#13424)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-05-23Allow `IO#close` to interrupt IO operations on fibers using ↵Samuel Williams
`fiber_interrupt` hook. (#12839) Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-05-22Fix for old mingw without `clock_gettime` and `clock_getres`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13405
2025-05-20Include stdbool.h without checking with autoconfAlan Wu
As reported in <https://bugs.ruby-lang.org/issues/21340>, older autoconf have an AC_HEADER_STDBOOL that's incompatible with C23. Autoconf 2.72 fixed the macro, but also mentions that it's obsolescent since all current compilers have this header. Since we require C99 [1] and VS 2015 [2], we might actually be able take that suggestion and include stdbool.h without a check. I want to try this on rubyci.org and will revert if this cause any issues. Not touching AC_HEADER_STDBOOL in configure.ac for now. [1]: https://bugs.ruby-lang.org/issues/15347 [2]: https://bugs.ruby-lang.org/issues/19982 Notes: Merged: https://github.com/ruby/ruby/pull/13384 Merged-By: XrXr
2025-05-14Bump ABI_VERSIONJean Boussier
`struct RTypedData` was changed significantly in https://github.com/ruby/ruby/pull/13190 which breaks many extensions. Bumping the ABI version might save some people from needlessly investigating crashes.
2025-05-14Reduce `Object#object_id` contention.Jean Boussier
If the object isn't shareable and already has a object_id we can access it without a lock. If we need to generate an ID, we may need to lock to find the child shape. We also generate the next `object_id` using atomics. Notes: Merged: https://github.com/ruby/ruby/pull/13298
2025-05-13Remove outdated references to FL_SEEN_OBJ_IDJean Boussier
2025-05-13Make `waiting_fd` behaviour per-IO. (#13127)Samuel Williams
- `rb_thread_fd_close` is deprecated and now a no-op. - IO operations (including close) no longer take a vm-wide lock. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-05-12Fix redefinition of `clock_gettime` and `clock_getres`Nobuyoshi Nakada
winpthreads-git 12.0.0.r720 provides `clock_gettime` and `clock_getres` as inline functions. Notes: Merged: https://github.com/ruby/ruby/pull/13302
2025-05-11namespace on readSatoshi Tagomori