jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c
author sjiang
Fri, 17 Apr 2015 09:40:02 +0200
changeset 30355 e37c7eba132f
parent 27493 jdk/src/java.management/share/native/libmanagement/Flag.c@8a2a7d7c52a0
child 40199 1795251e7dec
permissions -rw-r--r--
8042901: Allow com.sun.management to be in a different module to java.lang.management Reviewed-by: mchung, dfuchs, erikj, jbachorik
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
     2
 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5163
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5163
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5163
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5163
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5163
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <stdio.h>
6850
56966b0a6a0d 6989466: Miscellaneous compiler warnings in java/lang, java/util, java/io, sun/misc native code
alanb
parents: 5506
diff changeset
    28
#include <string.h>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <jni.h>
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    30
#include "management_ext.h"
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    31
#include "com_sun_management_internal_Flag.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
static jobject default_origin = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
static jobject vm_creation_origin = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
static jobject mgmt_origin = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
static jobject envvar_origin = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
static jobject config_file_origin = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
static jobject ergo_origin = NULL;
22299
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 7668
diff changeset
    39
static jobject attach_origin = NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
static jobject other_origin = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
JNIEXPORT jint JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    43
Java_com_sun_management_internal_Flag_getInternalFlagCount
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  (JNIEnv *env, jclass cls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    jlong count = jmm_interface->GetLongAttribute(env, NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
                                                  JMM_VM_GLOBAL_COUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    return (jint) count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
JNIEXPORT jobjectArray JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    52
  Java_com_sun_management_internal_Flag_getAllFlagNames
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
(JNIEnv *env, jclass cls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  return jmm_interface->GetVMGlobalNames(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
static jobject find_origin_constant(JNIEnv* env, const char* enum_name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    jvalue field;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    field = JNU_GetStaticFieldByName(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                                     NULL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                                     "com/sun/management/VMOption$Origin",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                                     enum_name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                     "Lcom/sun/management/VMOption$Origin;");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    return (*env)->NewGlobalRef(env, field.l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
JNIEXPORT void JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    69
Java_com_sun_management_internal_Flag_initialize
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  (JNIEnv *env, jclass cls)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    default_origin = find_origin_constant(env, "DEFAULT");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    vm_creation_origin = find_origin_constant(env, "VM_CREATION");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    mgmt_origin = find_origin_constant(env, "MANAGEMENT");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    envvar_origin = find_origin_constant(env, "ENVIRON_VAR");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    config_file_origin = find_origin_constant(env, "CONFIG_FILE");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    ergo_origin = find_origin_constant(env, "ERGONOMIC");
22299
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 7668
diff changeset
    78
    attach_origin = find_origin_constant(env, "ATTACH_ON_DEMAND");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    other_origin = find_origin_constant(env, "OTHER");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
JNIEXPORT jint JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    83
Java_com_sun_management_internal_Flag_getFlags
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  (JNIEnv *env, jclass cls, jobjectArray names, jobjectArray flags, jint count)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    jint num_flags, i, index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    jmmVMGlobal* globals;
4915
fe435c741ec8 6924497: HotSpotDiagnosticsMXBean.getDiagnosticOptions throws NPE
mchung
parents: 2
diff changeset
    88
    size_t gsize;
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
    89
    const char* class_name = "com/sun/management/internal/Flag";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    const char* signature = "(Ljava/lang/String;Ljava/lang/Object;ZZLcom/sun/management/VMOption$Origin;)V";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    jobject origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    jobject valueObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    jobject flag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    if (flags == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        JNU_ThrowNullPointerException(env, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
23890
b8388c5af315 8029735: Enhance service mgmt natives
jbachorik
parents: 22299
diff changeset
   100
    if (count <= 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        JNU_ThrowIllegalArgumentException(env, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
23890
b8388c5af315 8029735: Enhance service mgmt natives
jbachorik
parents: 22299
diff changeset
   105
    gsize = (size_t)count * sizeof(jmmVMGlobal);
4915
fe435c741ec8 6924497: HotSpotDiagnosticsMXBean.getDiagnosticOptions throws NPE
mchung
parents: 2
diff changeset
   106
    globals = (jmmVMGlobal*) malloc(gsize);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    if (globals == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        JNU_ThrowOutOfMemoryError(env, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
4915
fe435c741ec8 6924497: HotSpotDiagnosticsMXBean.getDiagnosticOptions throws NPE
mchung
parents: 2
diff changeset
   112
    memset(globals, 0, gsize);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    num_flags = jmm_interface->GetVMGlobals(env, names, globals, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    if (num_flags == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        free(globals);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    index = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    for (i = 0; i < count; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        if (globals[i].name == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        switch (globals[i].type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        case JMM_VMGLOBAL_TYPE_JBOOLEAN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            valueObj = JNU_NewObjectByName(env, "java/lang/Boolean", "(Z)V",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                                           globals[i].value.z);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        case JMM_VMGLOBAL_TYPE_JSTRING:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            valueObj = globals[i].value.l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        case JMM_VMGLOBAL_TYPE_JLONG:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            valueObj = JNU_NewObjectByName(env, "java/lang/Long", "(J)V",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                                           globals[i].value.j);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            break;
27493
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   136
        case JMM_VMGLOBAL_TYPE_JDOUBLE:
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   137
            valueObj = JNU_NewObjectByName(env, "java/lang/Double", "(D)V",
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   138
                                           globals[i].value.d);
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   139
            break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        default:
5163
e13f471e8dd5 6915365: 3/4 assert(false,"Unsupported VMGlobal Type") at management.cpp:1540
dcubed
parents: 4915
diff changeset
   141
            // ignore unsupported type
e13f471e8dd5 6915365: 3/4 assert(false,"Unsupported VMGlobal Type") at management.cpp:1540
dcubed
parents: 4915
diff changeset
   142
            continue;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        switch (globals[i].origin) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        case JMM_VMGLOBAL_ORIGIN_DEFAULT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            origin = default_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        case JMM_VMGLOBAL_ORIGIN_COMMAND_LINE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            origin = vm_creation_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        case JMM_VMGLOBAL_ORIGIN_MANAGEMENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            origin = mgmt_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        case JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            origin = envvar_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        case JMM_VMGLOBAL_ORIGIN_CONFIG_FILE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            origin = config_file_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        case JMM_VMGLOBAL_ORIGIN_ERGONOMIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            origin = ergo_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            break;
22299
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 7668
diff changeset
   163
        case JMM_VMGLOBAL_ORIGIN_ATTACH_ON_DEMAND:
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 7668
diff changeset
   164
            origin = attach_origin;
ee71d2eaa085 8028994: com.sun.management.VMOption is missing the ATTACH_ON_DEMAND origin
sla
parents: 7668
diff changeset
   165
            break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        case JMM_VMGLOBAL_ORIGIN_OTHER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            origin = other_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            // unknown origin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            origin = other_origin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        flag = JNU_NewObjectByName(env, class_name, signature, globals[i].name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                                   valueObj, globals[i].writeable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                                   globals[i].external, origin);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        if (flag == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            free(globals);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            JNU_ThrowOutOfMemoryError(env, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        (*env)->SetObjectArrayElement(env, flags, index, flag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        index++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    if (index != num_flags) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        JNU_ThrowInternalError(env, "Number of Flag objects created unmatched");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        free(globals);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    free(globals);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /* return the number of Flag objects created */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    return num_flags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
JNIEXPORT void JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
   199
Java_com_sun_management_internal_Flag_setLongValue
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
  (JNIEnv *env, jclass cls, jstring name, jlong value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
   jvalue v;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
   v.j = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
   jmm_interface->SetVMGlobal(env, name, v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
JNIEXPORT void JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
   209
Java_com_sun_management_internal_Flag_setDoubleValue
27493
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   210
  (JNIEnv *env, jclass cls, jstring name, jdouble value)
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   211
{
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   212
   jvalue v;
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   213
   v.d = value;
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   214
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   215
   jmm_interface->SetVMGlobal(env, name, v);
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   216
}
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   217
8a2a7d7c52a0 8061616: HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
jbachorik
parents: 25859
diff changeset
   218
JNIEXPORT void JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
   219
Java_com_sun_management_internal_Flag_setBooleanValue
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
  (JNIEnv *env, jclass cls, jstring name, jboolean value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
   jvalue v;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
   v.z = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
   jmm_interface->SetVMGlobal(env, name, v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
JNIEXPORT void JNICALL
30355
e37c7eba132f 8042901: Allow com.sun.management to be in a different module to java.lang.management
sjiang
parents: 27493
diff changeset
   229
Java_com_sun_management_internal_Flag_setStringValue
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
  (JNIEnv *env, jclass cls, jstring name, jstring value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
   jvalue v;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
   v.l = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
   jmm_interface->SetVMGlobal(env, name, v);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
}