RFR: 8349088: De-virtualize Codeblob and nmethod [v2]
Stefan Karlsson
stefank at openjdk.org
Mon Feb 10 16:26:12 UTC 2025
On Sun, 9 Feb 2025 19:43:29 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Remove virtual methods from CodeBlob and nmethod to simplify saving/restoring in Leyden AOT cache. It avoids the need to patch hidden VPTR pointer to class's virtual table.
>>
>> Added C++ static asserts to make sure no virtual methods are added in a future.
>>
>> Fixed/cleaned SA code which process CodeBlob and its subclasses. Use `CodeBlob::_kind` field value to determine the type of blob.
>>
>> Tested tier1-5, hs-tier6-rt (for JFR testing), stress, xcomp
>
> Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix Zero and Minimal VM builds
We have a similar situation with oopDesc that are not allowed to have a vtable. The solution there is to use the Klass as the proxy vtable and then have a bunch of Klass::oop_ functions that act like virtual dispatch functions for associated oopDesc functions.
I wonder if a similar approach can be use here? Such an approach would (to me at lest) have the benefit that we don't have to spread switch statements in various functions in the top-most class.
If you are interested in seeing a prototype of this, take a look at this branch:
https://github.com/openjdk/jdk/compare/master...stefank:jdk:code_blob_vptr
Just a suggestion if you want to consider alternatives to these switch statements.
-------------
PR Review: https://git.openjdk.org/jdk/pull/23533#pullrequestreview-2606457754
More information about the serviceability-dev
mailing list