1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, 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. |
61 virtual bool is_lazy(); |
61 virtual bool is_lazy(); |
62 // Constructor |
62 // Constructor |
63 ClassPathEntry(); |
63 ClassPathEntry(); |
64 // Attempt to locate file_name through this class path entry. |
64 // Attempt to locate file_name through this class path entry. |
65 // Returns a class file parsing stream if successfull. |
65 // Returns a class file parsing stream if successfull. |
66 virtual ClassFileStream* open_stream(const char* name) = 0; |
66 virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0; |
67 // Debugging |
67 // Debugging |
68 NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;) |
68 NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;) |
69 NOT_PRODUCT(virtual bool is_rt_jar() = 0;) |
69 NOT_PRODUCT(virtual bool is_rt_jar() = 0;) |
70 }; |
70 }; |
71 |
71 |
75 char* _dir; // Name of directory |
75 char* _dir; // Name of directory |
76 public: |
76 public: |
77 bool is_jar_file() { return false; } |
77 bool is_jar_file() { return false; } |
78 const char* name() { return _dir; } |
78 const char* name() { return _dir; } |
79 ClassPathDirEntry(char* dir); |
79 ClassPathDirEntry(char* dir); |
80 ClassFileStream* open_stream(const char* name); |
80 ClassFileStream* open_stream(const char* name, TRAPS); |
81 // Debugging |
81 // Debugging |
82 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
82 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
83 NOT_PRODUCT(bool is_rt_jar();) |
83 NOT_PRODUCT(bool is_rt_jar();) |
84 }; |
84 }; |
85 |
85 |
105 public: |
105 public: |
106 bool is_jar_file() { return true; } |
106 bool is_jar_file() { return true; } |
107 const char* name() { return _zip_name; } |
107 const char* name() { return _zip_name; } |
108 ClassPathZipEntry(jzfile* zip, const char* zip_name); |
108 ClassPathZipEntry(jzfile* zip, const char* zip_name); |
109 ~ClassPathZipEntry(); |
109 ~ClassPathZipEntry(); |
110 ClassFileStream* open_stream(const char* name); |
110 ClassFileStream* open_stream(const char* name, TRAPS); |
111 void contents_do(void f(const char* name, void* context), void* context); |
111 void contents_do(void f(const char* name, void* context), void* context); |
112 // Debugging |
112 // Debugging |
113 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
113 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
114 NOT_PRODUCT(void compile_the_world12(Handle loader, TRAPS);) // JDK 1.2 version |
114 NOT_PRODUCT(void compile_the_world12(Handle loader, TRAPS);) // JDK 1.2 version |
115 NOT_PRODUCT(void compile_the_world13(Handle loader, TRAPS);) // JDK 1.3 version |
115 NOT_PRODUCT(void compile_the_world13(Handle loader, TRAPS);) // JDK 1.3 version |
123 class LazyClassPathEntry: public ClassPathEntry { |
123 class LazyClassPathEntry: public ClassPathEntry { |
124 private: |
124 private: |
125 char* _path; // dir or file |
125 char* _path; // dir or file |
126 struct stat _st; |
126 struct stat _st; |
127 MetaIndex* _meta_index; |
127 MetaIndex* _meta_index; |
|
128 bool _has_error; |
128 volatile ClassPathEntry* _resolved_entry; |
129 volatile ClassPathEntry* _resolved_entry; |
129 ClassPathEntry* resolve_entry(); |
130 ClassPathEntry* resolve_entry(TRAPS); |
130 public: |
131 public: |
131 bool is_jar_file(); |
132 bool is_jar_file(); |
132 const char* name() { return _path; } |
133 const char* name() { return _path; } |
133 LazyClassPathEntry(char* path, struct stat st); |
134 LazyClassPathEntry(char* path, const struct stat* st); |
134 ClassFileStream* open_stream(const char* name); |
135 ClassFileStream* open_stream(const char* name, TRAPS); |
135 void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } |
136 void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } |
136 virtual bool is_lazy(); |
137 virtual bool is_lazy(); |
137 // Debugging |
138 // Debugging |
138 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
139 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
139 NOT_PRODUCT(bool is_rt_jar();) |
140 NOT_PRODUCT(bool is_rt_jar();) |
205 |
206 |
206 // Initialization |
207 // Initialization |
207 static void setup_meta_index(); |
208 static void setup_meta_index(); |
208 static void setup_bootstrap_search_path(); |
209 static void setup_bootstrap_search_path(); |
209 static void load_zip_library(); |
210 static void load_zip_library(); |
210 static void create_class_path_entry(char *path, struct stat st, ClassPathEntry **new_entry, bool lazy); |
211 static ClassPathEntry* create_class_path_entry(char *path, const struct stat* st, |
|
212 bool lazy, TRAPS); |
211 |
213 |
212 // Canonicalizes path names, so strcmp will work properly. This is mainly |
214 // Canonicalizes path names, so strcmp will work properly. This is mainly |
213 // to avoid confusing the zip library |
215 // to avoid confusing the zip library |
214 static bool get_canonical_path(char* orig, char* out, int len); |
216 static bool get_canonical_path(char* orig, char* out, int len); |
215 public: |
217 public: |
216 // Used by the kernel jvm. |
218 // Used by the kernel jvm. |
217 static void update_class_path_entry_list(const char *path, |
219 static void update_class_path_entry_list(char *path, |
218 bool check_for_duplicates); |
220 bool check_for_duplicates); |
219 static void print_bootclasspath(); |
221 static void print_bootclasspath(); |
220 |
222 |
221 // Timing |
223 // Timing |
222 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; } |
224 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; } |