| Age | Commit message (Collapse) | Author |
|
|
|
|
|
Not all IV writes require calling a C function. If we don't need to
execute a write barrier (IOW the written value is an immediate), and we
don't need to expand the object to accommodate a new IV, we won't need
to make a C call and we can avoid spilling temps.
|
|
This is the same optimization as e4272fd29 ("Avoid allocation when
passing no keywords to anonymous kwrest methods") but for YJIT. For
anonymous kwrest parameters, nil is just as good as an empty hash.
On the usage side, update `splatkw` to handle `nil` with a leaner path.
|
|
|
|
It eventually casts it to i32 anyways, and a lot of callers already have
an i32, so using isize was just adding unnecessary casts.
|
|
This should make it easier to grok the order of operations.
|
|
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
|
|
If YJIT knows the parameter to rb_str_getbyte is a fixnum, then I think
we can consider the function to be a leaf
|
|
|
|
Previously, our compile time check rejected dynamic symbols (e.g. what
String#to_sym could return) even though we could handle them just fine.
The runtime guards for the type of method name was also overly
restrictive and didn't accept dynamic symbols.
Fold the type check into the rb_get_symbol_id() and take advantage of
the guard already checking for 0. This also avoids generating the same
call twice in case the same method name is presented as different
types.
|
|
|
|
I was a little rushed and didn't notice that it was still using the
final stack size even though we don't grow the stack before kwrest
handling anymore. Oh well, we got a new test out of it.
Fix: cbdabd5890
|
|
* Specialize String#byteslice(a, b)
This adds a specialization for String#byteslice when there are two
parameters.
This makes our protobuf parser go from 5.84x slower to 5.33x slower
```
Comparison:
decode upstream (53738 bytes): 7228.5 i/s
decode protobuff (53738 bytes): 1236.8 i/s - 5.84x slower
Comparison:
decode upstream (53738 bytes): 7024.8 i/s
decode protobuff (53738 bytes): 1318.5 i/s - 5.33x slower
```
* Update yjit/src/codegen.rs
---------
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
|
|
We did stack_push() and then saved the SP without writing to the slots
of the new values first, which caused the GC to mark uninitialized
values. Should fix crashes like
https://github.com/ruby/ruby/actions/runs/7877298133/job/21493179294
|
|
Now that `...` uses `**kwrest` instead of regular splat and
ruby2keywords, we need to support these type of methods to
support `...` well.
|
|
Previously, `**nil` by itself worked, but if you add a block argument,
it raised a conversion error. The presence of the block argument
shouldn't change how keyword splat works.
See: <https://bugs.ruby-lang.org/issues/20064>
|
|
YJIT: Prefer an overloaded cme if applicable
|
|
|
|
|
|
|
|
|
|
|
|
* YJIT: Allow tracing a counted exit
* Avoid clobbering caller-saved registers
|
|
* YJIT: Use jit_prepare_call_with_gc as much as possible
* Stop assuming vm_defined doesn't make a call
|
|
|
|
Popping but not generating any code before returning `None` was allowed
before fallbacks were introduced so this is restoring that support in
the same way. The included test used to trip an assert due to popping
too much.
|
|
There is nothing special about argument handling when it comes to zsuper
if you look around in the VM. Everything passes removing these fallback
reasons. It was ~16% on `railsbench`.
|
|
with these guards in YJIT.
The previous commit was to fix "conflict" between two PRs, but I
actually wanted to use it here, which is why I filed the other one.
|
|
|
|
* YJIT: Add codegen for Float arithmetics
* Add Flonum and Fixnum tests
|
|
* YJIT: Add jit_prepare_for_gc function
* s/jit_prepare_routine_call/jit_prepare_non_leaf_call/
* s/jit_prepare_for_gc/jit_prepare_call_with_gc/
* Use jit_prepare_call_with_gc for leaf builtin
|
|
* YJIT: Specialize splatkw on T_HASH
* Fix a typo
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
* Fix a few more comments
---------
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
|
|
|
|
Small PR to add a comment when we clear local variable types,
so we can be aware that it's happening when looking at the disasm.
|
|
|
|
|
|
|
|
For receiver with a singleton class, there are multiple vectors YJIT can
end up retaining the object. There is a path in jit_guard_known_klass()
that bakes the receiver into the code, and the object could also be kept
alive indirectly through a path starting at the CME object baked into
the code.
To avoid these leaks, avoid compiling calls on objects with a singleton
class.
See: https://github.com/Shopify/ruby/issues/552
[Bug #20209]
|
|
YJIT: fix bug causing jit_rb_int_rshift to side-exit
The nqueens benchmark was showing zero performance improvement
because we immediately side-exited as soon as the shift amount
changed. If the amount changes, we want to fall back to the
C function call, not side-exit.
|
|
|
|
YJIT didn't guard for ruby2_keywords hash in case of splat calls that
land in methods with a rest parameter, creating incorrect results.
The compile-time checks didn't correspond to any actual effects of
ruby2_keywords, so it was masking this bug and YJIT was needlessly
refusing to compile some code. About 16% of fallback reasons in
`lobsters` was due to the ISeq check.
We already handle the tagging part with
exit_if_supplying_kw_and_has_no_kw() and should now have a dynamic guard
for all splat cases.
Note for backporting: You also need 7f51959ff1.
[Bug #20195]
|
|
* YJIT: Allow inlining ISEQ calls with a block
* Leave a TODO comment about u16 inline_block
|
|
Previously, YJIT put the guard for having enough items to extract from
splat array at a place where the side exit is invalid, so if the guard
fails, YJIT could raise something other than ArgumentError. Move the
guard up to a place before any stack manipulation.
[Bug #20204]
|
|
Support dropping extra arguments passed by `yield` in blocks. For
example `10.times { work }` drops the count argument. This is common
enough that it's about 3% of fallback reasons in `lobsters`.
Only support simple cases where the surplus arguments are at the top of
the stack, that way they just need to be popped, which takes no work.
|
|
* YJIT: Optimize defined?(yield)
* Remove an irrelevant comment
* s/get/gen/
|
|
We don't have support for keyword splat anywhere, but we tried to
compile these anyways in case of `invokeblock`. This led to bad things
happening such as passing the wrong value and passing a hash into
rb_yjit_array_len(), which raised in the middle of compilation.
[Bug #20192]
|
|
|
|
These seem odd at first glance, but they're used with `...` calls with
`Module#delegate` from Active Support. These account for ~3% of fallback
reasons in the `lobsters` benchmark.
|
|
* YJIT: specialized codegen for integer right shift
Used in optcarrot. May also be used to write pure-Ruby gems.
No overflow check or fixnum untagging required.
* Update yjit/src/codegen.rs
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
---------
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
|