RFR: 8364516: Serial: Move class unloading logic inside SerialFullGC::invoke_at_safepoint

Thomas Schatzl tschatzl at openjdk.org
Fri Aug 1 09:29:56 UTC 2025


On Fri, 1 Aug 2025 08:47:57 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Encapsulating classunloading logic inside `invoke_at_safepoint` and adding doc explaining why the classunloading logic can't be placed at the end of marking during full-gc, like other STW collectors.
> 
> Test: tier1-3

Minor suggestions to the comment.

src/hotspot/share/gc/serial/serialFullGC.cpp line 708:

> 706:   allocate_stacks();
> 707: 
> 708:   // Usually, all classunloading works occurs at the end of phase 1, but Serial

Suggestion:

  // Usually, all class unloading works occurs at the end of phase 1, but Serial

src/hotspot/share/gc/serial/serialFullGC.cpp line 711:

> 709:   // full-gc accesses dead-objs' klass to find out the start of next live-obj
> 710:   // during phase 2. This requires klasses of dead-objs to be kept loaded.
> 711:   // Therefore, we declare classunloading context in the same level as various

Suggestion:

  // Therefore, we declare the class unloading context at the same level as the other

or
Suggestion:

  // Therefore, we declare the ClassUnloadingContext at the same level as the other

src/hotspot/share/gc/serial/serialFullGC.cpp line 713:

> 711:   // Therefore, we declare classunloading context in the same level as various
> 712:   // phases, and purge dead classes (invoking ClassLoaderDataGraph::purge)
> 713:   // after all phases of full-gc.

Suggestion:

  // phases, and purge dead classes (invoking ClassLoaderDataGraph::purge())
  // after the other phases of full-gc.

src/hotspot/share/gc/serial/serialFullGC.cpp line 768:

> 766:   }
> 767: 
> 768:   // Delete metaspaces for unloaded class loaders and clean up loader_data graph

Suggestion:

  // Delete metaspaces for unloaded class loaders and clean up the CLDG.

or
Suggestion:

  // Delete metaspaces for unloaded class loaders and clean up the class loader data graph.

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

Changes requested by tschatzl (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26588#pullrequestreview-3078401549
PR Review Comment: https://git.openjdk.org/jdk/pull/26588#discussion_r2247430537
PR Review Comment: https://git.openjdk.org/jdk/pull/26588#discussion_r2247433520
PR Review Comment: https://git.openjdk.org/jdk/pull/26588#discussion_r2247436334
PR Review Comment: https://git.openjdk.org/jdk/pull/26588#discussion_r2247439584


More information about the hotspot-gc-dev mailing list