1024 // if this is called during a safepoint 1025 1026 if (JvmtiExport::should_post_single_step()) { 1027 // We are called during regular safepoints and when the VM is 1028 // single stepping. If any thread is marked for single stepping, 1029 // then we may have JVMTI work to do. 1030 JvmtiExport::at_single_stepping_point(thread, method(thread), bcp(thread)); 1031 } 1032 IRT_END 1033 1034 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj, 1035 ConstantPoolCacheEntry *cp_entry)) 1036 1037 // check the access_flags for the field in the klass 1038 1039 InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass()); 1040 int index = cp_entry->field_index(); 1041 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return; 1042 1043 bool is_static = (obj == NULL); 1044 HandleMark hm(thread); 1045 1046 Handle h_obj; 1047 if (!is_static) { 1048 // non-static field accessors have an object, but we need a handle 1049 h_obj = Handle(thread, obj); 1050 } 1051 instanceKlassHandle h_cp_entry_f1(thread, (Klass*)cp_entry->f1_as_klass()); 1052 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static); 1053 JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid); 1054 IRT_END 1055 1056 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread, 1057 oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value)) 1058 1059 Klass* k = (Klass*)cp_entry->f1_as_klass(); 1060 1061 // check the access_flags for the field in the klass 1062 InstanceKlass* ik = InstanceKlass::cast(k); 1063 int index = cp_entry->field_index(); 1064 // bail out if field modifications are not watched 1065 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return; 1066 1067 char sig_type = '\0'; 1068 1069 switch(cp_entry->flag_state()) { 1070 case btos: sig_type = 'Z'; break; 1071 case ctos: sig_type = 'C'; break; 1072 case stos: sig_type = 'S'; break; 1073 case itos: sig_type = 'I'; break; 1074 case ftos: sig_type = 'F'; break; 1075 case atos: sig_type = 'L'; break; 1076 case ltos: sig_type = 'J'; break; 1077 case dtos: sig_type = 'D'; break; 1078 default: ShouldNotReachHere(); return; 1079 } 1080 bool is_static = (obj == NULL); 1081 1082 HandleMark hm(thread); 1083 instanceKlassHandle h_klass(thread, k); 1084 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_klass, cp_entry->f2_as_index(), is_static); 1085 jvalue fvalue; 1086 #ifdef _LP64 1087 fvalue = *value; 1088 #else 1089 // Long/double values are stored unaligned and also noncontiguously with 1090 // tagged stacks. We can't just do a simple assignment even in the non- 1091 // J/D cases because a C++ compiler is allowed to assume that a jvalue is 1092 // 8-byte aligned, and interpreter stack slots are only 4-byte aligned. 1093 // We assume that the two halves of longs/doubles are stored in interpreter 1094 // stack slots in platform-endian order. 1095 jlong_accessor u; 1096 jint* newval = (jint*)value; 1097 u.words[0] = newval[0]; 1098 u.words[1] = newval[Interpreter::stackElementWords]; // skip if tag 1099 fvalue.j = u.long_value; 1100 #endif // _LP64 1101 1102 Handle h_obj; 1103 if (!is_static) { 1104 // non-static field accessors have an object, but we need a handle | 1024 // if this is called during a safepoint 1025 1026 if (JvmtiExport::should_post_single_step()) { 1027 // We are called during regular safepoints and when the VM is 1028 // single stepping. If any thread is marked for single stepping, 1029 // then we may have JVMTI work to do. 1030 JvmtiExport::at_single_stepping_point(thread, method(thread), bcp(thread)); 1031 } 1032 IRT_END 1033 1034 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj, 1035 ConstantPoolCacheEntry *cp_entry)) 1036 1037 // check the access_flags for the field in the klass 1038 1039 InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass()); 1040 int index = cp_entry->field_index(); 1041 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return; 1042 1043 bool is_static = (obj == NULL); 1044 bool is_final = ((ik->field_access_flags(index) & JVM_ACC_FINAL) != 0); 1045 HandleMark hm(thread); 1046 1047 Handle h_obj; 1048 if (!is_static) { 1049 // non-static field accessors have an object, but we need a handle 1050 h_obj = Handle(thread, obj); 1051 } 1052 instanceKlassHandle h_cp_entry_f1(thread, (Klass*)cp_entry->f1_as_klass()); 1053 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static, is_final); 1054 JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid); 1055 IRT_END 1056 1057 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread, 1058 oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value)) 1059 1060 Klass* k = (Klass*)cp_entry->f1_as_klass(); 1061 1062 // check the access_flags for the field in the klass 1063 InstanceKlass* ik = InstanceKlass::cast(k); 1064 int index = cp_entry->field_index(); 1065 // bail out if field modifications are not watched 1066 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return; 1067 1068 char sig_type = '\0'; 1069 1070 switch(cp_entry->flag_state()) { 1071 case btos: sig_type = 'Z'; break; 1072 case ctos: sig_type = 'C'; break; 1073 case stos: sig_type = 'S'; break; 1074 case itos: sig_type = 'I'; break; 1075 case ftos: sig_type = 'F'; break; 1076 case atos: sig_type = 'L'; break; 1077 case ltos: sig_type = 'J'; break; 1078 case dtos: sig_type = 'D'; break; 1079 default: ShouldNotReachHere(); return; 1080 } 1081 bool is_static = (obj == NULL); 1082 bool is_final = ((ik->field_access_flags(index) & JVM_ACC_FINAL) != 0); 1083 1084 HandleMark hm(thread); 1085 instanceKlassHandle h_klass(thread, k); 1086 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_klass, cp_entry->f2_as_index(), is_static, is_final); 1087 jvalue fvalue; 1088 #ifdef _LP64 1089 fvalue = *value; 1090 #else 1091 // Long/double values are stored unaligned and also noncontiguously with 1092 // tagged stacks. We can't just do a simple assignment even in the non- 1093 // J/D cases because a C++ compiler is allowed to assume that a jvalue is 1094 // 8-byte aligned, and interpreter stack slots are only 4-byte aligned. 1095 // We assume that the two halves of longs/doubles are stored in interpreter 1096 // stack slots in platform-endian order. 1097 jlong_accessor u; 1098 jint* newval = (jint*)value; 1099 u.words[0] = newval[0]; 1100 u.words[1] = newval[Interpreter::stackElementWords]; // skip if tag 1101 fvalue.j = u.long_value; 1102 #endif // _LP64 1103 1104 Handle h_obj; 1105 if (!is_static) { 1106 // non-static field accessors have an object, but we need a handle |