665 } 666 } 667 if (signature_idx == -1) { 668 _result = JVMTI_ERROR_INVALID_SLOT; 669 return false; // Incorrect slot index 670 } 671 Symbol* sign_sym = method_oop->constants()->symbol_at(signature_idx); 672 const char* signature = (const char *) sign_sym->as_utf8(); 673 BasicType slot_type = char2type(signature[0]); 674 675 switch (slot_type) { 676 case T_BYTE: 677 case T_SHORT: 678 case T_CHAR: 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; | 665 } 666 } 667 if (signature_idx == -1) { 668 _result = JVMTI_ERROR_INVALID_SLOT; 669 return false; // Incorrect slot index 670 } 671 Symbol* sign_sym = method_oop->constants()->symbol_at(signature_idx); 672 const char* signature = (const char *) sign_sym->as_utf8(); 673 BasicType slot_type = char2type(signature[0]); 674 675 switch (slot_type) { 676 case T_BYTE: 677 case T_SHORT: 678 case T_CHAR: 679 case T_BOOLEAN: 680 slot_type = T_INT; 681 break; 682 case T_ARRAY: 683 slot_type = T_OBJECT; 684 break; 685 default: 686 break; 687 }; 688 if (_type != slot_type) { 689 _result = JVMTI_ERROR_TYPE_MISMATCH; 690 return false; 691 } 692 693 jobject jobj = _value.l; 694 if (_set && slot_type == T_OBJECT && jobj != NULL) { // NULL reference is allowed 695 // Check that the jobject class matches the return type signature. 696 JavaThread* cur_thread = JavaThread::current(); 697 HandleMark hm(cur_thread); 698 699 Handle obj(cur_thread, JNIHandles::resolve_external_guard(jobj)); 700 NULL_CHECK(obj, (_result = JVMTI_ERROR_INVALID_OBJECT, false)); 701 Klass* ob_k = obj->klass(); 702 NULL_CHECK(ob_k, (_result = JVMTI_ERROR_INVALID_OBJECT, false)); 703 704 if (!is_assignable(signature, ob_k, cur_thread)) { 705 _result = JVMTI_ERROR_TYPE_MISMATCH; 706 return false; |