jvmtiGetLoadedClasses.cpp revision 0
1037N/A * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 1037N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1037N/A * This code is free software; you can redistribute it and/or modify it 1037N/A * under the terms of the GNU General Public License version 2 only, as 1037N/A * published by the Free Software Foundation. 1037N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1037N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1037N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1037N/A * version 2 for more details (a copy is included in the LICENSE file that 1037N/A * You should have received a copy of the GNU General Public License version 1037N/A * 2 along with this work; if not, write to the Free Software Foundation, 1037N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1037N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1037N/A * CA 95054 USA or visit www.sun.com if you need additional information or 1037N/A#
include "incls/_precompiled.incl" 1037N/A// The closure for GetLoadedClasses and GetClassLoaderClasses 1037N/A // Since the SystemDictionary::classes_do callback 1037N/A // doesn't pass a closureData pointer, 1037N/A // we use a thread-local slot to hold a pointer to 1037N/A // a stack allocated instance of this structure. 1037N/A // Getting and setting the thread local pointer assert(
false,
"empty get_element");
assert(
false,
"bad set_element");
for (
int i = 0; i <
limit; i +=
1) {
// Public methods that get called within the scope of the closure // Finally, the static methods that are the callbacks // if initiating loader not null, just include the instance with 1 dimension // if initiating loader not null, just include the instance with 1 dimension // increment the count for the given basic type array class (and any // multi-dimensional arrays). For example, for [B we check for // [[B, [[[B, .. and the count is incremented for each one that exists. // add the basic type array class and its multi-dimensional array classes to the list // Since SystemDictionary::classes_do only takes a function pointer // and doesn't call back with a closure data pointer, // we can only pass static methods. // To get a consistent list of classes we need MultiArray_lock to ensure // array classes aren't created, and SystemDictionary_lock to ensure that // classes aren't added to the system dictionary, // First, count the classes // Next, fill in the classes // Drop the SystemDictionary_lock, so the results could be wrong from here, // but we still have a snapshot. // Since SystemDictionary::classes_do only takes a function pointer // and doesn't call back with a closure data pointer, // we can only pass static methods. // To get a consistent list of classes we need MultiArray_lock to ensure // array classes aren't created, and SystemDictionary_lock to ensure that // classes aren't added to the system dictionary, // First, count the classes in the system dictionary which have this loader recorded // as an initiating loader. For basic type arrays this information is not recorded // so GetClassLoaderClasses will return all of the basic type arrays. This is okay // because the defining loader for basic type arrays is always the boot class loader // and these classes are "visible" to all loaders. // Next, fill in the classes // Drop the SystemDictionary_lock, so the results could be wrong from here, // but we still have a snapshot.