/*
* 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/systemDictionary.hpp"
#include "memory/universe.inline.hpp"
#include "prims/jvmtiGetLoadedClasses.hpp"
#include "runtime/thread.hpp"
// The closure for GetLoadedClasses and GetClassLoaderClasses
// Since the SystemDictionary::classes_do callback
// doesn't pass a closureData pointer,
// we use a thread-local slot to hold a pointer to
// a stack allocated instance of this structure.
private:
int _count;
int _index;
private:
// Getting and setting the thread local pointer
return result;
}
}
public:
_count = 0;
_index = 0;
set_this(this);
}
_count = 0;
_index = 0;
set_this(this);
}
_count = 0;
}
_index = 0;
}
// Accessors.
return _initiatingLoader;
}
int get_count() {
return _count;
}
}
return _list;
}
}
int get_index() {
return _index;
}
}
} else {
assert(false, "empty get_element");
return Handle();
}
}
} else {
assert(false, "bad set_element");
}
}
// Other predicates
bool available() {
}
#ifdef ASSERT
// For debugging.
for (int i = 0; i < limit; i += 1) {
}
}
#endif
// Public methods that get called within the scope of the closure
void allocate() {
_count = 0;
}
}
}
}
// Finally, the static methods that are the callbacks
}
} else if (k != NULL) {
// if initiating loader not null, just include the instance with 1 dimension
}
}
}
}
}
}
}
}
} else if (k != NULL) {
// 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.
}
// Post results
(unsigned char**)&result_list);
if (err != JVMTI_ERROR_NONE) {
return err;
}
return JVMTI_ERROR_NONE;
}
// 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.
}
// Post results
(unsigned char**)&result_list);
if (err != JVMTI_ERROR_NONE) {
return err;
}
return JVMTI_ERROR_NONE;
}