< prev index next >

src/hotspot/share/classfile/classLoaderExt.cpp

Print this page


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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 #include "precompiled.hpp"
  26 #include "classfile/classFileParser.hpp"
  27 #include "classfile/classFileStream.hpp"
  28 #include "classfile/classListParser.hpp"
  29 #include "classfile/classLoader.inline.hpp"
  30 #include "classfile/classLoaderExt.hpp"
  31 #include "classfile/classLoaderData.inline.hpp"
  32 #include "classfile/klassFactory.hpp"
  33 #include "classfile/modules.hpp"
  34 #include "classfile/sharedPathsMiscInfo.hpp"
  35 #include "classfile/systemDictionaryShared.hpp"
  36 #include "classfile/vmSymbols.hpp"
  37 #include "memory/allocation.inline.hpp"
  38 #include "memory/filemap.hpp"
  39 #include "memory/resourceArea.hpp"
  40 #include "oops/instanceKlass.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "oops/symbol.hpp"
  43 #include "runtime/arguments.hpp"
  44 #include "runtime/handles.inline.hpp"
  45 #include "runtime/java.hpp"
  46 #include "runtime/javaCalls.hpp"
  47 #include "runtime/os.hpp"
  48 #include "services/threadService.hpp"


 240     classloader_type = ClassLoader::PLATFORM_LOADER;
 241     ClassLoaderExt::set_has_platform_classes();
 242   }
 243   if (classpath_index > ClassLoaderExt::max_used_path_index()) {
 244     ClassLoaderExt::set_max_used_path_index(classpath_index);
 245   }
 246   result->set_shared_classpath_index(classpath_index);
 247   result->set_class_loader_type(classloader_type);
 248 }
 249 
 250 void ClassLoaderExt::finalize_shared_paths_misc_info() {
 251   if (!_has_app_classes) {
 252     shared_paths_misc_info()->pop_app();
 253   }
 254 }
 255 
 256 // Load the class of the given name from the location given by path. The path is specified by
 257 // the "source:" in the class list file (see classListParser.cpp), and can be a directory or
 258 // a JAR file.
 259 InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS) {
 260 
 261   assert(name != NULL, "invariant");
 262   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
 263   ResourceMark rm(THREAD);
 264   const char* class_name = name->as_C_string();
 265 
 266   const char* file_name = file_name_for_class_name(class_name,
 267                                                    name->utf8_length());
 268   assert(file_name != NULL, "invariant");
 269 
 270   // Lookup stream for parsing .class file
 271   ClassFileStream* stream = NULL;
 272   ClassPathEntry* e = find_classpath_entry_from_cache(path, CHECK_NULL);
 273   if (e == NULL) {
 274     return NULL;
 275   }
 276   {
 277     PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
 278                                ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(),
 279                                PerfClassTraceTime::CLASS_LOAD);
 280     stream = e->open_stream(file_name, CHECK_NULL);




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  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 #include "precompiled.hpp"
  26 #include "classfile/classFileParser.hpp"
  27 #include "classfile/classFileStream.hpp"

  28 #include "classfile/classLoader.inline.hpp"
  29 #include "classfile/classLoaderExt.hpp"
  30 #include "classfile/classLoaderData.inline.hpp"
  31 #include "classfile/klassFactory.hpp"
  32 #include "classfile/modules.hpp"
  33 #include "classfile/sharedPathsMiscInfo.hpp"
  34 #include "classfile/systemDictionaryShared.hpp"
  35 #include "classfile/vmSymbols.hpp"
  36 #include "memory/allocation.inline.hpp"
  37 #include "memory/filemap.hpp"
  38 #include "memory/resourceArea.hpp"
  39 #include "oops/instanceKlass.hpp"
  40 #include "oops/oop.inline.hpp"
  41 #include "oops/symbol.hpp"
  42 #include "runtime/arguments.hpp"
  43 #include "runtime/handles.inline.hpp"
  44 #include "runtime/java.hpp"
  45 #include "runtime/javaCalls.hpp"
  46 #include "runtime/os.hpp"
  47 #include "services/threadService.hpp"


 239     classloader_type = ClassLoader::PLATFORM_LOADER;
 240     ClassLoaderExt::set_has_platform_classes();
 241   }
 242   if (classpath_index > ClassLoaderExt::max_used_path_index()) {
 243     ClassLoaderExt::set_max_used_path_index(classpath_index);
 244   }
 245   result->set_shared_classpath_index(classpath_index);
 246   result->set_class_loader_type(classloader_type);
 247 }
 248 
 249 void ClassLoaderExt::finalize_shared_paths_misc_info() {
 250   if (!_has_app_classes) {
 251     shared_paths_misc_info()->pop_app();
 252   }
 253 }
 254 
 255 // Load the class of the given name from the location given by path. The path is specified by
 256 // the "source:" in the class list file (see classListParser.cpp), and can be a directory or
 257 // a JAR file.
 258 InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS) {

 259   assert(name != NULL, "invariant");
 260   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
 261   ResourceMark rm(THREAD);
 262   const char* class_name = name->as_C_string();
 263 
 264   const char* file_name = file_name_for_class_name(class_name,
 265                                                    name->utf8_length());
 266   assert(file_name != NULL, "invariant");
 267 
 268   // Lookup stream for parsing .class file
 269   ClassFileStream* stream = NULL;
 270   ClassPathEntry* e = find_classpath_entry_from_cache(path, CHECK_NULL);
 271   if (e == NULL) {
 272     return NULL;
 273   }
 274   {
 275     PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
 276                                ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(),
 277                                PerfClassTraceTime::CLASS_LOAD);
 278     stream = e->open_stream(file_name, CHECK_NULL);


< prev index next >