23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classFileStream.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/classLoaderData.inline.hpp"
29 #include "classfile/classLoaderExt.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "classfile/jimage.hpp"
32 #include "classfile/moduleEntry.hpp"
33 #include "classfile/modules.hpp"
34 #include "classfile/packageEntry.hpp"
35 #include "classfile/klassFactory.hpp"
36 #include "classfile/systemDictionary.hpp"
37 #include "classfile/vmSymbols.hpp"
38 #include "compiler/compileBroker.hpp"
39 #include "gc/shared/collectedHeap.inline.hpp"
40 #include "gc/shared/generation.hpp"
41 #include "interpreter/bytecodeStream.hpp"
42 #include "interpreter/oopMapCache.hpp"
43 #include "logging/logTag.hpp"
44 #include "memory/allocation.inline.hpp"
45 #include "memory/filemap.hpp"
46 #include "memory/oopFactory.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "memory/universe.inline.hpp"
49 #include "oops/instanceKlass.hpp"
50 #include "oops/instanceRefKlass.hpp"
51 #include "oops/objArrayOop.inline.hpp"
52 #include "oops/oop.inline.hpp"
53 #include "oops/symbol.hpp"
54 #include "prims/jvm.h"
55 #include "prims/jvm_misc.hpp"
56 #include "runtime/arguments.hpp"
57 #include "runtime/compilationPolicy.hpp"
58 #include "runtime/fprofiler.hpp"
59 #include "runtime/handles.hpp"
60 #include "runtime/handles.inline.hpp"
61 #include "runtime/init.hpp"
62 #include "runtime/interfaceSupport.hpp"
592 ClassPathEntry* e = _module_first_entry;
593 while (e != NULL) {
594 ClassPathEntry* next_entry = e->next();
595 delete e;
596 e = next_entry;
597 }
598 }
599
600 void ModuleClassPathList::add_to_list(ClassPathEntry* new_entry) {
601 if (new_entry != NULL) {
602 if (_module_last_entry == NULL) {
603 _module_first_entry = _module_last_entry = new_entry;
604 } else {
605 _module_last_entry->set_next(new_entry);
606 _module_last_entry = new_entry;
607 }
608 }
609 }
610
611 void ClassLoader::trace_class_path(const char* msg, const char* name) {
612 if (log_is_enabled(Info, class, path)) {
613 ResourceMark rm;
614 outputStream* out = Log(class, path)::info_stream();
615 if (msg) {
616 out->print("%s", msg);
617 }
618 if (name) {
619 if (strlen(name) < 256) {
620 out->print("%s", name);
621 } else {
622 // For very long paths, we need to print each character separately,
623 // as print_cr() has a length limit
624 while (name[0] != '\0') {
625 out->print("%c", name[0]);
626 name++;
627 }
628 }
629 }
630 out->cr();
631 }
632 }
633
634 #if INCLUDE_CDS
635 void ClassLoader::check_shared_classpath(const char *path) {
636 if (strcmp(path, "") == 0) {
637 exit_with_path_failure("Cannot have empty path in archived classpaths", NULL);
638 }
639
640 struct stat st;
641 if (os::stat(path, &st) == 0) {
642 if ((st.st_mode & S_IFMT) != S_IFREG) { // is not a regular file
643 if (!os::dir_is_empty(path)) {
644 tty->print_cr("Error: non-empty directory '%s'", path);
645 exit_with_path_failure("CDS allows only empty directories in archived classpaths", NULL);
646 }
647 }
648 }
649 }
650 #endif
|
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classFileStream.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/classLoaderData.inline.hpp"
29 #include "classfile/classLoaderExt.hpp"
30 #include "classfile/javaClasses.hpp"
31 #include "classfile/jimage.hpp"
32 #include "classfile/moduleEntry.hpp"
33 #include "classfile/modules.hpp"
34 #include "classfile/packageEntry.hpp"
35 #include "classfile/klassFactory.hpp"
36 #include "classfile/systemDictionary.hpp"
37 #include "classfile/vmSymbols.hpp"
38 #include "compiler/compileBroker.hpp"
39 #include "gc/shared/collectedHeap.inline.hpp"
40 #include "gc/shared/generation.hpp"
41 #include "interpreter/bytecodeStream.hpp"
42 #include "interpreter/oopMapCache.hpp"
43 #include "logging/log.hpp"
44 #include "logging/logStream.hpp"
45 #include "logging/logTag.hpp"
46 #include "memory/allocation.inline.hpp"
47 #include "memory/filemap.hpp"
48 #include "memory/oopFactory.hpp"
49 #include "memory/resourceArea.hpp"
50 #include "memory/universe.inline.hpp"
51 #include "oops/instanceKlass.hpp"
52 #include "oops/instanceRefKlass.hpp"
53 #include "oops/objArrayOop.inline.hpp"
54 #include "oops/oop.inline.hpp"
55 #include "oops/symbol.hpp"
56 #include "prims/jvm.h"
57 #include "prims/jvm_misc.hpp"
58 #include "runtime/arguments.hpp"
59 #include "runtime/compilationPolicy.hpp"
60 #include "runtime/fprofiler.hpp"
61 #include "runtime/handles.hpp"
62 #include "runtime/handles.inline.hpp"
63 #include "runtime/init.hpp"
64 #include "runtime/interfaceSupport.hpp"
594 ClassPathEntry* e = _module_first_entry;
595 while (e != NULL) {
596 ClassPathEntry* next_entry = e->next();
597 delete e;
598 e = next_entry;
599 }
600 }
601
602 void ModuleClassPathList::add_to_list(ClassPathEntry* new_entry) {
603 if (new_entry != NULL) {
604 if (_module_last_entry == NULL) {
605 _module_first_entry = _module_last_entry = new_entry;
606 } else {
607 _module_last_entry->set_next(new_entry);
608 _module_last_entry = new_entry;
609 }
610 }
611 }
612
613 void ClassLoader::trace_class_path(const char* msg, const char* name) {
614 LogTarget(Info, class, path) lt;
615 if (lt.is_enabled()) {
616 LogStream ls(lt);
617 if (msg) {
618 ls.print("%s", msg);
619 }
620 if (name) {
621 if (strlen(name) < 256) {
622 ls.print("%s", name);
623 } else {
624 // For very long paths, we need to print each character separately,
625 // as print_cr() has a length limit
626 while (name[0] != '\0') {
627 ls.print("%c", name[0]);
628 name++;
629 }
630 }
631 }
632 ls.cr();
633 }
634 }
635
636 #if INCLUDE_CDS
637 void ClassLoader::check_shared_classpath(const char *path) {
638 if (strcmp(path, "") == 0) {
639 exit_with_path_failure("Cannot have empty path in archived classpaths", NULL);
640 }
641
642 struct stat st;
643 if (os::stat(path, &st) == 0) {
644 if ((st.st_mode & S_IFMT) != S_IFREG) { // is not a regular file
645 if (!os::dir_is_empty(path)) {
646 tty->print_cr("Error: non-empty directory '%s'", path);
647 exit_with_path_failure("CDS allows only empty directories in archived classpaths", NULL);
648 }
649 }
650 }
651 }
652 #endif
|