< prev index next >

src/hotspot/share/prims/jvmtiImpl.cpp

Print this page




 655       signature_idx = (int) table[i].descriptor_cp_index;
 656       break;
 657     }
 658   }
 659   if (signature_idx == -1) {
 660     _result = JVMTI_ERROR_INVALID_SLOT;
 661     return false;       // Incorrect slot index
 662   }
 663   Symbol*   sign_sym  = method_oop->constants()->symbol_at(signature_idx);
 664   const char* signature = (const char *) sign_sym->as_utf8();
 665   BasicType slot_type = char2type(signature[0]);
 666 
 667   switch (slot_type) {
 668   case T_BYTE:
 669   case T_SHORT:
 670   case T_CHAR:
 671   case T_BOOLEAN:
 672     slot_type = T_INT;
 673     break;
 674   case T_ARRAY:

 675     slot_type = T_OBJECT;
 676     break;
 677   default:
 678     break;
 679   };
 680   if (_type != slot_type) {
 681     _result = JVMTI_ERROR_TYPE_MISMATCH;
 682     return false;
 683   }
 684 
 685   jobject jobj = _value.l;
 686   if (_set && slot_type == T_OBJECT && jobj != NULL) { // NULL reference is allowed
 687     // Check that the jobject class matches the return type signature.
 688     JavaThread* cur_thread = JavaThread::current();
 689     HandleMark hm(cur_thread);
 690 
 691     Handle obj(cur_thread, JNIHandles::resolve_external_guard(jobj));
 692     NULL_CHECK(obj, (_result = JVMTI_ERROR_INVALID_OBJECT, false));
 693     Klass* ob_k = obj->klass();
 694     NULL_CHECK(ob_k, (_result = JVMTI_ERROR_INVALID_OBJECT, false));




 655       signature_idx = (int) table[i].descriptor_cp_index;
 656       break;
 657     }
 658   }
 659   if (signature_idx == -1) {
 660     _result = JVMTI_ERROR_INVALID_SLOT;
 661     return false;       // Incorrect slot index
 662   }
 663   Symbol*   sign_sym  = method_oop->constants()->symbol_at(signature_idx);
 664   const char* signature = (const char *) sign_sym->as_utf8();
 665   BasicType slot_type = char2type(signature[0]);
 666 
 667   switch (slot_type) {
 668   case T_BYTE:
 669   case T_SHORT:
 670   case T_CHAR:
 671   case T_BOOLEAN:
 672     slot_type = T_INT;
 673     break;
 674   case T_ARRAY:
 675   case T_VALUETYPE:
 676     slot_type = T_OBJECT;
 677     break;
 678   default:
 679     break;
 680   };
 681   if (_type != slot_type) {
 682     _result = JVMTI_ERROR_TYPE_MISMATCH;
 683     return false;
 684   }
 685 
 686   jobject jobj = _value.l;
 687   if (_set && slot_type == T_OBJECT && jobj != NULL) { // NULL reference is allowed
 688     // Check that the jobject class matches the return type signature.
 689     JavaThread* cur_thread = JavaThread::current();
 690     HandleMark hm(cur_thread);
 691 
 692     Handle obj(cur_thread, JNIHandles::resolve_external_guard(jobj));
 693     NULL_CHECK(obj, (_result = JVMTI_ERROR_INVALID_OBJECT, false));
 694     Klass* ob_k = obj->klass();
 695     NULL_CHECK(ob_k, (_result = JVMTI_ERROR_INVALID_OBJECT, false));


< prev index next >