/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Copyright 2003 Wily Technology, Inc.
*/
#include <jni.h>
#include <jvmti.h>
#include "JPLISAssert.h"
#include "Reentrancy.h"
#include "JPLISAgent.h"
/*
* This module provides some utility functions to support the "same thread" re-entrancy management.
* Uses JVMTI TLS to store a single bit per thread.
* Non-zero means the thread is already inside; zero means the thread is not inside.
*/
/*
* Local prototypes
*/
/* Wrapper around set that does the set then re-fetches to make sure it worked.
* Degenerates to a simple set when assertions are disabled.
* This routine is only here because of a bug in the JVMTI where set to 0 fails.
*/
const void * newValue);
/* Confirmation routine only; used to assure that the TLS slot holds the value we expect it to. */
void
const void * expected);
#define JPLIS_CURRENTLY_OUTSIDE_TOKEN ((void *) 0)
const void * newValue) {
newValue);
newValue);
#endif
return error;
}
void
const void * expected) {
/* now check if we do a fetch we get what we wrote */
&test);
}
&storedValue);
if ( error == JVMTI_ERROR_NONE ) {
/* if this thread is already inside, just return false and short-circuit */
if ( storedValue == JPLIS_CURRENTLY_INSIDE_TOKEN ) {
}
else {
/* stuff in the sentinel and return true */
#endif
if ( error != JVMTI_ERROR_NONE ) {
}
else {
}
}
}
return result;
}
void
/* assert we hold the token */
#endif
}