| Age | Commit message (Collapse) | Author |
|
* ZJIT: Profile `invokesuper` instructions
* ZJIT: Introduce the `InvokeSuperDirect` HIR instruction
The new instruction is an optimized version of `InvokeSuper` when we know the `super` target is an ISEQ.
* ZJIT: Expand definition of unspecializable to more complex cases
* ZJIT: Ensure `invokesuper` optimization works when the inheritance hierarchy is modified
* ZJIT: Simplify `invokesuper` specialization to most common case
Looking at ruby-bench, most `super` calls don't pass a block, which means we can use the already optimized `SendWithoutBlockDirect`.
* ZJIT: Track `super` method entries directly to avoid GC issues
Because the method entry isn't typed as a `VALUE`, we set up barriers on its `VALUE` fields. But, that was insufficient as the method entry itself could be collected in certain cases, resulting in dangling objects. Now we track the method entry as a `VALUE` and can more naturally mark it and its children.
* ZJIT: Optimize `super` calls with simple argument forms
* ZJIT: Report the reason why we can't optimize an `invokesuper` instance
* ZJIT: Revise send fallback reasons for `super` calls
* ZJIT: Assert `super` calls are `FCALL` and don't need visibily checks
|
|
Make sure we check if we have seen a singleton for this class before assuming we have not. Port the API from YJIT.
|
|
Resolves TODO added in #15863 (See https://github.com/ruby/ruby/pull/15863#discussion_r2687769112)
Adds a method `Type::has_value` for comparing value specialized types with a `Const`.
|
|
Resolves https://github.com/Shopify/ruby/issues/915
When we have `LoadField` with a `Shape` return type, we can fold it similar to the object case.
`GuardBitEquals` can be removed when the argument is `Const` and the values are equal.
The behaviors for loading instances variables from frozen/dynamic objects are already covered in existing tests so no new tests were added.
|
|
This is really irritating when piping to a file or pager.
|
|
This reduces some processing and makes the HIR more accurate.
|
|
This is used a lot in optcarrot.
|
|
You can see the reordered args in the new Snapshot right before the
DirectSend insn:
v14:Any = Snapshot FrameState { pc: 0x00, stack: [v6, v11, v13], locals: [] }
PatchPoint MethodRedefined(Object@0x00, a@0x00, cme:0x00)
PatchPoint NoSingletonClass(Object@0x00)
v22:HeapObject[class_exact*:Object@VALUE(0x00)] = GuardType v6, HeapObject[class_exact*:Object@VALUE(0x00)]
- v23:BasicObject = SendWithoutBlockDirect v22, :a (0x00), v13, v11
- v16:Any = Snapshot FrameState { pc: 0x00, stack: [v23], locals: [] }
+ v23:Any = Snapshot FrameState { pc: 0x00, stack: [v6, v13, v11], locals: [] }
+ v24:BasicObject = SendWithoutBlockDirect v22, :a (0x00), v13, v11
+ v16:Any = Snapshot FrameState { pc: 0x00, stack: [v24], locals: [] }
|
|
|
|
|
|
|
|
|
|
|
|
GuardShape is just load+guard, so use the existing HIR instructions for load+guard. Probably makes future analysis slightly easier.
|
|
Inline `Array#[]=` into `ArrayAset`.
|
|
|
|
|
|
|
|
jump, branchif, etc don't invalidate locals in the JIT; they might in the interpreter because they can execute arbitrary code, but the JIT side exits before that happens.
|
|
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
|
|
To fix warnings from rustc on e.g. Make 4.3, which is in Ubuntu 24.04:
> warning: failed to connect to jobserver from environment variable
|
|
rb_gc_writebarrier() in gen_write_barrier()
* To avoid calling rb_gc_writebarrier() with an immediate value in gen_write_barrier(),
and avoid the LIR jump issue.
|
|
gen_write_barrier()"
* This reverts commit 623559faa3dd0927b4034a752226a30ae8821604.
* There is an issue with the jump in LIR, see https://github.com/ruby/ruby/pull/15542.
|
|
|
|
|
|
gen_write_barrier()
|
|
This reverts commit 2f151e76b5dc578026706b31f054d5caf5374b05.
The SP decrement (push) before the call do not match up with
the pops after the call, so registers were restored incorrectly.
Code from:
./miniruby --zjit-call-threshold=1 --zjit-dump-disasm -e 'p Time.new(1992, 9, 23, 23, 0, 0, :std)'
str x11, [sp, #-0x10]!
str x12, [sp, #-0x10]!
stur x7, [sp] # last argument
mov x0, x20
mov x7, x6
mov x6, x5
mov x5, x4
mov x4, x3
mov x3, x2
mov x2, x1
ldur x1, [x29, #-0x20]
mov x16, #0xccfc
movk x16, #0x2e7, lsl #16
movk x16, #1, lsl #32
blr x16
ldr x12, [sp], #0x10 # supposed to match str x12, [sp, #-0x10]!, but got last argument
ldr x11, [sp], #0x10
|
|
Before this change, GC'ing any Ractor object caused you to lose all
enabled tracepoints across all ractors (even main). Now tracepoints are
ractor-local and this doesn't happen. Internal events are still global.
Fixes [Bug #19112]
|
|
This can happen with documentation updates and we don't want
those to trip on ZJIT tests.
Redact the whole name since names like "_bi342" aren't that helpful
anyways.
|
|
Avoid garbage reads from locals in eval.
Before the fix the test fails with
<"[\"x\", \"x\", \"x\", \"x\"]"> expected but was
<"[\"x\", \"x\", \"x\", \"x286326928\"]">.
|
|
|
|
ZJIT: Add stack support for CCalls
|
|
|
|
|
|
It's just a nicety (they fit fine as CUInt32) but this makes printing
look nicer in real execution and also in tests (helps with #15489).
Co-authored-by: Randy Stauner <randy@r4s6.net>
|
|
|
|
Fix https://github.com/Shopify/ruby/issues/874
|
|
|
|
No point doing the manual size unit conversion for add. Sorry, no new
tests since there is no way to generate a LoadField with a negative
offset from ruby code AFAICT. Careful with the `as` casts.
|
|
So we don't expose builders to network flakiness which cannot be worked
around using cargo's --offline flag.
|
|
|
|
* ZJIT: Fold LoadField on frozen objects to constants
When accessing instance variables from frozen objects via attr_reader/
attr_accessor, fold the LoadField instruction to a constant at compile
time. This enables further optimizations like constant propagation.
- Add fold_getinstancevariable_frozen optimization in Function::optimize
- Check if receiver type has a known ruby_object() that is frozen
- Read the field value at compile time and replace with Const instruction
- Add 10 unit tests covering various value types (fixnum, string, symbol,
nil, true/false) and negative cases (unfrozen, dynamic receiver)
* Run zjit-test-update
* Add a test that we don't fold non-BasicObject
* Small cleanups
---------
Co-authored-by: Max Bernstein <ruby@bernsteinbear.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
|
|
|
|
This fixes a crash when the new shape after a transition is too complex;
we need to check that it's not complex before trying to read by index.
|
|
* ZJIT: Add dump to file for --zjit-stats
* ZJIT: Rename --zjit-stats=quiet to --zjit-stats-quiet
|
|
This adds comments to the hir dump output like this:
v13:BasicObject = SendWithoutBlock v6, :test, v11 # SendFallbackReason: Complex argument passing
|
|
|
|
|
|
|
|
|