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_CLASSFILE_MODULES_HPP
26 #define SHARE_CLASSFILE_MODULES_HPP
27
28 #include "memory/allStatic.hpp"
29 #include "runtime/handles.hpp"
30
31 class ModuleEntryTable;
32 class Symbol;
33
34 class Modules : AllStatic {
35 static void check_cds_restrictions(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
36
37 public:
38 // define_module defines a module containing the specified packages. It binds the
39 // module to its class loader by creating the ModuleEntry record in the
40 // ClassLoader's ModuleEntry table, and creates PackageEntry records in the class
41 // loader's PackageEntry table. The jstring for all package names will convert "."
42 // to "/"
43 //
44 // IllegalArgumentExceptions are thrown for the following :
45 // * Module's Class loader is not a subclass of java.lang.ClassLoader
46 // * Module's Class loader already has a module with that name
47 // * Module's Class loader has already defined types for any of the module's packages
48 // * Module_name is syntactically bad
49 // * Packages contains an illegal package name or a non-String object
50 // * A package already exists in another module for this class loader
51 // * Module is an unnamed module
52 // NullPointerExceptions are thrown if module is null.
53 static void define_module(Handle module, jboolean is_open, jstring version,
54 jstring location, jobjectArray packages, TRAPS);
55
56 static bool check_archived_module_oop(oop orig_module_obj) NOT_CDS_JAVA_HEAP_RETURN_(false);
57 static void update_oops_in_archived_module(oop orig_module_obj, int archived_module_root_index)
58 NOT_CDS_JAVA_HEAP_RETURN;
59 static void define_archived_modules(Handle h_platform_loader, Handle h_system_loader,
60 TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
61 static void verify_archived_modules() NOT_CDS_JAVA_HEAP_RETURN;
62 static void dump_main_module_name() NOT_CDS_JAVA_HEAP_RETURN;
63 static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
64 static void dump_addmods_names() NOT_CDS_JAVA_HEAP_RETURN;
65 static void serialize_addmods_names(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
66 static const char* get_addmods_names_as_sorted_string() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
67
68 #if INCLUDE_CDS_JAVA_HEAP
69 static char* _archived_main_module_name;
70 static char* _archived_addmods_names;
71 #endif
72
73 // Provides the java.lang.Module for the unnamed module defined
74 // to the boot loader.
75 //
76 // IllegalArgumentExceptions are thrown for the following :
77 // * Module has a name
78 // * Module is not a subclass of java.lang.Module
79 // * Module's class loader is not the boot loader
80 // NullPointerExceptions are thrown if module is null.
81 static void set_bootloader_unnamed_module(Handle module, TRAPS);
82
83 // This either does a qualified export of package in module from_module to module
|
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_CLASSFILE_MODULES_HPP
26 #define SHARE_CLASSFILE_MODULES_HPP
27
28 #include "memory/allStatic.hpp"
29 #include "runtime/handles.hpp"
30
31 class ModuleEntryTable;
32 class Symbol;
33
34 class Modules : AllStatic {
35 static void check_cds_restrictions(Handle module1, Handle module2, TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
36
37 public:
38 // define_module defines a module containing the specified packages. It binds the
39 // module to its class loader by creating the ModuleEntry record in the
40 // ClassLoader's ModuleEntry table, and creates PackageEntry records in the class
41 // loader's PackageEntry table. The jstring for all package names will convert "."
42 // to "/"
43 //
44 // IllegalArgumentExceptions are thrown for the following :
45 // * Module's Class loader is not a subclass of java.lang.ClassLoader
46 // * Module's Class loader already has a module with that name
47 // * Module's Class loader has already defined types for any of the module's packages
48 // * Module_name is syntactically bad
49 // * Packages contains an illegal package name or a non-String object
50 // * A package already exists in another module for this class loader
51 // * Module is an unnamed module
52 // NullPointerExceptions are thrown if module is null.
53 static void define_module(Handle module, jboolean is_open, jstring version,
54 jstring location, jobjectArray packages, TRAPS);
55
56 static bool check_archived_module_oop(oop orig_module_obj) NOT_CDS_JAVA_HEAP_RETURN_(false);
57 static void update_oops_in_archived_module(oop orig_module_obj, int archived_module_root_index)
58 NOT_CDS_JAVA_HEAP_RETURN;
59 static void define_archived_modules(Handle h_platform_loader, Handle h_system_loader,
60 TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
61 static void verify_archived_modules() NOT_CDS_JAVA_HEAP_RETURN;
62 static void dump_main_module_name() NOT_CDS_JAVA_HEAP_RETURN;
63 static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
64
65 static bool is_dynamic_proxy_module(Handle module);
66 static bool is_dynamic_proxy_module(ModuleEntry* module_entry);
67
68 static void dump_addmods_names() NOT_CDS_JAVA_HEAP_RETURN;
69 static void serialize_addmods_names(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
70 static const char* get_addmods_names_as_sorted_string() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
71
72 #if INCLUDE_CDS_JAVA_HEAP
73 static char* _archived_main_module_name;
74 static char* _archived_addmods_names;
75 #endif
76
77 // Provides the java.lang.Module for the unnamed module defined
78 // to the boot loader.
79 //
80 // IllegalArgumentExceptions are thrown for the following :
81 // * Module has a name
82 // * Module is not a subclass of java.lang.Module
83 // * Module's class loader is not the boot loader
84 // NullPointerExceptions are thrown if module is null.
85 static void set_bootloader_unnamed_module(Handle module, TRAPS);
86
87 // This either does a qualified export of package in module from_module to module
|