summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Move enum definitions out of struct definitionYusuke Endoh2022-07-221-30/+29
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-214-26/+26
| | | | [Misc #18891]
* Remove unused internal macros in rarray.hPeter Zhu2022-07-211-24/+0
|
* Implement Objects on VWAPeter Zhu2022-07-152-4/+43
| | | | | | 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.
* Fix some UBSAN false positives (#6115)Kevin Backhouse2022-07-121-1/+1
| | | | * Fix some UBSAN false positives. * ruby tool/update-deps --fix
* do not define our own version of memcpy卜部昌平2022-07-071-5/+1
| | | | | | 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]
* Copy `IO#wait*` methods from `io-wait` gem to `io.c`.Samuel Williams2022-06-251-0/+3
|
* Include JIT information in crash reportsChris Seaton2022-06-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* GVL Instrumentation API: add STARTED and EXITED eventsJean Boussier2022-06-171-4/+6
| | | | | | | | [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.
* Remove unused and accidentally public rb_str_shared_root_p()Alan Wu2022-06-161-3/+0
| | | | | | | 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
* Restore rb_exec_recursive_outerJohn Hawthorn2022-06-151-2/+1
| | | | This was a public method, so we should probably keep it.
* Move String RVALUES between poolsMatt Valentine-House2022-06-131-0/+3
| | | | | And re-embed any strings that can now fit inside the slot they've been moved to
* Make method id explicit in rb_exec_recursive_outerJohn Hawthorn2022-06-101-1/+2
| | | | | | | | | | | | | | 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.
* [Feature #18339] GVL Instrumentation APIJean Boussier2022-06-031-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove trailing comma from FL_USER3 (#5958)Jemma Issroff2022-05-261-1/+1
|
* Remove unused RMODULE_INCLUDED_INTO_REFINEMENT flagJemma Issroff2022-05-261-37/+0
|
* Remove unnecessary module flag, add module assertions to other module flagsJemma Issroff2022-05-231-10/+0
|
* Undefine RUBY_DLN_CHECK_ABI on cygwinDaisuke Fujimura (fd0)2022-05-191-1/+1
|
* Increase SIZE_POOL_COUNT to 5Peter Zhu2022-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Expose `rb_hash_new_capa(long)`Jean Boussier2022-04-261-0/+11
| | | | | | | | [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.
* [Doc] correct my understanding about nonblocking mode卜部昌平2022-04-211-4/+17
| | | | | I was wrong. Nonblocking mode nowadays does not interface with IO#read. Document updated. [ci skip]
* [DOC] add missing size params in fiber scheduler.h (#5441)Alex Matchneer2022-04-141-0/+2
|
* Finer-grained constant cache invalidation (take 2)Kevin Newton2022-04-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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]
* re.c: Add Regexp.timeout= and Regexp.timeoutYusuke Endoh2022-03-301-0/+7
| | | | [Feature #17837]
* Revert "Finer-grained inline constant cache invalidation"Nobuyoshi Nakada2022-03-252-7/+2
| | | | | | | | | | | | 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.
* Finer-grained inline constant cache invalidationKevin Newton2022-03-242-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [Feature #18634] Implement Arrays on Variable Width AllocationPeter Zhu2022-03-222-2/+21
| | | | | | 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.
* Honor if `_Bool` is availableNobuyoshi Nakada2022-03-161-1/+1
| | | | `AC_HEADER_STDBOOL` rejects stdbool.h in c2x, which is not conforming to C99.
* Wrap ruby_abi_version in `extern "C"` for C++Peter Zhu2022-03-011-0/+8
| | | | | Make ruby_abi_version have C linkage so that the symbol can be found in the shared object.
* Only define RUBY_DLN_CHECK_ABI when supportedPeter Zhu2022-03-011-4/+2
|
* [DOC] Fix reference in rb_enc_associate() descriptionLars Kanis2022-03-011-2/+2
|
* [DOC] Fix function name in exampleLars Kanis2022-03-011-1/+1
|
* [Feature #18249] Implement ABI checkingPeter Zhu2022-02-222-0/+46
| | | | | | | | | | | | | | | | | | | | 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"]`.
* Check if `__assume` is supportedNobuyoshi Nakada2022-02-192-5/+1
|
* Define `HAVE___BUILTIN_UNREACHABLE` instead of `UNREACHABLE`Nobuyoshi Nakada2022-02-192-6/+1
| | | | | `UNREACHABLE` in ruby/internal/has/builtin.h is only used as just a flag now, and redefined in ruby/backward/2/assume.h then.
* Mark `rb_clear_constant_cache` as internal use onlyNobuyoshi Nakada2022-01-202-11/+3
| | | | | | In the past, many internal functions are declared in intern.h under include/ruby directory, because there were no headers for internal use.
* include/ruby/win32.h: explicitly define HAVE_SHUTDOWNYuta Saito2022-01-191-0/+2
| | | | | | | | | | | | 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
* include/ruby/io.h: use 0 as POLLPRI when no support for itYuta Saito2022-01-191-4/+3
| | | | | 0x003 is not suitable as a bit mask, and it's ok just to be 0 to avoid setting unsupported bit.
* [wasm] include/ruby/io.h: define RB_WAITFD_PRI by ourselves for wasiYuta Saito2022-01-191-1/+6
| | | | | RB_WAITFD_PRI uses POLLPRI for other platforms, but wasi-libc doesn't have POLLPRI for now.
* [wasm] add no thread variant for freestanding environmentYuta Saito2022-01-191-0/+6
| | | | | This implementation does nothing around preemptive context switching because there is no native thread.
* [wasm] wasm/missing.{c,h}: add missing libc stubs for wasi-libcYuta Saito2022-01-191-0/+113
|
* Don't assume __builtin_bswap32 and __builtin_bswap64 are defined on OpenBSDJeremy Evans2022-01-181-0/+2
| | | | | | At least OpenBSD/sparc64 doesn't appear to define them, and possibly some other OpenBSD GCC platforms don't (most OpenBSD platforms have already switched to clang).
* [Feature #18491] Drop support for HP-UXPeter Zhu2022-01-181-3/+0
| | | | | IA64 support was dropped in ticket #15894, so we can drop support for HP-UX.
* include/ruby/win32.h: define HAVE_X for the missing prototypes (#5456)Yuta Saito2022-01-181-1/+7
|
* Suppress possible loss of data warningsNobuyoshi Nakada2022-01-141-2/+3
|
* [DOC] Fix a typo in a docNobuyoshi Nakada2022-01-131-1/+1
|
* Enable Variable Width Allocation by defaultPeter Zhu2022-01-121-1/+1
|
* Make embedded string length a long for VWAPeter Zhu2022-01-121-1/+1
| | | | | A short (2 bytes) will cause unaligned struct accesses when strings are used as a buffer to directly store binary data.
* Revert "Enable Variable Width Allocation by default"Peter Zhu2022-01-081-1/+1
| | | | This reverts commit c365c5921ea26e31c03a85b01ff4c04629abfc10.
* Use unsigned short for length of embedded stringsPeter Zhu2022-01-071-1/+1
|