-
-
Notifications
You must be signed in to change notification settings - Fork 933
Run specs repeatedly with forced JIT #8930
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3140cae to
55ef3ae
Compare
Specs and tests run only once, but much of JRuby's logic for optimizing code only runs after call sites have been executed more than once. This patch adds a CI job that runs language examples at least twice to ensure such logic is tested. Currently this runs the specs four times, to try to ensure that all optimizations are tested. This is based on an expectation that most code will pass through the following stages (with JIT threshold set to 0): * Methods will be forced to JIT and execute their compiled form immediately, but blocks may delay compilation if their surrounding method has not yet been compiled. This first stage may run in the interpreter. * Once compiled, call sites and other caches (like global vars) will initially be unoptimized, executing similar to the way the interpreter handles these constructs. This second stage is compiled, but unoptimized. * After the initial encounter of a call site, the optimized code will be installed for future invocations. This third stage is now compiled and using optimized call sites. * Some sites, such as those that redispatch for new/initialize or !=, may have additional caches that will not be encountered until the optimized code has been installed. This fourth stage helps ensure such multi-layer caches have optimized. There are other cases where more than 4 runs may be necessary, such as for polymorphic sites that must be built up across many calls, but such cases usually will only have slight differences in behavior from monomorphic sites (primarily around the cascading PIC logic that searches for a matching type). Rather than attempt to add additional runs with diminishing returns, we may explore more repetitive runs on a narrower set of specs. I have also included a small patch for mspec to allow using the repeat flag in CI mode (previously it was only available for the run command.
NthRef has the side effect requirement of a backref frame, so it should not be represented as a side-effect free operand. This patch introduces BuildNthRefInstr due to requirements that high group numbers warn, which conflicts with the lettered backrefs used in BuildBackrefInstr. The lack of a frame caused optimized NthRef logic in the JIT to fail to push a frame, which caused those references to break once JIT had settled. This patch also fixes defined?(any backref form) to also trigger a backref frame, also broken once JIT settled.
Undefined globals should continue to retrieve and trigger the undefined warning every time. By caching the result, we stop attempting to retrieve it, which causes the warning to stop displaying.
The JIT does not push backtrace frames, so we cannot rely on such frames being in context for eval location reporting. This patch modifies such calls to use full backtrace construction, done lazily now to avoid full JVM stack reification, so that eval parent frames can JIT without losing the backtrace information eval expects to be able to report. This only became visible while running specs repeatedly and allowing eval parent frames to JIT at runtime, which would suddenly cause their parent backtrace frame to disappear and the eval to use an ancestor's backtrace location instead.
The modified spec requires a file but does not clean up afterwards. This prevents it from being run repeatedly, since n+1 runs will fail to actually execute the required script. The CodeLoading fixture is used in the require specs for this sort of cleanup.
Private to_s should still be invoked, so switch this to doing a functional-style call. This only affects optimized dstr on their second and higher invocations.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Specs and tests run only once, but much of JRuby's logic for optimizing code only runs after call sites have been executed more than once. This patch adds a CI job that runs ruby/spec examples at least twice to ensure such logic is tested.