summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2022-11-10Remove numiv from RObjectJemma Issroff
Since object shapes store the capacity of an object, we no longer need the numiv field on RObjects. This gives us one extra slot which we can use to give embedded objects one more instance variable (for a total of 3 ivs). This commit removes the concept of numiv from RObject. Notes: Merged: https://github.com/ruby/ruby/pull/6699
2022-11-10Transition shape when object's capacity changesJemma Issroff
This commit adds a `capacity` field to shapes, and adds shape transitions whenever an object's capacity changes. Objects which are allocated out of a bigger size pool will also make a transition from the root shape to the shape with the correct capacity for their size pool when they are allocated. This commit will allow us to remove numiv from objects completely, and will also mean we can guarantee that if two objects share shapes, their IVs are in the same positions (an embedded and extended object cannot share shapes). This will enable us to implement ivar sets in YJIT using object shapes. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6699
2022-11-10[Bug #19100] Add `init_int32` function to `rb_random_interface_t`Nobuyoshi Nakada
Distinguish initialization by single word from initialization by array.
2022-11-10Add version to the interface of Random extensionsNobuyoshi Nakada
2022-11-09Reduce warningsTSUYUSATO Kitsune
2022-11-09Revert "Refactor field names"TSUYUSATO Kitsune
This reverts commit 1e6673d6bbd2adbf555d82c7c0906ceb148ed6ee.
2022-11-09Refactor field namesTSUYUSATO Kitsune
2022-11-09Support OP_REPEAT and OP_REPEAT_INCTSUYUSATO Kitsune
2022-11-09[DOC] Fix missing type nameNobuyoshi Nakada
2022-10-26Fix -Wundef warningsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6634
2022-10-25Prevent potential buffer overrun in onigmoYusuke Endoh
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> Notes: Merged: https://github.com/ruby/ruby/pull/6628
2022-10-24Use CXX14 to allow constexpr with non-return statementsNick Hengeveld
Co-authored-by: Daniel Colson <composerinteralia@github.com> Notes: Merged: https://github.com/ruby/ruby/pull/6626
2022-10-20Add Class#attached_objectUfuk Kayserilioglu
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. Notes: Merged: https://github.com/ruby/ruby/pull/6450
2022-10-20Define `UNDEF_P` and `NIL_OR_UNDEF_P` [EXPERIMENTAL]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6599
2022-10-20Move "special consts" so `Qundef` and `Qnil` differ just 1 bitNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6599
2022-10-20[DOC] Fix RUBY_SYMBOL_FLAG comment [ci skip]Nobuyoshi Nakada
Upper bits than the least significant 4 bits need not be 0.
2022-10-19Assert for RTEST that Qnil and Qfalse differ just 1 bitNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6589
2022-10-19Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975)Sergey Fedorov
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-19Add support for anonymous shared IO buffers. (#6580)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-15Update `Fiber::Scheduler` documentation. (#6562)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-15Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. ↵Samuel Williams
(#6559) Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-12Improvements to IO::Buffer implementation and documentation. (#6525)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-11Revert "Revert "This commit implements the Object Shapes technique in CRuby.""Jemma Issroff
This reverts commit 9a6803c90b817f70389cae10d60b50ad752da48f.
2022-10-10object.c: rb_eql returns int not VALUEJean Boussier
It works, but assumes `Qfalse == 0`, which is true today but might not be forever. Notes: Merged: https://github.com/ruby/ruby/pull/6508
2022-10-08Try `nil` as default for 'default timeout'. (#6509)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-07Simplify default argument specification. (#6507)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-07Add IO#timeout attribute and use it for blocking IO operations. (#5653)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-09-30Revert "This commit implements the Object Shapes technique in CRuby."Aaron Patterson
This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
2022-09-28This commit implements the Object Shapes technique in CRuby.Jemma Issroff
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>
2022-09-26Revert this until we can figure out WB issues or remove shapes from GCAaron Patterson
Revert "* expand tabs. [ci skip]" This reverts commit 830b5b5c351c5c6efa5ad461ae4ec5085e5f0275. Revert "This commit implements the Object Shapes technique in CRuby." This reverts commit 9ddfd2ca004d1952be79cf1b84c52c79a55978f4.
2022-09-26This commit implements the Object Shapes technique in CRuby.Jemma Issroff
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> Notes: Merged: https://github.com/ruby/ruby/pull/6386
2022-09-26Fix `io/buffer.h` header guard.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/6439
2022-09-23Just a star [ci skip]Nobuyoshi Nakada
2022-09-21rb_define_method: dedicated overload for rb_f_notimplement卜部昌平
rb_f_notimplement was type-compatible with VALUE(*)(ANYARGS), but not any longer in C23. Provide a dedicated path for it. Notes: Merged: https://github.com/ruby/ruby/pull/6358
2022-09-08[Bug #5317] Use `rb_off_t` instead of `off_t`Nobuyoshi Nakada
Get rid of the conflict with system-provided small `off_t`. Notes: Merged: https://github.com/ruby/ruby/pull/6329
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