forked from grigory-rechistov/interpreters-comparison
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add IR based JIT #2
Open
dstogov
wants to merge
17
commits into
rigidus:master
Choose a base branch
from
dstogov:jited_ir
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Stack resolution is incomplete. It doesn't respect Control Flow Graph yet.
native 0.601 asmopt 2.986 predecoded 21.943 subroutined 15.425 switched 24.787 tailrecursive 14.670 threaded 25.444 threaded-cached 18.190 translated 20.212 php -d opcache.enable=0 2.188 php -d opcache.jit=0 1.968 php -d opcache.jit=function 1.005 php -d opcache.jit=tracing 1.011 jited_ir 6.277 jited_ir_stack 0.616 jited_ir_var 0.613
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.
This adds JIT for your VM bytecode based on https://github.com/dstogov/ir
I just liked to check how IR framework does its work. The first naive version was 10 times slower than "native" code, but the obvious stack resolution made JIT-ed code almost as fast as "native" (~2-2.5% slower). The SSA construction removed even this gap.
It shouldn't be a big problem to port this to LLVM. SSA construction should be done by "mem2reg" pass on top of "jitted_ir_var".
Also, I found that a weak-typed PHP interpreter is significantly faster than your best asm optimized version.
So it's definitely possible to write much faster interpreters...
@atakua you may be interested.
Benchmark Results