/*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
/* The Class Loader table. */
/*
* The Class Loader objects show up so early in the VM process that a
* separate table was designated for Class Loaders.
*
* The Class Loader is unique by way of it's jobject uniqueness, unfortunately
* use of JNI too early for jobject comparisons is problematic.
* It is assumed that the number of class loaders will be limited, and
* a simple linear search will be performed for now.
* That logic is isolated here and can be changed to use the standard
* table hash table search once we know JNI can be called safely.
*
* A weak global reference is created to keep tabs on loaders, and as
* each search for a loader happens, NULL weak global references will
* trigger the freedom of those entries.
*
*/
#include "hprof.h"
typedef struct {
} LoaderInfo;
static LoaderInfo *
{
}
static void
{
}
info->object_index = 0;
}
static void
{
}
static void
{
}
static void
{
debug_message( "Loader 0x%08x: globalref=%p, object_index=%d\n",
}
static void
{
}
typedef struct SearchData {
} SearchData;
static void
{
/* Covers when looking for NULL too. */
/* Object went away, free reference and entry */
}
}
}
}
static LoaderIndex
{
}
{
/* See if we remembered the system loader */
return gdata->system_loader;
}
}
if ( index == 0 ) {
info = empty_info;
info.object_index = 0;
}
}
/* Remember the system loader */
}
return index;
}
void
loader_init(void)
{
}
void
loader_list(void)
{
"--------------------- Loader Table ------------------------\n");
"----------------------------------------------------------\n");
}
void
loader_cleanup(void)
{
}
void
{
}
/* Get the object index for a class loader */
{
/* Assume no object index at first (default class loader) */
object_index = 0;
/* Get the tag on the object and extract the object_index */
}
}
}
}
return object_index;
}