author | simonis |
Tue, 19 Jun 2018 09:43:53 +0200 | |
changeset 50625 | d9753e3db0c6 |
parent 50039 | 9fec54fe663d |
child 51439 | 0517bd2a0eda |
permissions | -rw-r--r-- |
26135 | 1 |
/* |
49341 | 2 |
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
26135 | 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_CLASSLOADEREXT_HPP |
|
26 |
#define SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP |
|
27 |
||
28 |
#include "classfile/classLoader.hpp" |
|
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
29 |
#include "classfile/moduleEntry.hpp" |
48138 | 30 |
#include "utilities/macros.hpp" |
26135 | 31 |
|
50039
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
32 |
class ClassListParser; |
34257
4be3504cc03b
8140802: Clean up and refactor of class loading code for CDS
iklam
parents:
29199
diff
changeset
|
33 |
|
26135 | 34 |
class ClassLoaderExt: public ClassLoader { // AllStatic |
35 |
public: |
|
48138 | 36 |
enum SomeConstants { |
37 |
max_classpath_index = 0x7fff |
|
38 |
}; |
|
26135 | 39 |
|
48138 | 40 |
private: |
41 |
#if INCLUDE_CDS |
|
42 |
static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size); |
|
43 |
static void setup_app_search_path(); // Only when -Xshare:dump |
|
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
44 |
static void process_module_table(ModuleEntryTable* met, TRAPS); |
50039
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
45 |
static SharedPathsMiscInfo* shared_paths_misc_info() { |
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
46 |
return (SharedPathsMiscInfo*)_shared_paths_misc_info; |
48138 | 47 |
} |
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
48 |
// index of first app JAR in shared classpath entry table |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
49 |
static jshort _app_class_paths_start_index; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
50 |
// index of first modular JAR in shared modulepath entry table |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
51 |
static jshort _app_module_paths_start_index; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
52 |
|
48138 | 53 |
static bool _has_app_classes; |
54 |
static bool _has_platform_classes; |
|
55 |
#endif |
|
56 |
||
57 |
public: |
|
58 |
CDS_ONLY(static void process_jar_manifest(ClassPathEntry* entry, bool check_for_duplicates);) |
|
59 |
||
50039
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
60 |
static bool should_verify(int classpath_index) { |
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
61 |
CDS_ONLY(return (classpath_index >= _app_class_paths_start_index);) |
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
62 |
NOT_CDS(return false;) |
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
63 |
} |
48138 | 64 |
// Called by JVMTI code to add boot classpath |
49931 | 65 |
static void append_boot_classpath(ClassPathEntry* new_entry); |
48138 | 66 |
|
67 |
static void setup_search_paths() NOT_CDS_RETURN; |
|
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
68 |
static void setup_module_paths(TRAPS) NOT_CDS_RETURN; |
48138 | 69 |
|
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46329
diff
changeset
|
70 |
#if INCLUDE_CDS |
48138 | 71 |
private: |
72 |
static char* read_manifest(ClassPathEntry* entry, jint *manifest_size, bool clean_text, TRAPS); |
|
73 |
static ClassPathEntry* find_classpath_entry_from_cache(const char* path, TRAPS); |
|
74 |
||
75 |
public: |
|
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46329
diff
changeset
|
76 |
static char* read_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { |
48138 | 77 |
// Remove all the new-line continuations (which wrap long lines at 72 characters, see |
78 |
// http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest), so |
|
79 |
// that the manifest is easier to parse. |
|
80 |
return read_manifest(entry, manifest_size, true, THREAD); |
|
81 |
} |
|
82 |
static char* read_raw_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { |
|
83 |
// Do not remove new-line continuations, so we can easily pass it as an argument to |
|
84 |
// java.util.jar.Manifest.getManifest() at run-time. |
|
85 |
return read_manifest(entry, manifest_size, false, THREAD); |
|
86 |
} |
|
87 |
||
88 |
static void finalize_shared_paths_misc_info(); |
|
89 |
||
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
90 |
static jshort app_class_paths_start_index() { return _app_class_paths_start_index; } |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
91 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
92 |
static jshort app_module_paths_start_index() { return _app_module_paths_start_index; } |
48138 | 93 |
|
94 |
static void init_paths_start_index(jshort app_start) { |
|
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
95 |
_app_class_paths_start_index = app_start; |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
96 |
} |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
97 |
|
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
98 |
static void init_app_module_paths_start_index(jshort module_start) { |
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
99 |
_app_module_paths_start_index = module_start; |
48138 | 100 |
} |
101 |
||
102 |
static bool is_boot_classpath(int classpath_index) { |
|
49739
00805b129186
8194812: Extend class-data sharing to support the module path
ccheung
parents:
49341
diff
changeset
|
103 |
return classpath_index < _app_class_paths_start_index; |
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46329
diff
changeset
|
104 |
} |
48138 | 105 |
|
106 |
static bool has_platform_or_app_classes() { |
|
107 |
return _has_app_classes || _has_platform_classes; |
|
108 |
} |
|
109 |
||
50039
9fec54fe663d
8197954: Remove unnecessary intermediary APIs from AppCDS implementation
iklam
parents:
49931
diff
changeset
|
110 |
static void record_result(const s2 classpath_index, |
48138 | 111 |
InstanceKlass* result, TRAPS); |
112 |
static InstanceKlass* load_class(Symbol* h_name, const char* path, TRAPS); |
|
113 |
static Klass* load_one_class(ClassListParser* parser, TRAPS); |
|
114 |
static void set_has_app_classes() { |
|
115 |
_has_app_classes = true; |
|
116 |
} |
|
117 |
static void set_has_platform_classes() { |
|
118 |
_has_platform_classes = true; |
|
119 |
} |
|
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46329
diff
changeset
|
120 |
#endif |
26135 | 121 |
}; |
122 |
||
123 |
#endif // SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP |