270 bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) { 271 return _method == bp._method 272 && _bci == bp._bci; 273 } 274 275 bool JvmtiBreakpoint::is_valid() { 276 // class loader can be NULL 277 return _method != NULL && 278 _bci >= 0; 279 } 280 281 address JvmtiBreakpoint::getBcp() const { 282 return _method->bcp_from(_bci); 283 } 284 285 void JvmtiBreakpoint::each_method_version_do(method_action meth_act) { 286 ((Method*)_method->*meth_act)(_bci); 287 288 // add/remove breakpoint to/from versions of the method that are EMCP. 289 Thread *thread = Thread::current(); 290 instanceKlassHandle ikh = instanceKlassHandle(thread, _method->method_holder()); 291 Symbol* m_name = _method->name(); 292 Symbol* m_signature = _method->signature(); 293 294 // search previous versions if they exist 295 for (InstanceKlass* pv_node = ikh->previous_versions(); 296 pv_node != NULL; 297 pv_node = pv_node->previous_versions()) { 298 Array<Method*>* methods = pv_node->methods(); 299 300 for (int i = methods->length() - 1; i >= 0; i--) { 301 Method* method = methods->at(i); 302 // Only set breakpoints in running EMCP methods. 303 if (method->is_running_emcp() && 304 method->name() == m_name && 305 method->signature() == m_signature) { 306 ResourceMark rm; 307 log_debug(redefine, class, breakpoint) 308 ("%sing breakpoint in %s(%s)", meth_act == &Method::set_breakpoint ? "sett" : "clear", 309 method->name()->as_C_string(), method->signature()->as_C_string()); 310 (method->*meth_act)(_bci); 311 break; 312 } 313 } 314 } 315 } 679 case T_BOOLEAN: 680 slot_type = T_INT; 681 break; 682 case T_ARRAY: 683 slot_type = T_OBJECT; 684 break; 685 }; 686 if (_type != slot_type) { 687 _result = JVMTI_ERROR_TYPE_MISMATCH; 688 return false; 689 } 690 691 jobject jobj = _value.l; 692 if (_set && slot_type == T_OBJECT && jobj != NULL) { // NULL reference is allowed 693 // Check that the jobject class matches the return type signature. 694 JavaThread* cur_thread = JavaThread::current(); 695 HandleMark hm(cur_thread); 696 697 Handle obj(cur_thread, JNIHandles::resolve_external_guard(jobj)); 698 NULL_CHECK(obj, (_result = JVMTI_ERROR_INVALID_OBJECT, false)); 699 KlassHandle ob_kh = KlassHandle(cur_thread, obj->klass()); 700 NULL_CHECK(ob_kh, (_result = JVMTI_ERROR_INVALID_OBJECT, false)); 701 702 if (!is_assignable(signature, ob_kh(), cur_thread)) { 703 _result = JVMTI_ERROR_TYPE_MISMATCH; 704 return false; 705 } 706 } 707 return true; 708 } 709 710 static bool can_be_deoptimized(vframe* vf) { 711 return (vf->is_compiled_frame() && vf->fr().can_be_deoptimized()); 712 } 713 714 bool VM_GetOrSetLocal::doit_prologue() { 715 _jvf = get_java_vframe(); 716 NULL_CHECK(_jvf, false); 717 718 if (_jvf->method()->is_native()) { 719 if (getting_receiver() && !_jvf->method()->is_static()) { 720 return true; 721 } else { 722 _result = JVMTI_ERROR_OPAQUE_FRAME; | 270 bool JvmtiBreakpoint::equals(JvmtiBreakpoint& bp) { 271 return _method == bp._method 272 && _bci == bp._bci; 273 } 274 275 bool JvmtiBreakpoint::is_valid() { 276 // class loader can be NULL 277 return _method != NULL && 278 _bci >= 0; 279 } 280 281 address JvmtiBreakpoint::getBcp() const { 282 return _method->bcp_from(_bci); 283 } 284 285 void JvmtiBreakpoint::each_method_version_do(method_action meth_act) { 286 ((Method*)_method->*meth_act)(_bci); 287 288 // add/remove breakpoint to/from versions of the method that are EMCP. 289 Thread *thread = Thread::current(); 290 InstanceKlass* ik = _method->method_holder(); 291 Symbol* m_name = _method->name(); 292 Symbol* m_signature = _method->signature(); 293 294 // search previous versions if they exist 295 for (InstanceKlass* pv_node = ik->previous_versions(); 296 pv_node != NULL; 297 pv_node = pv_node->previous_versions()) { 298 Array<Method*>* methods = pv_node->methods(); 299 300 for (int i = methods->length() - 1; i >= 0; i--) { 301 Method* method = methods->at(i); 302 // Only set breakpoints in running EMCP methods. 303 if (method->is_running_emcp() && 304 method->name() == m_name && 305 method->signature() == m_signature) { 306 ResourceMark rm; 307 log_debug(redefine, class, breakpoint) 308 ("%sing breakpoint in %s(%s)", meth_act == &Method::set_breakpoint ? "sett" : "clear", 309 method->name()->as_C_string(), method->signature()->as_C_string()); 310 (method->*meth_act)(_bci); 311 break; 312 } 313 } 314 } 315 } 679 case T_BOOLEAN: 680 slot_type = T_INT; 681 break; 682 case T_ARRAY: 683 slot_type = T_OBJECT; 684 break; 685 }; 686 if (_type != slot_type) { 687 _result = JVMTI_ERROR_TYPE_MISMATCH; 688 return false; 689 } 690 691 jobject jobj = _value.l; 692 if (_set && slot_type == T_OBJECT && jobj != NULL) { // NULL reference is allowed 693 // Check that the jobject class matches the return type signature. 694 JavaThread* cur_thread = JavaThread::current(); 695 HandleMark hm(cur_thread); 696 697 Handle obj(cur_thread, JNIHandles::resolve_external_guard(jobj)); 698 NULL_CHECK(obj, (_result = JVMTI_ERROR_INVALID_OBJECT, false)); 699 Klass* ob_k = obj->klass(); 700 NULL_CHECK(ob_k, (_result = JVMTI_ERROR_INVALID_OBJECT, false)); 701 702 if (!is_assignable(signature, ob_k, cur_thread)) { 703 _result = JVMTI_ERROR_TYPE_MISMATCH; 704 return false; 705 } 706 } 707 return true; 708 } 709 710 static bool can_be_deoptimized(vframe* vf) { 711 return (vf->is_compiled_frame() && vf->fr().can_be_deoptimized()); 712 } 713 714 bool VM_GetOrSetLocal::doit_prologue() { 715 _jvf = get_java_vframe(); 716 NULL_CHECK(_jvf, false); 717 718 if (_jvf->method()->is_native()) { 719 if (getting_receiver() && !_jvf->method()->is_static()) { 720 return true; 721 } else { 722 _result = JVMTI_ERROR_OPAQUE_FRAME; |