/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/systemDictionary.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "services/classLoadingService.hpp"
#include "utilities/hashtable.inline.hpp"
_current_class_index = 0;
};
int number_of_entries)
_current_class_index = 0;
};
return entry;
}
return entry;
}
// avoid recursion when deleting linked list
delete to_delete;
}
}
#ifdef ASSERT
// Ensure this doesn't show up in the pd_set (invariant)
bool in_pd_set = false;
in_pd_set = true;
break;
}
}
if (in_pd_set) {
assert(false, "A klass's protection domain should not show up "
"in its sys. dict. PD set");
}
}
#endif /* ASSERT */
// Succeeds trivially
return true;
}
}
return false;
}
// Warning: Preserve store ordering. The SystemDictionary is read
// without locks. The new ProtectionDomainEntry must be
// complete before other threads can be allowed to see it
// via a store to _pd_set.
}
if (TraceProtectionDomainVerification && WizardMode) {
print();
}
}
bool class_was_unloaded = false;
// Remove unloadable entries and classes from system dictionary
// The placeholder array has been handled in always_strong_oops_do.
probe = *p;
// This klass has previous versions so see what we can cleanup
// while it is safe to do so.
int live_count = 0;
// RC_TRACE macro has an embedded ResourceMark
// check the previous versions array for GC'ed weak refs
delete pv_node;
// Since we are traversing the array backwards, we don't have to
// do anything special with the index.
continue; // robustness
}
// this entry has been GC'ed so remove it
delete pv_node;
// Since we are traversing the array backwards, we don't have to
// do anything special with the index.
gc_count++;
continue;
} else {
live_count++;
} else {
guarantee(false, "sanity check");
}
}
if (method_refs != NULL) {
method_refs->length()));
if (method_ref == NULL) {
method_refs->remove_at(j);
// Since we are traversing the array backwards, we don't have to
// do anything special with the index.
continue; // robustness
}
// this method entry has been GC'ed so remove it
method_refs->remove_at(j);
} else {
// RC_TRACE macro has an embedded ResourceMark
RC_TRACE(0x00000200,
("unload: %s(%s): prev method @%d in version @%d is alive",
}
}
}
}
RC_TRACE(0x00000200,
("unload: previous version stats: live=%d, GC'ed=%d", live_count,
gc_count));
}
// Non-unloadable classes were handled in always_strong_oops_do
if (!is_strongly_reachable(class_loader, e)) {
// Entry was not visited in phase1 (negated test from phase1)
// Do we need to delete this system dictionary entry?
bool purge_entry = false;
// Do we need to delete this system dictionary entry?
// If the loader is not live this entry should always be
// removed (will never be looked up again). Note that this is
// not the same as unloading the referred class.
if (k_def_class_loader == class_loader) {
// This is the defining entry, so the referred class is about
// to be unloaded.
// Notify the debugger and clean up the class.
"klass should not be live if defining loader is not");
class_was_unloaded = true;
// notify the debugger
if (JvmtiExport::should_post_class_unload()) {
}
// notify ClassLoadingService of class unload
// Clean up C heap
}
// Also remove this system dictionary entry.
purge_entry = true;
} else {
// The loader in this entry is alive. If the klass is dead,
// the loader must be an initiating loader (rather than the
// defining loader). Remove this entry.
if (!is_alive->do_object_b(e)) {
"defining loader should not be live if klass is not");
// If we get here, the class_loader must not be the defining
// loader, it must be an initiating one.
"cannot have live defining loader and unreachable klass");
// Loader is live, but class and its defining loader are dead.
// Remove the entry. The class is going away.
purge_entry = true;
}
}
if (purge_entry) {
if (probe == _current_class_entry) {
}
continue;
}
}
}
}
return class_was_unloaded;
}
// Follow all system classes and temporary placeholders in dictionary
if (is_strongly_reachable(class_loader, e)) {
if (class_loader != NULL) {
}
}
}
}
}
// Just the classes from defining class loaders
f(k);
}
}
}
}
// Added for initialize_itable_for_klass to handle exceptions
// Just the classes from defining class loaders
f(k, CHECK);
}
}
}
}
// All classes, and their class loaders
// (added for helpers that use HandleMarks and ResourceMarks)
// Don't iterate over placeholders
}
}
}
// All classes, and their class loaders
// Don't iterate over placeholders
}
}
}
}
}
}
}
// only take klass is we have the entry with the defining class loader
}
}
}
}
while (true) {
if (_current_class_entry != NULL) {
return k;
}
}
// never reached
}
// Add a loaded class to the system dictionary.
// Readers of the SystemDictionary aren't always locked, so _buckets
// is volatile. The store of the next field in the constructor is
// also cast to volatile; we do this to ensure store order is maintained
// by the compilers.
KlassHandle obj) {
}
// This routine does not lock the system dictionary.
//
// Since readers don't hold a lock, we must make sure that system
// dictionary entries are only removed at a safepoint (when only one
// thread is running), and are added to in a safe way (all links must
// be updated in an MT-safe manner).
//
// Callers should be aware that an entry could be added just after
// _buckets[index] is read here, so the caller will not see the new entry.
return entry;
}
}
return NULL;
}
} else {
return NULL;
}
}
}
// Variant of find_class for shared classes. No locking required, as
// that table is static.
}
TRAPS) {
"real protection domain should be present");
"now protection domain should be present");
}
}
// Copy all the dictionary entries into a single master list.
for (int i = 0; i < table_size(); ++i) {
DictionaryEntry* p = bucket(i);
while (p != NULL) {
p->set_next(master_list);
master_list = p;
p = tmp;
}
}
// Add the dictionary entries back to the list in the correct buckets.
while (master_list != NULL) {
DictionaryEntry* p = master_list;
}
}
{
}
int number_of_entries)
{
}
return p;
}
}
return NULL;
}
return p;
}
if (p->property_oop() != NULL) {
f->do_oop(p->property_oop_addr());
}
}
}
}
}
}
}
}
// ----------------------------------------------------------------------------
#ifndef PRODUCT
table_size(), number_of_entries());
"defining loader");
bool is_defining_class =
if (class_loader != NULL) {
}
}
}
}
#endif
int element_count = 0;
"Verify of system dictionary failed");
// class loader must be present; a null class loader is the
// boostrap loader
"checking type of class_loader");
e->verify();
}
}
"Verify of system dictionary failed");
}