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_CLASSFILE_CLASSLOADER_HPP
26 #define SHARE_CLASSFILE_CLASSLOADER_HPP
27
28 #include "jimage.hpp"
29 #include "runtime/handles.hpp"
30 #include "runtime/perfData.hpp"
31 #include "utilities/exceptions.hpp"
32 #include "utilities/macros.hpp"
33
34 // The VM class loader.
35 #include <sys/stat.h>
36
37 // Name of boot "modules" image
38 #define MODULES_IMAGE_NAME "modules"
39
40 // Class path entry (directory or zip file)
41
42 class JImageFile;
43 class ClassFileStream;
44 class PackageEntry;
45 template <typename T> class GrowableArray;
46
47 class ClassPathEntry : public CHeapObj<mtClass> {
48 private:
378 static ClassPathEntry* classpath_entry(int n);
379
380 static bool is_in_patch_mod_entries(Symbol* module_name);
381
382 #if INCLUDE_CDS
383 // Sharing dump and restore
384
385 // Helper function used by CDS code to get the number of boot classpath
386 // entries during shared classpath setup time.
387 static int num_boot_classpath_entries();
388
389 static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
390
391 // Helper function used by CDS code to get the number of app classpath
392 // entries during shared classpath setup time.
393 static int num_app_classpath_entries();
394
395 // Helper function used by CDS code to get the number of module path
396 // entries during shared classpath setup time.
397 static int num_module_path_entries() {
398 assert(DumpSharedSpaces || DynamicDumpSharedSpaces,
399 "Should only be called at CDS dump time");
400 int num_entries = 0;
401 ClassPathEntry* e= ClassLoader::_module_path_entries;
402 while (e != NULL) {
403 num_entries ++;
404 e = e->next();
405 }
406 return num_entries;
407 }
408 static void exit_with_path_failure(const char* error, const char* message);
409 static char* skip_uri_protocol(char* source);
410 static void record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS);
411 #endif
412 static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
413 const char* file_name, jlong &size);
414
415 static void trace_class_path(const char* msg, const char* name = NULL);
416
417 // VM monitoring and management support
418 static jlong classloader_time_ms();
419 static jlong class_method_total_size();
|
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_CLASSFILE_CLASSLOADER_HPP
26 #define SHARE_CLASSFILE_CLASSLOADER_HPP
27
28 #include "jimage.hpp"
29 #include "runtime/arguments.hpp"
30 #include "runtime/handles.hpp"
31 #include "runtime/perfData.hpp"
32 #include "utilities/exceptions.hpp"
33 #include "utilities/macros.hpp"
34
35 // The VM class loader.
36 #include <sys/stat.h>
37
38 // Name of boot "modules" image
39 #define MODULES_IMAGE_NAME "modules"
40
41 // Class path entry (directory or zip file)
42
43 class JImageFile;
44 class ClassFileStream;
45 class PackageEntry;
46 template <typename T> class GrowableArray;
47
48 class ClassPathEntry : public CHeapObj<mtClass> {
49 private:
379 static ClassPathEntry* classpath_entry(int n);
380
381 static bool is_in_patch_mod_entries(Symbol* module_name);
382
383 #if INCLUDE_CDS
384 // Sharing dump and restore
385
386 // Helper function used by CDS code to get the number of boot classpath
387 // entries during shared classpath setup time.
388 static int num_boot_classpath_entries();
389
390 static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
391
392 // Helper function used by CDS code to get the number of app classpath
393 // entries during shared classpath setup time.
394 static int num_app_classpath_entries();
395
396 // Helper function used by CDS code to get the number of module path
397 // entries during shared classpath setup time.
398 static int num_module_path_entries() {
399 Arguments::assert_is_dumping_archive();
400 int num_entries = 0;
401 ClassPathEntry* e= ClassLoader::_module_path_entries;
402 while (e != NULL) {
403 num_entries ++;
404 e = e->next();
405 }
406 return num_entries;
407 }
408 static void exit_with_path_failure(const char* error, const char* message);
409 static char* skip_uri_protocol(char* source);
410 static void record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS);
411 #endif
412 static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
413 const char* file_name, jlong &size);
414
415 static void trace_class_path(const char* msg, const char* name = NULL);
416
417 // VM monitoring and management support
418 static jlong classloader_time_ms();
419 static jlong class_method_total_size();
|