Mercurial > hg > graal-compiler
comparison src/share/vm/prims/jni.cpp @ 20324:8ae0d26ab728
8046919: jni_PushLocalFrame OOM - increase MAX_REASONABLE_LOCAL_CAPACITY
Summary: Increase the previous limit from 4k to 64k, added "-XX:MaxJNILocalCapacity=<capacity>" flag
Reviewed-by: hseigel, fparain
author | dsimms |
---|---|
date | Thu, 14 Aug 2014 10:56:34 +0200 |
parents | fa62fb12cdca |
children | 1f1d373cd044 |
comparison
equal
deleted
inserted
replaced
20323:5c8178d7dd35 | 20324:8ae0d26ab728 |
---|---|
290 } | 290 } |
291 guarantee(InstanceKlass::cast(k)->contains_field_offset(offset), | 291 guarantee(InstanceKlass::cast(k)->contains_field_offset(offset), |
292 "Bug in native code: jfieldID offset must address interior of object"); | 292 "Bug in native code: jfieldID offset must address interior of object"); |
293 } | 293 } |
294 | 294 |
295 // Pick a reasonable higher bound for local capacity requested | |
296 // for EnsureLocalCapacity and PushLocalFrame. We don't want it too | |
297 // high because a test (or very unusual application) may try to allocate | |
298 // that many handles and run out of swap space. An implementation is | |
299 // permitted to allocate more handles than the ensured capacity, so this | |
300 // value is set high enough to prevent compatibility problems. | |
301 const int MAX_REASONABLE_LOCAL_CAPACITY = 4*K; | |
302 | |
303 | |
304 // Wrapper to trace JNI functions | 295 // Wrapper to trace JNI functions |
305 | 296 |
306 #ifdef ASSERT | 297 #ifdef ASSERT |
307 Histogram* JNIHistogram; | 298 Histogram* JNIHistogram; |
308 static volatile jint JNIHistogram_lock = 0; | 299 static volatile jint JNIHistogram_lock = 0; |
878 #else /* USDT2 */ | 869 #else /* USDT2 */ |
879 HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY( | 870 HOTSPOT_JNI_PUSHLOCALFRAME_ENTRY( |
880 env, capacity); | 871 env, capacity); |
881 #endif /* USDT2 */ | 872 #endif /* USDT2 */ |
882 //%note jni_11 | 873 //%note jni_11 |
883 if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) { | 874 if (capacity < 0 || |
875 ((MaxJNILocalCapacity > 0) && (capacity > MaxJNILocalCapacity))) { | |
884 #ifndef USDT2 | 876 #ifndef USDT2 |
885 DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR); | 877 DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR); |
886 #else /* USDT2 */ | 878 #else /* USDT2 */ |
887 HOTSPOT_JNI_PUSHLOCALFRAME_RETURN( | 879 HOTSPOT_JNI_PUSHLOCALFRAME_RETURN( |
888 (uint32_t)JNI_ERR); | 880 (uint32_t)JNI_ERR); |
1037 #else /* USDT2 */ | 1029 #else /* USDT2 */ |
1038 HOTSPOT_JNI_ENSURELOCALCAPACITY_ENTRY( | 1030 HOTSPOT_JNI_ENSURELOCALCAPACITY_ENTRY( |
1039 env, capacity); | 1031 env, capacity); |
1040 #endif /* USDT2 */ | 1032 #endif /* USDT2 */ |
1041 jint ret; | 1033 jint ret; |
1042 if (capacity >= 0 && capacity <= MAX_REASONABLE_LOCAL_CAPACITY) { | 1034 if (capacity >= 0 && |
1035 ((MaxJNILocalCapacity <= 0) || (capacity <= MaxJNILocalCapacity))) { | |
1043 ret = JNI_OK; | 1036 ret = JNI_OK; |
1044 } else { | 1037 } else { |
1045 ret = JNI_ERR; | 1038 ret = JNI_ERR; |
1046 } | 1039 } |
1047 #ifndef USDT2 | 1040 #ifndef USDT2 |