< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page
rev 52582 : 4947890: Minimize JNI upcalls in system-properties initialization
Reviewed-by: erikj

*** 352,385 **** } #define PUTPROP(props, name, value) set_property((props), (name), (value), CHECK_(properties)); ! ! JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties)) ! JVMWrapper("JVM_InitProperties"); ! ResourceMark rm; ! ! Handle props(THREAD, JNIHandles::resolve_non_null(properties)); ! ! // System property list includes both user set via -D option and ! // jvm system specific properties. ! for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) { ! if (strcmp(p->key(), "sun.nio.MaxDirectMemorySize") == 0) // Can not be defined with -D ! continue; ! PUTPROP(props, p->key(), p->value()); } // Convert the -XX:MaxDirectMemorySize= command line flag // to the sun.nio.MaxDirectMemorySize property. // Do this after setting user properties to prevent people // from setting the value with a -D option, as requested. // Leave empty if not supplied if (!FLAG_IS_DEFAULT(MaxDirectMemorySize)) { char as_chars[256]; jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize); ! PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars); } // JVM monitoring and management support // Add the sun.management.compiler property for the compiler's name { --- 352,407 ---- } #define PUTPROP(props, name, value) set_property((props), (name), (value), CHECK_(properties)); ! /* ! * Return all of the system properties in a Java String array with alternating ! * names and values from the jvm SystemProperty. ! * Which includes some internal and all commandline -D defined properties. ! */ ! JVM_ENTRY(jobjectArray, JVM_GetProperties(JNIEnv *env)) ! JVMWrapper("JVM_GetProperties"); ! ResourceMark rm(THREAD); ! HandleMark hm(THREAD); ! int ndx = 0; ! int fixedCount = 2; ! ! SystemProperty* p = Arguments::system_properties(); ! int count = Arguments::PropertyList_count(p); ! ! // Allocate result String array ! InstanceKlass* ik = SystemDictionary::String_klass(); ! objArrayOop r = oopFactory::new_objArray(ik, (count + fixedCount) * 2, CHECK_NULL); ! objArrayHandle result_h(THREAD, r); ! ! while (p != NULL) { ! const char * key = p->key(); ! if (strcmp(key, "sun.nio.MaxDirectMemorySize") != 0) { ! const char * value = p->value(); ! Handle key_str = java_lang_String::create_from_platform_dependent_str(key, CHECK_NULL); ! Handle value_str = java_lang_String::create_from_platform_dependent_str((value != NULL ? value : ""), CHECK_NULL); ! result_h->obj_at_put(ndx * 2, key_str()); ! result_h->obj_at_put(ndx * 2 + 1, value_str()); ! ndx++; ! } ! p = p->next(); } // Convert the -XX:MaxDirectMemorySize= command line flag // to the sun.nio.MaxDirectMemorySize property. // Do this after setting user properties to prevent people // from setting the value with a -D option, as requested. // Leave empty if not supplied if (!FLAG_IS_DEFAULT(MaxDirectMemorySize)) { char as_chars[256]; jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize); ! Handle key_str = java_lang_String::create_from_platform_dependent_str("sun.nio.MaxDirectMemorySize", CHECK_NULL); ! Handle value_str = java_lang_String::create_from_platform_dependent_str(as_chars, CHECK_NULL); ! result_h->obj_at_put(ndx * 2, key_str()); ! result_h->obj_at_put(ndx * 2 + 1, value_str()); ! ndx++; } // JVM monitoring and management support // Add the sun.management.compiler property for the compiler's name {
*** 404,418 **** #endif // compilers #endif // TIERED if (*compiler_name != '\0' && (Arguments::mode() != Arguments::_int)) { ! PUTPROP(props, "sun.management.compiler", compiler_name); } } ! return properties; JVM_END /* * Return the temporary directory that the VM uses for the attach --- 426,444 ---- #endif // compilers #endif // TIERED if (*compiler_name != '\0' && (Arguments::mode() != Arguments::_int)) { ! Handle key_str = java_lang_String::create_from_platform_dependent_str("sun.management.compiler", CHECK_NULL); ! Handle value_str = java_lang_String::create_from_platform_dependent_str(compiler_name, CHECK_NULL); ! result_h->obj_at_put(ndx * 2, key_str()); ! result_h->obj_at_put(ndx * 2 + 1, value_str()); ! ndx++; } } ! return (jobjectArray) JNIHandles::make_local(env, result_h()); JVM_END /* * Return the temporary directory that the VM uses for the attach
< prev index next >