Open 0xdaryl opened 5 years ago
PR #16848 implements EDO for AArch64.
There is a design choice for ForceRecompilationSnippet
: Single snippet or multiple snippets for a method.
Power takes the single snippet design. When there are 2 or more catch blocks in a method, they share a single snippet. The sequence for branching to the snippet on Power looks like this:
lwz reg, (counter address)
addi. reg, reg, -1
stw reg, (counter address)
beql snippetLabel // conditional BL
doneLabel:
The snippet jumps to the induceRecompilation
helper with the b
instruction, and the helper returns to doneLabel
using the address stored in the link register.
Power has the conditional branch-and-link instruction, but AArch64 does not. The AArch64 instruction sequece for the single snippet design will be like this:
ldr reg, (counter address)
subs reg, reg, #1
str reg, (counter address)
b.ne doneLabel
bl snippetLabel // unconditional BL
doneLabel:
There is a small penalty with b.ne doneLabel
in the normal path.
I took the multiple snippet design in my PR. The instruction sequence looks like this.
ldr reg, (counter address)
subs reg, reg, #1
str reg, (counter address)
b.eq snippetLabel // conditional B
doneLabel:
The snippet calls the helper with the bl
instruction, and goes back to the main line with b doneLabel
. The address of doneLabel
is different for each catch block, and that is the reason for generating a separate snippet for each catch block in this approach.
I can change my code to the single snippet design for smaller footprint.
Implement EDO support in catch blocks for AArch64. See #6426 for placeholder.