< prev index next >

src/share/vm/classfile/vmSymbols.cpp

Print this page




 875   }
 876   return vmIntrinsics::_none;
 877 
 878 #undef VM_INTRINSIC_CASE
 879 }
 880 
 881 
 882 const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) {
 883   const char* str = name_at(id);
 884 #ifndef PRODUCT
 885   const char* kname = vmSymbols::name_for(class_for(id));
 886   const char* mname = vmSymbols::name_for(name_for(id));
 887   const char* sname = vmSymbols::name_for(signature_for(id));
 888   const char* fname = "";
 889   switch (flags_for(id)) {
 890   case F_Y:  fname = "synchronized ";  break;
 891   case F_RN: fname = "native ";        break;
 892   case F_SN: fname = "native static "; break;
 893   case F_S:  fname = "static ";        break;
 894   case F_RNY:fname = "native synchronized "; break;

 895   }
 896   const char* kptr = strrchr(kname, '/');
 897   if (kptr != NULL)  kname = kptr + 1;
 898   int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s",
 899                          str, fname, kname, mname, sname);
 900   if (len < buflen)
 901     str = buf;
 902 #endif //PRODUCT
 903   return str;
 904 }
 905 
 906 
 907 // These are to get information about intrinsics.
 908 
 909 #define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f))
 910 
 911 static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = {
 912 #define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \
 913   ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode),
 914 


 972                    VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
 973   return vmIntrinsics::_none;
 974 #undef VM_INTRINSIC_MATCH
 975 }
 976 
 977 void vmIntrinsics::verify_method(ID actual_id, Method* m) {
 978   Symbol* mk = m->method_holder()->name();
 979   ID declared_id = match_method_with_klass(m, mk);
 980 
 981   if (declared_id == actual_id)  return; // success
 982 
 983   if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) {
 984     // Here are a few special cases in StrictMath not declared in vmSymbols.hpp.
 985     switch (actual_id) {
 986     case _min:
 987     case _max:
 988     case _dsqrt:
 989       declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math());
 990       if (declared_id == actual_id)  return; // acceptable alias
 991       break;


 992     }
 993   }
 994 
 995   const char* declared_name = name_at(declared_id);
 996   const char* actual_name   = name_at(actual_id);
 997   methodHandle mh = m;
 998   m = NULL;
 999   ttyLocker ttyl;
1000   if (xtty != NULL) {
1001     xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
1002                      actual_name, declared_name);
1003     xtty->method(mh);
1004     xtty->end_elem("%s", "");
1005   }
1006   if (PrintMiscellaneous && (WizardMode || Verbose)) {
1007     tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
1008                   declared_name, declared_id, actual_name, actual_id);
1009     mh()->print_short_name(tty);
1010     tty->cr();
1011   }


 875   }
 876   return vmIntrinsics::_none;
 877 
 878 #undef VM_INTRINSIC_CASE
 879 }
 880 
 881 
 882 const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) {
 883   const char* str = name_at(id);
 884 #ifndef PRODUCT
 885   const char* kname = vmSymbols::name_for(class_for(id));
 886   const char* mname = vmSymbols::name_for(name_for(id));
 887   const char* sname = vmSymbols::name_for(signature_for(id));
 888   const char* fname = "";
 889   switch (flags_for(id)) {
 890   case F_Y:  fname = "synchronized ";  break;
 891   case F_RN: fname = "native ";        break;
 892   case F_SN: fname = "native static "; break;
 893   case F_S:  fname = "static ";        break;
 894   case F_RNY:fname = "native synchronized "; break;
 895   default: break;
 896   }
 897   const char* kptr = strrchr(kname, '/');
 898   if (kptr != NULL)  kname = kptr + 1;
 899   int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s",
 900                          str, fname, kname, mname, sname);
 901   if (len < buflen)
 902     str = buf;
 903 #endif //PRODUCT
 904   return str;
 905 }
 906 
 907 
 908 // These are to get information about intrinsics.
 909 
 910 #define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f))
 911 
 912 static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = {
 913 #define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \
 914   ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode),
 915 


 973                    VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
 974   return vmIntrinsics::_none;
 975 #undef VM_INTRINSIC_MATCH
 976 }
 977 
 978 void vmIntrinsics::verify_method(ID actual_id, Method* m) {
 979   Symbol* mk = m->method_holder()->name();
 980   ID declared_id = match_method_with_klass(m, mk);
 981 
 982   if (declared_id == actual_id)  return; // success
 983 
 984   if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) {
 985     // Here are a few special cases in StrictMath not declared in vmSymbols.hpp.
 986     switch (actual_id) {
 987     case _min:
 988     case _max:
 989     case _dsqrt:
 990       declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math());
 991       if (declared_id == actual_id)  return; // acceptable alias
 992       break;
 993     default:
 994       break;
 995     }
 996   }
 997 
 998   const char* declared_name = name_at(declared_id);
 999   const char* actual_name   = name_at(actual_id);
1000   methodHandle mh = m;
1001   m = NULL;
1002   ttyLocker ttyl;
1003   if (xtty != NULL) {
1004     xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
1005                      actual_name, declared_name);
1006     xtty->method(mh);
1007     xtty->end_elem("%s", "");
1008   }
1009   if (PrintMiscellaneous && (WizardMode || Verbose)) {
1010     tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
1011                   declared_name, declared_id, actual_name, actual_id);
1012     mh()->print_short_name(tty);
1013     tty->cr();
1014   }
< prev index next >