Agent.cpp revision 1657
1472N/A * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. 1138N/A * Redistribution and use in source and binary forms, with or without 1138N/A * modification, are permitted provided that the following conditions 1138N/A * - Redistributions of source code must retain the above copyright 1138N/A * notice, this list of conditions and the following disclaimer. 1138N/A * - Redistributions in binary form must reproduce the above copyright 1138N/A * notice, this list of conditions and the following disclaimer in the 1138N/A * documentation and/or other materials provided with the distribution. 1138N/A * - Neither the name of Sun Microsystems nor the names of its 1138N/A * contributors may be used to endorse or promote products derived 1138N/A * from this software without specific prior written permission. 1472N/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 1472N/A * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1472N/A * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1138N/A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 1138N/A * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1138N/A * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 1138N/A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1138N/A * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 1138N/A * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1138N/A * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1138N/A * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1138N/A/* Implementation of the Agent class */ /* Given a jvmtiEnv* and jthread, find the Thread instance */ /* This should always be in the Thread Local Storage */ /* This jthread has never been seen before? */ /* Given a jvmtiEnv* and jobject, find the Monitor instance or create one */ /* Save monitor on list */ /* VM initialization and VM death calls to Agent */ /* Delete all Monitors we allocated */ /* Print death message */ /* Thread start event, setup a new thread */ /* Allocate a new Thread instance, put it in the Thread Local * Storage for easy access later. /* Thread end event, we need to reclaim the space */ /* Clear out the Thread Local Storage */ /* Reclaim the C++ object space */ /* Monitor contention begins for a thread. */ /* Monitor contention ends for a thread. */ /* Monitor wait begins for a thread. */ /* Monitor wait ends for a thread. */ /* A tagged object has been freed */ /* We just cast the tag to a C++ pointer and delete it. * we know it can only be a Monitor *. /* Move the last element to this Monitor's slot */