< prev index next >

src/hotspot/share/classfile/classLoaderData.hpp

Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com

*** 1,7 **** /* ! * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 115,135 **** ClassLoaderMetaspace * volatile _metaspace; // Meta-space where meta-data defined by the // classes in the class loader are allocated. Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. bool _unloading; // true if this class loader goes away ! bool _is_unsafe_anonymous; // CLD is dedicated to one class and that class determines the CLDs lifecycle. ! // For example, an unsafe anonymous class. // Remembered sets support for the oops in the class loader data. bool _modified_oops; // Card Table Equivalent (YC/CMS support) bool _accumulated_modified_oops; // Mod Union Equivalent (CMS support) int _keep_alive; // if this CLD is kept alive. ! // Used for unsafe anonymous classes and the boot class ! // loader. _keep_alive does not need to be volatile or ! // atomic since there is one unique CLD per unsafe anonymous class. volatile int _claim; // non-zero if claimed, for example during GC traces. // To avoid applying oop closure more than once. ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which // have the same life cycle of the corresponding ClassLoader. --- 115,137 ---- ClassLoaderMetaspace * volatile _metaspace; // Meta-space where meta-data defined by the // classes in the class loader are allocated. Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. bool _unloading; // true if this class loader goes away ! bool _has_class_mirror_holder; // If true, CLD is dedicated to one class and that class determines ! // the CLDs lifecycle. For example, a non-strong hidden class or an ! // unsafe anonymous class. Arrays of these classes are also assigned ! // to these class loader datas. // Remembered sets support for the oops in the class loader data. bool _modified_oops; // Card Table Equivalent (YC/CMS support) bool _accumulated_modified_oops; // Mod Union Equivalent (CMS support) int _keep_alive; // if this CLD is kept alive. ! // Used for weak hidden classes, unsafe anonymous classes and the ! // boot class loader. _keep_alive does not need to be volatile or ! // atomic since there is one unique CLD per weak hidden or unsafe anonymous class. volatile int _claim; // non-zero if claimed, for example during GC traces. // To avoid applying oop closure more than once. ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which // have the same life cycle of the corresponding ClassLoader.
*** 160,170 **** JFR_ONLY(DEFINE_TRACE_ID_FIELD;) void set_next(ClassLoaderData* next) { _next = next; } ClassLoaderData* next() const { return Atomic::load(&_next); } ! ClassLoaderData(Handle h_class_loader, bool is_unsafe_anonymous); ~ClassLoaderData(); // The CLD are not placed in the Heap, so the Card Table or // the Mod Union Table can't be used to mark when CLD have modified oops. // The CT and MUT bits saves this information for the whole class loader data. --- 162,172 ---- JFR_ONLY(DEFINE_TRACE_ID_FIELD;) void set_next(ClassLoaderData* next) { _next = next; } ClassLoaderData* next() const { return Atomic::load(&_next); } ! ClassLoaderData(Handle h_class_loader, bool has_class_mirror_holder); ~ClassLoaderData(); // The CLD are not placed in the Heap, so the Card Table or // the Mod Union Table can't be used to mark when CLD have modified oops. // The CT and MUT bits saves this information for the whole class loader data.
*** 229,256 **** return _the_null_class_loader_data; } Mutex* metaspace_lock() const { return _metaspace_lock; } ! bool is_unsafe_anonymous() const { return _is_unsafe_anonymous; } static void init_null_class_loader_data(); bool is_the_null_class_loader_data() const { return this == _the_null_class_loader_data; } // Returns true if this class loader data is for the system class loader. ! // (Note that the class loader data may be unsafe anonymous.) bool is_system_class_loader_data() const; // Returns true if this class loader data is for the platform class loader. ! // (Note that the class loader data may be unsafe anonymous.) bool is_platform_class_loader_data() const; // Returns true if this class loader data is for the boot class loader. ! // (Note that the class loader data may be unsafe anonymous.) inline bool is_boot_class_loader_data() const; bool is_builtin_class_loader_data() const; bool is_permanent_class_loader_data() const; --- 231,258 ---- return _the_null_class_loader_data; } Mutex* metaspace_lock() const { return _metaspace_lock; } ! bool has_class_mirror_holder() const { return _has_class_mirror_holder; } static void init_null_class_loader_data(); bool is_the_null_class_loader_data() const { return this == _the_null_class_loader_data; } // Returns true if this class loader data is for the system class loader. ! // (Note that the class loader data may be for an weak hidden or unsafe anonymous class) bool is_system_class_loader_data() const; // Returns true if this class loader data is for the platform class loader. ! // (Note that the class loader data may be for an weak hidden or unsafe anonymous class) bool is_platform_class_loader_data() const; // Returns true if this class loader data is for the boot class loader. ! // (Note that the class loader data may be for an weak hidden unsafe anonymous class) inline bool is_boot_class_loader_data() const; bool is_builtin_class_loader_data() const; bool is_permanent_class_loader_data() const;
*** 267,277 **** bool is_unloading() const { assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded"); return _unloading; } ! // Used to refcount an unsafe anonymous class's CLD in order to // indicate their aliveness. void inc_keep_alive(); void dec_keep_alive(); void initialize_holder(Handle holder); --- 269,279 ---- bool is_unloading() const { assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded"); return _unloading; } ! // Used to refcount an weak hidden or unsafe anonymous class's CLD in order to // indicate their aliveness. void inc_keep_alive(); void dec_keep_alive(); void initialize_holder(Handle holder);
*** 311,321 **** void add_to_deallocate_list(Metadata* m); static ClassLoaderData* class_loader_data(oop loader); static ClassLoaderData* class_loader_data_or_null(oop loader); ! static ClassLoaderData* unsafe_anonymous_class_loader_data(Handle loader); // Returns Klass* of associated class loader, or NULL if associated loader is 'bootstrap'. // Also works if unloading. Klass* class_loader_klass() const { return _class_loader_klass; } --- 313,323 ---- void add_to_deallocate_list(Metadata* m); static ClassLoaderData* class_loader_data(oop loader); static ClassLoaderData* class_loader_data_or_null(oop loader); ! static ClassLoaderData* has_class_mirror_holder_cld(Handle loader); // Returns Klass* of associated class loader, or NULL if associated loader is 'bootstrap'. // Also works if unloading. Klass* class_loader_klass() const { return _class_loader_klass; }
< prev index next >