summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2022-08-27Avoid leaving a period alone [ci skip]Takashi Kokubun
2022-08-27typosspaette
Notes: Merged: https://github.com/ruby/ruby/pull/6290
2022-08-19Support Encoding::Converter newline: :lf and :lf_newline optionsJeremy Evans
Previously, newline: :lf was accepted but ignored. Where it should have been used was commented out code that didn't work, but unlike all other invalid values, using newline: :lf did not raise an error. This adds support for newline: :lf and :lf_newline, for consistency with newline: :cr and :cr_newline. This is basically the same as universal_newline, except that it only affects writing and not reading due to RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK. Add tests for the File.open :newline option while here. Fixes [Bug #12436] Notes: Merged: https://github.com/ruby/ruby/pull/4590
2022-08-12Stop defining `RUBY_ABI_VERSION` if released versionsNobuyoshi Nakada
As commented in include/ruby/internal/abi.h, since teeny versions of Ruby should guarantee ABI compatibility, `RUBY_ABI_VERSION` has no role in released versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/6231
2022-08-12Add missing `rb_enc_iscntrl`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6235
2022-08-12[DOC] Use `true`/`false` for `@retval`s which are `bool`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6235
2022-08-07[DOC] Add return values of rb_enc_mbcputNobuyoshi Nakada
2022-07-27Adjust styles [ci skip]Nobuyoshi Nakada
2022-07-26Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu
rb_ary_tmp_new suggests that the array is temporary in some way, but that's not true, it just creates an array that's hidden and not on the transient heap. This commit renames it to rb_ary_hidden_new. Notes: Merged: https://github.com/ruby/ruby/pull/6180
2022-07-22Move enum definitions out of struct definitionYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/6169
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-21Remove unused internal macros in rarray.hPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/6157
2022-07-15Implement Objects on VWAPeter Zhu
This commit implements Objects on Variable Width Allocation. This allows Objects with more ivars to be embedded (i.e. contents directly follow the object header) which improves performance through better cache locality. Notes: Merged: https://github.com/ruby/ruby/pull/6117
2022-07-12Fix some UBSAN false positives (#6115)Kevin Backhouse
* Fix some UBSAN false positives. * ruby tool/update-deps --fix Notes: Merged-By: jhawthorn <john@hawthorn.email>
2022-07-07do not define our own version of memcpy卜部昌平
The (sole) use of memcpy in our public header is now replaced to directly call ruby_nonempty_memcpy, and the previous definition of memcpy is now internal-only. [Bug#18893] Notes: Merged: https://github.com/ruby/ruby/pull/6098
2022-06-25Copy `IO#wait*` methods from `io-wait` gem to `io.c`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/6036
2022-06-20Include JIT information in crash reportsChris Seaton
Since enabling YJIT or MJIT drastically changes what could go wrong at runtime, it's good to be front and center about whether they are enabled when dumping a crash report. Previously, `RUBY_DESCRIPTION` and the description printed when crashing can be different when a JIT is on. Introduce a new internal data global, `rb_dynamic_description`, and set it to be the same as `RUBY_DESCRIPTION` during initialization; use it when crashing. * version.c: Init_ruby_description(): Initialize and use `rb_dynamic_description`. * error.c: Change crash reports to use `rb_dynamic_description`. * ruby.c: Call `Init_ruby_description()` earlier. Slightly more work for when we exit right after printing the description but that was deemed acceptable. * include/ruby/version.h: Talk about how JIT info is not in `ruby_description`. * test/-ext-/bug_reporter/test_bug_reporter.rb: Remove handling for crash description being different from `RUBY_DESCRIPTION`. * test/ruby/test_rubyoptions.rb: ditto Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Alan Wu <alanwu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/5872
2022-06-17GVL Instrumentation API: add STARTED and EXITED eventsJean Boussier
[Feature #18339] After experimenting with the initial version of the API I figured there is a need for an exit event to cleanup instrumentation data. e.g. if you record data in a {thread_id -> data} table, you need to free associated data when a thread goes away. Notes: Merged: https://github.com/ruby/ruby/pull/6029
2022-06-16Remove unused and accidentally public rb_str_shared_root_p()Alan Wu
This function was added to a public header in [1] probably unintentionally since it's not used anywhere, exposes implementation details, and isn't related to the goals of that pull request. [1]: 56cc3e99b6b9ec004255280337f6b8353f5e5b06 Notes: Merged: https://github.com/ruby/ruby/pull/6023 Merged-By: XrXr
2022-06-15Restore rb_exec_recursive_outerJohn Hawthorn
This was a public method, so we should probably keep it. Notes: Merged: https://github.com/ruby/ruby/pull/6027
2022-06-13Move String RVALUES between poolsMatt Valentine-House
And re-embed any strings that can now fit inside the slot they've been moved to Notes: Merged: https://github.com/ruby/ruby/pull/5986
2022-06-10Make method id explicit in rb_exec_recursive_outerJohn Hawthorn
Previously, because opt_aref and opt_aset don't push a frame, when they would call rb_hash to determine the hash value of the key, the initial level of recursion would incorrectly use the method id at the top of the stack instead of "hash". This commit replaces rb_exec_recursive_outer with rb_exec_recursive_outer_mid, which takes an explicit method id, so that we can make the hash calculation behave consistently. rb_exec_recursive_outer was documented as being internal, so I believe this should be okay to change. Notes: Merged: https://github.com/ruby/ruby/pull/6004
2022-06-03[Feature #18339] GVL Instrumentation APIJean Boussier
Ref: https://bugs.ruby-lang.org/issues/18339 Design: - This tries to minimize the overhead when no hook is registered. It should only incur an extra unsynchronized boolean check. - The hook list is protected with a read-write lock as to cause contention when some hooks are registered. - The hooks MUST be thread safe, and MUST NOT call into Ruby as they are executed outside the GVL. - It's simply a noop on Windows. API: ``` rb_internal_thread_event_hook_t * rb_internal_thread_add_event_hook(rb_internal_thread_event_callback callback, rb_event_flag_t internal_event, void *user_data); bool rb_internal_thread_remove_event_hook(rb_internal_thread_event_hook_t * hook); ``` You can subscribe to 3 events: - READY: called right before attempting to acquire the GVL - RESUMED: called right after successfully acquiring the GVL - SUSPENDED: called right after releasing the GVL. The hooks MUST be threadsafe, as they are executed outside of the GVL, they also MUST NOT call any Ruby API. Notes: Merged: https://github.com/ruby/ruby/pull/5500
2022-05-26Remove trailing comma from FL_USER3 (#5958)Jemma Issroff
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-05-26Remove unused RMODULE_INCLUDED_INTO_REFINEMENT flagJemma Issroff
Notes: Merged: https://github.com/ruby/ruby/pull/5932
2022-05-23Remove unnecessary module flag, add module assertions to other module flagsJemma Issroff
Notes: Merged: https://github.com/ruby/ruby/pull/5930
2022-05-19Undefine RUBY_DLN_CHECK_ABI on cygwinDaisuke Fujimura (fd0)
Notes: Merged: https://github.com/ruby/ruby/pull/5810
2022-05-09Increase SIZE_POOL_COUNT to 5Peter Zhu
Having more size pools will allow us to allocate larger objects through Variable Width Allocation. I have attached some benchmark results below. Discourse: On Discourse, we don't see much change in response times. We do see a small reduction in RSS. Branch RSS: 377.8 MB Master RSS: 396.3 MB railsbench: On railsbench, we don't see a big change in RPS or p99 performance. We see a small increase in RSS. Branch RPS: 815.38 Master RPS: 811.73 Branch p99: 1.69 ms Master p99: 1.68 ms Branch RSS: 90.6 MB Master RSS: 89.4 MB liquid: We don't see a significant change in liquid performance. Branch parse & render: 29.041 I/s Master parse & render: 29.211 I/s Notes: Merged: https://github.com/ruby/ruby/pull/5885
2022-04-26Expose `rb_hash_new_capa(long)`Jean Boussier
[Feature #18683] This allows parsers and similar libraries to create Hashes of a certain capacity in advance. It's useful when the key and values are streamed, hence `bulk_insert()` can't be used. Notes: Merged: https://github.com/ruby/ruby/pull/5835
2022-04-21[Doc] correct my understanding about nonblocking mode卜部昌平
I was wrong. Nonblocking mode nowadays does not interface with IO#read. Document updated. [ci skip]
2022-04-14[DOC] add missing size params in fiber scheduler.h (#5441)Alex Matchneer
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-04-01Finer-grained constant cache invalidation (take 2)Kevin Newton
This commit reintroduces finer-grained constant cache invalidation. After 8008fb7 got merged, it was causing issues on token-threaded builds (such as on Windows). The issue was that when you're iterating through instruction sequences and using the translator functions to get back the instruction structs, you're either using `rb_vm_insn_null_translator` or `rb_vm_insn_addr2insn2` depending if it's a direct-threading build. `rb_vm_insn_addr2insn2` does some normalization to always return to you the non-trace version of whatever instruction you're looking at. `rb_vm_insn_null_translator` does not do that normalization. This means that when you're looping through the instructions if you're trying to do an opcode comparison, it can change depending on the type of threading that you're using. This can be very confusing. So, this commit creates a new translator function `rb_vm_insn_normalizing_translator` to always return the non-trace version so that opcode comparisons don't have to worry about different configurations. [Feature #18589] Notes: Merged: https://github.com/ruby/ruby/pull/5716
2022-03-30re.c: Add Regexp.timeout= and Regexp.timeoutYusuke Endoh
[Feature #17837] Notes: Merged: https://github.com/ruby/ruby/pull/5703
2022-03-25Revert "Finer-grained inline constant cache invalidation"Nobuyoshi Nakada
This reverts commits for [Feature #18589]: * 8008fb7352abc6fba433b99bf20763cf0d4adb38 "Update formatting per feedback" * 8f6eaca2e19828e92ecdb28b0fe693d606a03f96 "Delete ID from constant cache table if it becomes empty on ISEQ free" * 629908586b4bead1103267652f8b96b1083573a8 "Finer-grained inline constant cache invalidation" MSWin builds on AppVeyor have been crashing since the merger. Notes: Merged: https://github.com/ruby/ruby/pull/5715 Merged-By: nobu <nobu@ruby-lang.org>
2022-03-24Finer-grained inline constant cache invalidationKevin Newton
Current behavior - caches depend on a global counter. All constant mutations cause caches to be invalidated. ```ruby class A B = 1 end def foo A::B # inline cache depends on global counter end foo # populate inline cache foo # hit inline cache C = 1 # global counter increments, all caches are invalidated foo # misses inline cache due to `C = 1` ``` Proposed behavior - caches depend on name components. Only constant mutations with corresponding names will invalidate the cache. ```ruby class A B = 1 end def foo A::B # inline cache depends constants named "A" and "B" end foo # populate inline cache foo # hit inline cache C = 1 # caches that depend on the name "C" are invalidated foo # hits inline cache because IC only depends on "A" and "B" ``` Examples of breaking the new cache: ```ruby module C # Breaks `foo` cache because "A" constant is set and the cache in foo depends # on "A" and "B" class A; end end B = 1 ``` We expect the new cache scheme to be invalidated less often because names aren't frequently reused. With the cache being invalidated less, we can rely on its stability more to keep our constant references fast and reduce the need to throw away generated code in YJIT. Notes: Merged: https://github.com/ruby/ruby/pull/5433
2022-03-22[Feature #18634] Implement Arrays on Variable Width AllocationPeter Zhu
This commit implements arrays on Variable Width Allocation. This allows longer arrays to be embedded (i.e. contents directly follow the object header) which improves performance through better cache locality. Notes: Merged: https://github.com/ruby/ruby/pull/5660
2022-03-16Honor if `_Bool` is availableNobuyoshi Nakada
`AC_HEADER_STDBOOL` rejects stdbool.h in c2x, which is not conforming to C99. Notes: Merged: https://github.com/ruby/ruby/pull/5666 Merged-By: nobu <nobu@ruby-lang.org>
2022-03-01Wrap ruby_abi_version in `extern "C"` for C++Peter Zhu
Make ruby_abi_version have C linkage so that the symbol can be found in the shared object.
2022-03-01Only define RUBY_DLN_CHECK_ABI when supportedPeter Zhu
2022-03-01[DOC] Fix reference in rb_enc_associate() descriptionLars Kanis
Notes: Merged: https://github.com/ruby/ruby/pull/5534
2022-03-01[DOC] Fix function name in exampleLars Kanis
Notes: Merged: https://github.com/ruby/ruby/pull/5599
2022-02-22[Feature #18249] Implement ABI checkingPeter Zhu
Header file include/ruby/internal/abi.h contains RUBY_ABI_VERSION which is the ABI version. This value should be bumped whenever an ABI incompatible change is introduced. When loading dynamic libraries, Ruby will compare its own `ruby_abi_version` and the `ruby_abi_version` of the loaded library. If these two values don't match it will raise a `LoadError`. This feature can also be turned off by setting the environment variable `RUBY_RUBY_ABI_CHECK=0`. This feature will prevent cases where previously installed native gems fail in unexpected ways due to incompatibility of changes in header files. This will force the developer to recompile their gems to use the same header files as the built Ruby. In Ruby, the ABI version is exposed through `RbConfig::CONFIG["ruby_abi_version"]`. Notes: Merged: https://github.com/ruby/ruby/pull/5474
2022-02-19Check if `__assume` is supportedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5577
2022-02-19Define `HAVE___BUILTIN_UNREACHABLE` instead of `UNREACHABLE`Nobuyoshi Nakada
`UNREACHABLE` in ruby/internal/has/builtin.h is only used as just a flag now, and redefined in ruby/backward/2/assume.h then. Notes: Merged: https://github.com/ruby/ruby/pull/5577
2022-01-20Mark `rb_clear_constant_cache` as internal use onlyNobuyoshi Nakada
In the past, many internal functions are declared in intern.h under include/ruby directory, because there were no headers for internal use.
2022-01-19include/ruby/win32.h: explicitly define HAVE_SHUTDOWNYuta Saito
Configuration for mingw32 can't detect 'shutdown' due to wrong -l option even though it's available (this has been going on for a while, and it needs to be fixed). In this situation, include/ruby/missing.h declares a stub shutdown function since 7ee786388a, and another shutdown decl is came from system header. They are incompatible at stdcall attribute, so it causes compilation failure. This change defines a HAVE_SHUTDOWN to guard a newly introduced stub decl in include/ruby/missing.h Notes: Merged: https://github.com/ruby/ruby/pull/5465
2022-01-19include/ruby/io.h: use 0 as POLLPRI when no support for itYuta Saito
0x003 is not suitable as a bit mask, and it's ok just to be 0 to avoid setting unsupported bit. Notes: Merged: https://github.com/ruby/ruby/pull/5461
2022-01-19[wasm] include/ruby/io.h: define RB_WAITFD_PRI by ourselves for wasiYuta Saito
RB_WAITFD_PRI uses POLLPRI for other platforms, but wasi-libc doesn't have POLLPRI for now. Notes: Merged: https://github.com/ruby/ruby/pull/5407
2022-01-19[wasm] add no thread variant for freestanding environmentYuta Saito
This implementation does nothing around preemptive context switching because there is no native thread. Notes: Merged: https://github.com/ruby/ruby/pull/5407
2022-01-19[wasm] wasm/missing.{c,h}: add missing libc stubs for wasi-libcYuta Saito
Notes: Merged: https://github.com/ruby/ruby/pull/5407