summaryrefslogtreecommitdiff
path: root/ext/-test-
AgeCommit message (Collapse)Author
2022-08-11Fix Array#[] with ArithmeticSequence with negative steps (#5739)Jeremy Evans
* Fix Array#[] with ArithmeticSequence with negative steps Previously, Array#[] when called with an ArithmeticSequence with a negative step did not handle all cases correctly, especially cases involving infinite ranges, inverted ranges, and/or exclusive ends. Fixes [Bug #18247] * Add Array#slice tests for ArithmeticSequence with negative step to test_array Add tests of rb_arithmetic_sequence_beg_len_step C-API function. * Fix ext/-test-/arith_seq/beg_len_step/depend * Rename local variables * Fix a variable name Co-authored-by: Kenta Murata <3959+mrkn@users.noreply.github.com> Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2022-08-01respect current frame of `rb_eval_string`Koichi Sasada
`self` is nearest Ruby method's `self`. If there is no ruby frame, use toplevel `self` (`main`). https://bugs.ruby-lang.org/issues/18780 Notes: Merged: https://github.com/ruby/ruby/pull/6199
2022-07-27Adjust styles [ci skip]Nobuyoshi Nakada
2022-07-26Fix `rb_profile_frames` output includes dummy main thread frameIvo Anjo
The `rb_profile_frames` API did not skip the two dummy frames that each thread has at its beginning. This was unlike `backtrace_each` and `rb_ec_parcial_backtrace_object`, which do skip them. This does not seem to be a problem for non-main thread frames, because both `VM_FRAME_RUBYFRAME_P(cfp)` and `rb_vm_frame_method_entry(cfp)` are NULL for them. BUT, on the main thread `VM_FRAME_RUBYFRAME_P(cfp)` was true and thus the dummy thread was still included in the output of `rb_profile_frames`. I've now made `rb_profile_frames` skip this extra frame (like `backtrace_each` and friends), as well as add a test that asserts the size and contents of `rb_profile_frames`. Fixes [Bug #18907] (<https://bugs.ruby-lang.org/issues/18907>) Notes: Merged: https://github.com/ruby/ruby/pull/6114
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-08Make a local symbol staticNobuyoshi Nakada
2022-07-07thread_pthread.c: call SUSPENDED event when entering native_sleepJean Boussier
[Bug #18900] Thread#join and a few other codepaths are using native sleep as a way to suspend the current thread. So we should call the relevant hook when this happen, otherwise some thread may transition directly from `RESUMED` to `READY`. Notes: Merged: https://github.com/ruby/ruby/pull/6101
2022-06-19Remove unnecessary `*` before the function nameNobuyoshi Nakada
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-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-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-02-22Update ext/-test-/dln/empty/dependPeter Zhu
Dependencies was not updated in 06dab12717a05bf49e4c6dff1d6f5458678d0e00.
2022-02-22Include ruby.h in empty.c to have ABI versionPeter Zhu
I forgot to include this as part of 638fd8774bed27b997f3b634ba8be7aa304be3c3.
2022-02-22[Feature #18249] Update dependenciesPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/5474
2022-02-22[Feature #18249] Include ruby.h in extensions to have ABI versionPeter Zhu
All shared libraries must have `include/ruby/internal/abi.h` to include the ABI version. Including `ruby.h` will guarantee that. Notes: Merged: https://github.com/ruby/ruby/pull/5474
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-01-18[Feature #18491] Drop support for HP-UXPeter Zhu
IA64 support was dropped in ticket #15894, so we can drop support for HP-UX. Notes: Merged: https://github.com/ruby/ruby/pull/5457
2021-11-22Avoid assert failure when NULL EC is expectedAlan Wu
After 5680c38c75aeb5cbd219aafa8eb48c315f287d97, postponed job APIs now expect to be called on native threads not managed by Ruby and handles getting a NULL execution context. However, in debug builds the change runs into an assertion failure with GET_EC() which asserts that EC is non-NULL. Avoid the assertion failure by passing `false` for `expect_ec` instead as the intention is to handle when there is no EC. Add a test from John Crepezzi and John Hawthorn to exercise this situation. See GH-4108 See GH-5094 [Bug #17573] Co-authored-by: John Hawthorn <john@hawthorn.email> Co-authored-by: John Crepezzi <john.crepezzi@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/5156 Merged-By: XrXr
2021-11-21Update dependenciesNobuyoshi Nakada
2021-11-08Prefer ANSI-style prototypes over old K&R-style definitionsNobuyoshi Nakada
2021-11-08Fix filename typo [Bug #18140]Nobuyoshi Nakada
2021-10-25[Feature #18239] Implement VWA for stringsPeter Zhu
This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings. Notes: Merged: https://github.com/ruby/ruby/pull/4933
2021-10-05ruby tool/update-deps --fix卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4909
2021-09-05[ruby/fiddle] Create extconf header for MSVCNobuyoshi Nakada
Not to include parenthesized argument. https://github.com/ruby/fiddle/commit/c2c921e16a Notes: Merged: https://github.com/ruby/ruby/pull/4810
2021-09-02Refined test [Bug #18140]Nobuyoshi Nakada
2021-09-01Guard array when appendingAaron Patterson
This prevents early collection of the array. The GC doesn't see the array on the stack when Ruby is compiled with optimizations enabled Thanks @jhaberman for the test case [ruby-core:105099] [Bug #18140]
2021-08-09Include ruby.h before internal headers to suppress -Wundef warningsNobuyoshi Nakada
2021-08-05Show WorkingSetSize as RSS on WindowsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4709
2021-08-01Define functions using rb_wait_for_single_fd [Bug #18046]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4696 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-29Renamed thraed_fd_close as thread_fdNobuyoshi Nakada
2021-07-14[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version ↵Nobuyoshi Nakada
(https://github.com/ruby/fiddle/pull/86) https://github.com/ruby/fiddle/commit/c5abcc3a7e
2021-06-29Add basic test for updated IO wait functions.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4612
2021-06-26Scan the coderange in the given encodingNobuyoshi Nakada
2021-06-22Deprecate and rework old (fd) centric functions.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4592
2021-06-13Check if alternative malloc header can work in C++Nobuyoshi Nakada
jemalloc (5.2.1 at least) cannot compile in C++ on macOS SDK, due to conflicts on exception specification.
2021-04-13dependency updates卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4371
2021-03-22rb_enc_interned_str: handle autoloaded encodingsJean Boussier
If called with an autoloaded encoding that was not yet initialized, `rb_enc_interned_str` would crash with a NULL pointer exception. See: https://github.com/ruby/ruby/pull/4119#issuecomment-800189841 Notes: Merged: https://github.com/ruby/ruby/pull/4290
2021-01-09Get rid of defining methods for tests in core classesNobuyoshi Nakada
Not to interfere in other tests. Notes: Merged: https://github.com/ruby/ruby/pull/4043
2020-12-27Removed declarations conflicting on MinGWNobuyoshi Nakada
2020-12-23[memory_view] Make some rb_memroy_view_t members constKenta Murata
2020-12-23[memory_view] Remove needless use of StringValueCStrKenta Murata
2020-12-23[memory_view] Add mdview_release_view for testKenta Murata
2020-12-23[memory_view][fiddle] Rename len to byte_size in rb_memory_view_tKenta Murata
2020-12-23[memory_view][fiddle] Use bool for boolean return valueKenta Murata
2020-12-22Removed rb_cData entityNobuyoshi Nakada
* Use the wrapper of rb_cObject instead of data access * Replaced rest of extentions * Updated the version guard for Data * Added the version guard of rb_cData Notes: Merged: https://github.com/ruby/ruby/pull/3961
2020-12-16[memory_view] Make MemoryView API Ractor-safe (#3911)Kenta Murata
* memory_view.c: make Ractor-safe * test/ruby/test_memory_view.rb: Add test_ractor * memory_view: fix typo * memory_view.c: Use st_update in unregster_exported_object * memory_view: update dependency Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-12-11Import fiddle-1.0.4 (#3860)Kenta Murata
I don't use tool/sync_default_gem.rb because the last sync was incomplete. Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: sinisterchipmunk <sinisterchipmunk@gmail.com> Co-authored-by: Sutou Kouhei <kou@clear-code.com> Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-12-10memory_view.c: Add rb_memory_view_get_item and ↵Kenta Murata
rb_memory_view_prepare_item_desc (#3871) Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-12-08memory_view.c: Add rb_memory_view_extract_item_members (#3855)Kenta Murata
Notes: Merged-By: mrkn <mrkn@ruby-lang.org>