About static call code emit
Erik Osterlund
erik.osterlund at oracle.com
Sun Nov 14 09:21:58 UTC 2021
The static call can go either to the verified entry of an nmethod, or to the c2i adapter to convert the execution to interpreted. In the latter case, we need to set the target Method* in a particular register (rbx on x86_64) so the interpreter knows what to run. But you don’t need to do that for compiled calls, as the destination implies that. The static call stubs are literally just a way to have the static call sites only conditionally set the method register when it’s needed, to save a register set operation in the fast path.
You might wonder if said optimization is really worthwhile. In my experiments, it is not. Therefore my new invoke bindings removes that. It’s a lot of complicated code, and no noticeable advantage, compared to just always setting the register in case it is needed.
/Erik
> On 14 Nov 2021, at 05:08, 刘斯宇 <liusy58 at smail.nju.edu.cn> wrote:
>
> I have noticed that during the code_emit phase, a static call will create a static stub, and doing some relocation here, you can find the logic in the function emit_call from file `src/hotspot/share/c1/c1_LIRAssembler.cpp`, I'm at a loss about why a stub should be created? any help?
>
>
>
More information about the hotspot-compiler-dev
mailing list