8046919: jni_PushLocalFrame OOM - increase MAX_REASONABLE_LOCAL_CAPACITY
Increase the previous limit from 4k to 64k, added "-XX:MaxJNILocalCapacity=<capacity>" flag Reviewed-by: hseigel, fparain
This commit is contained in:
parent
23b30dee7e
commit
e5b71580fb
@ -247,15 +247,6 @@ void jfieldIDWorkaround::verify_instance_jfieldID(Klass* k, jfieldID id) {
|
|||||||
"Bug in native code: jfieldID offset must address interior of object");
|
"Bug in native code: jfieldID offset must address interior of object");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a reasonable higher bound for local capacity requested
|
|
||||||
// for EnsureLocalCapacity and PushLocalFrame. We don't want it too
|
|
||||||
// high because a test (or very unusual application) may try to allocate
|
|
||||||
// that many handles and run out of swap space. An implementation is
|
|
||||||
// permitted to allocate more handles than the ensured capacity, so this
|
|
||||||
// value is set high enough to prevent compatibility problems.
|
|
||||||
const int MAX_REASONABLE_LOCAL_CAPACITY = 4*K;
|
|
||||||
|
|
||||||
|
|
||||||
// Wrapper to trace JNI functions
|
// Wrapper to trace JNI functions
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
@ -741,7 +732,8 @@ JNI_ENTRY(jint, jni_PushLocalFrame(JNIEnv *env, jint capacity))
|
|||||||
HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY(env, capacity);
|
HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY(env, capacity);
|
||||||
|
|
||||||
//%note jni_11
|
//%note jni_11
|
||||||
if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) {
|
if (capacity < 0 ||
|
||||||
|
((MaxJNILocalCapacity > 0) && (capacity > MaxJNILocalCapacity))) {
|
||||||
HOTSPOT_JNI_PUSHLOCALFRAME_RETURN((uint32_t)JNI_ERR);
|
HOTSPOT_JNI_PUSHLOCALFRAME_RETURN((uint32_t)JNI_ERR);
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
@ -844,7 +836,8 @@ JNI_LEAF(jint, jni_EnsureLocalCapacity(JNIEnv *env, jint capacity))
|
|||||||
HOTSPOT_JNI_ENSURELOCALCAPACITY_ENTRY(env, capacity);
|
HOTSPOT_JNI_ENSURELOCALCAPACITY_ENTRY(env, capacity);
|
||||||
|
|
||||||
jint ret;
|
jint ret;
|
||||||
if (capacity >= 0 && capacity <= MAX_REASONABLE_LOCAL_CAPACITY) {
|
if (capacity >= 0 &&
|
||||||
|
((MaxJNILocalCapacity <= 0) || (capacity <= MaxJNILocalCapacity))) {
|
||||||
ret = JNI_OK;
|
ret = JNI_OK;
|
||||||
} else {
|
} else {
|
||||||
ret = JNI_ERR;
|
ret = JNI_ERR;
|
||||||
|
@ -1216,6 +1216,11 @@ class CommandLineFlags {
|
|||||||
product(bool, UseFastJNIAccessors, true, \
|
product(bool, UseFastJNIAccessors, true, \
|
||||||
"Use optimized versions of Get<Primitive>Field") \
|
"Use optimized versions of Get<Primitive>Field") \
|
||||||
\
|
\
|
||||||
|
product(intx, MaxJNILocalCapacity, 65536, \
|
||||||
|
"Maximum allowable local JNI handle capacity to " \
|
||||||
|
"EnsureLocalCapacity() and PushLocalFrame(), " \
|
||||||
|
"where <= 0 is unlimited, default: 65536") \
|
||||||
|
\
|
||||||
product(bool, EagerXrunInit, false, \
|
product(bool, EagerXrunInit, false, \
|
||||||
"Eagerly initialize -Xrun libraries; allows startup profiling, " \
|
"Eagerly initialize -Xrun libraries; allows startup profiling, " \
|
||||||
"but not all -Xrun libraries may support the state of the VM " \
|
"but not all -Xrun libraries may support the state of the VM " \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user