< prev index next >

src/share/vm/prims/jni.cpp

Print this page

        

*** 664,674 **** #endif /* USDT2 */ oop sub_mirror = JNIHandles::resolve_non_null(sub); oop super_mirror = JNIHandles::resolve_non_null(super); if (java_lang_Class::is_primitive(sub_mirror) || java_lang_Class::is_primitive(super_mirror)) { ! jboolean ret = (sub_mirror == super_mirror); #ifndef USDT2 DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret); #else /* USDT2 */ HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN( ret); --- 664,674 ---- #endif /* USDT2 */ oop sub_mirror = JNIHandles::resolve_non_null(sub); oop super_mirror = JNIHandles::resolve_non_null(super); if (java_lang_Class::is_primitive(sub_mirror) || java_lang_Class::is_primitive(super_mirror)) { ! jboolean ret = sub_mirror == super_mirror; #ifndef USDT2 DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret); #else /* USDT2 */ HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN( ret);
*** 995,1005 **** HOTSPOT_JNI_ISSAMEOBJECT_ENTRY( env, r1, r2); #endif /* USDT2 */ oop a = JNIHandles::resolve(r1); oop b = JNIHandles::resolve(r2); ! jboolean ret = (a == b) ? JNI_TRUE : JNI_FALSE; #ifndef USDT2 DTRACE_PROBE1(hotspot_jni, IsSameObject__return, ret); #else /* USDT2 */ HOTSPOT_JNI_ISSAMEOBJECT_RETURN( ret); --- 995,1006 ---- HOTSPOT_JNI_ISSAMEOBJECT_ENTRY( env, r1, r2); #endif /* USDT2 */ oop a = JNIHandles::resolve(r1); oop b = JNIHandles::resolve(r2); ! jboolean ret = a == b ? JNI_TRUE : JNI_FALSE; ! #ifndef USDT2 DTRACE_PROBE1(hotspot_jni, IsSameObject__return, ret); #else /* USDT2 */ HOTSPOT_JNI_ISSAMEOBJECT_RETURN( ret);
*** 2627,2637 **** jobject ret = JNIHandles::make_local(env, o->obj_field(offset)); #if INCLUDE_ALL_GCS // If G1 is enabled and we are accessing the value of the referent // field in a reference object then we need to register a non-null // referent with the SATB barrier. ! if (UseG1GC) { bool needs_barrier = false; if (ret != NULL && offset == java_lang_ref_Reference::referent_offset && InstanceKlass::cast(k)->reference_type() != REF_NONE) { --- 2628,2638 ---- jobject ret = JNIHandles::make_local(env, o->obj_field(offset)); #if INCLUDE_ALL_GCS // If G1 is enabled and we are accessing the value of the referent // field in a reference object then we need to register a non-null // referent with the SATB barrier. ! if (UseG1GC || (UseShenandoahGC && ShenandoahKeepAliveBarrier)) { bool needs_barrier = false; if (ret != NULL && offset == java_lang_ref_Reference::referent_offset && InstanceKlass::cast(k)->reference_type() != REF_NONE) {
*** 4248,4271 **** } } } JNI_END JNI_ENTRY(void*, jni_GetPrimitiveArrayCritical(JNIEnv *env, jarray array, jboolean *isCopy)) JNIWrapper("GetPrimitiveArrayCritical"); #ifndef USDT2 DTRACE_PROBE3(hotspot_jni, GetPrimitiveArrayCritical__entry, env, array, isCopy); #else /* USDT2 */ HOTSPOT_JNI_GETPRIMITIVEARRAYCRITICAL_ENTRY( env, array, (uintptr_t *) isCopy); #endif /* USDT2 */ - GC_locker::lock_critical(thread); if (isCopy != NULL) { *isCopy = JNI_FALSE; } ! oop a = JNIHandles::resolve_non_null(array); assert(a->is_array(), "just checking"); BasicType type; if (a->is_objArray()) { type = T_OBJECT; } else { --- 4249,4289 ---- } } } JNI_END + static oop lock_gc_or_pin_object(JavaThread* thread, jobject obj) { + if (Universe::heap()->supports_object_pinning()) { + const oop o = JNIHandles::resolve_non_null(obj); + return Universe::heap()->pin_object(thread, o); + } else { + GC_locker::lock_critical(thread); + return JNIHandles::resolve_non_null(obj); + } + } + + static void unlock_gc_or_unpin_object(JavaThread* thread, jobject obj) { + if (Universe::heap()->supports_object_pinning()) { + const oop o = JNIHandles::resolve_non_null(obj); + return Universe::heap()->unpin_object(thread, o); + } else { + GC_locker::unlock_critical(thread); + } + } JNI_ENTRY(void*, jni_GetPrimitiveArrayCritical(JNIEnv *env, jarray array, jboolean *isCopy)) JNIWrapper("GetPrimitiveArrayCritical"); #ifndef USDT2 DTRACE_PROBE3(hotspot_jni, GetPrimitiveArrayCritical__entry, env, array, isCopy); #else /* USDT2 */ HOTSPOT_JNI_GETPRIMITIVEARRAYCRITICAL_ENTRY( env, array, (uintptr_t *) isCopy); #endif /* USDT2 */ if (isCopy != NULL) { *isCopy = JNI_FALSE; } ! oop a = lock_gc_or_pin_object(thread, array); assert(a->is_array(), "just checking"); BasicType type; if (a->is_objArray()) { type = T_OBJECT; } else {
*** 4289,4299 **** #else /* USDT2 */ HOTSPOT_JNI_RELEASEPRIMITIVEARRAYCRITICAL_ENTRY( env, array, carray, mode); #endif /* USDT2 */ // The array, carray and mode arguments are ignored ! GC_locker::unlock_critical(thread); #ifndef USDT2 DTRACE_PROBE(hotspot_jni, ReleasePrimitiveArrayCritical__return); #else /* USDT2 */ HOTSPOT_JNI_RELEASEPRIMITIVEARRAYCRITICAL_RETURN( ); --- 4307,4317 ---- #else /* USDT2 */ HOTSPOT_JNI_RELEASEPRIMITIVEARRAYCRITICAL_ENTRY( env, array, carray, mode); #endif /* USDT2 */ // The array, carray and mode arguments are ignored ! unlock_gc_or_unpin_object(thread, array); #ifndef USDT2 DTRACE_PROBE(hotspot_jni, ReleasePrimitiveArrayCritical__return); #else /* USDT2 */ HOTSPOT_JNI_RELEASEPRIMITIVEARRAYCRITICAL_RETURN( );
*** 4307,4321 **** DTRACE_PROBE3(hotspot_jni, GetStringCritical__entry, env, string, isCopy); #else /* USDT2 */ HOTSPOT_JNI_GETSTRINGCRITICAL_ENTRY( env, string, (uintptr_t *) isCopy); #endif /* USDT2 */ - GC_locker::lock_critical(thread); if (isCopy != NULL) { *isCopy = JNI_FALSE; } ! oop s = JNIHandles::resolve_non_null(string); int s_len = java_lang_String::length(s); typeArrayOop s_value = java_lang_String::value(s); int s_offset = java_lang_String::offset(s); const jchar* ret; if (s_len > 0) { --- 4325,4338 ---- DTRACE_PROBE3(hotspot_jni, GetStringCritical__entry, env, string, isCopy); #else /* USDT2 */ HOTSPOT_JNI_GETSTRINGCRITICAL_ENTRY( env, string, (uintptr_t *) isCopy); #endif /* USDT2 */ if (isCopy != NULL) { *isCopy = JNI_FALSE; } ! oop s = lock_gc_or_pin_object(thread, string); int s_len = java_lang_String::length(s); typeArrayOop s_value = java_lang_String::value(s); int s_offset = java_lang_String::offset(s); const jchar* ret; if (s_len > 0) {
*** 4340,4350 **** #else /* USDT2 */ HOTSPOT_JNI_RELEASESTRINGCRITICAL_ENTRY( env, str, (uint16_t *) chars); #endif /* USDT2 */ // The str and chars arguments are ignored ! GC_locker::unlock_critical(thread); #ifndef USDT2 DTRACE_PROBE(hotspot_jni, ReleaseStringCritical__return); #else /* USDT2 */ HOTSPOT_JNI_RELEASESTRINGCRITICAL_RETURN( ); --- 4357,4367 ---- #else /* USDT2 */ HOTSPOT_JNI_RELEASESTRINGCRITICAL_ENTRY( env, str, (uint16_t *) chars); #endif /* USDT2 */ // The str and chars arguments are ignored ! unlock_gc_or_unpin_object(thread, str); #ifndef USDT2 DTRACE_PROBE(hotspot_jni, ReleaseStringCritical__return); #else /* USDT2 */ HOTSPOT_JNI_RELEASESTRINGCRITICAL_RETURN( );
< prev index next >