1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "compiler/compilerDirectives.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/oopFactory.hpp"
  31 #include "memory/metaspaceClosure.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/handles.inline.hpp"
  34 #include "utilities/xmlstream.hpp"
  35 
  36 
  37 Symbol* vmSymbols::_symbols[vmSymbols::SID_LIMIT];
  38 
  39 Symbol* vmSymbols::_type_signatures[T_VOID+1] = { NULL /*, NULL...*/ };
  40 
  41 inline int compare_symbol(const Symbol* a, const Symbol* b) {
  42   if (a == b)  return 0;
  43   // follow the natural address order:
  44   return (address)a > (address)b ? +1 : -1;
  45 }
  46 
  47 static vmSymbols::SID vm_symbol_index[vmSymbols::SID_LIMIT];
  48 extern "C" {
  49   static int compare_vmsymbol_sid(const void* void_a, const void* void_b) {
  50     const Symbol* a = vmSymbols::symbol_at(*((vmSymbols::SID*) void_a));
  51     const Symbol* b = vmSymbols::symbol_at(*((vmSymbols::SID*) void_b));
  52     return compare_symbol(a, b);
  53   }
  54 }
  55 
  56 #ifdef ASSERT
  57 #define VM_SYMBOL_ENUM_NAME_BODY(name, string) #name "\0"
  58 static const char* vm_symbol_enum_names =
  59   VM_SYMBOLS_DO(VM_SYMBOL_ENUM_NAME_BODY, VM_ALIAS_IGNORE)
  60   "\0";
  61 static const char* vm_symbol_enum_name(vmSymbols::SID sid) {
  62   const char* string = &vm_symbol_enum_names[0];
  63   int skip = (int)sid - (int)vmSymbols::FIRST_SID;
  64   for (; skip != 0; skip--) {
  65     size_t skiplen = strlen(string);
  66     if (skiplen == 0)  return "<unknown>";  // overflow
  67     string += skiplen+1;
  68   }
  69   return string;
  70 }
  71 #endif //ASSERT
  72 
  73 // Put all the VM symbol strings in one place.
  74 // Makes for a more compact libjvm.
  75 #define VM_SYMBOL_BODY(name, string) string "\0"
  76 static const char* vm_symbol_bodies = VM_SYMBOLS_DO(VM_SYMBOL_BODY, VM_ALIAS_IGNORE);
  77 
  78 void vmSymbols::initialize(TRAPS) {
  79   assert((int)SID_LIMIT <= (1<<log2_SID_LIMIT), "must fit in this bitfield");
  80   assert((int)SID_LIMIT*5 > (1<<log2_SID_LIMIT), "make the bitfield smaller, please");
  81   assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield");
  82 
  83   if (!UseSharedSpaces) {
  84     const char* string = &vm_symbol_bodies[0];
  85     for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
  86       Symbol* sym = SymbolTable::new_permanent_symbol(string, CHECK);
  87       _symbols[index] = sym;
  88       string += strlen(string); // skip string body
  89       string += 1;              // skip trailing null
  90     }
  91 
  92     _type_signatures[T_BYTE]    = byte_signature();
  93     _type_signatures[T_CHAR]    = char_signature();
  94     _type_signatures[T_DOUBLE]  = double_signature();
  95     _type_signatures[T_FLOAT]   = float_signature();
  96     _type_signatures[T_INT]     = int_signature();
  97     _type_signatures[T_LONG]    = long_signature();
  98     _type_signatures[T_SHORT]   = short_signature();
  99     _type_signatures[T_BOOLEAN] = bool_signature();
 100     _type_signatures[T_VOID]    = void_signature();
 101     // no single signatures for T_OBJECT, T_VALUETYPE or T_ARRAY
 102 #ifdef ASSERT
 103     for (int i = (int)T_BOOLEAN; i < (int)T_VOID+1; i++) {
 104       Symbol* s = _type_signatures[i];
 105       if (s == NULL)  continue;
 106       BasicType st = signature_type(s);
 107       assert(st == i, "");
 108     }
 109 #endif
 110   }
 111 
 112 #ifdef ASSERT
 113   // Check for duplicates:
 114   for (int i1 = (int)FIRST_SID; i1 < (int)SID_LIMIT; i1++) {
 115     Symbol* sym = symbol_at((SID)i1);
 116     for (int i2 = (int)FIRST_SID; i2 < i1; i2++) {
 117       if (symbol_at((SID)i2) == sym) {
 118         tty->print("*** Duplicate VM symbol SIDs %s(%d) and %s(%d): \"",
 119                    vm_symbol_enum_name((SID)i2), i2,
 120                    vm_symbol_enum_name((SID)i1), i1);
 121         sym->print_symbol_on(tty);
 122         tty->print_cr("\"");
 123       }
 124     }
 125   }
 126 #endif //ASSERT
 127 
 128   // Create an index for find_id:
 129   {
 130     for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
 131       vm_symbol_index[index] = (SID)index;
 132     }
 133     int num_sids = SID_LIMIT-FIRST_SID;
 134     qsort(&vm_symbol_index[FIRST_SID], num_sids, sizeof(vm_symbol_index[0]),
 135           compare_vmsymbol_sid);
 136   }
 137 
 138 #ifdef ASSERT
 139   {
 140     // Spot-check correspondence between strings, symbols, and enums:
 141     assert(_symbols[NO_SID] == NULL, "must be");
 142     const char* str = "java/lang/Object";
 143     TempNewSymbol jlo = SymbolTable::new_permanent_symbol(str, CHECK);
 144     assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, "");
 145     assert(jlo == java_lang_Object(), "");
 146     SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object);
 147     assert(find_sid(jlo) == sid, "");
 148     assert(symbol_at(sid) == jlo, "");
 149 
 150     // Make sure find_sid produces the right answer in each case.
 151     for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
 152       Symbol* sym = symbol_at((SID)index);
 153       sid = find_sid(sym);
 154       assert(sid == (SID)index, "symbol index works");
 155       // Note:  If there are duplicates, this assert will fail.
 156       // A "Duplicate VM symbol" message will have already been printed.
 157     }
 158 
 159     // The string "format" happens (at the moment) not to be a vmSymbol,
 160     // though it is a method name in java.lang.String.
 161     str = "format";
 162     TempNewSymbol fmt = SymbolTable::new_permanent_symbol(str, CHECK);
 163     sid = find_sid(fmt);
 164     assert(sid == NO_SID, "symbol index works (negative test)");
 165   }
 166 #endif
 167 }
 168 
 169 
 170 #ifndef PRODUCT
 171 const char* vmSymbols::name_for(vmSymbols::SID sid) {
 172   if (sid == NO_SID)
 173     return "NO_SID";
 174   const char* string = &vm_symbol_bodies[0];
 175   for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
 176     if (index == (int)sid)
 177       return string;
 178     string += strlen(string); // skip string body
 179     string += 1;              // skip trailing null
 180   }
 181   return "BAD_SID";
 182 }
 183 #endif
 184 
 185 
 186 
 187 void vmSymbols::symbols_do(SymbolClosure* f) {
 188   for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
 189     f->do_symbol(&_symbols[index]);
 190   }
 191   for (int i = 0; i < T_VOID+1; i++) {
 192     f->do_symbol(&_type_signatures[i]);
 193   }
 194 }
 195 
 196 void vmSymbols::metaspace_pointers_do(MetaspaceClosure *it) {
 197   for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
 198     it->push(&_symbols[index]);
 199   }
 200   for (int i = 0; i < T_VOID+1; i++) {
 201     it->push(&_type_signatures[i]);
 202   }
 203 }
 204 
 205 void vmSymbols::serialize(SerializeClosure* soc) {
 206   soc->do_region((u_char*)&_symbols[FIRST_SID],
 207                  (SID_LIMIT - FIRST_SID) * sizeof(_symbols[0]));
 208   soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures));
 209 }
 210 
 211 
 212 BasicType vmSymbols::signature_type(const Symbol* s) {
 213   assert(s != NULL, "checking");
 214   if (s->utf8_length() == 1) {
 215     BasicType result = char2type(s->char_at(0));
 216     if (is_java_primitive(result) || result == T_VOID) {
 217       assert(s == _type_signatures[result], "");
 218       return result;
 219     }
 220   }
 221   return s->char_at(0) == 'Q' ? T_VALUETYPE : T_OBJECT;
 222 }
 223 
 224 
 225 static int mid_hint = (int)vmSymbols::FIRST_SID+1;
 226 
 227 #ifndef PRODUCT
 228 static int find_sid_calls, find_sid_probes;
 229 // (Typical counts are calls=7000 and probes=17000.)
 230 #endif
 231 
 232 vmSymbols::SID vmSymbols::find_sid(const Symbol* symbol) {
 233   // Handle the majority of misses by a bounds check.
 234   // Then, use a binary search over the index.
 235   // Expected trip count is less than log2_SID_LIMIT, about eight.
 236   // This is slow but acceptable, given that calls are not
 237   // dynamically common.  (Method*::intrinsic_id has a cache.)
 238   NOT_PRODUCT(find_sid_calls++);
 239   int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1;
 240   SID sid = NO_SID, sid1;
 241   int cmp1;
 242   sid1 = vm_symbol_index[min];
 243   cmp1 = compare_symbol(symbol, symbol_at(sid1));
 244   if (cmp1 <= 0) {              // before the first
 245     if (cmp1 == 0)  sid = sid1;
 246   } else {
 247     sid1 = vm_symbol_index[max];
 248     cmp1 = compare_symbol(symbol, symbol_at(sid1));
 249     if (cmp1 >= 0) {            // after the last
 250       if (cmp1 == 0)  sid = sid1;
 251     } else {
 252       // After checking the extremes, do a binary search.
 253       ++min; --max;             // endpoints are done
 254       int mid = mid_hint;       // start at previous success
 255       while (max >= min) {
 256         assert(mid >= min && mid <= max, "");
 257         NOT_PRODUCT(find_sid_probes++);
 258         sid1 = vm_symbol_index[mid];
 259         cmp1 = compare_symbol(symbol, symbol_at(sid1));
 260         if (cmp1 == 0) {
 261           mid_hint = mid;
 262           sid = sid1;
 263           break;
 264         }
 265         if (cmp1 < 0)
 266           max = mid - 1;        // symbol < symbol_at(sid)
 267         else
 268           min = mid + 1;
 269 
 270         // Pick a new probe point:
 271         mid = (max + min) / 2;
 272       }
 273     }
 274   }
 275 
 276 #ifdef ASSERT
 277   // Perform the exhaustive self-check the first 1000 calls,
 278   // and every 100 calls thereafter.
 279   static int find_sid_check_count = -2000;
 280   if ((uint)++find_sid_check_count > (uint)100) {
 281     if (find_sid_check_count > 0)  find_sid_check_count = 0;
 282 
 283     // Make sure this is the right answer, using linear search.
 284     // (We have already proven that there are no duplicates in the list.)
 285     SID sid2 = NO_SID;
 286     for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
 287       Symbol* sym2 = symbol_at((SID)index);
 288       if (sym2 == symbol) {
 289         sid2 = (SID)index;
 290         break;
 291       }
 292     }
 293     // Unless it's a duplicate, assert that the sids are the same.
 294     if (_symbols[sid] != _symbols[sid2]) {
 295       assert(sid == sid2, "binary same as linear search");
 296     }
 297   }
 298 #endif //ASSERT
 299 
 300   return sid;
 301 }
 302 
 303 vmSymbols::SID vmSymbols::find_sid(const char* symbol_name) {
 304   Symbol* symbol = SymbolTable::probe(symbol_name, (int) strlen(symbol_name));
 305   if (symbol == NULL)  return NO_SID;
 306   return find_sid(symbol);
 307 }
 308 
 309 static vmIntrinsics::ID wrapper_intrinsic(BasicType type, bool unboxing) {
 310 #define TYPE2(type, unboxing) ((int)(type)*2 + ((unboxing) ? 1 : 0))
 311   switch (TYPE2(type, unboxing)) {
 312 #define BASIC_TYPE_CASE(type, box, unbox) \
 313     case TYPE2(type, false):  return vmIntrinsics::box; \
 314     case TYPE2(type, true):   return vmIntrinsics::unbox
 315     BASIC_TYPE_CASE(T_BOOLEAN, _Boolean_valueOf,   _booleanValue);
 316     BASIC_TYPE_CASE(T_BYTE,    _Byte_valueOf,      _byteValue);
 317     BASIC_TYPE_CASE(T_CHAR,    _Character_valueOf, _charValue);
 318     BASIC_TYPE_CASE(T_SHORT,   _Short_valueOf,     _shortValue);
 319     BASIC_TYPE_CASE(T_INT,     _Integer_valueOf,   _intValue);
 320     BASIC_TYPE_CASE(T_LONG,    _Long_valueOf,      _longValue);
 321     BASIC_TYPE_CASE(T_FLOAT,   _Float_valueOf,     _floatValue);
 322     BASIC_TYPE_CASE(T_DOUBLE,  _Double_valueOf,    _doubleValue);
 323 #undef BASIC_TYPE_CASE
 324   }
 325 #undef TYPE2
 326   return vmIntrinsics::_none;
 327 }
 328 
 329 vmIntrinsics::ID vmIntrinsics::for_boxing(BasicType type) {
 330   return wrapper_intrinsic(type, false);
 331 }
 332 vmIntrinsics::ID vmIntrinsics::for_unboxing(BasicType type) {
 333   return wrapper_intrinsic(type, true);
 334 }
 335 
 336 vmIntrinsics::ID vmIntrinsics::for_raw_conversion(BasicType src, BasicType dest) {
 337 #define SRC_DEST(s,d) (((int)(s) << 4) + (int)(d))
 338   switch (SRC_DEST(src, dest)) {
 339   case SRC_DEST(T_INT, T_FLOAT):   return vmIntrinsics::_intBitsToFloat;
 340   case SRC_DEST(T_FLOAT, T_INT):   return vmIntrinsics::_floatToRawIntBits;
 341 
 342   case SRC_DEST(T_LONG, T_DOUBLE): return vmIntrinsics::_longBitsToDouble;
 343   case SRC_DEST(T_DOUBLE, T_LONG): return vmIntrinsics::_doubleToRawLongBits;
 344   }
 345 #undef SRC_DEST
 346 
 347   return vmIntrinsics::_none;
 348 }
 349 
 350 bool vmIntrinsics::preserves_state(vmIntrinsics::ID id) {
 351   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 352   switch(id) {
 353 #ifdef JFR_HAVE_INTRINSICS
 354   case vmIntrinsics::_counterTime:
 355 #endif
 356   case vmIntrinsics::_currentTimeMillis:
 357   case vmIntrinsics::_nanoTime:
 358   case vmIntrinsics::_floatToRawIntBits:
 359   case vmIntrinsics::_intBitsToFloat:
 360   case vmIntrinsics::_doubleToRawLongBits:
 361   case vmIntrinsics::_longBitsToDouble:
 362   case vmIntrinsics::_getClass:
 363   case vmIntrinsics::_isInstance:
 364   case vmIntrinsics::_currentThread:
 365   case vmIntrinsics::_dabs:
 366   case vmIntrinsics::_dsqrt:
 367   case vmIntrinsics::_dsin:
 368   case vmIntrinsics::_dcos:
 369   case vmIntrinsics::_dtan:
 370   case vmIntrinsics::_dlog:
 371   case vmIntrinsics::_dlog10:
 372   case vmIntrinsics::_dexp:
 373   case vmIntrinsics::_dpow:
 374   case vmIntrinsics::_checkIndex:
 375   case vmIntrinsics::_Reference_get:
 376   case vmIntrinsics::_updateCRC32:
 377   case vmIntrinsics::_updateBytesCRC32:
 378   case vmIntrinsics::_updateByteBufferCRC32:
 379   case vmIntrinsics::_vectorizedMismatch:
 380   case vmIntrinsics::_fmaD:
 381   case vmIntrinsics::_fmaF:
 382     return true;
 383   default:
 384     return false;
 385   }
 386 }
 387 
 388 bool vmIntrinsics::can_trap(vmIntrinsics::ID id) {
 389   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 390   switch(id) {
 391 #ifdef JFR_HAVE_INTRINSICS
 392   case vmIntrinsics::_counterTime:
 393   case vmIntrinsics::_getClassId:
 394 #endif
 395   case vmIntrinsics::_currentTimeMillis:
 396   case vmIntrinsics::_nanoTime:
 397   case vmIntrinsics::_floatToRawIntBits:
 398   case vmIntrinsics::_intBitsToFloat:
 399   case vmIntrinsics::_doubleToRawLongBits:
 400   case vmIntrinsics::_longBitsToDouble:
 401   case vmIntrinsics::_currentThread:
 402   case vmIntrinsics::_dabs:
 403   case vmIntrinsics::_dsqrt:
 404   case vmIntrinsics::_dsin:
 405   case vmIntrinsics::_dcos:
 406   case vmIntrinsics::_dtan:
 407   case vmIntrinsics::_dlog:
 408   case vmIntrinsics::_dlog10:
 409   case vmIntrinsics::_dexp:
 410   case vmIntrinsics::_dpow:
 411   case vmIntrinsics::_updateCRC32:
 412   case vmIntrinsics::_updateBytesCRC32:
 413   case vmIntrinsics::_updateByteBufferCRC32:
 414   case vmIntrinsics::_vectorizedMismatch:
 415   case vmIntrinsics::_fmaD:
 416   case vmIntrinsics::_fmaF:
 417     return false;
 418   default:
 419     return true;
 420   }
 421 }
 422 
 423 // Some intrinsics produce different results if they are not pinned
 424 bool vmIntrinsics::should_be_pinned(vmIntrinsics::ID id) {
 425   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 426   switch(id) {
 427 #ifdef JFR_HAVE_INTRINSICS
 428   case vmIntrinsics::_counterTime:
 429 #endif
 430   case vmIntrinsics::_currentTimeMillis:
 431   case vmIntrinsics::_nanoTime:
 432     return true;
 433   default:
 434     return false;
 435   }
 436 }
 437 
 438 bool vmIntrinsics::does_virtual_dispatch(vmIntrinsics::ID id) {
 439   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 440   switch(id) {
 441   case vmIntrinsics::_hashCode:
 442   case vmIntrinsics::_clone:
 443     return true;
 444     break;
 445   default:
 446     return false;
 447   }
 448 }
 449 
 450 int vmIntrinsics::predicates_needed(vmIntrinsics::ID id) {
 451   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 452   switch (id) {
 453   case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
 454   case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
 455   case vmIntrinsics::_counterMode_AESCrypt:
 456     return 1;
 457   case vmIntrinsics::_digestBase_implCompressMB:
 458     return 3;
 459   default:
 460     return 0;
 461   }
 462 }
 463 
 464 bool vmIntrinsics::is_intrinsic_available(vmIntrinsics::ID id) {
 465   return !vmIntrinsics::is_intrinsic_disabled(id) &&
 466     !vmIntrinsics::is_disabled_by_flags(id);
 467 }
 468 
 469 bool vmIntrinsics::is_intrinsic_disabled(vmIntrinsics::ID id) {
 470   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 471 
 472   // Canonicalize DisableIntrinsic to contain only ',' as a separator.
 473   // Note, DirectiveSet may not be created at this point yet since this code
 474   // is called from initial stub geenration code.
 475   char* local_list = (char*)DirectiveSet::canonicalize_disableintrinsic(DisableIntrinsic);
 476 
 477   bool found = false;
 478   char* token = strtok(local_list, ",");
 479   while (token != NULL) {
 480     if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
 481       found = true;
 482       break;
 483     } else {
 484       token = strtok(NULL, ",");
 485     }
 486   }
 487 
 488   FREE_C_HEAP_ARRAY(char, local_list);
 489   return found;
 490 }
 491 
 492 
 493 bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
 494   vmIntrinsics::ID id = method->intrinsic_id();
 495   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 496   return is_disabled_by_flags(id);
 497 }
 498 
 499 bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
 500   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 501 
 502   // -XX:-InlineNatives disables nearly all intrinsics except the ones listed in
 503   // the following switch statement.
 504   if (!InlineNatives) {
 505     switch (id) {
 506     case vmIntrinsics::_indexOfL:
 507     case vmIntrinsics::_indexOfU:
 508     case vmIntrinsics::_indexOfUL:
 509     case vmIntrinsics::_indexOfIL:
 510     case vmIntrinsics::_indexOfIU:
 511     case vmIntrinsics::_indexOfIUL:
 512     case vmIntrinsics::_indexOfU_char:
 513     case vmIntrinsics::_compareToL:
 514     case vmIntrinsics::_compareToU:
 515     case vmIntrinsics::_compareToLU:
 516     case vmIntrinsics::_compareToUL:
 517     case vmIntrinsics::_equalsL:
 518     case vmIntrinsics::_equalsU:
 519     case vmIntrinsics::_equalsC:
 520     case vmIntrinsics::_getCharStringU:
 521     case vmIntrinsics::_putCharStringU:
 522     case vmIntrinsics::_compressStringC:
 523     case vmIntrinsics::_compressStringB:
 524     case vmIntrinsics::_inflateStringC:
 525     case vmIntrinsics::_inflateStringB:
 526     case vmIntrinsics::_getAndAddInt:
 527     case vmIntrinsics::_getAndAddLong:
 528     case vmIntrinsics::_getAndSetInt:
 529     case vmIntrinsics::_getAndSetLong:
 530     case vmIntrinsics::_getAndSetReference:
 531     case vmIntrinsics::_loadFence:
 532     case vmIntrinsics::_storeFence:
 533     case vmIntrinsics::_fullFence:
 534     case vmIntrinsics::_hasNegatives:
 535     case vmIntrinsics::_Reference_get:
 536       break;
 537     default:
 538       return true;
 539     }
 540   }
 541 
 542   switch (id) {
 543   case vmIntrinsics::_isInstance:
 544   case vmIntrinsics::_isAssignableFrom:
 545   case vmIntrinsics::_getModifiers:
 546   case vmIntrinsics::_isInterface:
 547   case vmIntrinsics::_isArray:
 548   case vmIntrinsics::_isPrimitive:
 549   case vmIntrinsics::_getSuperclass:
 550   case vmIntrinsics::_Class_cast:
 551   case vmIntrinsics::_getLength:
 552   case vmIntrinsics::_newArray:
 553   case vmIntrinsics::_getClass:
 554     if (!InlineClassNatives) return true;
 555     break;
 556   case vmIntrinsics::_currentThread:
 557   case vmIntrinsics::_isInterrupted:
 558     if (!InlineThreadNatives) return true;
 559     break;
 560   case vmIntrinsics::_floatToRawIntBits:
 561   case vmIntrinsics::_intBitsToFloat:
 562   case vmIntrinsics::_doubleToRawLongBits:
 563   case vmIntrinsics::_longBitsToDouble:
 564   case vmIntrinsics::_dabs:
 565   case vmIntrinsics::_dsqrt:
 566   case vmIntrinsics::_dsin:
 567   case vmIntrinsics::_dcos:
 568   case vmIntrinsics::_dtan:
 569   case vmIntrinsics::_dlog:
 570   case vmIntrinsics::_dexp:
 571   case vmIntrinsics::_dpow:
 572   case vmIntrinsics::_dlog10:
 573   case vmIntrinsics::_datan2:
 574   case vmIntrinsics::_min:
 575   case vmIntrinsics::_max:
 576   case vmIntrinsics::_floatToIntBits:
 577   case vmIntrinsics::_doubleToLongBits:
 578     if (!InlineMathNatives) return true;
 579     break;
 580   case vmIntrinsics::_fmaD:
 581   case vmIntrinsics::_fmaF:
 582     if (!InlineMathNatives || !UseFMA) return true;
 583     break;
 584   case vmIntrinsics::_arraycopy:
 585     if (!InlineArrayCopy) return true;
 586     break;
 587   case vmIntrinsics::_updateCRC32:
 588   case vmIntrinsics::_updateBytesCRC32:
 589   case vmIntrinsics::_updateByteBufferCRC32:
 590     if (!UseCRC32Intrinsics) return true;
 591     break;
 592   case vmIntrinsics::_makePrivateBuffer:
 593   case vmIntrinsics::_finishPrivateBuffer:
 594   case vmIntrinsics::_getReference:
 595   case vmIntrinsics::_getBoolean:
 596   case vmIntrinsics::_getByte:
 597   case vmIntrinsics::_getShort:
 598   case vmIntrinsics::_getChar:
 599   case vmIntrinsics::_getInt:
 600   case vmIntrinsics::_getLong:
 601   case vmIntrinsics::_getFloat:
 602   case vmIntrinsics::_getDouble:
 603   case vmIntrinsics::_getValue:
 604   case vmIntrinsics::_putReference:
 605   case vmIntrinsics::_putBoolean:
 606   case vmIntrinsics::_putByte:
 607   case vmIntrinsics::_putShort:
 608   case vmIntrinsics::_putChar:
 609   case vmIntrinsics::_putInt:
 610   case vmIntrinsics::_putLong:
 611   case vmIntrinsics::_putFloat:
 612   case vmIntrinsics::_putDouble:
 613   case vmIntrinsics::_putValue:
 614   case vmIntrinsics::_getReferenceVolatile:
 615   case vmIntrinsics::_getBooleanVolatile:
 616   case vmIntrinsics::_getByteVolatile:
 617   case vmIntrinsics::_getShortVolatile:
 618   case vmIntrinsics::_getCharVolatile:
 619   case vmIntrinsics::_getIntVolatile:
 620   case vmIntrinsics::_getLongVolatile:
 621   case vmIntrinsics::_getFloatVolatile:
 622   case vmIntrinsics::_getDoubleVolatile:
 623   case vmIntrinsics::_putReferenceVolatile:
 624   case vmIntrinsics::_putBooleanVolatile:
 625   case vmIntrinsics::_putByteVolatile:
 626   case vmIntrinsics::_putShortVolatile:
 627   case vmIntrinsics::_putCharVolatile:
 628   case vmIntrinsics::_putIntVolatile:
 629   case vmIntrinsics::_putLongVolatile:
 630   case vmIntrinsics::_putFloatVolatile:
 631   case vmIntrinsics::_putDoubleVolatile:
 632   case vmIntrinsics::_getReferenceAcquire:
 633   case vmIntrinsics::_getBooleanAcquire:
 634   case vmIntrinsics::_getByteAcquire:
 635   case vmIntrinsics::_getShortAcquire:
 636   case vmIntrinsics::_getCharAcquire:
 637   case vmIntrinsics::_getIntAcquire:
 638   case vmIntrinsics::_getLongAcquire:
 639   case vmIntrinsics::_getFloatAcquire:
 640   case vmIntrinsics::_getDoubleAcquire:
 641   case vmIntrinsics::_putReferenceRelease:
 642   case vmIntrinsics::_putBooleanRelease:
 643   case vmIntrinsics::_putByteRelease:
 644   case vmIntrinsics::_putShortRelease:
 645   case vmIntrinsics::_putCharRelease:
 646   case vmIntrinsics::_putIntRelease:
 647   case vmIntrinsics::_putLongRelease:
 648   case vmIntrinsics::_putFloatRelease:
 649   case vmIntrinsics::_putDoubleRelease:
 650   case vmIntrinsics::_getReferenceOpaque:
 651   case vmIntrinsics::_getBooleanOpaque:
 652   case vmIntrinsics::_getByteOpaque:
 653   case vmIntrinsics::_getShortOpaque:
 654   case vmIntrinsics::_getCharOpaque:
 655   case vmIntrinsics::_getIntOpaque:
 656   case vmIntrinsics::_getLongOpaque:
 657   case vmIntrinsics::_getFloatOpaque:
 658   case vmIntrinsics::_getDoubleOpaque:
 659   case vmIntrinsics::_putReferenceOpaque:
 660   case vmIntrinsics::_putBooleanOpaque:
 661   case vmIntrinsics::_putByteOpaque:
 662   case vmIntrinsics::_putShortOpaque:
 663   case vmIntrinsics::_putCharOpaque:
 664   case vmIntrinsics::_putIntOpaque:
 665   case vmIntrinsics::_putLongOpaque:
 666   case vmIntrinsics::_putFloatOpaque:
 667   case vmIntrinsics::_putDoubleOpaque:
 668   case vmIntrinsics::_getAndAddInt:
 669   case vmIntrinsics::_getAndAddLong:
 670   case vmIntrinsics::_getAndSetInt:
 671   case vmIntrinsics::_getAndSetLong:
 672   case vmIntrinsics::_getAndSetReference:
 673   case vmIntrinsics::_loadFence:
 674   case vmIntrinsics::_storeFence:
 675   case vmIntrinsics::_fullFence:
 676   case vmIntrinsics::_compareAndSetLong:
 677   case vmIntrinsics::_weakCompareAndSetLong:
 678   case vmIntrinsics::_weakCompareAndSetLongPlain:
 679   case vmIntrinsics::_weakCompareAndSetLongAcquire:
 680   case vmIntrinsics::_weakCompareAndSetLongRelease:
 681   case vmIntrinsics::_compareAndSetInt:
 682   case vmIntrinsics::_weakCompareAndSetInt:
 683   case vmIntrinsics::_weakCompareAndSetIntPlain:
 684   case vmIntrinsics::_weakCompareAndSetIntAcquire:
 685   case vmIntrinsics::_weakCompareAndSetIntRelease:
 686   case vmIntrinsics::_compareAndSetReference:
 687   case vmIntrinsics::_weakCompareAndSetReference:
 688   case vmIntrinsics::_weakCompareAndSetReferencePlain:
 689   case vmIntrinsics::_weakCompareAndSetReferenceAcquire:
 690   case vmIntrinsics::_weakCompareAndSetReferenceRelease:
 691   case vmIntrinsics::_compareAndExchangeInt:
 692   case vmIntrinsics::_compareAndExchangeIntAcquire:
 693   case vmIntrinsics::_compareAndExchangeIntRelease:
 694   case vmIntrinsics::_compareAndExchangeLong:
 695   case vmIntrinsics::_compareAndExchangeLongAcquire:
 696   case vmIntrinsics::_compareAndExchangeLongRelease:
 697   case vmIntrinsics::_compareAndExchangeReference:
 698   case vmIntrinsics::_compareAndExchangeReferenceAcquire:
 699   case vmIntrinsics::_compareAndExchangeReferenceRelease:
 700     if (!InlineUnsafeOps) return true;
 701     break;
 702   case vmIntrinsics::_getShortUnaligned:
 703   case vmIntrinsics::_getCharUnaligned:
 704   case vmIntrinsics::_getIntUnaligned:
 705   case vmIntrinsics::_getLongUnaligned:
 706   case vmIntrinsics::_putShortUnaligned:
 707   case vmIntrinsics::_putCharUnaligned:
 708   case vmIntrinsics::_putIntUnaligned:
 709   case vmIntrinsics::_putLongUnaligned:
 710   case vmIntrinsics::_allocateInstance:
 711     if (!InlineUnsafeOps || !UseUnalignedAccesses) return true;
 712     break;
 713   case vmIntrinsics::_hashCode:
 714     if (!InlineObjectHash) return true;
 715     break;
 716   case vmIntrinsics::_aescrypt_encryptBlock:
 717   case vmIntrinsics::_aescrypt_decryptBlock:
 718     if (!UseAESIntrinsics) return true;
 719     break;
 720   case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
 721   case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
 722     if (!UseAESIntrinsics) return true;
 723     break;
 724   case vmIntrinsics::_counterMode_AESCrypt:
 725     if (!UseAESCTRIntrinsics) return true;
 726     break;
 727   case vmIntrinsics::_sha_implCompress:
 728     if (!UseSHA1Intrinsics) return true;
 729     break;
 730   case vmIntrinsics::_sha2_implCompress:
 731     if (!UseSHA256Intrinsics) return true;
 732     break;
 733   case vmIntrinsics::_sha5_implCompress:
 734     if (!UseSHA512Intrinsics) return true;
 735     break;
 736   case vmIntrinsics::_digestBase_implCompressMB:
 737     if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) return true;
 738     break;
 739   case vmIntrinsics::_ghash_processBlocks:
 740     if (!UseGHASHIntrinsics) return true;
 741     break;
 742   case vmIntrinsics::_base64_encodeBlock:
 743     if (!UseBASE64Intrinsics) return true;
 744     break;
 745   case vmIntrinsics::_updateBytesCRC32C:
 746   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 747     if (!UseCRC32CIntrinsics) return true;
 748     break;
 749   case vmIntrinsics::_vectorizedMismatch:
 750     if (!UseVectorizedMismatchIntrinsic) return true;
 751     break;
 752   case vmIntrinsics::_updateBytesAdler32:
 753   case vmIntrinsics::_updateByteBufferAdler32:
 754     if (!UseAdler32Intrinsics) return true;
 755     break;
 756   case vmIntrinsics::_copyMemory:
 757     if (!InlineArrayCopy || !InlineUnsafeOps) return true;
 758     break;
 759 #ifdef COMPILER1
 760   case vmIntrinsics::_checkIndex:
 761     if (!InlineNIOCheckIndex) return true;
 762     break;
 763 #endif // COMPILER1
 764 #ifdef COMPILER2
 765   case vmIntrinsics::_clone:
 766 #if INCLUDE_ZGC
 767     if (UseZGC) return true;
 768 #endif
 769   case vmIntrinsics::_copyOf:
 770   case vmIntrinsics::_copyOfRange:
 771     // These intrinsics use both the objectcopy and the arraycopy
 772     // intrinsic mechanism.
 773     if (!InlineObjectCopy || !InlineArrayCopy) return true;
 774     break;
 775   case vmIntrinsics::_compareToL:
 776   case vmIntrinsics::_compareToU:
 777   case vmIntrinsics::_compareToLU:
 778   case vmIntrinsics::_compareToUL:
 779     if (!SpecialStringCompareTo) return true;
 780     break;
 781   case vmIntrinsics::_indexOfL:
 782   case vmIntrinsics::_indexOfU:
 783   case vmIntrinsics::_indexOfUL:
 784   case vmIntrinsics::_indexOfIL:
 785   case vmIntrinsics::_indexOfIU:
 786   case vmIntrinsics::_indexOfIUL:
 787   case vmIntrinsics::_indexOfU_char:
 788     if (!SpecialStringIndexOf) return true;
 789     break;
 790   case vmIntrinsics::_equalsL:
 791   case vmIntrinsics::_equalsU:
 792     if (!SpecialStringEquals) return true;
 793     break;
 794   case vmIntrinsics::_equalsB:
 795   case vmIntrinsics::_equalsC:
 796     if (!SpecialArraysEquals) return true;
 797     break;
 798   case vmIntrinsics::_encodeISOArray:
 799   case vmIntrinsics::_encodeByteISOArray:
 800     if (!SpecialEncodeISOArray) return true;
 801     break;
 802   case vmIntrinsics::_getCallerClass:
 803     if (!InlineReflectionGetCallerClass) return true;
 804     break;
 805   case vmIntrinsics::_multiplyToLen:
 806     if (!UseMultiplyToLenIntrinsic) return true;
 807     break;
 808   case vmIntrinsics::_squareToLen:
 809     if (!UseSquareToLenIntrinsic) return true;
 810     break;
 811   case vmIntrinsics::_mulAdd:
 812     if (!UseMulAddIntrinsic) return true;
 813     break;
 814   case vmIntrinsics::_montgomeryMultiply:
 815     if (!UseMontgomeryMultiplyIntrinsic) return true;
 816     break;
 817   case vmIntrinsics::_montgomerySquare:
 818     if (!UseMontgomerySquareIntrinsic) return true;
 819     break;
 820   case vmIntrinsics::_addExactI:
 821   case vmIntrinsics::_addExactL:
 822   case vmIntrinsics::_decrementExactI:
 823   case vmIntrinsics::_decrementExactL:
 824   case vmIntrinsics::_incrementExactI:
 825   case vmIntrinsics::_incrementExactL:
 826   case vmIntrinsics::_multiplyExactI:
 827   case vmIntrinsics::_multiplyExactL:
 828   case vmIntrinsics::_negateExactI:
 829   case vmIntrinsics::_negateExactL:
 830   case vmIntrinsics::_subtractExactI:
 831   case vmIntrinsics::_subtractExactL:
 832     if (!UseMathExactIntrinsics || !InlineMathNatives) return true;
 833     break;
 834 #endif // COMPILER2
 835   default:
 836     return false;
 837   }
 838 
 839   return false;
 840 }
 841 
 842 #define VM_INTRINSIC_INITIALIZE(id, klass, name, sig, flags) #id "\0"
 843 static const char* vm_intrinsic_name_bodies =
 844   VM_INTRINSICS_DO(VM_INTRINSIC_INITIALIZE,
 845                    VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
 846 
 847 static const char* vm_intrinsic_name_table[vmIntrinsics::ID_LIMIT];
 848 
 849 const char* vmIntrinsics::name_at(vmIntrinsics::ID id) {
 850   const char** nt = &vm_intrinsic_name_table[0];
 851   if (nt[_none] == NULL) {
 852     char* string = (char*) &vm_intrinsic_name_bodies[0];
 853     for (int index = FIRST_ID; index < ID_LIMIT; index++) {
 854       nt[index] = string;
 855       string += strlen(string); // skip string body
 856       string += 1;              // skip trailing null
 857     }
 858     assert(!strcmp(nt[_hashCode], "_hashCode"), "lined up");
 859     nt[_none] = "_none";
 860   }
 861   if ((uint)id < (uint)ID_LIMIT)
 862     return vm_intrinsic_name_table[(uint)id];
 863   else
 864     return "(unknown intrinsic)";
 865 }
 866 
 867 // These are flag-matching functions:
 868 inline bool match_F_R(jshort flags) {
 869   const int req = 0;
 870   const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED;
 871   return (flags & (req | neg)) == req;
 872 }
 873 inline bool match_F_Y(jshort flags) {
 874   const int req = JVM_ACC_SYNCHRONIZED;
 875   const int neg = JVM_ACC_STATIC;
 876   return (flags & (req | neg)) == req;
 877 }
 878 inline bool match_F_RN(jshort flags) {
 879   const int req = JVM_ACC_NATIVE;
 880   const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED;
 881   return (flags & (req | neg)) == req;
 882 }
 883 inline bool match_F_S(jshort flags) {
 884   const int req = JVM_ACC_STATIC;
 885   const int neg = JVM_ACC_SYNCHRONIZED;
 886   return (flags & (req | neg)) == req;
 887 }
 888 inline bool match_F_SN(jshort flags) {
 889   const int req = JVM_ACC_STATIC | JVM_ACC_NATIVE;
 890   const int neg = JVM_ACC_SYNCHRONIZED;
 891   return (flags & (req | neg)) == req;
 892 }
 893 inline bool match_F_RNY(jshort flags) {
 894   const int req = JVM_ACC_NATIVE | JVM_ACC_SYNCHRONIZED;
 895   const int neg = JVM_ACC_STATIC;
 896   return (flags & (req | neg)) == req;
 897 }
 898 
 899 // These are for forming case labels:
 900 #define ID3(x, y, z) (( jlong)(z) +                                  \
 901                       ((jlong)(y) <<    vmSymbols::log2_SID_LIMIT) + \
 902                       ((jlong)(x) << (2*vmSymbols::log2_SID_LIMIT))  )
 903 #define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n)
 904 
 905 vmIntrinsics::ID vmIntrinsics::find_id_impl(vmSymbols::SID holder,
 906                                             vmSymbols::SID name,
 907                                             vmSymbols::SID sig,
 908                                             jshort flags) {
 909   assert((int)vmSymbols::SID_LIMIT <= (1<<vmSymbols::log2_SID_LIMIT), "must fit");
 910 
 911   // Let the C compiler build the decision tree.
 912 
 913 #define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \
 914   case ID3(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig)): \
 915     if (!match_##fcode(flags))  break; \
 916     return id;
 917 
 918   switch (ID3(holder, name, sig)) {
 919     VM_INTRINSICS_DO(VM_INTRINSIC_CASE,
 920                      VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
 921   }
 922   return vmIntrinsics::_none;
 923 
 924 #undef VM_INTRINSIC_CASE
 925 }
 926 
 927 
 928 const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) {
 929   const char* str = name_at(id);
 930 #ifndef PRODUCT
 931   const char* kname = vmSymbols::name_for(class_for(id));
 932   const char* mname = vmSymbols::name_for(name_for(id));
 933   const char* sname = vmSymbols::name_for(signature_for(id));
 934   const char* fname = "";
 935   switch (flags_for(id)) {
 936   case F_Y:  fname = "synchronized ";  break;
 937   case F_RN: fname = "native ";        break;
 938   case F_SN: fname = "native static "; break;
 939   case F_S:  fname = "static ";        break;
 940   case F_RNY:fname = "native synchronized "; break;
 941   default:   break;
 942   }
 943   const char* kptr = strrchr(kname, '/');
 944   if (kptr != NULL)  kname = kptr + 1;
 945   int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s",
 946                          str, fname, kname, mname, sname);
 947   if (len < buflen)
 948     str = buf;
 949 #endif //PRODUCT
 950   return str;
 951 }
 952 
 953 
 954 // These are to get information about intrinsics.
 955 
 956 #define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f))
 957 
 958 static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = {
 959 #define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \
 960   ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode),
 961 
 962   0, VM_INTRINSICS_DO(VM_INTRINSIC_INFO,
 963                      VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE)
 964     0
 965 #undef VM_INTRINSIC_INFO
 966 };
 967 
 968 inline jlong intrinsic_info(vmIntrinsics::ID id) {
 969   return intrinsic_info_array[vmIntrinsics::ID_from((int)id)];
 970 }
 971 
 972 vmSymbols::SID vmIntrinsics::class_for(vmIntrinsics::ID id) {
 973   jlong info = intrinsic_info(id);
 974   int shift = 2*vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT);
 975   assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1021, "");
 976   return vmSymbols::SID( (info >> shift) & mask );
 977 }
 978 
 979 vmSymbols::SID vmIntrinsics::name_for(vmIntrinsics::ID id) {
 980   jlong info = intrinsic_info(id);
 981   int shift = vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT);
 982   assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1022, "");
 983   return vmSymbols::SID( (info >> shift) & mask );
 984 }
 985 
 986 vmSymbols::SID vmIntrinsics::signature_for(vmIntrinsics::ID id) {
 987   jlong info = intrinsic_info(id);
 988   int shift = log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT);
 989   assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1023, "");
 990   return vmSymbols::SID( (info >> shift) & mask );
 991 }
 992 
 993 vmIntrinsics::Flags vmIntrinsics::flags_for(vmIntrinsics::ID id) {
 994   jlong info = intrinsic_info(id);
 995   int shift = 0, mask = right_n_bits(log2_FLAG_LIMIT);
 996   assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 15, "");
 997   return Flags( (info >> shift) & mask );
 998 }
 999 
1000 
1001 #ifndef PRODUCT
1002 // verify_method performs an extra check on a matched intrinsic method
1003 
1004 static bool match_method(Method* m, Symbol* n, Symbol* s) {
1005   return (m->name() == n &&
1006           m->signature() == s);
1007 }
1008 
1009 static vmIntrinsics::ID match_method_with_klass(Method* m, Symbol* mk) {
1010 #define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \
1011   { Symbol* k = vmSymbols::klassname(); \
1012     if (mk == k) { \
1013       Symbol* n = vmSymbols::namepart(); \
1014       Symbol* s = vmSymbols::sigpart(); \
1015       if (match_method(m, n, s)) \
1016         return vmIntrinsics::id; \
1017     } }
1018   VM_INTRINSICS_DO(VM_INTRINSIC_MATCH,
1019                    VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
1020   return vmIntrinsics::_none;
1021 #undef VM_INTRINSIC_MATCH
1022 }
1023 
1024 void vmIntrinsics::verify_method(ID actual_id, Method* m) {
1025   Symbol* mk = m->method_holder()->name();
1026   ID declared_id = match_method_with_klass(m, mk);
1027 
1028   if (declared_id == actual_id)  return; // success
1029 
1030   if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) {
1031     // Here are a few special cases in StrictMath not declared in vmSymbols.hpp.
1032     switch (actual_id) {
1033     case _min:
1034     case _max:
1035     case _dsqrt:
1036       declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math());
1037       if (declared_id == actual_id)  return; // acceptable alias
1038       break;
1039     default:
1040         break;
1041     }
1042   }
1043 
1044   const char* declared_name = name_at(declared_id);
1045   const char* actual_name   = name_at(actual_id);
1046   methodHandle mh = m;
1047   m = NULL;
1048   ttyLocker ttyl;
1049   if (xtty != NULL) {
1050     xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
1051                      actual_name, declared_name);
1052     xtty->method(mh);
1053     xtty->end_elem("%s", "");
1054   }
1055   if (PrintMiscellaneous && (WizardMode || Verbose)) {
1056     tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
1057                   declared_name, declared_id, actual_name, actual_id);
1058     mh()->print_short_name(tty);
1059     tty->cr();
1060   }
1061 }
1062 #endif //PRODUCT