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