1 /* 2 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 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 #ifndef SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP 26 #define SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP 27 28 #include "classfile/sharedPathsMiscInfo.hpp" 29 #include "memory/filemap.hpp" 30 #include "classfile/classLoaderExt.hpp" 31 #include "classfile/dictionary.hpp" 32 #include "classfile/systemDictionaryShared.hpp" 33 #include "oops/klass.hpp" 34 35 class FileMapHeaderExt: public FileMapInfo::FileMapHeader { 36 public: 37 jshort _app_paths_start_index; // Index of first app classpath entry 38 bool _verify_local; // BytecodeVerificationLocal setting 39 bool _verify_remote; // BytecodeVerificationRemote setting 40 bool _has_platform_or_app_classes; // Archive contains app classes 41 42 FileMapHeaderExt() { 43 _has_platform_or_app_classes = true; 44 } 45 virtual void populate(FileMapInfo* mapinfo, size_t alignment); 46 virtual bool validate(); 47 }; 48 49 // In addition to SharedPathsMiscInfo, the following information is also stored 50 // 51 // 52 // + The value of Arguments::get_appclasspath() used during dumping. 53 // 54 class SharedPathsMiscInfoExt : public SharedPathsMiscInfo { 55 private: 56 int _app_offset; 57 public: 58 enum { 59 APP = 5 60 }; 61 62 virtual const char* type_name(int type) { 63 switch (type) { 64 case APP: return "APP"; 65 default: return SharedPathsMiscInfo::type_name(type); 66 } 67 } 68 69 virtual void print_path(outputStream* out, int type, const char* path); 70 71 SharedPathsMiscInfoExt() : SharedPathsMiscInfo() { 72 _app_offset = 0; 73 } 74 SharedPathsMiscInfoExt(char* buf, int size) : SharedPathsMiscInfo(buf, size) { 75 _app_offset = 0; 76 } 77 78 virtual bool check(jint type, const char* path); 79 80 void add_app_classpath(const char* path) { 81 add_path(path, APP); 82 } 83 84 void record_app_offset() { | 1 /* 2 * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 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 #ifndef SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP 26 #define SHARE_VM_CLASSFILE_SHAREDCLASSUTIL_HPP 27 28 #include "classfile/sharedPathsMiscInfo.hpp" 29 #include "memory/filemap.hpp" 30 #include "classfile/classLoaderExt.hpp" 31 #include "classfile/dictionary.hpp" 32 #include "classfile/systemDictionaryShared.hpp" 33 #include "oops/klass.hpp" 34 35 class FileMapHeaderExt: public FileMapInfo::FileMapHeader { 36 public: 37 jshort _app_class_paths_start_index; // Index of first app classpath entry 38 jshort _app_module_paths_start_index; // Index of first module path entry 39 bool _verify_local; // BytecodeVerificationLocal setting 40 bool _verify_remote; // BytecodeVerificationRemote setting 41 bool _has_platform_or_app_classes; // Archive contains app classes 42 43 FileMapHeaderExt() { 44 _has_platform_or_app_classes = true; 45 } 46 virtual void populate(FileMapInfo* mapinfo, size_t alignment); 47 virtual bool validate(); 48 }; 49 50 // In addition to SharedPathsMiscInfo, the following information is also stored 51 // 52 // 53 // + The value of Arguments::get_appclasspath() used during dumping. 54 // 55 class SharedPathsMiscInfoExt : public SharedPathsMiscInfo { 56 private: 57 int _app_offset; 58 public: 59 enum { 60 APP = 5, 61 MODULE = 6 62 }; 63 64 virtual const char* type_name(int type) { 65 switch (type) { 66 case APP: return "APP"; 67 case MODULE: return "MODULE"; 68 default: return SharedPathsMiscInfo::type_name(type); 69 } 70 } 71 72 virtual void print_path(outputStream* out, int type, const char* path); 73 74 SharedPathsMiscInfoExt() : SharedPathsMiscInfo() { 75 _app_offset = 0; 76 } 77 SharedPathsMiscInfoExt(char* buf, int size) : SharedPathsMiscInfo(buf, size) { 78 _app_offset = 0; 79 } 80 81 virtual bool check(jint type, const char* path); 82 83 void add_app_classpath(const char* path) { 84 add_path(path, APP); 85 } 86 87 void record_app_offset() { |