aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_c.rb
Commit message (Collapse)AuthorAgeFilesLines
* rename SHAPE_BITS to SHAPE_ID_NUM_BITSAaron Patterson2022-11-181-4/+4
|
* MJIT: Fix vm_cc_cme(cc).def.type to use bit fieldTakashi Kokubun2022-11-151-1/+1
| | | | | | | | | access properly. Because the libclang node had two children, it wasn't handled well by the pattern matching for the bit field case. In addition to that, this bit field has a non-1 width. Because we're returning true/false for a width-1 bit field, I added another behavior that works like a char value for bit fields with width 2-8.
* MJIT: Remove reference to ROBJECT_EMBED_LEN_MAXTakashi Kokubun2022-11-141-4/+0
| | | | maybe not used since some shape changes?
* Rename --mjit-min-calls to --mjit-call-threshold (#6731)Takashi Kokubun2022-11-141-1/+1
| | | for consistency with YJIT
* Remove USE_RVARGC codeAaron Patterson2022-11-141-4/+0
| | | | We don't need this constant to be exposed anymore, so remove it
* Import shape constants with mjit-bindgenTakashi Kokubun2022-11-141-34/+34
|
* Import class constants with mjit-bindgenTakashi Kokubun2022-11-141-7/+26
|
* Transition shape when object's capacity changesJemma Issroff2022-11-101-0/+26
| | | | | | | | | | | | | | | | 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>
* Remove iv_index_tbl_entryJohn Hawthorn2022-10-241-9/+0
|
* Rename `iv_count` on shapes to `next_iv_index`Jemma Issroff2022-10-211-1/+1
| | | | | | `iv_count` is a misleading name because when IVs are unset, the new shape doesn't decrement this value. `next_iv_count` is an accurate, and more descriptive name.
* Only expose Ruby Shape API if VM_CHECK_MODE is enabledAaron Patterson2022-10-131-2/+23
|
* Make inline cache reads / writes atomic with object shapesJemma Issroff2022-10-111-5/+6
| | | | | | | | | | | | | | Prior to this commit, we were reading and writing ivar index and shape ID in inline caches in two separate instructions when getting and setting ivars. This meant there was a race condition with ractors and these caches where one ractor could change a value in the cache while another was still reading from it. This commit instead reads and writes shape ID and ivar index to inline caches atomically so there is no longer a race condition. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: John Hawthorn <john@hawthorn.email>
* Revert "Revert "This commit implements the Object Shapes technique in CRuby.""Jemma Issroff2022-10-111-5/+30
| | | | This reverts commit 9a6803c90b817f70389cae10d60b50ad752da48f.
* Revert "This commit implements the Object Shapes technique in CRuby."Aaron Patterson2022-09-301-30/+5
| | | | This reverts commit 68bc9e2e97d12f80df0d113e284864e225f771c2.
* This commit implements the Object Shapes technique in CRuby.Jemma Issroff2022-09-281-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-261-31/+6
| | | | | | | | | | 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-261-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Rework vm_core to use `int first_lineno` struct member.Samuel Williams2022-09-261-1/+6
|
* Skip struct fields whose output differsTakashi Kokubun2022-09-231-3/+0
| | | | across different environments
* Swap the positions of offsetof and typeTakashi Kokubun2022-09-231-203/+203
|
* Bindgen offsetof struct and union with builtinTakashi Kokubun2022-09-231-183/+183
| | | | | | | | except for bit fields. I made a risky assumption on leading bit fields and just gave up non-leading bit fields for now. I'll change it to let C code access bit fields later.
* Bindgen sizeof struct and union with builtinTakashi Kokubun2022-09-231-32/+32
|
* Bindgen immediate types with builtinTakashi Kokubun2022-09-231-55/+56
|
* Drop c_64 and c_32Takashi Kokubun2022-09-231-0/+539
|
* Bindgen enum with builtinTakashi Kokubun2022-09-231-4/+20
|
* Builtin needs to be baseruby-compatibleTakashi Kokubun2022-09-231-5/+15
|
* mjit_c.rb doesn't need to be an erbTakashi Kokubun2022-09-231-0/+137