< prev index next >

src/hotspot/share/classfile/classLoaderData.inline.hpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
  26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
  27 
  28 #include "classfile/classLoaderData.hpp"
  29 #include "classfile/javaClasses.hpp"

  30 #include "oops/oop.inline.hpp"
  31 #include "oops/oopHandle.inline.hpp"
  32 #include "oops/weakHandle.inline.hpp"
  33 
  34 inline oop ClassLoaderData::class_loader() const {
  35   assert(!_unloading, "This oop is not available to unloading class loader data");
  36   assert(_holder.is_null() || _holder.peek() != NULL , "This class loader data holder must be alive");
  37   return _class_loader.resolve();
  38 }
  39 
  40 inline bool ClassLoaderData::is_boot_class_loader_data() const {
  41     return class_loader() == NULL;
  42   }
  43 
  44 inline ClassLoaderData* ClassLoaderData::class_loader_data_or_null(oop loader) {
  45   if (loader == NULL) {
  46     return ClassLoaderData::the_null_class_loader_data();
  47   }
  48   return java_lang_ClassLoader::loader_data(loader);
  49 }


  73 size_t ClassLoaderDataGraph::num_array_classes() {
  74   return _num_array_classes;
  75 }
  76 
  77 void ClassLoaderDataGraph::inc_instance_classes(size_t count) {
  78   Atomic::add(count, &_num_instance_classes);
  79 }
  80 
  81 void ClassLoaderDataGraph::dec_instance_classes(size_t count) {
  82   assert(count <= _num_instance_classes, "Sanity");
  83   Atomic::sub(count, &_num_instance_classes);
  84 }
  85 
  86 void ClassLoaderDataGraph::inc_array_classes(size_t count) {
  87   Atomic::add(count, &_num_array_classes);
  88 }
  89 
  90 void ClassLoaderDataGraph::dec_array_classes(size_t count) {
  91   assert(count <= _num_array_classes, "Sanity");
  92   Atomic::sub(count, &_num_array_classes);






  93 }
  94 
  95 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
  26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
  27 
  28 #include "classfile/classLoaderData.hpp"
  29 #include "classfile/javaClasses.hpp"
  30 #include "oops/instanceKlass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "oops/oopHandle.inline.hpp"
  33 #include "oops/weakHandle.inline.hpp"
  34 
  35 inline oop ClassLoaderData::class_loader() const {
  36   assert(!_unloading, "This oop is not available to unloading class loader data");
  37   assert(_holder.is_null() || _holder.peek() != NULL , "This class loader data holder must be alive");
  38   return _class_loader.resolve();
  39 }
  40 
  41 inline bool ClassLoaderData::is_boot_class_loader_data() const {
  42     return class_loader() == NULL;
  43   }
  44 
  45 inline ClassLoaderData* ClassLoaderData::class_loader_data_or_null(oop loader) {
  46   if (loader == NULL) {
  47     return ClassLoaderData::the_null_class_loader_data();
  48   }
  49   return java_lang_ClassLoader::loader_data(loader);
  50 }


  74 size_t ClassLoaderDataGraph::num_array_classes() {
  75   return _num_array_classes;
  76 }
  77 
  78 void ClassLoaderDataGraph::inc_instance_classes(size_t count) {
  79   Atomic::add(count, &_num_instance_classes);
  80 }
  81 
  82 void ClassLoaderDataGraph::dec_instance_classes(size_t count) {
  83   assert(count <= _num_instance_classes, "Sanity");
  84   Atomic::sub(count, &_num_instance_classes);
  85 }
  86 
  87 void ClassLoaderDataGraph::inc_array_classes(size_t count) {
  88   Atomic::add(count, &_num_array_classes);
  89 }
  90 
  91 void ClassLoaderDataGraph::dec_array_classes(size_t count) {
  92   assert(count <= _num_array_classes, "Sanity");
  93   Atomic::sub(count, &_num_array_classes);
  94 }
  95 
  96 bool ClassLoaderDataGraph::should_clean_metaspaces() {
  97   bool do_cleaning = _safepoint_cleanup_needed;
  98   _safepoint_cleanup_needed = false;  // reset
  99   return (do_cleaning && _should_clean_deallocate_lists) || InstanceKlass::has_previous_versions();
 100 }
 101 
 102 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP
< prev index next >