diff -r b1e37377b2a3 -r b6c37f4753fd jdk/src/share/native/sun/management/HotSpotDiagnostic.c --- a/jdk/src/share/native/sun/management/HotSpotDiagnostic.c Wed Feb 15 09:29:05 2012 -0800 +++ b/jdk/src/share/native/sun/management/HotSpotDiagnostic.c Wed Feb 15 10:46:55 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,141 +34,3 @@ { jmm_interface->DumpHeap0(env, outputfile, live); } - -JNIEXPORT jobjectArray JNICALL -Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0 - (JNIEnv *env, jobject dummy) -{ - if ((jmm_version > JMM_VERSION_1_2_1) - || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) { - return jmm_interface->GetDiagnosticCommands(env); - } - JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", - "Diagnostic commands are not supported by this VM"); -} - -jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command, - int num_arg) { - int i; - jobject obj; - jobjectArray result; - dcmdArgInfo* dcmd_arg_info_array; - jclass dcmdArgInfoCls; - jclass arraysCls; - jmethodID mid; - jobject resultList; - - dcmd_arg_info_array = (dcmdArgInfo*) malloc(num_arg * sizeof(dcmdArgInfo)); - if (dcmd_arg_info_array == NULL) { - return NULL; - } - jmm_interface->GetDiagnosticCommandArgumentsInfo(env, command, - dcmd_arg_info_array); - dcmdArgInfoCls = (*env)->FindClass(env, - "com/sun/management/DiagnosticCommandArgumentInfo"); - result = (*env)->NewObjectArray(env, num_arg, dcmdArgInfoCls, NULL); - if (result == NULL) { - free(dcmd_arg_info_array); - return NULL; - } - for (i=0; iNewStringUTF(env,dcmd_arg_info_array[i].name), - (*env)->NewStringUTF(env,dcmd_arg_info_array[i].description), - (*env)->NewStringUTF(env,dcmd_arg_info_array[i].type), - dcmd_arg_info_array[i].default_string == NULL ? NULL: - (*env)->NewStringUTF(env, dcmd_arg_info_array[i].default_string), - dcmd_arg_info_array[i].mandatory, - dcmd_arg_info_array[i].option, - dcmd_arg_info_array[i].position); - if (obj == NULL) { - free(dcmd_arg_info_array); - return NULL; - } - (*env)->SetObjectArrayElement(env, result, i, obj); - } - free(dcmd_arg_info_array); - arraysCls = (*env)->FindClass(env, "java/util/Arrays"); - mid = (*env)->GetStaticMethodID(env, arraysCls, - "asList", "([Ljava/lang/Object;)Ljava/util/List;"); - resultList = (*env)->CallStaticObjectMethod(env, arraysCls, mid, result); - return resultList; -} - -/* Throws IllegalArgumentException if at least one the diagnostic command - * passed in argument is not supported by the JVM - */ -JNIEXPORT jobjectArray JNICALL -Java_sun_management_HotSpotDiagnostic_getDiagnosticCommandInfo0 -(JNIEnv *env, jobject dummy, jobjectArray commands) -{ - int i; - jclass dcmdInfoCls; - jobject result; - jobjectArray args; - jobject obj; - - if (commands == NULL) { - JNU_ThrowNullPointerException(env, "Invalid String Array"); - return NULL; - } - if ((jmm_version > JMM_VERSION_1_2_1) - || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) { - jsize num_commands = (*env)->GetArrayLength(env, commands); - dcmdInfo* dcmd_info_array = (dcmdInfo*) malloc(num_commands * - sizeof(dcmdInfo)); - if (dcmd_info_array == NULL) { - JNU_ThrowOutOfMemoryError(env, NULL); - } - jmm_interface->GetDiagnosticCommandInfo(env, commands, dcmd_info_array); - dcmdInfoCls = (*env)->FindClass(env, - "com/sun/management/DiagnosticCommandInfo"); - result = (*env)->NewObjectArray(env, num_commands, dcmdInfoCls, NULL); - if (result == NULL) { - free(dcmd_info_array); - JNU_ThrowOutOfMemoryError(env, 0); - } - for (i=0; iGetObjectArrayElement(env,commands,i), - dcmd_info_array[i].num_arguments); - if (args == NULL) { - free(dcmd_info_array); - JNU_ThrowOutOfMemoryError(env, 0); - } - obj = JNU_NewObjectByName(env, - "com/sun/management/DiagnosticCommandInfo", - "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/util/List;)V", - (*env)->NewStringUTF(env,dcmd_info_array[i].name), - (*env)->NewStringUTF(env,dcmd_info_array[i].description), - (*env)->NewStringUTF(env,dcmd_info_array[i].impact), - dcmd_info_array[i].enabled, - args); - if (obj == NULL) { - free(dcmd_info_array); - JNU_ThrowOutOfMemoryError(env, 0); - } - (*env)->SetObjectArrayElement(env, result, i, obj); - } - free(dcmd_info_array); - return result; - } - JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", - "Diagnostic commands are not supported by this VM"); -} - -/* Throws IllegalArgumentException if the diagnostic command - * passed in argument is not supported by the JVM - */ -JNIEXPORT jstring JNICALL -Java_sun_management_HotSpotDiagnostic_executeDiagnosticCommand0 -(JNIEnv *env, jobject dummy, jstring command) { - if((jmm_version > JMM_VERSION_1_2_1 ) - || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) { - return jmm_interface->ExecuteDiagnosticCommand(env, command); - } - JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", - "Diagnostic commands are not supported by this VM"); -}