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