aboutsummaryrefslogtreecommitdiffstats
path: root/include/ruby
Commit message (Collapse)AuthorAgeFilesLines
* YJIT: Move ROBJECT_OFFSET_* to yjit.c (#8157)Takashi Kokubun2023-08-021-7/+0
|
* support `rescue` event for TracePointKoichi Sasada2023-08-011-0/+1
| | | | fix [Feature #19572]
* Resurrect rb_reg_prepare_re C APITakashi Kokubun2023-07-271-0/+21
| | | | | | | | Existing strscan releases rely on this C API. It means that the current Ruby master doesn't work if your Gemfile.lock has strscan unless it's locked to 3.0.7, which is not released yet. To fix it, let's not remove the C API we've exposed to users.
* Add function rb_reg_onig_matchPeter Zhu2023-07-271-7/+11
| | | | | | rb_reg_onig_match performs preparation, error handling, and cleanup for matching a regex against a string. This reduces repetitive code and removes the need for StringScanner to access internal data of regex.
* Check if macros are defined before usingNobuyoshi Nakada2023-07-241-4/+4
| | | | Assume macros with the same prefix would be defined together.
* RString NULL ptr check only when RUBY_DEBUGNobuyoshi Nakada2023-07-241-7/+3
| | | | | Since edf01d4e82d8e44ee30ec41fbcb7f802bc8b8c5d, fake string treats NULL as an empty string.
* Embed struct rmatch into GC slot (#8097)Kunshan Wang2023-07-201-8/+6
|
* Move `posix_signal` declaration internal with prefix `ruby_`Nobuyoshi Nakada2023-07-171-6/+0
|
* Remove RARRAY_CONST_PTR_TRANSIENTPeter Zhu2023-07-131-22/+2
| | | | RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT.
* Remove RARRAY_PTR_USE_TRANSIENTPeter Zhu2023-07-131-12/+2
| | | | RARRAY_PTR_USE now does the same things as RARRAY_PTR_USE_TRANSIENT.
* Remove rb_array_ptr_use_{start,end}Peter Zhu2023-07-131-52/+5
|
* [Feature #19730] Remove transient heapPeter Zhu2023-07-131-88/+0
|
* [Feature #19757] Add new API `rb_data_define`Nobuyoshi Nakada2023-07-131-0/+14
|
* Store object age in a bitmapMatt Valentine-House2023-07-132-41/+15
| | | | | | | | | | | | | | | | | | Closes [Feature #19729] Previously 2 bits of the flags on each RVALUE are reserved to store the number of GC cycles that each object has survived. This commit introduces a new bit array on the heap page, called age_bits, to store that information instead. This patch still reserves one of the age bits in the flags (the old FL_PROMOTED0 bit, now renamed FL_PROMOTED). This is set to 0 for young objects and 1 for old objects, and is used as a performance optimisation for the write barrier. Fetching the age_bits from the heap page and doing the required math to calculate if the object was old or not would slow down the write barrier. So we keep this bit synced in the flags for fast access.
* Remove reference to USE_RINCGCMatt Valentine-House2023-07-041-12/+0
| | | | | | This compile time flag was removed in https://github.com/ruby/ruby/pull/7313 This commit cleans up some related dead code.
* Fix memory leak when copying ST tablesPeter Zhu2023-06-291-0/+2
| | | | | | | | | | | | | | | | | st_copy allocates a st_table, which is not needed for hashes since it is allocated by VWA and embedded, so this causes a memory leak. The following script demonstrates the issue: ```ruby 20.times do 100_000.times do {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9} end puts `ps -o rss= -p #{$$}` end ```
* Use `rb_reg_nth_defined` instead of `rb_match_nth_defined`Nobuyoshi Nakada2023-06-271-5/+0
|
* Remove taint and untrusted flags (#7958)Nobuyoshi Nakada2023-06-191-9/+2
| | | | | | | | | | * Make TAINT and UNTRUSTED flags zero These flags do nothing already, and should break nothing. * Remove TAINT and UNTRUSTED macros same as functions These macros had been defined to use with `#ifdef`, but should not be used anymore.
* Fixes [Bug #19732]. Add missing stdint.h header to event.h.Peter Arato2023-06-171-0/+4
|
* [DOC] Should use `NULL` instead of zeroNobuyoshi Nakada2023-06-121-8/+8
| | | | | | | Since no type information is available for variadic arguments, 0 is passed as `int` without promoting to pointer. On platforms where `sizeof(int) < sizeof(void*)`, the terminator argument may be read together with an adjoining word, and may not be found.
* Optimize `Regexp#dup` and `Regexp.new(/RE/)`Nobuyoshi Nakada2023-06-091-0/+2
| | | | | When copying from another regexp, copy already built `regex_t` instead of re-compiling its source.
* Add deprecations for public `struct rb_io` members. (#7916)Samuel Williams2023-06-081-12/+27
| | | * Add deprecations for public struct rb_io members.
* Unify length field for embedded and heap strings (#7908)Peter Zhu2023-06-061-43/+13
| | | | | | | | * Unify length field for embedded and heap strings The length field is of the same type and position in RString for both embedded and heap allocated strings, so we can unify it. * Remove RSTRING_EMBED_LEN
* Expose `enum rb_io_event` flags without `_t` suffix. (#7887)Samuel Williams2023-06-011-2/+4
|
* Drop `_t` suffix from struct names. (#7886)Samuel Williams2023-06-012-12/+12
| | | POSIX reserves `_t` suffix in types.
* Hide the usage of `rb_io_t` where possible. (#7880)Samuel Williams2023-06-011-1/+34
| | | This retries the compatible parts of the previously reverted PR so we can continue to update related code without breaking backwards compatibility.
* Revert "Hide most of the implementation of `struct rb_io`. (#6511)"NARUSE, Yui2023-06-012-43/+125
| | | | | | | | | This reverts commit 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2. fix [Bug #19704] https://bugs.ruby-lang.org/issues/19704 This breaks compatibility for extension libraries. Such changes need a discussion.
* Hide most of the implementation of `struct rb_io`. (#6511)Samuel Williams2023-05-302-125/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add rb_io_path and rb_io_open_descriptor. * Use rb_io_open_descriptor to create PTY objects * Rename FMODE_PREP -> FMODE_EXTERNAL and expose it FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but FMODE_EXTERNAL is clearer about what the file descriptor represents and aligns with language in the IO::Buffer module. * Ensure that rb_io_open_descriptor closes the FD if it fails If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be responsible for closing your file, eventually, if you pass it to rb_io_open_descriptor, even if it raises an exception. * Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P * Expose `rb_io_closed_p`. * Add `rb_io_mode` to get IO mode. --------- Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
* Improve `read`/`write`/`pread`/`pwrite` consistency. (#7860)Samuel Williams2023-05-271-6/+0
| | | | | | | * Documentation consistency. * Improve consistency of `pread`/`pwrite` implementation when given length. * Remove HAVE_PREAD / HAVE_PWRITE - it is no longer optional.
* Move rb_thread_cond_struct definition into thread_native.hKJ Tsanaktsidis2023-05-261-0/+5
| | | | | | | | | | | On Win32, currently, rb_nativethread_cond_t is an incomplete type because it's a typedef for `struct rb_thread_cond_struct`. That means you can't actually allocate a rb_nativethread_cond_t unless you also include THREAD_IMPL_H (since its defined in thread_win32.h) (alternatively, including vm_core.h also works). Move the definition of rb_thread_cond_struct into thread_native.h to alleviate this.
* Fix "runs a C function with the global lock unlocked and unlocks IO with the ↵Samuel Williams2023-05-241-4/+4
| | | | | | | | | generic RUBY_UBF_IO" on Windows. (#7848) * Enable borked spec. * Ensure win32 wrappers are visible and used. * Reorganise `read`/`write`/`pipe` in `thread_spec.c`.
* Add support for pread/pwrite on windows. (#7827)Samuel Williams2023-05-241-4/+14
|
* Implement Hash ST tables on VWAPeter Zhu2023-05-171-0/+2
|
* Constify `type` and `typed_flag` in `RTypedData`Nobuyoshi Nakada2023-04-271-4/+2
| | | | These must not be changed once initialized.
* Refactor `Regexp#match` cache implementation (#7724)TSUYUSATO Kitsune2023-04-191-2/+0
| | | | | | | | | | * Refactor Regexp#match cache implementation Improved variable and function names Fixed [Bug 19537] (Maybe fixed in https://github.com/ruby/ruby/pull/7694) * Add a comment of the glossary for "match cache" * Skip to reset match cache when no cache point on null check
* Add RB_WARN_CATEGORY_DEFAULT_BITSJean Boussier2023-04-141-0/+6
| | | | | | | | | | Followup: ac123f167a364c3d7a43eca78d564e41f6dbb91e RB_WARN_CATEGORY_ALL_BITS is exposed in a public header, so it makes sense for it to be updated to contain all valid bits. Instead we introduce RB_WARN_CATEGORY_DEFAULT_BITS to list the categories that are enabled by default.
* Emit a performance warning when a class reached max variationsJean Boussier2023-04-131-0/+3
| | | | | | | [Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true`
* Disable all warning categories other than `RB_WARN_CATEGORY_ALL_BITS`Nobuyoshi Nakada2023-04-131-1/+4
|
* [Bug #19584] [DOC] Tweek description of `rb_gc_register_address`Nobuyoshi Nakada2023-04-071-4/+9
|
* [Feature #19579] Remove !USE_RVARGC code (#7655)Peter Zhu2023-04-044-90/+0
| | | | | | | | | | | Remove !USE_RVARGC code [Feature #19579] The Variable Width Allocation feature was turned on by default in Ruby 3.2. Since then, we haven't received bug reports or backports to the non-Variable Width Allocation code paths, so we assume that nobody is using it. We also don't plan on maintaining the non-Variable Width Allocation code, so we are going to remove it.
* Support `IO#pread` / `IO#pwrite` using fiber scheduler. (#7594)Samuel Williams2023-03-312-25/+55
| | | * Skip test if non-blocking file IO is not supported.
* Use an st table for "too complex" objectsAaron Patterson2023-03-201-0/+2
| | | | | | | | | | st tables will maintain insertion order so we can marshal dump / load objects with instance variables in the same order they were set on that particular instance [ruby-core:112926] [Bug #19535] Co-Authored-By: Jemma Issroff <jemmaissroff@gmail.com>
* [Feature #19406] Allow declarative definition of referencesMatt Valentine-House2023-03-172-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using rb_data_type_struct to wrap a C struct, that C struct can contain VALUE references to other Ruby objects. If this is the case then one must also define dmark and optionally dcompact callbacks in order to allow these objects to be correctly handled by the GC. This is suboptimal as it requires GC related logic to be implemented by extension developers. This can be a cause of subtle bugs when references are not marked of updated correctly inside these callbacks. This commit provides an alternative approach, useful in the simple case where the C struct contains VALUE members (ie. there isn't any conditional logic, or data structure manipulation required to traverse these references). In this case references can be defined using a declarative syntax as a list of edges (or, pointers to references). A flag can be set on the rb_data_type_struct to notify the GC that declarative references are being used, and a list of those references can be assigned to the dmark pointer instead of a function callback, on the rb_data_type_struct. Macros are also provided for simple declaration of the reference list, and building edges. To avoid having to also find space in the struct to define a length for the references list, I've chosed to always terminate the references list with RUBY_REF_END - defined as UINTPTR_MAX. My assumption is that no single struct will ever be large enough that UINTPTR_MAX is actually a valid reference.
* Remove obsoleted MJIT_HEADER macroTakashi Kokubun2023-03-062-7/+3
|
* Remove obsoleted MJIT_STATIC macroTakashi Kokubun2023-03-062-20/+1
|
* Stop exporting symbols for MJITTakashi Kokubun2023-03-061-11/+0
|
* Update the depend filesMatt Valentine-House2023-02-281-425/+0
|
* Merge internal/rgengc.h and internal/gc.hMatt Valentine-House2023-02-283-3/+424
|
* Remove "unused parameter" warnings on include of ruby.hSébastien Helleu2023-02-282-0/+13
| | | | | These warnings are displayed when compiling with flag "-Wunused-parameter" (or with "-Wall -Wextra").
* Merge internal/intern/gc.h into internal/gc.hMatt Valentine-House2023-02-273-393/+363
|