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 5; 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::_sha3_implCompress: 715 if (!UseSHA3Intrinsics) return true; 716 break; 717 case vmIntrinsics::_digestBase_implCompressMB: 718 if (!(UseMD5Intrinsics || UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics || UseSHA3Intrinsics)) return true; 719 break; 720 case vmIntrinsics::_ghash_processBlocks: 721 if (!UseGHASHIntrinsics) return true; 722 break; 723 case vmIntrinsics::_base64_encodeBlock: 724 if (!UseBASE64Intrinsics) return true; 725 break; 726 case vmIntrinsics::_updateBytesCRC32C: 727 case vmIntrinsics::_updateDirectByteBufferCRC32C: 728 if (!UseCRC32CIntrinsics) return true; 729 break; 730 case vmIntrinsics::_vectorizedMismatch: 731 if (!UseVectorizedMismatchIntrinsic) return true; 732 break; 733 case vmIntrinsics::_updateBytesAdler32: 734 case vmIntrinsics::_updateByteBufferAdler32: 735 if (!UseAdler32Intrinsics) return true; 736 break; 737 case vmIntrinsics::_copyMemory: 738 if (!InlineArrayCopy || !InlineUnsafeOps) return true; 739 break; 740 #ifdef COMPILER1 741 case vmIntrinsics::_checkIndex: 742 if (!InlineNIOCheckIndex) return true; 743 break; 744 #endif // COMPILER1 745 #ifdef COMPILER2 746 case vmIntrinsics::_clone: 747 case vmIntrinsics::_copyOf: 748 case vmIntrinsics::_copyOfRange: 749 // These intrinsics use both the objectcopy and the arraycopy 750 // intrinsic mechanism. 751 if (!InlineObjectCopy || !InlineArrayCopy) return true; 752 break; 753 case vmIntrinsics::_compareToL: 754 case vmIntrinsics::_compareToU: 755 case vmIntrinsics::_compareToLU: 756 case vmIntrinsics::_compareToUL: 757 if (!SpecialStringCompareTo) return true; 758 break; 759 case vmIntrinsics::_indexOfL: 760 case vmIntrinsics::_indexOfU: 761 case vmIntrinsics::_indexOfUL: 762 case vmIntrinsics::_indexOfIL: 763 case vmIntrinsics::_indexOfIU: 764 case vmIntrinsics::_indexOfIUL: 765 case vmIntrinsics::_indexOfU_char: 766 if (!SpecialStringIndexOf) return true; 767 break; 768 case vmIntrinsics::_equalsL: 769 case vmIntrinsics::_equalsU: 770 if (!SpecialStringEquals) return true; 771 break; 772 case vmIntrinsics::_equalsB: 773 case vmIntrinsics::_equalsC: 774 if (!SpecialArraysEquals) return true; 775 break; 776 case vmIntrinsics::_encodeISOArray: 777 case vmIntrinsics::_encodeByteISOArray: 778 if (!SpecialEncodeISOArray) return true; 779 break; 780 case vmIntrinsics::_getCallerClass: 781 if (!InlineReflectionGetCallerClass) return true; 782 break; 783 case vmIntrinsics::_multiplyToLen: 784 if (!UseMultiplyToLenIntrinsic) return true; 785 break; 786 case vmIntrinsics::_squareToLen: 787 if (!UseSquareToLenIntrinsic) return true; 788 break; 789 case vmIntrinsics::_mulAdd: 790 if (!UseMulAddIntrinsic) return true; 791 break; 792 case vmIntrinsics::_montgomeryMultiply: 793 if (!UseMontgomeryMultiplyIntrinsic) return true; 794 break; 795 case vmIntrinsics::_montgomerySquare: 796 if (!UseMontgomerySquareIntrinsic) return true; 797 break; 798 case vmIntrinsics::_bigIntegerRightShiftWorker: 799 case vmIntrinsics::_bigIntegerLeftShiftWorker: 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 case vmIntrinsics::_isDigit: 816 case vmIntrinsics::_isLowerCase: 817 case vmIntrinsics::_isUpperCase: 818 case vmIntrinsics::_isWhitespace: 819 if (!UseCharacterCompareIntrinsics) return true; 820 break; 821 #endif // COMPILER2 822 default: 823 return false; 824 } 825 826 return false; 827 } 828 829 #define VM_INTRINSIC_INITIALIZE(id, klass, name, sig, flags) #id "\0" 830 static const char* vm_intrinsic_name_bodies = 831 VM_INTRINSICS_DO(VM_INTRINSIC_INITIALIZE, 832 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 833 834 static const char* vm_intrinsic_name_table[vmIntrinsics::ID_LIMIT]; 835 static TriBoolArray<vmIntrinsics::ID_LIMIT, int> vm_intrinsic_control_words; 836 837 static void init_vm_intrinsic_name_table() { 838 const char** nt = &vm_intrinsic_name_table[0]; 839 char* string = (char*) &vm_intrinsic_name_bodies[0]; 840 for (int index = vmIntrinsics::FIRST_ID; index < vmIntrinsics::ID_LIMIT; index++) { 841 nt[index] = string; 842 string += strlen(string); // skip string body 843 string += 1; // skip trailing null 844 } 845 assert(!strcmp(nt[vmIntrinsics::_hashCode], "_hashCode"), "lined up"); 846 nt[vmIntrinsics::_none] = "_none"; 847 } 848 849 const char* vmIntrinsics::name_at(vmIntrinsics::ID id) { 850 const char** nt = &vm_intrinsic_name_table[0]; 851 if (nt[_none] == NULL) { 852 init_vm_intrinsic_name_table(); 853 } 854 855 if ((uint)id < (uint)ID_LIMIT) 856 return vm_intrinsic_name_table[(uint)id]; 857 else 858 return "(unknown intrinsic)"; 859 } 860 861 vmIntrinsics::ID vmIntrinsics::find_id(const char* name) { 862 const char** nt = &vm_intrinsic_name_table[0]; 863 if (nt[_none] == NULL) { 864 init_vm_intrinsic_name_table(); 865 } 866 867 for (int index = FIRST_ID; index < ID_LIMIT; ++index) { 868 if (0 == strcmp(name, nt[index])) { 869 return ID_from(index); 870 } 871 } 872 873 return _none; 874 } 875 876 bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) { 877 vmIntrinsics::ID id = method->intrinsic_id(); 878 return is_disabled_by_flags(id); 879 } 880 881 bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) { 882 assert(id > _none && id < ID_LIMIT, "must be a VM intrinsic"); 883 884 // not initialized yet, process Control/DisableIntrinsic 885 if (vm_intrinsic_control_words[_none].is_default()) { 886 for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != NULL; ++iter) { 887 vmIntrinsics::ID id = vmIntrinsics::find_id(*iter); 888 889 if (id != vmIntrinsics::_none) { 890 vm_intrinsic_control_words[id] = iter.is_enabled() && !disabled_by_jvm_flags(id); 891 } 892 } 893 894 // Order matters, DisableIntrinsic can overwrite ControlIntrinsic 895 for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != NULL; ++iter) { 896 vmIntrinsics::ID id = vmIntrinsics::find_id(*iter); 897 898 if (id != vmIntrinsics::_none) { 899 vm_intrinsic_control_words[id] = false; 900 } 901 } 902 903 vm_intrinsic_control_words[_none] = true; 904 } 905 906 TriBool b = vm_intrinsic_control_words[id]; 907 if (b.is_default()) { 908 // unknown yet, query and cache it 909 b = vm_intrinsic_control_words[id] = !disabled_by_jvm_flags(id); 910 } 911 912 return !b; 913 } 914 915 // These are flag-matching functions: 916 inline bool match_F_R(jshort flags) { 917 const int req = 0; 918 const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED; 919 return (flags & (req | neg)) == req; 920 } 921 inline bool match_F_Y(jshort flags) { 922 const int req = JVM_ACC_SYNCHRONIZED; 923 const int neg = JVM_ACC_STATIC; 924 return (flags & (req | neg)) == req; 925 } 926 inline bool match_F_RN(jshort flags) { 927 const int req = JVM_ACC_NATIVE; 928 const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED; 929 return (flags & (req | neg)) == req; 930 } 931 inline bool match_F_S(jshort flags) { 932 const int req = JVM_ACC_STATIC; 933 const int neg = JVM_ACC_SYNCHRONIZED; 934 return (flags & (req | neg)) == req; 935 } 936 inline bool match_F_SN(jshort flags) { 937 const int req = JVM_ACC_STATIC | JVM_ACC_NATIVE; 938 const int neg = JVM_ACC_SYNCHRONIZED; 939 return (flags & (req | neg)) == req; 940 } 941 inline bool match_F_RNY(jshort flags) { 942 const int req = JVM_ACC_NATIVE | JVM_ACC_SYNCHRONIZED; 943 const int neg = JVM_ACC_STATIC; 944 return (flags & (req | neg)) == req; 945 } 946 947 // These are for forming case labels: 948 #define ID3(x, y, z) (( jlong)(z) + \ 949 ((jlong)(y) << vmSymbols::log2_SID_LIMIT) + \ 950 ((jlong)(x) << (2*vmSymbols::log2_SID_LIMIT)) ) 951 #define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n) 952 953 vmIntrinsics::ID vmIntrinsics::find_id_impl(vmSymbols::SID holder, 954 vmSymbols::SID name, 955 vmSymbols::SID sig, 956 jshort flags) { 957 assert((int)vmSymbols::SID_LIMIT <= (1<<vmSymbols::log2_SID_LIMIT), "must fit"); 958 959 // Let the C compiler build the decision tree. 960 961 #define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \ 962 case ID3(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig)): \ 963 if (!match_##fcode(flags)) break; \ 964 return id; 965 966 switch (ID3(holder, name, sig)) { 967 VM_INTRINSICS_DO(VM_INTRINSIC_CASE, 968 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 969 } 970 return vmIntrinsics::_none; 971 972 #undef VM_INTRINSIC_CASE 973 } 974 975 976 const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) { 977 const char* str = name_at(id); 978 #ifndef PRODUCT 979 const char* kname = vmSymbols::name_for(class_for(id)); 980 const char* mname = vmSymbols::name_for(name_for(id)); 981 const char* sname = vmSymbols::name_for(signature_for(id)); 982 const char* fname = ""; 983 switch (flags_for(id)) { 984 case F_Y: fname = "synchronized "; break; 985 case F_RN: fname = "native "; break; 986 case F_SN: fname = "native static "; break; 987 case F_S: fname = "static "; break; 988 case F_RNY:fname = "native synchronized "; break; 989 default: break; 990 } 991 const char* kptr = strrchr(kname, JVM_SIGNATURE_SLASH); 992 if (kptr != NULL) kname = kptr + 1; 993 int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s", 994 str, fname, kname, mname, sname); 995 if (len < buflen) 996 str = buf; 997 #endif //PRODUCT 998 return str; 999 } 1000 1001 1002 // These are to get information about intrinsics. 1003 1004 #define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f)) 1005 1006 static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = { 1007 #define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \ 1008 ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode), 1009 1010 0, VM_INTRINSICS_DO(VM_INTRINSIC_INFO, 1011 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) 1012 0 1013 #undef VM_INTRINSIC_INFO 1014 }; 1015 1016 inline jlong intrinsic_info(vmIntrinsics::ID id) { 1017 return intrinsic_info_array[vmIntrinsics::ID_from((int)id)]; 1018 } 1019 1020 vmSymbols::SID vmIntrinsics::class_for(vmIntrinsics::ID id) { 1021 jlong info = intrinsic_info(id); 1022 int shift = 2*vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); 1023 assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1021, ""); 1024 return vmSymbols::SID( (info >> shift) & mask ); 1025 } 1026 1027 vmSymbols::SID vmIntrinsics::name_for(vmIntrinsics::ID id) { 1028 jlong info = intrinsic_info(id); 1029 int shift = vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); 1030 assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1022, ""); 1031 return vmSymbols::SID( (info >> shift) & mask ); 1032 } 1033 1034 vmSymbols::SID vmIntrinsics::signature_for(vmIntrinsics::ID id) { 1035 jlong info = intrinsic_info(id); 1036 int shift = log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); 1037 assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1023, ""); 1038 return vmSymbols::SID( (info >> shift) & mask ); 1039 } 1040 1041 vmIntrinsics::Flags vmIntrinsics::flags_for(vmIntrinsics::ID id) { 1042 jlong info = intrinsic_info(id); 1043 int shift = 0, mask = right_n_bits(log2_FLAG_LIMIT); 1044 assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 15, ""); 1045 return Flags( (info >> shift) & mask ); 1046 } 1047 1048 1049 #ifndef PRODUCT 1050 // verify_method performs an extra check on a matched intrinsic method 1051 1052 static bool match_method(Method* m, Symbol* n, Symbol* s) { 1053 return (m->name() == n && 1054 m->signature() == s); 1055 } 1056 1057 static vmIntrinsics::ID match_method_with_klass(Method* m, Symbol* mk) { 1058 #define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \ 1059 { Symbol* k = vmSymbols::klassname(); \ 1060 if (mk == k) { \ 1061 Symbol* n = vmSymbols::namepart(); \ 1062 Symbol* s = vmSymbols::sigpart(); \ 1063 if (match_method(m, n, s)) \ 1064 return vmIntrinsics::id; \ 1065 } } 1066 VM_INTRINSICS_DO(VM_INTRINSIC_MATCH, 1067 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 1068 return vmIntrinsics::_none; 1069 #undef VM_INTRINSIC_MATCH 1070 } 1071 1072 void vmIntrinsics::verify_method(ID actual_id, Method* m) { 1073 Symbol* mk = m->method_holder()->name(); 1074 ID declared_id = match_method_with_klass(m, mk); 1075 1076 if (declared_id == actual_id) return; // success 1077 1078 if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) { 1079 // Here are a few special cases in StrictMath not declared in vmSymbols.hpp. 1080 switch (actual_id) { 1081 case _min: 1082 case _max: 1083 case _dsqrt: 1084 declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math()); 1085 if (declared_id == actual_id) return; // acceptable alias 1086 break; 1087 default: 1088 break; 1089 } 1090 } 1091 1092 const char* declared_name = name_at(declared_id); 1093 const char* actual_name = name_at(actual_id); 1094 m = NULL; 1095 ttyLocker ttyl; 1096 if (xtty != NULL) { 1097 xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'", 1098 actual_name, declared_name); 1099 xtty->method(m); 1100 xtty->end_elem("%s", ""); 1101 } 1102 if (PrintMiscellaneous && (WizardMode || Verbose)) { 1103 tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):", 1104 declared_name, declared_id, actual_name, actual_id); 1105 m->print_short_name(tty); 1106 tty->cr(); 1107 } 1108 } 1109 #endif //PRODUCT