hotspot/src/share/vm/classfile/classLoaderData.cpp
changeset 46271 979ebd346ecf
parent 42639 762117d57d05
child 46289 1904e7ec236e
equal deleted inserted replaced
46270:2e7898927798 46271:979ebd346ecf
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   520 
   520 
   521 // Returns true if this class loader data is one of the 3 builtin
   521 // Returns true if this class loader data is one of the 3 builtin
   522 // (boot, application/system or platform) class loaders. Note, the
   522 // (boot, application/system or platform) class loaders. Note, the
   523 // builtin loaders are not freed by a GC.
   523 // builtin loaders are not freed by a GC.
   524 bool ClassLoaderData::is_builtin_class_loader_data() const {
   524 bool ClassLoaderData::is_builtin_class_loader_data() const {
   525   Handle classLoaderHandle = class_loader();
       
   526   return (is_the_null_class_loader_data() ||
   525   return (is_the_null_class_loader_data() ||
   527           SystemDictionary::is_system_class_loader(classLoaderHandle) ||
   526           SystemDictionary::is_system_class_loader(class_loader()) ||
   528           SystemDictionary::is_platform_class_loader(classLoaderHandle));
   527           SystemDictionary::is_platform_class_loader(class_loader()));
   529 }
   528 }
   530 
   529 
   531 Metaspace* ClassLoaderData::metaspace_non_null() {
   530 Metaspace* ClassLoaderData::metaspace_non_null() {
   532   assert(!DumpSharedSpaces, "wrong metaspace!");
   531   assert(!DumpSharedSpaces, "wrong metaspace!");
   533   // If the metaspace has not been allocated, create a new one.  Might want
   532   // If the metaspace has not been allocated, create a new one.  Might want
   625 }
   624 }
   626 
   625 
   627 // These anonymous class loaders are to contain classes used for JSR292
   626 // These anonymous class loaders are to contain classes used for JSR292
   628 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   627 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   629   // Add a new class loader data to the graph.
   628   // Add a new class loader data to the graph.
   630   return ClassLoaderDataGraph::add(loader, true, THREAD);
   629   Handle lh(THREAD, loader);
       
   630   return ClassLoaderDataGraph::add(lh, true, THREAD);
   631 }
   631 }
   632 
   632 
   633 const char* ClassLoaderData::loader_name() {
   633 const char* ClassLoaderData::loader_name() {
   634   // Handles null class loader
   634   // Handles null class loader
   635   return SystemDictionary::loader_name(class_loader());
   635   return SystemDictionary::loader_name(class_loader());
   766                             spec_klass,
   766                             spec_klass,
   767                             vmSymbols::toString_name(),
   767                             vmSymbols::toString_name(),
   768                             vmSymbols::void_string_signature(),
   768                             vmSymbols::void_string_signature(),
   769                             CHECK);
   769                             CHECK);
   770     assert(result.get_type() == T_OBJECT, "just checking");
   770     assert(result.get_type() == T_OBJECT, "just checking");
   771     string = (oop)result.get_jobject();
   771     string = Handle(THREAD, (oop)result.get_jobject());
   772   }
   772   }
   773 
   773 
   774   ResourceMark rm;
   774   ResourceMark rm;
   775   outputStream* log = Log(class, loader, data)::debug_stream();
   775   outputStream* log = Log(class, loader, data)::debug_stream();
   776   log->print("create class loader data " INTPTR_FORMAT, p2i(cld));
   776   log->print("create class loader data " INTPTR_FORMAT, p2i(cld));