mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 22:04:51 +02:00
8073423: Remove LazyClassPathEntry support if no longer needed
Remove LazyClassPathEntry support and deprecate -XX:+LazyBootClassLoader Reviewed-by: acorn, lfoltan
This commit is contained in:
parent
1a534420a8
commit
28effe7632
4 changed files with 29 additions and 150 deletions
|
@ -156,10 +156,6 @@ ClassPathEntry::ClassPathEntry() {
|
|||
}
|
||||
|
||||
|
||||
bool ClassPathEntry::is_lazy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
ClassPathDirEntry::ClassPathDirEntry(const char* dir) : ClassPathEntry() {
|
||||
char* copy = NEW_C_HEAP_ARRAY(char, strlen(dir)+1, mtClass);
|
||||
strcpy(copy, dir);
|
||||
|
@ -276,80 +272,6 @@ void ClassPathZipEntry::contents_do(void f(const char* name, void* context), voi
|
|||
}
|
||||
}
|
||||
|
||||
LazyClassPathEntry::LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception) : ClassPathEntry() {
|
||||
_path = os::strdup_check_oom(path);
|
||||
_st = *st;
|
||||
_resolved_entry = NULL;
|
||||
_has_error = false;
|
||||
_throw_exception = throw_exception;
|
||||
}
|
||||
|
||||
LazyClassPathEntry::~LazyClassPathEntry() {
|
||||
os::free((void*)_path);
|
||||
}
|
||||
|
||||
bool LazyClassPathEntry::is_jar_file() {
|
||||
size_t len = strlen(_path);
|
||||
if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
|
||||
return ((_st.st_mode & S_IFREG) == S_IFREG);
|
||||
}
|
||||
|
||||
ClassPathEntry* LazyClassPathEntry::resolve_entry(TRAPS) {
|
||||
if (_resolved_entry != NULL) {
|
||||
return (ClassPathEntry*) _resolved_entry;
|
||||
}
|
||||
ClassPathEntry* new_entry = NULL;
|
||||
new_entry = ClassLoader::create_class_path_entry(_path, &_st, false, _throw_exception, CHECK_NULL);
|
||||
if (!_throw_exception && new_entry == NULL) {
|
||||
assert(!HAS_PENDING_EXCEPTION, "must be");
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
ThreadCritical tc;
|
||||
if (_resolved_entry == NULL) {
|
||||
_resolved_entry = new_entry;
|
||||
return new_entry;
|
||||
}
|
||||
}
|
||||
assert(_resolved_entry != NULL, "bug in MT-safe resolution logic");
|
||||
delete new_entry;
|
||||
return (ClassPathEntry*) _resolved_entry;
|
||||
}
|
||||
|
||||
ClassFileStream* LazyClassPathEntry::open_stream(const char* name, TRAPS) {
|
||||
if (_has_error) {
|
||||
return NULL;
|
||||
}
|
||||
ClassPathEntry* cpe = resolve_entry(THREAD);
|
||||
if (cpe == NULL) {
|
||||
_has_error = true;
|
||||
return NULL;
|
||||
} else {
|
||||
return cpe->open_stream(name, THREAD);
|
||||
}
|
||||
}
|
||||
|
||||
bool LazyClassPathEntry::is_lazy() {
|
||||
return true;
|
||||
}
|
||||
|
||||
u1* LazyClassPathEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) {
|
||||
if (_has_error) {
|
||||
return NULL;
|
||||
}
|
||||
ClassPathEntry* cpe = resolve_entry(THREAD);
|
||||
if (cpe == NULL) {
|
||||
_has_error = true;
|
||||
return NULL;
|
||||
} else if (cpe->is_jar_file()) {
|
||||
return ((ClassPathZipEntry*)cpe)->open_entry(name, filesize, nul_terminate,THREAD);
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
*filesize = 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ClassPathImageEntry::ClassPathImageEntry(ImageFileReader* image) :
|
||||
ClassPathEntry(),
|
||||
_image(image),
|
||||
|
@ -564,11 +486,8 @@ void ClassLoader::setup_search_path(const char *class_path) {
|
|||
}
|
||||
|
||||
ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const struct stat* st,
|
||||
bool lazy, bool throw_exception, TRAPS) {
|
||||
bool throw_exception, TRAPS) {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
if (lazy) {
|
||||
return new LazyClassPathEntry(path, st, throw_exception);
|
||||
}
|
||||
ClassPathEntry* new_entry = NULL;
|
||||
if ((st->st_mode & S_IFREG) == S_IFREG) {
|
||||
// Regular file, should be a zip or image file
|
||||
|
@ -607,7 +526,8 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
|
|||
msg = NEW_RESOURCE_ARRAY(char, len); ;
|
||||
jio_snprintf(msg, len - 1, "error in opening JAR file <%s> %s", error_msg, path);
|
||||
}
|
||||
if (throw_exception) {
|
||||
// Don't complain about bad jar files added via -Xbootclasspath/a:.
|
||||
if (throw_exception && is_init_completed()) {
|
||||
THROW_MSG_(vmSymbols::java_lang_ClassNotFoundException(), msg, NULL);
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -690,7 +610,7 @@ bool ClassLoader::update_class_path_entry_list(const char *path,
|
|||
// File or directory found
|
||||
ClassPathEntry* new_entry = NULL;
|
||||
Thread* THREAD = Thread::current();
|
||||
new_entry = create_class_path_entry(path, &st, LazyBootClassLoader, throw_exception, CHECK_(false));
|
||||
new_entry = create_class_path_entry(path, &st, throw_exception, CHECK_(false));
|
||||
if (new_entry == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1343,19 +1263,6 @@ bool ClassPathZipEntry::is_jrt() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
|
||||
ClassPathEntry* cpe = resolve_entry(THREAD);
|
||||
if (cpe != NULL) {
|
||||
cpe->compile_the_world(loader, CHECK);
|
||||
}
|
||||
}
|
||||
|
||||
bool LazyClassPathEntry::is_jrt() {
|
||||
Thread* THREAD = Thread::current();
|
||||
ClassPathEntry* cpe = resolve_entry(THREAD);
|
||||
return (cpe != NULL) ? cpe->is_jar_file() : false;
|
||||
}
|
||||
|
||||
void ClassLoader::compile_the_world() {
|
||||
EXCEPTION_MARK;
|
||||
HandleMark hm(THREAD);
|
||||
|
|
|
@ -53,7 +53,6 @@ class ClassPathEntry: public CHeapObj<mtClass> {
|
|||
virtual bool is_jar_file() = 0;
|
||||
virtual const char* name() = 0;
|
||||
virtual ImageFileReader* image() = 0;
|
||||
virtual bool is_lazy();
|
||||
// Constructor
|
||||
ClassPathEntry();
|
||||
// Attempt to locate file_name through this class path entry.
|
||||
|
@ -113,30 +112,6 @@ class ClassPathZipEntry: public ClassPathEntry {
|
|||
};
|
||||
|
||||
|
||||
// For lazier loading of boot class path entries
|
||||
class LazyClassPathEntry: public ClassPathEntry {
|
||||
private:
|
||||
const char* _path; // dir or file
|
||||
struct stat _st;
|
||||
bool _has_error;
|
||||
bool _throw_exception;
|
||||
volatile ClassPathEntry* _resolved_entry;
|
||||
ClassPathEntry* resolve_entry(TRAPS);
|
||||
public:
|
||||
bool is_jar_file();
|
||||
const char* name() { return _path; }
|
||||
ImageFileReader* image() { return NULL; }
|
||||
LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception);
|
||||
virtual ~LazyClassPathEntry();
|
||||
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
|
||||
|
||||
ClassFileStream* open_stream(const char* name, TRAPS);
|
||||
virtual bool is_lazy();
|
||||
// Debugging
|
||||
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
|
||||
NOT_PRODUCT(bool is_jrt();)
|
||||
};
|
||||
|
||||
// For java image files
|
||||
class ClassPathImageEntry: public ClassPathEntry {
|
||||
private:
|
||||
|
@ -168,7 +143,6 @@ class ClassLoader: AllStatic {
|
|||
package_hash_table_size = 31 // Number of buckets
|
||||
};
|
||||
protected:
|
||||
friend class LazyClassPathEntry;
|
||||
|
||||
// Performance counters
|
||||
static PerfCounter* _perf_accumulated_time;
|
||||
|
@ -233,7 +207,7 @@ class ClassLoader: AllStatic {
|
|||
|
||||
static void load_zip_library();
|
||||
static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
|
||||
bool lazy, bool throw_exception, TRAPS);
|
||||
bool throw_exception, TRAPS);
|
||||
|
||||
// Canonicalizes path names, so strcmp will work properly. This is mainly
|
||||
// to avoid confusing the zip library
|
||||
|
|
|
@ -275,6 +275,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
|
|||
{ "AdaptiveSizePausePolicy", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||
{ "ParallelGCRetainPLAB", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||
{ "ThreadSafetyMargin", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||
{ "LazyBootClassLoader", JDK_Version::jdk(9), JDK_Version::jdk(10) },
|
||||
{ NULL, JDK_Version(0), JDK_Version(0) }
|
||||
};
|
||||
|
||||
|
|
|
@ -1358,9 +1358,6 @@ public:
|
|||
develop(uintx, PreallocatedOutOfMemoryErrorCount, 4, \
|
||||
"Number of OutOfMemoryErrors preallocated with backtrace") \
|
||||
\
|
||||
product(bool, LazyBootClassLoader, true, \
|
||||
"Enable/disable lazy opening of boot class path entries") \
|
||||
\
|
||||
product(bool, UseXMMForArrayCopy, false, \
|
||||
"Use SSE2 MOVQ instruction for Arraycopy") \
|
||||
\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue