RFR: 8194759: Support caching class mirror objects

Thomas Schatzl thomas.schatzl at oracle.com
Thu Feb 22 11:15:52 UTC 2018


Hi,

On Thu, 2018-02-08 at 15:59 -0800, Jiangli Zhou wrote:
> Please review the change for caching class mirror objects in of CDS
> archive. Currently, CDS archive contains java.lang.String objects and
> constant pool resolved_references arrays with resolved string
> constants (when archiving java heap object is allowed). This change
> adds the mirror objects. Please see the description below for
> details.
> 
> RFE: https://bugs.openjdk.java.net/browse/JDK-8194759 <https://bugs.o
> penjdk.java.net/browse/JDK-8194759>
> webrev: http://cr.openjdk.java.net/~jiangli/8194759/webrev.00/
> <http://cr.openjdk.java.net/~jiangli/8194759/webrev.00/>

I looked at the change at this link since although there were comments,
no new webrev seems to have been posted.

[...]
> 
> GC Considerations
> ===============
> When an archived mirror is installed (becomes 'in use') during shared
> class loading and restoration at runtime, the archived mirror is
> accessed via GC access API with barrier. The archived object is
> denoted with IN_ARCHIVE_ROOT and becomes a special root that handled
> differently by GC and enqueued in SATB implicitly in G1.
> Similar to the klass constant pool resolved_references array, the
> archived mirrors resides in the 'open archive' heap region. The
> mirror fields may be updated with references pointing to other non-
> archive heap regions during runtime execution. References within the
> archived mirrors are scanned and followed by GC.
> Shared classes from builtin loaders are never unloaded after they
> become 'in use' (loaded from the archive) at runtime, which keeps all
> 'used' archived mirrors alive after being installed.

I concur with Coleen that the casting in Klass::archived_mirror_raw() 
and Klass::set_archived_java_mirror_raw() is really ugly :)

Otherwise as far as GC is concerned it looks good.

Thomas



More information about the hotspot-runtime-dev mailing list