2362N/A * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * Redistribution and use in source and binary forms, with or without 0N/A * modification, are permitted provided that the following conditions 0N/A * - Redistributions of source code must retain the above copyright 0N/A * notice, this list of conditions and the following disclaimer. 0N/A * - Redistributions in binary form must reproduce the above copyright 0N/A * notice, this list of conditions and the following disclaimer in the 0N/A * documentation and/or other materials provided with the distribution. 0N/A * - Neither the name of Oracle nor the names of its 0N/A * contributors may be used to endorse or promote products derived 0N/A * from this software without specific prior written permission. 2362N/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 2362N/A * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 2362N/A * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 0N/A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 0N/A * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 0N/A * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 0N/A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 0N/A * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 0N/A * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 0N/A * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 0N/A * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0N/A * This source code is provided to illustrate the usage of a given feature 0N/A * or technique and has been deliberately simplified. Additional steps 169N/A * required for a production-quality application, such as security checks, 0N/A * input validation and proper error handling, might not be present in /* Table of class information. * Each element in this table is identified with a ClassIndex. * Each element is uniquely identified by it's signature and loader. * Every class load has a unique class serial number. * While loaded, each element will have a cache of a global reference * to it's jclass object, plus jmethodID's as needed. * Method signatures and names are obtained via BCI. * Methods can be identified with a ClassIndex and MethodIndex pair, * where the MethodIndex matches the index of the method name and * signature arrays obtained from the BCI pass. * Strings are stored in the string table and a StringIndex is used. * Class Loaders are stored in the loader table and a LoaderIndex is used. * Since the jclass object is an object, at some point an object table * entry may be allocated for the jclass as an ObjectIndex. /* Effectively represents a jclass object. */ /* These table elements are made unique by and sorted by signature name. */ /* Each class could contain method information, gotten from BCI callback */ /* The basic class information we save */ /* Class signature looks like "Lname;", we want "name" here. */ /* This would be strange, a class signature not in "Lname;" form? */ /* Cleanup any information in this ClassInfo structure. */ "0x%08x: Class %s, SN=%u, status=0x%08x, ref=%p," " Method %d: \"%s\", sig=\"%s\", method=%p\n",
/* External interfaces */ /* Prime System classes? Anything before VM_START is System class. * Or classes loaded before env arg is non-NULL. * Or any of the classes listed below. "--------------------- Class Table ------------------------\n");
"----------------------------------------------------------\n");
for ( i = 0 ; i <
count ; i++ ) {
/* This really only makes sense for the bootclass classes, * since FindClass doesn't provide a way to load a class in * a specific class loader. /* Get ALL class fields (supers too), return 1 on error, 0 if ok */ ret =
1;
/* Default is to return an error condition */ ret = 0;
/* Return of cache data, no error */ /* This is probably an error because this will cause the field * index values to be off, but I'm hesitant to generate a * fatal error here, so I will issue something and continue. * I should have been holding a global reference to all the * jclass, so I'm not sure how this could happen. * Issuing a FindClass() here is just asking for trouble * because if the class went away, we aren't even sure * what ClassLoader to use. ret = 0;
/* Primitive or array ok */ /* Call JVMTI to get them */