RFR: 8317007: Add bulk removal of dead nmethods during class unloading [v5]
Thomas Schatzl
tschatzl at openjdk.org
Wed Dec 13 13:12:41 UTC 2023
On Wed, 13 Dec 2023 12:39:46 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Wrong order of unregister and free code blobs after merge. Do not verify unlinked nmethods.
>
> src/hotspot/share/code/nmethod.cpp line 1447:
>
>> 1445: }
>> 1446:
>> 1447: void nmethod::purge(bool free_code_cache_data, bool unregister_nmethod) {
>
> When will `free_code_cache_data` be `false`? I thought with the sort-before-free patch, freeing is always delayed after purging.
The compiler eagerly allocates code blobs, so it can give them back if not needed any more (e.g. compiler thread stops due to dynamic adjustment, when shutting down the compilers, when the compiler fails to install an nmethod, ...).
Only when code unloading we always delay freeing (as this code shows).
> src/hotspot/share/code/nmethod.cpp line 1469:
>
>> 1467: if (unregister_nmethod) {
>> 1468: assert(!free_code_cache_data, "must not free when postponing unregistering");
>> 1469: Universe::heap()->unregister_nmethod(this);
>
> Could the impl of `unregister_nmethod` be `ShouldNotReachHere()` for GCs using bulk-removal?
No, for the reasons above, we need to keep the functionality to unregister individual nmethods/code blobs for the situations above.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16767#discussion_r1425332377
PR Review Comment: https://git.openjdk.org/jdk/pull/16767#discussion_r1425333506
More information about the hotspot-gc-dev
mailing list