-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[GR-58575] SubstrateVM PLT/GOT Feature #9883
Conversation
Hello, I have some questions regarding this feature.
FYI @galderz @franz1981 |
7bf3e19
to
ae58618
Compare
Introduces an additional level of indirection for calls where a GOT (Global Offset Table) is an array of method pointers and PLT (Procedure Linkage Table) is a collection of small stubs. With this feature enabled, direct calls are emitted as indirect calls through the GOT. The virtual table is filled with PLT stubs instead. While inspired by ELF, no ELF mechanisms are used in the implementation. Example usecase: Hijack code execution on call boundaries to diverge execution from AOT code to an interpreter. Contributors: - Aleksandar Gradinac: Initial implementation on linux-amd64. - Marko Spasic: Miscellaneous improvements. - Bernhard Urban-Forster: Support for linux-aarch64, darwin-aarch64 and darwin-amd64. - Alfonso² Peterssen: Support for windows-amd64. Co-authored-by: Aleksandar Gradinac <[email protected]> Co-authored-by: Marko Spasic <[email protected]> Co-authored-by: Alfonso² Peterssen <[email protected]>
ae58618
to
ff719b3
Compare
@mukel this is a gentle ping for the question above ^^ |
The PLT/GOT is disabled by default and only enabled ATM for the JDWP debugger. It may be used in the future for other purposes e.g. compressing cold code in the image. There's a single digit % performance impact, depending on the benchmark... @mspasic-oracle can you provide more data here? All calls should go through it; with some exceptions. For the JDWP debugger, it is only applied for methods that can be diverted to the interpreter; it doesn't affect inlined methods, nor methods marked with @Uninterruptible ... |
@zakkak Hi, @mspasic-oracle here.
So it's an extra
If there’s anything more I can help with, please feel free to reach out on the public graalvm Slack channel. |
Hi @zakkak,
There was no statistically significant change in the dacapo and renaissance benchmarks compared to the main branch. All the benchmarks with PLT/GOT enabled and redirecting almost all methods through the PLT/GOT (except for some external C calls and Uninterrupitble methods) are within the statistical variability. Side note: The main overhead in |
Thanks for the quick reply @spaske00
Out of curiosity, does this mean that PLT/GOT never interferes with direct calls? What about monomorphic call sites where we can use a direct call? |
That's how I learn the most! :D
The The compiler decides whether a call is direct or indirect. The PLT/GOT then transforms the direct calls for which The call sites of virtual calls that go through PLT/GOT remain unchanged; we just mark appropriate vtable entries as relocations to the appropriate PLT stubs. Is that what you were asking or did I misunderstand? |
Yes. So in some cases PLT/GOT will end up replacing a direct calls with indirect ones (which should have a bigger impact than just an additional Thanks again |
Introduces an additional level of indirection for calls where a GOT (Global Offset Table) is an array of method pointers and PLT (Procedure Linkage Table) is a collection of small stubs. With this feature enabled, direct calls are emitted as indirect calls through the GOT. The virtual table is filled with PLT stubs instead.
While inspired by ELF, no ELF mechanisms are used in the implementation.
Example usecase: Hijack code execution on call boundaries to diverge execution from AOT code to an interpreter.
Contributors:
Co-authored-by: Aleksandar Gradinac [email protected]
Co-authored-by: Marko Spasic [email protected]
Co-authored-by: Alfonso² Peterssen [email protected]