eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k stars 722 forks source link

Enable EDO for AArch64 #6538

Open 0xdaryl opened 5 years ago

0xdaryl commented 5 years ago

Implement EDO support in catch blocks for AArch64. See #6426 for placeholder.

knn-k commented 1 year ago

PR #16848 implements EDO for AArch64.

knn-k commented 1 year ago

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.