equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
31 |
31 |
32 // The VM class loader. |
32 // The VM class loader. |
33 #include <sys/stat.h> |
33 #include <sys/stat.h> |
34 |
34 |
35 |
35 |
36 // Meta-index (optional, to be able to skip opening boot classpath jar files) |
|
37 class MetaIndex: public CHeapObj<mtClass> { |
|
38 private: |
|
39 char** _meta_package_names; |
|
40 int _num_meta_package_names; |
|
41 public: |
|
42 MetaIndex(char** meta_package_names, int num_meta_package_names); |
|
43 ~MetaIndex(); |
|
44 bool may_contain(const char* class_name); |
|
45 }; |
|
46 |
|
47 |
|
48 // Class path entry (directory or zip file) |
36 // Class path entry (directory or zip file) |
49 |
37 |
50 class ClassPathEntry: public CHeapObj<mtClass> { |
38 class ClassPathEntry: public CHeapObj<mtClass> { |
51 private: |
39 private: |
52 ClassPathEntry* _next; |
40 ClassPathEntry* _next; |
120 // For lazier loading of boot class path entries |
108 // For lazier loading of boot class path entries |
121 class LazyClassPathEntry: public ClassPathEntry { |
109 class LazyClassPathEntry: public ClassPathEntry { |
122 private: |
110 private: |
123 const char* _path; // dir or file |
111 const char* _path; // dir or file |
124 struct stat _st; |
112 struct stat _st; |
125 MetaIndex* _meta_index; |
|
126 bool _has_error; |
113 bool _has_error; |
127 bool _throw_exception; |
114 bool _throw_exception; |
128 volatile ClassPathEntry* _resolved_entry; |
115 volatile ClassPathEntry* _resolved_entry; |
129 ClassPathEntry* resolve_entry(TRAPS); |
116 ClassPathEntry* resolve_entry(TRAPS); |
130 public: |
117 public: |
133 LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception); |
120 LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception); |
134 virtual ~LazyClassPathEntry(); |
121 virtual ~LazyClassPathEntry(); |
135 u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); |
122 u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); |
136 |
123 |
137 ClassFileStream* open_stream(const char* name, TRAPS); |
124 ClassFileStream* open_stream(const char* name, TRAPS); |
138 void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } |
|
139 virtual bool is_lazy(); |
125 virtual bool is_lazy(); |
140 // Debugging |
126 // Debugging |
141 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
127 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
142 NOT_PRODUCT(bool is_jrt();) |
128 NOT_PRODUCT(bool is_jrt();) |
143 }; |
129 }; |
229 // Adds a new package entry for the specified class or package name and |
215 // Adds a new package entry for the specified class or package name and |
230 // corresponding directory or jar file name. |
216 // corresponding directory or jar file name. |
231 static bool add_package(const char *pkgname, int classpath_index, TRAPS); |
217 static bool add_package(const char *pkgname, int classpath_index, TRAPS); |
232 |
218 |
233 // Initialization |
219 // Initialization |
234 static void setup_bootstrap_meta_index(); |
|
235 static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir, |
|
236 int start_index); |
|
237 static void setup_bootstrap_search_path(); |
220 static void setup_bootstrap_search_path(); |
238 static void setup_search_path(const char *class_path); |
221 static void setup_search_path(const char *class_path); |
239 |
222 |
240 static void load_zip_library(); |
223 static void load_zip_library(); |
241 static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st, |
224 static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st, |