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/classLoader.hpp"
27 #include "classfile/compactHashtable.inline.hpp"
28 #include "classfile/sharedClassUtil.hpp"
29 #include "classfile/symbolTable.hpp"
30 #include "classfile/systemDictionaryShared.hpp"
31 #include "classfile/altHashing.hpp"
32 #if INCLUDE_ALL_GCS
33 #include "gc/g1/g1CollectedHeap.hpp"
34 #endif
35 #include "logging/log.hpp"
36 #include "logging/logMessage.hpp"
37 #include "memory/filemap.hpp"
38 #include "memory/metadataFactory.hpp"
39 #include "memory/oopFactory.hpp"
40 #include "oops/objArrayOop.hpp"
41 #include "prims/jvm.h"
42 #include "prims/jvmtiExport.hpp"
43 #include "runtime/arguments.hpp"
44 #include "runtime/java.hpp"
45 #include "runtime/os.hpp"
46 #include "runtime/vm_version.hpp"
47 #include "services/memTracker.hpp"
48 #include "utilities/defaultStream.hpp"
49
50 # include <sys/stat.h>
51 # include <errno.h>
52
53 #ifndef O_BINARY // if defined (Win32) use binary files.
54 #define O_BINARY 0 // otherwise do nothing.
55 #endif
86 //
87 // If we continue, then disable shared spaces and close the file.
88
89 void FileMapInfo::fail_continue(const char *msg, ...) {
90 va_list ap;
91 va_start(ap, msg);
92 MetaspaceShared::set_archive_loading_failed();
93 if (PrintSharedArchiveAndExit && _validating_classpath_entry_table) {
94 // If we are doing PrintSharedArchiveAndExit and some of the classpath entries
95 // do not validate, we can still continue "limping" to validate the remaining
96 // entries. No need to quit.
97 tty->print("[");
98 tty->vprint(msg, ap);
99 tty->print_cr("]");
100 } else {
101 if (RequireSharedSpaces) {
102 fail(msg, ap);
103 } else {
104 if (log_is_enabled(Info, cds)) {
105 ResourceMark rm;
106 outputStream* logstream = Log(cds)::info_stream();
107 logstream->print("UseSharedSpaces: ");
108 logstream->vprint_cr(msg, ap);
109 }
110 }
111 UseSharedSpaces = false;
112 assert(current_info() != NULL, "singleton must be registered");
113 current_info()->close();
114 }
115 va_end(ap);
116 }
117
118 // Fill in the fileMapInfo structure with data about this VM instance.
119
120 // This method copies the vm version info into header_version. If the version is too
121 // long then a truncated version, which has a hash code appended to it, is copied.
122 //
123 // Using a template enables this method to verify that header_version is an array of
124 // length JVM_IDENT_MAX. This ensures that the code that writes to the CDS file and
125 // the code that reads the CDS file will both use the same size buffer. Hence, will
126 // use identical truncation. This is necessary for matching of truncated versions.
127 template <int N> static void get_header_version(char (&header_version) [N]) {
128 assert(N == JVM_IDENT_MAX, "Bad header_version size");
|
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/classLoader.hpp"
27 #include "classfile/compactHashtable.inline.hpp"
28 #include "classfile/sharedClassUtil.hpp"
29 #include "classfile/symbolTable.hpp"
30 #include "classfile/systemDictionaryShared.hpp"
31 #include "classfile/altHashing.hpp"
32 #if INCLUDE_ALL_GCS
33 #include "gc/g1/g1CollectedHeap.hpp"
34 #endif
35 #include "logging/log.hpp"
36 #include "logging/logStream.hpp"
37 #include "logging/logMessage.hpp"
38 #include "memory/filemap.hpp"
39 #include "memory/metadataFactory.hpp"
40 #include "memory/oopFactory.hpp"
41 #include "oops/objArrayOop.hpp"
42 #include "prims/jvm.h"
43 #include "prims/jvmtiExport.hpp"
44 #include "runtime/arguments.hpp"
45 #include "runtime/java.hpp"
46 #include "runtime/os.hpp"
47 #include "runtime/vm_version.hpp"
48 #include "services/memTracker.hpp"
49 #include "utilities/defaultStream.hpp"
50
51 # include <sys/stat.h>
52 # include <errno.h>
53
54 #ifndef O_BINARY // if defined (Win32) use binary files.
55 #define O_BINARY 0 // otherwise do nothing.
56 #endif
87 //
88 // If we continue, then disable shared spaces and close the file.
89
90 void FileMapInfo::fail_continue(const char *msg, ...) {
91 va_list ap;
92 va_start(ap, msg);
93 MetaspaceShared::set_archive_loading_failed();
94 if (PrintSharedArchiveAndExit && _validating_classpath_entry_table) {
95 // If we are doing PrintSharedArchiveAndExit and some of the classpath entries
96 // do not validate, we can still continue "limping" to validate the remaining
97 // entries. No need to quit.
98 tty->print("[");
99 tty->vprint(msg, ap);
100 tty->print_cr("]");
101 } else {
102 if (RequireSharedSpaces) {
103 fail(msg, ap);
104 } else {
105 if (log_is_enabled(Info, cds)) {
106 ResourceMark rm;
107 LogStream ls(Log(cds)::info());
108 ls.print("UseSharedSpaces: ");
109 ls.vprint_cr(msg, ap);
110 }
111 }
112 UseSharedSpaces = false;
113 assert(current_info() != NULL, "singleton must be registered");
114 current_info()->close();
115 }
116 va_end(ap);
117 }
118
119 // Fill in the fileMapInfo structure with data about this VM instance.
120
121 // This method copies the vm version info into header_version. If the version is too
122 // long then a truncated version, which has a hash code appended to it, is copied.
123 //
124 // Using a template enables this method to verify that header_version is an array of
125 // length JVM_IDENT_MAX. This ensures that the code that writes to the CDS file and
126 // the code that reads the CDS file will both use the same size buffer. Hence, will
127 // use identical truncation. This is necessary for matching of truncated versions.
128 template <int N> static void get_header_version(char (&header_version) [N]) {
129 assert(N == JVM_IDENT_MAX, "Bad header_version size");
|