Ensure backwards jumps get a yk_location. #96
Merged
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.
Requires: ykjit/yk#1466
I noticed that the mandelbrot benchmark was not triggering the JIT. This was because we only assigned locations to
forloops, but this benchmark contains mostlywhilelooping.Lua has no deidcated bytecode for
whileloops. Instead it uses unstructured control flow using conditionals and jumps.Here's an example:
Becomes:
In this example
JMP -8is a CFG back edge that makes the loop.This commit makes yklua recognise back edges as potential loops so that they get JITted if/when they get hot. This is of course a proxy: not all back edges are necessarily loops, but it should (tm) be a decent enough approximation for our purposes.
I measured about a 12% slowdown with this change. We can't not trace while loops and expect to be faster, so we will have to take this on for now.