summaryrefslogtreecommitdiff
path: root/zjit
AgeCommit message (Collapse)Author
2025-08-29ZJIT: Specialize monomorphic GetIvar (#14388)Max Bernstein
Specialize monomorphic `GetIvar` into: * `GuardType(HeapObject)` * `GuardShape` * `LoadIvarEmbedded` or `LoadIvarExtended` This requires profiling self for `getinstancevariable` (it's not on the operand stack). This also optimizes `GetIvar`s that happen as a result of inlining `attr_reader` and `attr_accessor`. Also move some (newly) shared JIT helpers into jit.c.
2025-08-29ZJIT: Remove special case for defined?(method call) (#14401)Max Bernstein
This was fixed in https://github.com/ruby/ruby/pull/14308 Thanks, Stan, for noticing. Fixes https://github.com/Shopify/ruby/issues/703
2025-08-29ZJIT: Repurpose ExitCounters for unhandled YARV insns (#14392)Takashi Kokubun
2025-08-28ZJIT: Compile Insn::SendTakashi Kokubun
2025-08-28ZJIT: Add code_region_bytes stat (#14389)Takashi Kokubun
* ZJIT: Add code_region_bytes stat * Share more logic among --zjit and --zjit-stats
2025-08-28ZJIT: Prepare getglobal for non-leaf call (#14387)Stan Lo
Depending on the user's warning level, getting certain global variables may lead to calling `Warning#warn`, which can be redefined by the user. This fixes another `bootstraptest/test_yjit.rb` failure.
2025-08-28ZJIT: Fix a flipped statTakashi Kokubun
I'm sorry. Another follow-up on https://github.com/ruby/ruby/pull/14378
2025-08-28ZJIT: Fix a typoTakashi Kokubun
follow-up on https://github.com/ruby/ruby/pull/14378
2025-08-28ZJIT: Disable profiling in compile_iseq (#14385)Max Bernstein
This catches both the interpreter-JIT and JIT-JIT cases. Fixes https://github.com/Shopify/ruby/issues/719
2025-08-28ZJIT: Generate code for ArrayExtendMax Bernstein
2025-08-28ZJIT: Generate code for DefinedIvarMax Bernstein
2025-08-28ZJIT: Generate code for ToArray, ToNewArrayMax Bernstein
2025-08-28ZJIT: Generate code for ArrayPushMax Bernstein
2025-08-28ZJIT: Generate code for HashDupMax Bernstein
2025-08-28ZJIT: Track if object is a T_OBJECTMax Bernstein
We will (for now) only cache ivar reads from T_OBJECTs.
2025-08-28ZJIT: Track object embedded bitMax Bernstein
This lets us know where to look for an ivar: in the object or indirect elsewhere in the heap.
2025-08-28ZJIT: Add Ractor mode PatchPoint for ivar get/set (#14375)Stan Lo
* ZJIT: Add Ractor mode PatchPoint for ivar get/set * ZJIT: Only add single ractor patchpoint to class/module receivers * ZJIT: Improve Ractor mode patch point comments Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2025-08-28ZJIT: Refactor stats implementations (#14378)Takashi Kokubun
* ZJIT: Refactor stats implementations * s/num_send_dynamic/dynamic_send_count/
2025-08-28ZJIT: Enable no-fail-fast on zjit-testStan Lo
2025-08-28ZJIT: Add zjit-test-update for updating insta snapshotStan Lo
2025-08-27ZJIT: Pessimize locals in the presence of send (with block) (#14374)Max Bernstein
We can refine this later by some kind of analysis of the block we're sending to: maybe it doesn't write to our locals, or at least doesn't write to all of them.
2025-08-27ZJIT: Count dynamic dispatch (SendWithoutBlock)Max Bernstein
2025-08-27ZJIT: Increment specific counter on side-exitMax Bernstein
2025-08-27ZJIT: Specialize some Sends (#14363)Max Bernstein
* ZJIT: Profile and specialize Array#empty? * ZJIT: Specialize BasicObject#== * ZJIT: Specialize Hash#empty? * ZJIT: Specialize BasicObject#! Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2025-08-27ZJIT: Implement side exit stats (#14357)Takashi Kokubun
2025-08-27Replace ROBJECT_EMBED by ROBJECT_HEAPJean Boussier
The embed layout is way more common than the heap one, especially since WVA. I think it makes for more readable code to inverse the flag.
2025-08-26Follow up cleanup for `opt_(aref|aset)_with` removalStan Lo
Just removing some unneeded tests, outdated comments...etc.
2025-08-26ZJIT: Dump graphviz output to given filenameMax Bernstein
2025-08-26ZJIT: Graphviz point to top of paramsMax Bernstein
2025-08-26ZJIT: Canonicalize --zjit-log-compiled-iseqs filename (#14352)Max Bernstein
This fixes issues related to the process changing directory and not having only a relative path. Thanks, Alan.
2025-08-26Remove `opt_aref_with` and `opt_aset_with`Aaron Patterson
When these instructions were introduced it was common to read from a hash with mutable string literals. However, these days, I think these instructions are fairly rare. I tested this with the lobsters benchmark, and saw no difference in speed. In order to be sure, I tracked down every use of this instruction in the lobsters benchmark, and there were only 4 places where it was used. Additionally, this patch fixes a case where "chilled strings" should emit a warning but they don't. ```ruby class Foo def self.[](x)= x.gsub!(/hello/, "hi") end Foo["hello world"] ``` Removing these instructions shows this warning: ``` > ./miniruby -vw test.rb ruby 3.5.0dev (2025-08-25T21:36:50Z rm-opt_aref_with dca08e286c) +PRISM [arm64-darwin24] test.rb:2: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` [Feature #21553]
2025-08-26ZJIT: Side-exit on unknown instructions (#14212)Max Bernstein
Don't abort the entire compilation. Fix https://github.com/Shopify/ruby/issues/700
2025-08-26Ensure T_OBJECT and T_IMEMO/fields have identical layoutJean Boussier
2025-08-25ZJIT: Migrate to instaMax Bernstein
Migrate from expect-test to insta snapshot testing library. While expect-test is very small and has a limited surface, it does not handle nextest well; it while doing inline snapshot updates, it races other test processes to update the file, leading to frequent "Failed to process macro invocation" errors. insta handles this by doing batches; it writes to temporary files which can then be committed in a batch using `cargo insta review` or `INSTA_UPDATE=always`.
2025-08-25ZJIT: Add compilation failure stats (#14310)Takashi Kokubun
2025-08-22ZJIT: Spill whole FrameState in `Insn::SendWithoutBlock`Alan Wu
Previously, we only spilled the arguments necessary for the particular send. In case the callee raises and a rescue resumes the ISEQ, that did not present a complete stack state. E.g. in `[1, (raise rescue 2)]` the raise send only spills `self`, when `1` also needs to be spilled. Spill the whole stack. Adjust parsing for `opt_aref_with` since the key argument for the send now needs to be described by the frame state of the send. This changes the contract for `Insn::SendWithoutBlock` to use arguments from the interpreter stack as described by its frame state.
2025-08-22ZJIT: Allow querying a single ZJIT stat (#14309)Takashi Kokubun
* ZJIT: Add RubyVM::ZJIT.stats_enabled? * ZJIT: Allow querying a single ZJIT stat
2025-08-22ZJIT: Update testsMax Bernstein
2025-08-22ZJIT: Eagerly place CheckInterruptsMax Bernstein
Ideally we would do this lazily post optimization, but this is easier for now: we already have the requisite Snapshots available.
2025-08-22ZJIT: Add CheckInterrupts HIR instructionMax Bernstein
2025-08-21ZJIT: Fill nils before function_stub_hit exit (#14294)Takashi Kokubun
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Co-authored-by: Max Bernstein <ruby@bernsteinbear.com> Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-08-21ZJIT: Allocate register for VRegs that begin and end at the same index (#14270)Max Bernstein
If the LiveRange looks like (idx, idx), we will currently not allocate a register. This change allocates a register and then immediately deallocates it. Fix https://github.com/Shopify/ruby/issues/614
2025-08-21Remove unused SPECIAL_CONST_SHAPE_IDÉtienne Barrié
Its usage was removed in 306d50811dd060d876d1eb364a0d5e6106f5e4f1.
2025-08-21ZJIT: Refactor `gen_new_hash` (#14293)Stan Lo
We can use the `gen_push_opnds` and `gen_pop_opnds` helpers added in #14200 to simplify the code.
2025-08-20ZJIT: Remove unnecessary option return type on gen_branch_params (#14286)Stan Lo
2025-08-19ZJIT: Mark Insn::NewRange as having side effectsAlan Wu
2025-08-19ZJIT: Prepare for rb_range_new() calling <=>Alan Wu
gen_prepare_call_with_gc() was not enough because of the rb_funcall() usage in range_init(). Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Max Bernstein <rubybugs@bernsteinbear.com>
2025-08-19ZJIT: Remove try_num_bits (#14272)Takashi Kokubun
2025-08-19ZJIT: Remove more Option from codegen (#14265)Max Bernstein
2025-08-19ZJIT: Compile toregexp (#14200)Daniel Colson
`toregexp` is fairly similar to `concatstrings`, so this commit extracts a helper for pushing and popping operands on the native stack. There's probably opportunity to move some of this into lir (e.g. Alan suggested a push_many that could use STP on ARM to push 2 at a time), but I might save that for another day.