Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/hotspot/share/classfile/classLoaderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,7 @@ void ClassLoaderData::modules_do(void f(ModuleEntry*)) {
f(_unnamed_module);
}
if (_modules != NULL) {
for (int i = 0; i < _modules->table_size(); i++) {
for (ModuleEntry* entry = _modules->bucket(i);
entry != NULL;
entry = entry->next()) {
f(entry);
}
}
_modules->modules_do(f);
}
}

Expand Down Expand Up @@ -592,7 +586,7 @@ ModuleEntryTable* ClassLoaderData::modules() {
MutexLocker m1(Module_lock);
// Check if _modules got allocated while we were waiting for this lock.
if ((modules = _modules) == NULL) {
modules = new ModuleEntryTable(ModuleEntryTable::_moduletable_entry_size);
modules = new ModuleEntryTable();

{
MutexLocker m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
Expand Down Expand Up @@ -715,7 +709,7 @@ ClassLoaderData::~ClassLoaderData() {
}

if (_unnamed_module != NULL) {
_unnamed_module->delete_unnamed_module();
delete _unnamed_module;
_unnamed_module = NULL;
}

Expand Down Expand Up @@ -1040,6 +1034,10 @@ void ClassLoaderData::verify() {
k->verify();
assert(k != k->next_link(), "no loops!");
}

if (_modules != NULL) {
_modules->verify();
}
}

bool ClassLoaderData::contains_klass(Klass* klass) {
Expand Down
17 changes: 11 additions & 6 deletions src/hotspot/share/classfile/classLoaderExt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -81,17 +81,22 @@ void ClassLoaderExt::setup_app_search_path(JavaThread* current) {

void ClassLoaderExt::process_module_table(JavaThread* current, ModuleEntryTable* met) {
ResourceMark rm(current);
for (int i = 0; i < met->table_size(); i++) {
for (ModuleEntry* m = met->bucket(i); m != NULL;) {
class Process : public ModuleClosure {
JavaThread* _current;
public:
Process(JavaThread* current) : _current(current) {}
void do_module(ModuleEntry* m) {
char* path = m->location()->as_C_string();
if (strncmp(path, "file:", 5) == 0) {
path = ClassLoader::skip_uri_protocol(path);
ClassLoader::setup_module_search_path(current, path);
ClassLoader::setup_module_search_path(_current, path);
}
m = m->next();
}
}
};
Process process(current);
met->modules_do(&process);
}

void ClassLoaderExt::setup_module_paths(JavaThread* current) {
Arguments::assert_is_dumping_archive();
_app_module_paths_start_index = ClassLoader::num_boot_classpath_entries() +
Expand Down
Loading