summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2025-12-18thread_sync.c: declare queue_data_type as parent of szqueue_data_type.Jean Boussier
Allows to remove some duplicated code like szqueue_length, etc.
2025-12-18[DOC] Fix documents of `rb_intern_str` and so onNobuyoshi Nakada
* `rb_intern_str`: the argument must be `T_STRING`, no conversion. * `rb_intern_str`, `rb_check_id`, `rb_to_id`, `rb_check_symbol`: raise `EncodingError` unless the "name" argument is a valid string in its encoding.
2025-12-18[DOC] Re-fill the paragraphNobuyoshi Nakada
2025-12-18[DOC] Fix double-word typos in commentsv4.0.0-preview3Augustin Gottlieb
Found via `grep` for repeated words. * set.c: Fix "or or" * include/ruby/internal/symbol.h: Fix "is is" * include/ruby/internal/ctype.h: Fix "in in"
2025-12-17Rename to `struct rbimpl_size_overflow_tag`Nobuyoshi Nakada
This struct is used for addition not only for multiplication, so remove the word `mul`, and make the member names more descriptive.
2025-12-16gc.h: Reintroduce immediate guard in `rb_obj_written`Jean Boussier
This guard was removed in https://github.com/ruby/ruby/pull/13497 on the justification that some GC may need to be notified even for immediate. But the two currently available GCs don't, and there are plenty of assumtions GCs don't everywhere, notably in YJIT and ZJIT. This optimization is also not so micro (but not huge either). I routinely see 1-2% wasted there on micro-benchmarks. So perhaps if in the future we actually need this, it might make sense to introduce a way for GCs to declare that as an option, but in the meantime it's extra overhead with little gain.
2025-12-13Fix documentation of RB_PASS_CALLED_KEYWORDS in C APIBenoit Daloze
2025-12-12Fewer calls to `GET_EC()` and `GET_THREAD()` (#15506)Luke Gruber
The changes are to `io.c` and `thread.c`. I changed the API of 2 exported thread functions from `internal/thread.h` that didn't look like they had any use in C extensions: * rb_thread_wait_for_single_fd * rb_thread_io_wait I didn't change the following exported internal function because it's used in C extensions: * rb_thread_fd_select I added a comment to note that this function, although internal, is used in C extensions.
2025-12-12Win32: Make `rb_w32_osid` return Windows NT alwaysNobuyoshi Nakada
Since support for Windows 9x was dropped over a decade ago.
2025-12-12Win32: Deprecate Windows version info APINobuyoshi Nakada
`dwMajorVersion` alone has no meaning since Windows 7. Use API in VersionHelper.h instead.
2025-12-10Add `NUM2PTR` and `PTR2NUM` macrosNobuyoshi Nakada
These macros have been defined here and there, so collect them.
2025-12-09Don't declare `rbimpl_check_typeddata` as pureJean Boussier
[Bug #21771] It may raise so it's incorrect and can lead to the compiler optimizing the call out.
2025-12-09Fix a typo in the deprecation warning messageNobuyoshi Nakada
2025-12-08Move RBIMPL_ATTR_DEPRECATED_* macros to the appropriate header fileKazuki Yamaguchi
Move these macros from include/ruby/backward.h to include/ruby/internal/attr/deprecated.h, alongside the other similar macros. include/ruby/internal/intern/vm.h cannot currently use them because include/ruby/backward.h is included too late.
2025-12-06Yield to scheduler if interrupts are pending. (#14700)Samuel Williams
2025-12-05fix typo s/sharable/shareable/Koichi Sasada
2025-12-05(experimental) RUBY_TYPED_FROZEN_SHAREABLE_NO_RECKoichi Sasada
`T_DATA` has a flag `RUBY_TYPED_FROZEN_SHAREABLE` which means if the `T_DATA` object is frozen, it can be sharable. On the `Ractor.make_sharable(obj)`, rechable objects from the `T_DATA` object will be apply `Ractor.make_shareable` recursively. `RUBY_TYPED_FROZEN_SHAREABLE_NO_REC` is similar to the `RUBY_TYPED_FROZEN_SHAREABLE`, but doesn't apply `Ractor.make_sharable` recursively for children. If it refers to unshareable objects, it will simply raise an error. I'm not sure this pattern is common or not, so it is not in public. If we find more cases, we can discuss publication.
2025-12-04Deprecate `rb_eval_cmd_kw`Nobuyoshi Nakada
2025-12-03Speedup TypedData_Get_StructJean Boussier
While profiling `Monitor#synchronize` and `Mutex#synchronize` I noticed a fairly significant amount of time spent in `rb_check_typeddata`. By implementing a fast path that assumes the object is valid and that can be inlined, it does make a significant difference: Before: ``` Mutex 13.548M (± 3.6%) i/s (73.81 ns/i) - 68.566M in 5.067444 Monitor 10.497M (± 6.5%) i/s (95.27 ns/i) - 52.529M in 5.032698s ``` After: ``` Mutex 20.887M (± 0.3%) i/s (47.88 ns/i) - 106.021M in 5.075989s Monitor 16.245M (±13.3%) i/s (61.56 ns/i) - 80.705M in 5.099680s ``` ```ruby require 'bundler/inline' gemfile do gem "benchmark-ips" end mutex = Mutex.new require "monitor" monitor = Monitor.new Benchmark.ips do |x| x.report("Mutex") { mutex.synchronize { } } x.report("Monitor") { monitor.synchronize { } } end ```
2025-11-27[DOC] Fix typo in rb_debug_inspector_current_depthPeter Zhu
2025-11-19Win32: Drop support for older than MSVC 12.0/_MSC_VER 1800Nobuyoshi Nakada
Visual C++ 2013 (12.0): - _MSC_VER: 1800 - MSVCRT_VERSION: 120
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>