RFR: 8363620: AArch64: reimplement emit_static_call_stub()

Mikhail Ablakatov mablakatov at openjdk.org
Tue Aug 12 13:14:12 UTC 2025


On Sun, 10 Aug 2025 07:24:18 GMT, Andrew Haley <aph at openjdk.org> wrote:

> There may still be a race in set_to_clean(), which doesn't zero out the [method, entry} fields in the stub. I'd fix that, to be safe. It'd be tricky to test.

It appears  that `CompiledDirectCall::set_stub_to_clean` is currently unused. I would suggest either leaving it as-is or even better removing it entirely to avoid the risk of someone using it in the future since it's not safe under all conditions.

For example, consider a situation when a system thread is preempted by the OS while executing a static stub. If another thread clears that static stub before the preempted thread resumes, the first thread might execute a partially cleared sequence of `movk`/`movz` instructions.

Here's a simplified scenario:

| Thread A | Thread B | 
|-|-|
| `isb` | - |
| `movk` | - |
| `movz` | - |
| PREEMPTED | Clears the static stub |
| `movz` (cleared) | - |
| ... | ... |

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26638#issuecomment-3179283141


More information about the hotspot-dev mailing list