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
Jits: Discard registers which we know will be overwritten #9351
Conversation
f9426ea
to
ab8f433
Compare
|
x64 changes lgtm |
8e7ca98
to
ef402e4
Compare
ef402e4
to
bd60531
Compare
| @@ -551,6 +551,10 @@ void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const Gekk | |||
| code->outputFPRF = (opinfo->flags & FL_SET_FPRF) != 0; | |||
| code->canEndBlock = (opinfo->flags & FL_ENDBLOCK) != 0; | |||
|
|
|||
| // TODO: Is it possible to determine that some FPU instructions never cause exceptions? | |||
| code->canCauseException = | |||
| (opinfo->flags & (FL_LOADSTORE | FL_USE_FPU | FL_PROGRAMEXCEPTION)) != 0; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first FPU instruction will throw an exception, so all others are fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't FPU instructions throw exceptions in other situations as well (that may not have been implemented in the JITs yet), like division by zero? (See the discussion about True Crime on IRC earlier this month)
| if (op.canEndBlock || op.canCauseException) | ||
| { | ||
| gprDiscardable = BitSet32{}; | ||
| fprDiscardable = BitSet32{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder, is there a reason why wantsCR, wantsFPRF, ..., is only set for op.canEndBlock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure exactly how the logic works, and I'm also not sure if it has to do with this PR.
bd60531
to
a8a08d9
Compare
a8a08d9
to
4402941
Compare
4402941
to
a98e550
Compare
We've run out of space :(
This commit adds a new "discarded" state for registers. Discarding a register is like flushing it, but without actually writing its value back to memory. We can discard a register only when it is guaranteed that no instruction will read from the register before it is next written to. Discarding reduces the register pressure a little, and can also let us skip a few flushes on interpreter fallbacks.
a98e550
to
62ce1c7
Compare
This pull request adds a new "discarded" state for registers. Discarding a register is like flushing it, but without actually writing its value back to memory. We can discard a register only when it is guaranteed that no instruction will read from the register before it is next written to.
Discarding reduces the register pressure a little, and can also let us skip a few flushes on interpreter fallbacks.