jdk/src/share/demo/jvmti/hprof/hprof_event.c
author sjiang
Fri, 19 Jul 2013 13:35:01 +0200
changeset 20823 ddd111318407
parent 14342 8435a30053c1
child 23010 6dadb192ad81
permissions -rw-r--r--
8014534: Better profiling support Summary: Validation of parameters Reviewed-by: sspitsyn, skoivu, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 10292
diff changeset
     2
 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * Redistribution and use in source and binary forms, with or without
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * modification, are permitted provided that the following conditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * are met:
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *   - Redistributions of source code must retain the above copyright
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *     notice, this list of conditions and the following disclaimer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *   - Redistributions in binary form must reproduce the above copyright
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *     notice, this list of conditions and the following disclaimer in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *     documentation and/or other materials provided with the distribution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    15
 *   - Neither the name of Oracle nor the names of its
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *     contributors may be used to endorse or promote products derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 *     from this software without specific prior written permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
10292
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    32
/*
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    33
 * This source code is provided to illustrate the usage of a given feature
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    34
 * or technique and has been deliberately simplified. Additional steps
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    35
 * required for a production-quality application, such as security checks,
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    36
 * input validation and proper error handling, might not be present in
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    37
 * this sample code.
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    38
 */
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    39
ed7db6a12c2a 7067811: Update demo/sample code to state it should not be used for production
nloodin
parents: 5506
diff changeset
    40
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/* This file contains all class, method and allocation event support functions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *   both JVMTI and BCI events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *   (See hprof_monitor.c for the monitor event handlers).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#include "hprof.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
/* Private internal functions. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
/* Return a TraceIndex for the given thread. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
static TraceIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
get_current(TlsIndex tls_index, JNIEnv *env, jboolean skip_init)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    TraceIndex trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    trace_index  = tls_get_trace(tls_index, env, gdata->max_trace_depth, skip_init);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    return trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
/* Return a ClassIndex for the given jclass, loader supplied or looked up. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
static ClassIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
find_cnum(JNIEnv *env, jclass klass, jobject loader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    LoaderIndex loader_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    ClassIndex  cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    char *      signature;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    HPROF_ASSERT(klass!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /* Get the loader index */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    loader_index = loader_find_or_create(env, loader);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /* Get the signature for this class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    getClassSignature(klass, &signature, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /* Find the ClassIndex for this class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    cnum   = class_find_or_create(signature, loader_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /* Free the signature space */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    jvmtiDeallocate(signature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /* Make sure we save a global reference to this class in the table */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    HPROF_ASSERT(cnum!=0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    (void)class_new_classref(env, cnum, klass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    return cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
/* Get the ClassIndex for the superClass of this jclass. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
static ClassIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
get_super(JNIEnv *env, jclass klass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    ClassIndex super_cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    super_cnum  = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        jclass  super_klass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        super_klass = getSuperclass(env, klass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        if ( super_klass != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            super_cnum = find_cnum(env, super_klass,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                                getClassLoader(super_klass));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    } END_WITH_LOCAL_REFS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    return super_cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
/* Record an allocation. Could be jobject, jclass, jarray or primitive type. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
any_allocation(JNIEnv *env, SerialNumber thread_serial_num,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
               TraceIndex trace_index, jobject object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    SiteIndex    site_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    ClassIndex   cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    jint         size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    jclass       klass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /*    NOTE: Normally the getObjectClass() and getClassLoader()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *          would require a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *               WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *               } END_WITH_LOCAL_REFS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     *          but for performance reasons we skip it here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /* Get and tag the klass */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    klass = getObjectClass(env, object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    cnum = find_cnum(env, klass, getClassLoader(klass));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    site_index = site_find_or_create(cnum, trace_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    tag_class(env, klass, cnum, thread_serial_num, site_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /* Tag the object */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    size  = (jint)getObjectSize(object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    tag_new_object(object, OBJECT_NORMAL, thread_serial_num, size, site_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
/* Handle a java.lang.Object.<init> object allocation. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
event_object_init(JNIEnv *env, jthread thread, jobject object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /* Called via BCI Tracker class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /* Be very careful what is called here, watch out for recursion. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    jint        *pstatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    TraceIndex   trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    SerialNumber thread_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    HPROF_ASSERT(thread!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    HPROF_ASSERT(object!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /* Prevent recursion into any BCI function for this thread (pstatus). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    if ( tls_get_tracker_status(env, thread, JNI_TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
             &pstatus, NULL, &thread_serial_num, &trace_index) == 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        (*pstatus) = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        any_allocation(env, thread_serial_num, trace_index, object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        (*pstatus) = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
/* Handle any newarray opcode allocation. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
event_newarray(JNIEnv *env, jthread thread, jobject object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /* Called via BCI Tracker class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /* Be very careful what is called here, watch out for recursion. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    jint        *pstatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    TraceIndex   trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    SerialNumber thread_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    HPROF_ASSERT(thread!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    HPROF_ASSERT(object!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /* Prevent recursion into any BCI function for this thread (pstatus). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    if ( tls_get_tracker_status(env, thread, JNI_FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
             &pstatus, NULL, &thread_serial_num, &trace_index) == 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        (*pstatus) = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        any_allocation(env, thread_serial_num, trace_index, object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        (*pstatus) = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
/* Handle tracking of a method call. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
event_call(JNIEnv *env, jthread thread, ClassIndex cnum, MethodIndex mnum)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /* Called via BCI Tracker class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /* Be very careful what is called here, watch out for recursion. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    TlsIndex tls_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    jint     *pstatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    HPROF_ASSERT(thread!=NULL);
20823
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   198
    if (cnum == 0 || cnum == gdata->tracker_cnum) {
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   199
        jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   200
        (*env)->ThrowNew(env, newExcCls, "Illegal cnum.");
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   201
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   202
        return;
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   203
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    /* Prevent recursion into any BCI function for this thread (pstatus). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    if ( tls_get_tracker_status(env, thread, JNI_FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
             &pstatus, &tls_index, NULL, NULL) == 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        jmethodID     method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        (*pstatus) = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        method      = class_get_methodID(env, cnum, mnum);
20823
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   212
        if (method != NULL) {
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   213
            tls_push_method(tls_index, method);
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   214
        }
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   215
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        (*pstatus) = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
/* Handle tracking of an exception catch */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
event_exception_catch(JNIEnv *env, jthread thread, jmethodID method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        jlocation location, jobject exception)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /* Called via JVMTI_EVENT_EXCEPTION_CATCH callback */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /* Be very careful what is called here, watch out for recursion. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    TlsIndex tls_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    jint     *pstatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    HPROF_ASSERT(thread!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    HPROF_ASSERT(method!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /* Prevent recursion into any BCI function for this thread (pstatus). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    if ( tls_get_tracker_status(env, thread, JNI_FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
             &pstatus, &tls_index, NULL, NULL) == 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        (*pstatus) = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
         tls_pop_exception_catch(tls_index, thread, method);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        (*pstatus) = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
/* Handle tracking of a method return pop one (maybe more) methods. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
event_return(JNIEnv *env, jthread thread, ClassIndex cnum, MethodIndex mnum)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /* Called via BCI Tracker class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    /* Be very careful what is called here, watch out for recursion. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    TlsIndex tls_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    jint     *pstatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    HPROF_ASSERT(thread!=NULL);
20823
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   258
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   259
    if (cnum == 0 || cnum == gdata->tracker_cnum) {
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   260
        jclass newExcCls = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   261
        (*env)->ThrowNew(env, newExcCls, "Illegal cnum.");
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   262
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   263
        return;
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   264
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /* Prevent recursion into any BCI function for this thread (pstatus). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    if ( tls_get_tracker_status(env, thread, JNI_FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
             &pstatus, &tls_index, NULL, NULL) == 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        jmethodID     method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        (*pstatus) = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        method      = class_get_methodID(env, cnum, mnum);
20823
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   273
        if (method != NULL) {
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   274
            tls_pop_method(tls_index, thread, method);
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   275
        }
ddd111318407 8014534: Better profiling support
sjiang
parents: 14342
diff changeset
   276
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        (*pstatus) = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
/* Handle a class prepare (should have been already loaded) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
event_class_prepare(JNIEnv *env, jthread thread, jclass klass, jobject loader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    /* Called via JVMTI_EVENT_CLASS_PREPARE event */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    ClassIndex    cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    HPROF_ASSERT(thread!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    HPROF_ASSERT(klass!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    /* Find the ClassIndex for this class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    cnum   = find_cnum(env, klass, loader);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    class_add_status(cnum, CLASS_PREPARED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
/* Handle a class load (could have been already loaded) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
event_class_load(JNIEnv *env, jthread thread, jclass klass, jobject loader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /* Called via JVMTI_EVENT_CLASS_LOAD event or reset_class_load_status() */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    ClassIndex   cnum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    HPROF_ASSERT(klass!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    /* Find the ClassIndex for this class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    cnum   = find_cnum(env, klass, loader);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    /* Always mark it as being in the load list */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    class_add_status(cnum, CLASS_IN_LOAD_LIST);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    /* If we are seeing this as a new loaded class, extra work */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    if ( ! ( class_get_status(cnum) & CLASS_LOADED ) ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        TraceIndex   trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        SiteIndex    site_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        ClassIndex   super;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        SerialNumber class_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        SerialNumber trace_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        SerialNumber thread_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        ObjectIndex  class_object_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        char        *signature;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        /* Get the TlsIndex and a TraceIndex for this location */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        if ( thread == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            /* This should be very rare, but if this class load was simulated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
             *    from hprof_init.c due to a reset of the class load status,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
             *    and it originated from a pre-VM_INIT event, the jthread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
             *    would be NULL, or it was a jclass created that didn't get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
             *    reported to us, like an array class or a primitive class?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            trace_index       = gdata->system_trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            thread_serial_num = gdata->unknown_thread_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            TlsIndex     tls_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            tls_index    = tls_find_or_create(env, thread);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
            trace_index  = get_current(tls_index, env, JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            thread_serial_num = tls_get_thread_serial_number(tls_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        /* Get the SiteIndex for this location and a java.lang.Class object */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        /*    Note that the target cnum, not the cnum for java.lang.Class. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        site_index = site_find_or_create(cnum, trace_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        /* Tag this java.lang.Class object */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        tag_class(env, klass, cnum, thread_serial_num, site_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        class_add_status(cnum, CLASS_LOADED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        class_serial_num   = class_get_serial_number(cnum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        class_object_index = class_get_object_index(cnum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        trace_serial_num   = trace_get_serial_number(trace_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        signature          = string_get(class_get_signature(cnum));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        rawMonitorEnter(gdata->data_access_lock); {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
            io_write_class_load(class_serial_num, class_object_index,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                        trace_serial_num, signature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        } rawMonitorExit(gdata->data_access_lock);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        super  = get_super(env, klass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        class_set_super(cnum, super);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
/* Handle a thread start event */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
event_thread_start(JNIEnv *env, jthread thread)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    /* Called via JVMTI_EVENT_THREAD_START event */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    TlsIndex    tls_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    ObjectIndex object_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    TraceIndex  trace_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    jlong       tag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    SerialNumber thread_serial_num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    HPROF_ASSERT(thread!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    tls_index = tls_find_or_create(env, thread);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    thread_serial_num = tls_get_thread_serial_number(tls_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    trace_index = get_current(tls_index, env, JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    tag = getTag(thread);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    if ( tag == (jlong)0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        SiteIndex site_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        jint      size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        size = (jint)getObjectSize(thread);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        site_index = site_find_or_create(gdata->thread_cnum, trace_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        /*  We create a new object with this thread's serial number */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        object_index = object_new(site_index, size, OBJECT_NORMAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                                              thread_serial_num);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        object_index = tag_extract(tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        /* Normally the Thread object is created and tagged before we get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
         *   here, but the thread_serial_number on this object isn't what
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
         *   we want. So we update it to the serial number of this thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        object_set_thread_serial_number(object_index, thread_serial_num);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    tls_set_thread_object_index(tls_index, object_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        jvmtiThreadInfo      threadInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        jvmtiThreadGroupInfo threadGroupInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        jvmtiThreadGroupInfo parentGroupInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        getThreadInfo(thread, &threadInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        getThreadGroupInfo(threadInfo.thread_group, &threadGroupInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        if ( threadGroupInfo.parent != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            getThreadGroupInfo(threadGroupInfo.parent, &parentGroupInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            (void)memset(&parentGroupInfo, 0, sizeof(parentGroupInfo));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        rawMonitorEnter(gdata->data_access_lock); {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            io_write_thread_start(thread_serial_num,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                object_index, trace_get_serial_number(trace_index),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                threadInfo.name, threadGroupInfo.name, parentGroupInfo.name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        } rawMonitorExit(gdata->data_access_lock);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        jvmtiDeallocate(threadInfo.name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        jvmtiDeallocate(threadGroupInfo.name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        jvmtiDeallocate(parentGroupInfo.name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    } END_WITH_LOCAL_REFS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
event_thread_end(JNIEnv *env, jthread thread)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    /* Called via JVMTI_EVENT_THREAD_END event */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    TlsIndex     tls_index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    HPROF_ASSERT(env!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    HPROF_ASSERT(thread!=NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    tls_index = tls_find_or_create(env, thread);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    rawMonitorEnter(gdata->data_access_lock); {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        io_write_thread_end(tls_get_thread_serial_number(tls_index));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    } rawMonitorExit(gdata->data_access_lock);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    tls_thread_ended(env, tls_index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    setThreadLocalStorage(thread, (void*)NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
}