summaryrefslogtreecommitdiff
path: root/zjit/src
AgeCommit message (Collapse)Author
2025-07-08ZJIT: Support guarding *Exact types (#13797)Stan Lo
ZJIT already can generate guard type instructions for *Exact types. For example: ``` def test(strings) strings.map do |string| string.bytesize end end test(["foo", "bar"]) ``` ``` HIR: fn block in test: bb0(v0:BasicObject, v1:BasicObject): PatchPoint MethodRedefined(String@0x1014be890, bytesize@0x19f1) v7:StringExact = GuardType v1, StringExact v8:Fixnum = CCall bytesize@0x16fa4cc18, v7 Return v8 ``` But zjit only supported guarding fixnums so this script would panic. This commit adds support for guarding *Exact types.
2025-07-08ZJIT: Use BitSet in HIRMax Bernstein
2025-07-08ZJIT: Add a BitSet typeMax Bernstein
2025-07-08ZJIT: Use nil? optimization to test guard generation against different typesStan Lo
2025-07-08ZJIT: Profile `nil?` callsStan Lo
This allows ZJIT to profile `nil?` calls and create type guards for its receiver. - Add `zjit_profile` to `opt_nil_p` insn - Start profiling `opt_nil_p` calls - Use `runtime_exact_ruby_class` instead of `exact_ruby_class` to determine the profiled receiver class
2025-07-08ZJIT: Make type definition code more consistentStan Lo
2025-07-08ZJIT: More accurately model Class typesStan Lo
2025-07-08ZJIT: Support inference of ModuleExact typeStan Lo
2025-07-07ZJIT: Fix Rust warnings (#13813)Stan Lo
2025-07-07ZJIT: Add opnds macro for Vec<InsnId> to Vec<Opnd> (#13805)Daniel Colson
Along the same lines as the `opnd` macro we already have, but for a `Vec<InsnId>` instead of a single `InsnId`. This gets a few for loops and `jit.get_opnd` calls out of the `gen_` functions.
2025-07-07ZJIT: Add a simple HIR validator (#13780)Ken Jin
This PR adds a simple validator for ZJIT's HIR. See issue https://github.com/Shopify/ruby/issues/591
2025-07-07ZJIT: Avoid double negative in Mem debugDaniel Colson
Prior to this commit the debug output for negative offsets would look like: ``` Mem64[Reg(3) - -8 ``` That makes it look like we're adding instead of subtracting. After this commit we'll print: ``` Mem64[Reg(3) - 8 ```
2025-07-03Support inference of ClassExact typeStan Lo
2025-07-03Add missed runtime_exact_ruby_class case for RegexpStan Lo
2025-07-03ZJIT: Panic on BOP redefinition only when needed (#13782)Takashi Kokubun
2025-07-03ZJIT: Bail out on register spill (#13773)Takashi Kokubun
2025-07-02ZJIT: Reject ISEQs with too-large stack_max (#13770)Takashi Kokubun
2025-07-02ZJIT: Add reason for SideExit (#13768)Max Bernstein
This makes it clearer what is unimplemented when looking at HIR dumps.
2025-07-02ZJIT: Avoid panicing with "Option::unwrap() on None" (#13762)Takashi Kokubun
2025-07-02ZJIT: Support spilling basic block arguments (#13761)Takashi Kokubun
Co-authored-by: Max Bernstein <max@bernsteinbear.com>
2025-07-02ZJIT: Annotate NilClass#nil? and Kernel#nil?Stan Lo
These methods return fixed `true` or `false` so we can be certain about their return types.
2025-07-03ZJIT: `throw` to HIRAlan Wu
2025-07-03ZJIT: Use initialization shorthandAlan Wu
2025-07-02ZJIT: Support `Regexp` type (#13760)Stan Lo
2025-07-01ZJIT: Shorten Debug print for 64-bit VReg (#13763)Takashi Kokubun
2025-07-01ZJIT: Stop tracking EP == BP assumption on JIT entry (#13752)Takashi Kokubun
* ZJIT: Stop tracking EP == BP assumption on JIT entry * Enable test_method.rb as well
2025-06-30ZJIT: Add codegen for IsNilywenc
2025-06-30ZJIT: Add IsNil optimization and tests for optimized hirywenc
2025-06-30ZJIT: Rename Ruby<->Rust functions for clarityMax Bernstein
No need to be so terse.
2025-06-30ZJIT: Pretty-print symbols in HIR dumpMax Bernstein
This lets us better see what is going on, for example in pattern matching code, which has a bunch of dynamic method lookups and `respond_to?` sends.
2025-06-30ZJIT: Mark GetLocal as having no effects (#13750)Max Bernstein
This removes the GetLocal of l3 from: def test l3 = 3 1.times do |l2| _ = l3 1 end end
2025-06-30ZJIT: Don't compile functions with unhandled parameter types (#13749)Max Bernstein
2025-06-30ZJIT: Add new ZJIT types for Set (#13743)Stan Lo
2025-06-30ZJIT: setglobal should not return output (#13744)Takashi Kokubun
* ZJIT: setglobal should not return output * Let the caller wrap Some
2025-06-28ZJIT: Codegen for `defined?(yield)`Alan Wu
Lots of stdlib methods such as Integer#times and Kernel#then use this, so at least this will make writing tests slightly easier.
2025-06-28ZJIT: Use `std::fmt::Display` when codegen for instruction failsAlan Wu
It's nicer since e.g. you get text representation of enums like `defined_type` instead of just a number.
2025-06-27ZJIT: Add TODOs and omitted test for nested scope local accessAlan Wu
2025-06-27ZJIT: Function::find(): Use find_vec!() moreAlan Wu
2025-06-27ZJIT: Function::find(): Use clone() instead of doing it manuallyAlan Wu
2025-06-27ZJIT: Add codegen for GetLocal and SetLocalAlan Wu
They're only used when level≠0. Same EP hopping logic as interpreter and YJIT. Change assert_compiles() to get ISeq by method name since the old code didn't support methods defined using define_method() which I need for the new test.
2025-06-27ZJIT: `getlocal` and `setlocal` to HIRAlan Wu
2025-06-26ZJIT: Stop loading an extra parameter (#13719)Takashi Kokubun
2025-06-26ZJIT: Disable profiling instructions before asserting opcodes in tests (#13720)Max Bernstein
2025-06-24Remove trailing spacesNobuyoshi Nakada
2025-06-23ZJIT: Parse putspecialobject(VMCore) into Const (#13683)Max Bernstein
This way we get more information in HIR for the optimizer. Fix https://github.com/Shopify/ruby/issues/587
2025-06-23ZJIT: Optimize frozen array aref (#13666)Max Bernstein
If we have a frozen array `[..., a, ...]` and a compile-time fixnum index `i`, we can do the array load at compile-time.
2025-06-24ZJIT: `anytostring` to HIR (GH-13658)ywenc
Pop two values from the stack, return the first if it is a string, otherwise return string coercion of the second Also piggybacks a fix for string subclasses skipping `to_s` for `objtostring`. Co-authored-by: composerinteralia <composerinteralia@github.com>
2025-06-21ZJIT: Move ccall comments near ccall instructions (#13662)Max Bernstein
Don't confuse them with other nearby instructions.
2025-06-20ZJIT: Typofix (#13665)Hiroshi SHIBATA
2025-06-20ZJIT: Add pass to clean CFG (#13655)Max Bernstein
We can fuse linked lists of blocks. This can be run any time, improves future analyses, improves codegen, and also makes the HIR output look nicer. Inspired by my implementation of CleanCFG for Cinder, which was itself inspired by Brett Simmers' implementation in HHVM. Notes: Merged-By: tekknolagi <donotemailthisaddress@bernsteinbear.com>