-
-
Notifications
You must be signed in to change notification settings - Fork 926
Possible JIT optimizations #7588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milestone
Comments
headius
added a commit
to headius/jruby
that referenced
this issue
May 12, 2023
Still only supports one arity with no varargs or block conversion. This code seems to have broken at some point as it used the wrong signature to check for a block argument and did exactly the wrong thing when comparing arity of a static or instance method. This implements the first part of Java method call optimization as mentioned in jrubyGH-7588.
headius
added a commit
to headius/jruby
that referenced
this issue
May 23, 2023
Still only supports one arity with no varargs or block conversion. This code seems to have broken at some point as it used the wrong signature to check for a block argument and did exactly the wrong thing when comparing arity of a static or instance method. This implements the first part of Java method call optimization as mentioned in jrubyGH-7588.
headius
added a commit
to headius/jruby
that referenced
this issue
Mar 30, 2024
Fixnum and String ranges can be reduced in complexity by doing all of the construction in one go rather than each piece individually. A Range of fixnum..fixnum now uses indy to pass the long values to the bootstrap, avoiding bytecode to construct the fixnum objects. A Range of string..string embeds the bytelist and CR into the bootstrap parameters, for the same result. Both also have simplified forms in the non-indy JIT mode. From ideas list in jruby#7588.
This was referenced Mar 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a list of optimizations I see could be done in the JIT but which require more work than just on the code that the JIT emits (i.e. specialized invokedynamic call sites or helper code).
block_given?
currently cause the method to deoptimize, since we need the method's frame to be able to retrieve the block fromRubyKernel#block_given_p
. This is unnecessary when we are in a normal method scope; we can just check the passed-in block directly, avoiding the deoptimization. This requires work in IR (use BlockGivenInstr rather than call when in a method scope, possibly with a guard for user-definedblock_given?
) (Implemented for bareblock_given?
calls in Implement block_given? call as optimized instruction #8170)void
to avoid popping, or a method immediately used in a conditional could be called with aboolean
return value and avoid callingisTrue
. Calls guaranteed to return specific types could return those types and avoid acheckcast
.return
to an otherwise leafy scope will force it to allocate and use its own DynamicScope (early return from a block is slow #5933)....
as described in https://bugs.ruby-lang.org/issues/20425.__dir__
and attrs need access to the file (Inconsistency between MRI and JRuby source location. #8079), refined methods need access to the scope. These currently force either a frame or a dynamic scope or need a backtrace (not provided by JIT). None of them should need to trigger deopt just to pass readily-available values.The text was updated successfully, but these errors were encountered: