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