summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
...
* Prevent potential buffer overrun in onigmoYusuke Endoh2022-10-251-2/+2
| | | | | | | | | | A code pattern `p + enclen(enc, p, pend)` may lead to a buffer overrun if incomplete bytes of a UTF-8 character is placed at the end of a string. Because this pattern is used in several places in onigmo, this change fixes the issue in the side of `enclen`: the function should not return a number that is larger than `pend - p`. Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Use CXX14 to allow constexpr with non-return statementsNick Hengeveld2022-10-241-1/+1
| | | | Co-authored-by: Daniel Colson <composerinteralia@github.com>
* Add Class#attached_objectUfuk Kayserilioglu2022-10-201-0/+12
| | | | | | | Implements [Feature #12084] Returns the object for which the receiver is the singleton class, or raises TypeError if the receiver is not a singleton class.
* Define `UNDEF_P` and `NIL_OR_UNDEF_P` [EXPERIMENTAL]Nobuyoshi Nakada2022-10-201-0/+58
|
* Move "special consts" so `Qundef` and `Qnil` differ just 1 bitNobuyoshi Nakada2022-10-202-12/+12
|
* [DOC] Fix RUBY_SYMBOL_FLAG comment [ci skip]Nobuyoshi Nakada2022-10-201-1/+1
| | | | Upper bits than the least significant 4 bits need not be 0.
* Assert for RTEST that Qnil and Qfalse differ just 1 bitNobuyoshi Nakada2022-10-191-0/+9
|
* Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975)Sergey Fedorov2022-10-191-0/+2
|
* Add support for anonymous shared IO buffers. (#6580)Samuel Williams2022-10-191-0/+3
|
* Update `Fiber::Scheduler` documentation. (#6562)Samuel Williams2022-10-151-14/+20
|
* Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. ↵Samuel Williams2022-10-151-1/+21
| | | | (#6559)
* Improvements to IO::Buffer implementation and documentation. (#6525)Samuel Williams2022-10-122-12/+20
|
* Revert "Revert "This commit implements the Object Shapes technique in CRuby.""Jemma Issroff2022-10-112-18/+4
| | | | This reverts commit 9a6803c90b817f70389cae10d60b50ad752da48f.
* object.c: rb_eql returns int not VALUEJean Boussier2022-10-101-2/+2
| | | | | It works, but assumes `Qfalse == 0`, which is true today but might not be forever.
* Try `nil` as default for 'default timeout'. (#6509)Samuel Williams2022-10-081-4/+4
|
* Simplify default argument specification. (#6507)Samuel Williams2022-10-071-0/+5
|
* Add IO#timeout attribute and use it for blocking IO operations. (#5653)Samuel Williams2022-10-071-14/+36
|
* Revert "This commit implements the Object Shapes technique in CRuby."Aaron Patterson2022-09-302-4/+18
| | | | This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
* This commit implements the Object Shapes technique in CRuby.Jemma Issroff2022-09-282-18/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* Revert this until we can figure out WB issues or remove shapes from GCAaron Patterson2022-09-262-4/+18
| | | | | | | | | | Revert "* expand tabs. [ci skip]" This reverts commit 830b5b5c351c5c6efa5ad461ae4ec5085e5f0275. Revert "This commit implements the Object Shapes technique in CRuby." This reverts commit 9ddfd2ca004d1952be79cf1b84c52c79a55978f4.
* This commit implements the Object Shapes technique in CRuby.Jemma Issroff2022-09-262-18/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Object Shapes is used for accessing instance variables and representing the "frozenness" of objects. Object instances have a "shape" and the shape represents some attributes of the object (currently which instance variables are set and the "frozenness"). Shapes form a tree data structure, and when a new instance variable is set on an object, that object "transitions" to a new shape in the shape tree. Each shape has an ID that is used for caching. The shape structure is independent of class, so objects of different types can have the same shape. For example: ```ruby class Foo def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end class Bar def initialize # Starts with shape id 0 @a = 1 # transitions to shape id 1 @b = 1 # transitions to shape id 2 end end foo = Foo.new # `foo` has shape id 2 bar = Bar.new # `bar` has shape id 2 ``` Both `foo` and `bar` instances have the same shape because they both set instance variables of the same name in the same order. This technique can help to improve inline cache hits as well as generate more efficient machine code in JIT compilers. This commit also adds some methods for debugging shapes on objects. See `RubyVM::Shape` for more details. For more context on Object Shapes, see [Feature: #18776] Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* Fix `io/buffer.h` header guard.Samuel Williams2022-09-261-3/+3
|
* Just a star [ci skip]Nobuyoshi Nakada2022-09-231-1/+1
|
* rb_define_method: dedicated overload for rb_f_notimplement卜部昌平2022-09-211-7/+8
| | | | | rb_f_notimplement was type-compatible with VALUE(*)(ANYARGS), but not any longer in C23. Provide a dedicated path for it.
* [Bug #5317] Use `rb_off_t` instead of `off_t`Nobuyoshi Nakada2022-09-084-12/+11
| | | | Get rid of the conflict with system-provided small `off_t`.
* Avoid leaving a period alone [ci skip]Takashi Kokubun2022-08-271-2/+2
|
* typosspaette2022-08-274-4/+5
|
* Support Encoding::Converter newline: :lf and :lf_newline optionsJeremy Evans2022-08-191-7/+11
| | | | | | | | | | | | | | | | 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]
* Stop defining `RUBY_ABI_VERSION` if released versionsNobuyoshi Nakada2022-08-121-1/+5
| | | | | | 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.
* Add missing `rb_enc_iscntrl`Nobuyoshi Nakada2022-08-121-0/+15
|
* [DOC] Use `true`/`false` for `@retval`s which are `bool`Nobuyoshi Nakada2022-08-121-43/+43
|
* [DOC] Add return values of rb_enc_mbcputNobuyoshi Nakada2022-08-071-4/+6
|
* Adjust styles [ci skip]Nobuyoshi Nakada2022-07-271-4/+8
|
* Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu2022-07-261-3/+3
| | | | | | 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.
* 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
|