/*
*
* 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.
*/
/* Object table. */
/*
* An Object is unique by it's allocation site (SiteIndex), it's size,
* it's kind, and it's serial number. Normally only the serial number
* would have been necessary for heap=dump, and these other items
* could have been moved to the ObjectInfo. An optimization left
* to the reader. Lookups are not normally done on ObjectIndex's
* anyway because we typically know when to create them.
* Objects that have been tagged, are tagged with an ObjectIndex,
* Objects that are not tagged need a ObjectIndex, a lookup when
* heap=sites, and a new one when heap=dump.
* Objects that are freed, need the tag converted to an ObjectIndex,
* so they can be freed, but only when heap=dump.
* The thread serial number is for the thread associated with this
* object. If the object is a Thread object, it should be the serial
* number for that thread. The ThreadStart event is responsible
* for making sure the thread serial number is correct, but between the
* initial allocation of a Thread object and it's ThreadStart event
* the thread serial number could be for the thread that allocated
* the Thread object.
*
* This will likely be the largest table when using heap=dump, when
* there is one table entry per object.
*
* ObjectIndex entries differ between heap=dump and heap=sites.
* With heap=sites, each ObjectIndex represents a unique site, size,
* and kind of object, so many jobject's will map to a single ObjectIndex.
* With heap=dump, every ObjectIndex maps to a unique jobject.
*
* During processing of a heap dump, the references for the object
* this ObjectIndex represents is assigned to the references field
* of the ObjectInfo as a linked list. (see hprof_references.c).
* Once all the refernces are attached, they are processed into the
* appropriate hprof dump information.
*
* The references field is set and cleared as many times as the heap
* is dumped, as is the reference table.
*
*/
#include "hprof.h"
typedef struct ObjectKey {
} ObjectKey;
typedef struct ObjectInfo {
} ObjectInfo;
/* Private internal functions. */
static ObjectKey*
{
void *key_ptr;
int key_len;
}
static ObjectInfo *
{
return info;
}
static void
{
HPROF_ASSERT(key_len!=0);
debug_message( "Object 0x%08x: site=0x%08x, SN=%u, "
" size=%d, kind=%d, refs=0x%x, threadSN=%u\n",
}
static void
{
info->references = 0;
}
static void
{
}
static void
{
}
/* External interfaces. */
{
ObjectInfo i;
i = empty_info;
} else {
}
return index;
}
void
object_init(void)
{
bucket_count = 511;
bucket_count = 0;
}
}
{
return pkey->site_index;
}
{
}
{
}
{
/* Decrement allocations at this site. */
}
return kind;
}
void
object_list(void)
{
"--------------------- Object Table ------------------------\n");
"----------------------------------------------------------\n");
}
void
object_cleanup(void)
{
}
void
{
}
{
return info->thread_serial_num;
}
{
return info->references;
}
void
{
}
void
object_clear_references(void)
{
}
void
{
}