/*
*
* 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.
*/
/* This file contains all class, method and allocation event support functions,
* both JVMTI and BCI events.
* (See hprof_monitor.c for the monitor event handlers).
*/
#include "hprof.h"
/* Private internal functions. */
/* Return a TraceIndex for the given thread. */
static TraceIndex
{
return trace_index;
}
/* Return a ClassIndex for the given jclass, loader supplied or looked up. */
static ClassIndex
{
char * signature;
/* Get the loader index */
/* Get the signature for this class */
/* Find the ClassIndex for this class */
/* Free the signature space */
/* Make sure we save a global reference to this class in the table */
HPROF_ASSERT(cnum!=0);
return cnum;
}
/* Get the ClassIndex for the superClass of this jclass. */
static ClassIndex
{
super_cnum = 0;
if ( super_klass != NULL ) {
}
return super_cnum;
}
/* Record an allocation. Could be jobject, jclass, jarray or primitive type. */
static void
{
/* NOTE: Normally the getObjectClass() and getClassLoader()
* would require a
* WITH_LOCAL_REFS(env, 1) {
* } END_WITH_LOCAL_REFS;
* but for performance reasons we skip it here.
*/
/* Get and tag the klass */
/* Tag the object */
}
/* Handle a java.lang.Object.<init> object allocation. */
void
{
/* Called via BCI Tracker class */
/* Be very careful what is called here, watch out for recursion. */
/* Prevent recursion into any BCI function for this thread (pstatus). */
(*pstatus) = 1;
(*pstatus) = 0;
}
}
/* Handle any newarray opcode allocation. */
void
{
/* Called via BCI Tracker class */
/* Be very careful what is called here, watch out for recursion. */
/* Prevent recursion into any BCI function for this thread (pstatus). */
(*pstatus) = 1;
(*pstatus) = 0;
}
}
/* Handle tracking of a method call. */
void
{
/* Called via BCI Tracker class */
/* Be very careful what is called here, watch out for recursion. */
/* Prevent recursion into any BCI function for this thread (pstatus). */
(*pstatus) = 1;
(*pstatus) = 0;
}
}
/* Handle tracking of an exception catch */
void
{
/* Called via JVMTI_EVENT_EXCEPTION_CATCH callback */
/* Be very careful what is called here, watch out for recursion. */
/* Prevent recursion into any BCI function for this thread (pstatus). */
(*pstatus) = 1;
(*pstatus) = 0;
}
}
/* Handle tracking of a method return pop one (maybe more) methods. */
void
{
/* Called via BCI Tracker class */
/* Be very careful what is called here, watch out for recursion. */
/* Prevent recursion into any BCI function for this thread (pstatus). */
(*pstatus) = 1;
(*pstatus) = 0;
}
}
/* Handle a class prepare (should have been already loaded) */
void
{
/* Called via JVMTI_EVENT_CLASS_PREPARE event */
/* Find the ClassIndex for this class */
}
/* Handle a class load (could have been already loaded) */
void
{
/* Called via JVMTI_EVENT_CLASS_LOAD event or reset_class_load_status() */
/* Find the ClassIndex for this class */
/* Always mark it as being in the load list */
/* If we are seeing this as a new loaded class, extra work */
char *signature;
/* Get the TlsIndex and a TraceIndex for this location */
/* This should be very rare, but if this class load was simulated
* from hprof_init.c due to a reset of the class load status,
* and it originated from a pre-VM_INIT event, the jthread
* would be NULL, or it was a jclass created that didn't get
* reported to us, like an array class or a primitive class?
*/
} else {
}
/* Get the SiteIndex for this location and a java.lang.Class object */
/* Note that the target cnum, not the cnum for java.lang.Class. */
/* Tag this java.lang.Class object */
}
}
/* Handle a thread start event */
void
{
/* Called via JVMTI_EVENT_THREAD_START event */
/* We create a new object with this thread's serial number */
} else {
/* Normally the Thread object is created and tagged before we get
* here, but the thread_serial_number on this object isn't what
* we want. So we update it to the serial number of this thread.
*/
}
} else {
}
}
void
{
/* Called via JVMTI_EVENT_THREAD_END event */
}