< prev index next >

src/hotspot/share/prims/jni.cpp

Print this page




3672 
3673     jni_GetObjectRefType,
3674 
3675     // Module features
3676 
3677     jni_GetModule
3678 };
3679 
3680 
3681 // For jvmti use to modify jni function table.
3682 // Java threads in native contiues to run until it is transitioned
3683 // to VM at safepoint. Before the transition or before it is blocked
3684 // for safepoint it may access jni function table. VM could crash if
3685 // any java thread access the jni function table in the middle of memcpy.
3686 // To avoid this each function pointers are copied automically.
3687 void copy_jni_function_table(const struct JNINativeInterface_ *new_jni_NativeInterface) {
3688   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
3689   intptr_t *a = (intptr_t *) jni_functions();
3690   intptr_t *b = (intptr_t *) new_jni_NativeInterface;
3691   for (uint i=0; i <  sizeof(struct JNINativeInterface_)/sizeof(void *); i++) {
3692     Atomic::store(*b++, a++);
3693   }
3694 }
3695 
3696 void quicken_jni_functions() {
3697   // Replace Get<Primitive>Field with fast versions
3698   if (UseFastJNIAccessors && !VerifyJNIFields && !CountJNICalls && !CheckJNICalls) {
3699     address func;
3700     func = JNI_FastGetField::generate_fast_get_boolean_field();
3701     if (func != (address)-1) {
3702       jni_NativeInterface.GetBooleanField = (GetBooleanField_t)func;
3703     }
3704     func = JNI_FastGetField::generate_fast_get_byte_field();
3705     if (func != (address)-1) {
3706       jni_NativeInterface.GetByteField = (GetByteField_t)func;
3707     }
3708     func = JNI_FastGetField::generate_fast_get_char_field();
3709     if (func != (address)-1) {
3710       jni_NativeInterface.GetCharField = (GetCharField_t)func;
3711     }
3712     func = JNI_FastGetField::generate_fast_get_short_field();




3672 
3673     jni_GetObjectRefType,
3674 
3675     // Module features
3676 
3677     jni_GetModule
3678 };
3679 
3680 
3681 // For jvmti use to modify jni function table.
3682 // Java threads in native contiues to run until it is transitioned
3683 // to VM at safepoint. Before the transition or before it is blocked
3684 // for safepoint it may access jni function table. VM could crash if
3685 // any java thread access the jni function table in the middle of memcpy.
3686 // To avoid this each function pointers are copied automically.
3687 void copy_jni_function_table(const struct JNINativeInterface_ *new_jni_NativeInterface) {
3688   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
3689   intptr_t *a = (intptr_t *) jni_functions();
3690   intptr_t *b = (intptr_t *) new_jni_NativeInterface;
3691   for (uint i=0; i <  sizeof(struct JNINativeInterface_)/sizeof(void *); i++) {
3692     Atomic::store(a++, *b++);
3693   }
3694 }
3695 
3696 void quicken_jni_functions() {
3697   // Replace Get<Primitive>Field with fast versions
3698   if (UseFastJNIAccessors && !VerifyJNIFields && !CountJNICalls && !CheckJNICalls) {
3699     address func;
3700     func = JNI_FastGetField::generate_fast_get_boolean_field();
3701     if (func != (address)-1) {
3702       jni_NativeInterface.GetBooleanField = (GetBooleanField_t)func;
3703     }
3704     func = JNI_FastGetField::generate_fast_get_byte_field();
3705     if (func != (address)-1) {
3706       jni_NativeInterface.GetByteField = (GetByteField_t)func;
3707     }
3708     func = JNI_FastGetField::generate_fast_get_char_field();
3709     if (func != (address)-1) {
3710       jni_NativeInterface.GetCharField = (GetCharField_t)func;
3711     }
3712     func = JNI_FastGetField::generate_fast_get_short_field();


< prev index next >