jvm.cpp revision 3879
1472N/A * or visit www.oracle.com if you need additional information or have any
1879N/A#include "precompiled.hpp"
1879N/A#include "classfile/classLoader.hpp"
1879N/A#include "classfile/javaAssertions.hpp"
1879N/A#include "classfile/javaClasses.hpp"
1879N/A#include "classfile/symbolTable.hpp"
1879N/A#include "classfile/systemDictionary.hpp"
1879N/A#include "classfile/vmSymbols.hpp"
1879N/A#include "gc_interface/collectedHeap.inline.hpp"
1879N/A#include "memory/oopFactory.hpp"
1879N/A#include "memory/universe.inline.hpp"
1879N/A#include "oops/fieldStreams.hpp"
1879N/A#include "oops/instanceKlass.hpp"
1879N/A#include "oops/objArrayKlass.hpp"
1879N/A#include "oops/methodOop.hpp"
1879N/A#include "prims/jvm_misc.hpp"
1879N/A#include "prims/jvmtiExport.hpp"
0N/A#include "prims/jvmtiThreadState.hpp"
0N/A#include "prims/nativeLookup.hpp"
0N/A#include "prims/privilegedStack.hpp"
0N/A#include "runtime/arguments.hpp"
0N/A#include "runtime/dtraceJSDT.hpp"
0N/A#include "runtime/handles.inline.hpp"
0N/A#include "runtime/interfaceSupport.hpp"
0N/A#include "runtime/javaCalls.hpp"
0N/A#include "runtime/jfieldIDWorkaround.hpp"
0N/A#include "runtime/perfData.hpp"
0N/A#include "runtime/reflection.hpp"
0N/A#include "runtime/vframe.hpp"
0N/A#include "runtime/vm_operations.hpp"
0N/A#include "services/attachListener.hpp"
0N/A#include "services/management.hpp"
0N/A#include "services/threadService.hpp"
0N/A#include "utilities/defaultStream.hpp"
0N/A#include "utilities/dtrace.hpp"
0N/A#include "utilities/events.hpp"
0N/A#include "utilities/histogram.hpp"
0N/A#ifdef TARGET_OS_FAMILY_linux
0N/A# include "jvm_linux.h"
0N/A#ifdef TARGET_OS_FAMILY_solaris
0N/A# include "jvm_solaris.h"
0N/A#ifdef TARGET_OS_FAMILY_windows
0N/A# include "jvm_windows.h"
0N/A#ifdef TARGET_OS_FAMILY_bsd
113N/A such ctors and calls MUST NOT come between an oop declaration/init and its
0N/A TempNewSymbol access_controller = SymbolTable::new_symbol("java/security/AccessController", CHECK);
0N/A klassOop access_controller_klass = SystemDictionary::resolve_or_fail(access_controller, false, CHECK);
0N/A TempNewSymbol privileged_action = SymbolTable::new_symbol("java/security/PrivilegedAction", CHECK);
0N/A klassOop privileged_action_klass = SystemDictionary::resolve_or_fail(privileged_action, false, CHECK);
0N/A if (!vfst.method()->method_holder()->klass_part()->is_subclass_of(SystemDictionary::ClassLoader_klass())&&
0N/A last_caller = m;
366N/A instanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class() &&
366N/A instanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class() &&
0N/A if (HAS_PENDING_EXCEPTION) {
0N/A if (TraceJVMCalls) {
0N/A if ( (WarnOnStalledSpinLock > 0)
0N/A if (e != NULL) e->increment_count(); // Due to bug in VC++, we need a NULL check here eventhough it should never happen!
0N/A #define JVMWrapper4(arg1, arg2, arg3, arg4) JVMCountWrapper(arg1); JVMTraceWrapper(arg1, arg2, arg3, arg4)
0N/A return JVM_INTERFACE_VERSION;
0N/A Handle value_str = java_lang_String::create_from_platform_dependent_str((value != NULL ? value : ""), CHECK);
0N/A // Add the sun.management.compiler property for the compiler's name
0N/A return properties;
0N/A if (!DisableExplicitGC) {
0N/A return convert_size_t_to_jlong(n);
0N/A return convert_size_t_to_jlong(n);
0N/A return convert_size_t_to_jlong(n);
0N/A JvmtiVMObjectAllocEventCollector oam; // This ctor (throughout this module) may trigger a safepoint/GC
0N/A return handle == NULL ? 0 : ObjectSynchronizer::FastHashCode (THREAD, JNIHandles::resolve_non_null(handle)) ;
0N/A return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
0N/A if (TraceClassResolution) {
0N/A if (throwError) {
0N/A if (UsePerfData) {
0N/A if (UsePerfData) {
0N/AJVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd))
0N/AJVM_ENTRY(jclass, JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source))
1666N/A if (UsePerfData) {
1666N/A// Reflection support //////////////////////////////////////////////////////////////////////////////
0N/A // Signers are only set once, ClassLoader.java, and thus shouldn't
37N/AJVM_ENTRY(jobject, JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject context, jboolean wrapException))
0N/A if (m.is_null() || !m->is_method() || !methodOop(m())->is_public() || methodOop(m())->is_static()) {
0N/A pi.initialize(&vfst, JNIHandles::resolve(context), thread->privileged_stack_top(), CHECK_NULL);
17N/A // invoke the Object run() in the action object. We cannot use call_interface here, since the static type
17N/A // is not really known - it is either java.security.PrivilegedAction or java.security.PrivilegedExceptionAction
0N/A assert(thread->privileged_stack_top() != NULL && thread->privileged_stack_top() == &pi, "wrong top element");
0N/A if (HAS_PENDING_EXCEPTION) {
0N/Aclass RegisterArrayForGC {
0N/A ~RegisterArrayForGC() {
0N/A bool is_privileged = false;
0N/A if (thread->privileged_stack_top() && thread->privileged_stack_top()->frame_id() == frame_id) {
0N/A is_privileged = true;
0N/A if (is_privileged) break;
0N/A oop result = java_security_AccessControlContext::create(objArrayHandle(), is_privileged, privileged_context, CHECK_NULL);
0N/A oop result = java_security_AccessControlContext::create(h_context, is_privileged, privileged_context, CHECK_NULL);
0N/A return k->modifier_flags();
0N/A// Inner class reflection ///////////////////////////////////////////////////////////////////////////////
0N/A ! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
0N/A instanceKlassHandle k(thread, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)));
0N/A objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), length/4, CHECK_NULL);
0N/A if (outer_klass == k()) {
0N/A objArrayOop res = oopFactory::new_objArray(SystemDictionary::Class_klass(), members, CHECK_NULL);
0N/A ! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
1522N/A bool inner_is_member = false;
1522N/A// should be in instanceKlass.cpp, but is here for historical reasons
0N/A bool* inner_is_member,
0N/A *inner_is_member = false;
0N/A *inner_is_member = true;
0N/A if (encl_method_class_idx != 0) {
0N/A *inner_is_member = false;
0N/A return outer_klass();
0N/AJVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly))
0N/A Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) {
0N/A instanceKlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)));
0N/A bool skip_backtrace = false;
0N/A int num_fields;
0N/A if (publicOnly) {
0N/A num_fields = 0;
0N/A num_fields--;
0N/A skip_backtrace = true;
0N/A objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), num_fields, CHECK_NULL);
0N/A if (skip_backtrace) {
0N/AJVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly))
0N/A || Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) {
0N/A instanceKlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)));
0N/A int num_methods = 0;
0N/A for (i = 0; i < methods_length; i++) {
0N/A ++num_methods;
0N/A objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), num_methods, CHECK_NULL);
0N/A for (i = 0; i < methods_length; i++) {
0N/AJVM_ENTRY(jobjectArray, JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly))
0N/A || Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) {
0N/A oop res = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), 0 , CHECK_NULL);
0N/A instanceKlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)));
0N/A int num_constructors = 0;
0N/A for (i = 0; i < methods_length; i++) {
0N/A objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), num_constructors, CHECK_NULL);
0N/A for (i = 0; i < methods_length; i++) {
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Constant pool index out of bounds");
0N/AJVM_ENTRY(jclass, JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/AJVM_ENTRY(jclass, JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/Astatic jobject get_method_at_helper(constantPoolHandle cp, jint index, bool force_resolution, TRAPS) {
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/A if (force_resolution) {
0N/A THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "Unable to look up method in target class");
0N/AJVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/AJVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/Astatic jobject get_field_at_helper(constantPoolHandle cp, jint index, bool force_resolution, TRAPS) {
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/A if (force_resolution) {
0N/A THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "Unable to look up field in target class");
0N/AJVM_ENTRY(jobject, JVM_ConstantPoolGetFieldAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/AJVM_ENTRY(jobject, JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/AJVM_ENTRY(jobjectArray, JVM_ConstantPoolGetMemberRefInfoAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/A objArrayOop dest_o = oopFactory::new_objArray(SystemDictionary::String_klass(), 3, CHECK_NULL);
0N/AJVM_ENTRY(jint, JVM_ConstantPoolGetIntAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/AJVM_ENTRY(jlong, JVM_ConstantPoolGetLongAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/AJVM_ENTRY(jfloat, JVM_ConstantPoolGetFloatAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/AJVM_ENTRY(jdouble, JVM_ConstantPoolGetDoubleAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/AJVM_ENTRY(jstring, JVM_ConstantPoolGetStringAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/AJVM_ENTRY(jstring, JVM_ConstantPoolGetUTF8At(JNIEnv *env, jobject unused, jobject jcpool, jint index))
0N/A constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
0N/A THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
0N/A// Verification ////////////////////////////////////////////////////////////////////////////////
0N/A// Reflection for the verifier /////////////////////////////////////////////////////////////////
0N/A// Please, refer to the description in the jvmtiThreadSate.hpp.
0N/AJVM_QUICK_ENTRY(void, JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cls, jint method_index, unsigned short *exceptions))
0N/AJVM_QUICK_ENTRY(jint, JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cls, jint method_index))
0N/AJVM_QUICK_ENTRY(void, JVM_GetMethodIxByteCode(JNIEnv *env, jclass cls, jint method_index, unsigned char *code))
248N/AJVM_QUICK_ENTRY(jint, JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cls, jint method_index))
0N/AJVM_QUICK_ENTRY(void, JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cls, jint method_index, jint entry_index, JVM_ExceptionTableEntryType *entry))
254N/AJVM_QUICK_ENTRY(jint, JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cls, int method_index))
0N/A return instanceKlass::cast(k)->field_access_flags(field_index) & JVM_RECOGNIZED_FIELD_MODIFIERS;
0N/A case JVM_CONSTANT_Fieldref:
case JVM_CONSTANT_Methodref:
return NULL;
case JVM_CONSTANT_Methodref:
return NULL;
case JVM_CONSTANT_Fieldref:
return NULL;
case JVM_CONSTANT_Fieldref: {
return NULL;
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_InterfaceMethodref: {
return NULL;
case JVM_CONSTANT_Fieldref: {
JVM_QUICK_ENTRY(jint, JVM_GetCPMethodModifiers(JNIEnv *env, jclass cls, int cp_index, jclass called_cls))
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_InterfaceMethodref: {
for (int i = 0; i < methods_count; i++) {
// Misc //////////////////////////////////////////////////////////////////////////////////////////////
// IO functions ////////////////////////////////////////////////////////////////////////////////////////
if (result >= 0) {
return result;
switch(errno) {
case EEXIST:
return JVM_EEXIST;
int len;
return len;
int len;
return len;
int len;
return len;
void jio_print(const char* s) {
obj,
THREAD);
bool throw_illegal_thread_state = false;
throw_illegal_thread_state = true;
if (throw_illegal_thread_state) {
delete native_thread;
"JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]",
#ifndef USDT2
if (ConvertYieldToSleep) {
if (millis < 0) {
#ifndef USDT2
millis);
if (millis == 0) {
if (ConvertSleepToYield) {
if (!HAS_PENDING_EXCEPTION) {
#ifndef USDT2
#ifndef USDT2
bool throw_illegal_thread_state = false;
int count = 0;
throw_illegal_thread_state = true;
if (throw_illegal_thread_state) {
return count;
JVM_QUICK_ENTRY(jboolean, JVM_IsInterrupted(JNIEnv* env, jobject jthread, jboolean clear_interrupted))
return JNI_FALSE;
// java.lang.SecurityManager ///////////////////////////////////////////////////////////////////////
if (trusted) return true;
if (!m->is_native()) {
return NULL;
if (!m->is_native()) {
return NULL;
int depth = 0;
depth++;
last = l;
int index = 0;
int depth = 0;
return depth;
depth++;
int depth = 0;
if (!m->is_native()) {
return depth;
depth++;
bool force_verify_field_access(klassOop current_class, klassOop field_class, AccessFlags access, bool classloader_only) {
return (!access.is_private() && instanceKlass::cast(current_class)->is_same_class_package(field_class));
JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass currClass, jclass initClass))
if (m.is_null()) {
return NULL;
false, thread);
return result;
// Array ///////////////////////////////////////////////////////////////////////////////////////////
return arrayOop(a);
return a->length();
return value;
if (a->is_objArray()) {
JVM_ENTRY(void, JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, unsigned char vCode))
oop result = Reflection::reflect_new_multi_array(element_mirror, typeArrayOop(dim_array), CHECK_NULL);
return result;
JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen))
return result;
return result;
return result;
void *load_result;
return load_result;
return g_isnan(a);
void initialize_converter_functions() {
int_bits_to_float_fn = CAST_TO_FN_PTR(IntBitsToFloatFn , NativeLookup::base_library_lookup("java/lang/Float" , "intBitsToFloat" , "(I)F"));
long_bits_to_double_fn = CAST_TO_FN_PTR(LongBitsToDoubleFn, NativeLookup::base_library_lookup("java/lang/Double", "longBitsToDouble", "(J)D"));
float_to_int_bits_fn = CAST_TO_FN_PTR(FloatToIntBitsFn , NativeLookup::base_library_lookup("java/lang/Float" , "floatToIntBits" , "(F)I"));
double_to_long_bits_fn = CAST_TO_FN_PTR(DoubleToLongBitsFn, NativeLookup::base_library_lookup("java/lang/Double", "doubleToLongBits", "(D)J"));
if (nfids == 0) return;
int field_offset;
off++;
off++;
if (nfids == 0) return;
jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
klassOop klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
#ifndef PRODUCT
JNIEXPORT jboolean JNICALL JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get);
return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, INTERNAL);
intx v;
jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, INTERNAL);
return result;
// Method ///////////////////////////////////////////////////////////////////////////////////////////
return res;
return res;
// Atomic ///////////////////////////////////////////////////////////////////////////////////////////
JVM_ENTRY(jboolean, JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fid, jlong oldVal, jlong newVal))
objArrayOop r = oopFactory::new_objArray(SystemDictionary::Thread_klass(), num_threads, CHECK_NULL);
for (int i = 0; i < num_threads; i++) {
if (num_threads == 0) {
GrowableArray<instanceHandle>* thread_handle_array = new GrowableArray<instanceHandle>(num_threads);
for (int i = 0; i < num_threads; i++) {
Handle stacktraces = ThreadService::dump_stack_traces(thread_handle_array, num_threads, CHECK_NULL);
// com.sun.tools.attach.VirtualMachine agent properties support
return properties;
return NULL;
return NULL;
return NULL;
if (encl_method_class_idx == 0) {
return NULL;
if (encl_method_method_idx != 0) {
switch (javaThreadState) {
case JAVA_THREAD_STATE_NEW : {
case JAVA_THREAD_STATE_RUNNABLE : {
case JAVA_THREAD_STATE_BLOCKED : {
case JAVA_THREAD_STATE_WAITING : {
case JAVA_THREAD_STATE_TIMED_WAITING : {
case JAVA_THREAD_STATE_TERMINATED : {
return NULL;
switch (javaThreadState) {
case JAVA_THREAD_STATE_NEW : {
case JAVA_THREAD_STATE_RUNNABLE : {
case JAVA_THREAD_STATE_BLOCKED : {
case JAVA_THREAD_STATE_WAITING : {
case JAVA_THREAD_STATE_TIMED_WAITING : {
case JAVA_THREAD_STATE_TERMINATED : {
return NULL;
// counter defined in runtimeService.cpp.
#ifdef KERNEL