1 /* 2 * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/vmClasses.hpp" 27 #include "compiler/compilationMemoryStatistic.hpp" 28 #include "compiler/compilerDefinitions.inline.hpp" 29 #include "runtime/handles.inline.hpp" 30 #include "jfr/support/jfrIntrinsics.hpp" 31 #include "opto/c2compiler.hpp" 32 #include "opto/compile.hpp" 33 #include "opto/optoreg.hpp" 34 #include "opto/output.hpp" 35 #include "opto/runtime.hpp" 36 #include "runtime/stubRoutines.hpp" 37 #include "runtime/globals_extension.hpp" 38 #include "utilities/macros.hpp" 39 40 41 // register information defined by ADLC 42 extern const char register_save_policy[]; 43 extern const int register_save_type[]; 44 45 const char* C2Compiler::retry_no_subsuming_loads() { 46 return "retry without subsuming loads"; 47 } 48 const char* C2Compiler::retry_no_escape_analysis() { 49 return "retry without escape analysis"; 50 } 51 const char* C2Compiler::retry_no_locks_coarsening() { 52 return "retry without locks coarsening"; 53 } 54 const char* C2Compiler::retry_no_iterative_escape_analysis() { 55 return "retry without iterative escape analysis"; 56 } 57 const char* C2Compiler::retry_no_reduce_allocation_merges() { 58 return "retry without reducing allocation merges"; 59 } 60 const char* C2Compiler::retry_no_superword() { 61 return "retry without SuperWord"; 62 } 63 64 void compiler_stubs_init(bool in_compiler_thread); 65 66 bool C2Compiler::init_c2_runtime() { 67 68 #ifdef ASSERT 69 if (!AlignVector && VerifyAlignVector) { 70 warning("VerifyAlignVector disabled because AlignVector is not enabled."); 71 FLAG_SET_CMDLINE(VerifyAlignVector, false); 72 } 73 #endif 74 75 // Check assumptions used while running ADLC 76 Compile::adlc_verification(); 77 assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts"); 78 79 for (int i = 0; i < ConcreteRegisterImpl::number_of_registers ; i++ ) { 80 OptoReg::vm2opto[i] = OptoReg::Bad; 81 } 82 83 for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(REG_COUNT); i = OptoReg::add(i,1) ) { 84 VMReg r = OptoReg::as_VMReg(i); 85 if (r->is_valid()) { 86 OptoReg::vm2opto[r->value()] = i; 87 } 88 } 89 90 DEBUG_ONLY( Node::init_NodeProperty(); ) 91 92 compiler_stubs_init(true /* in_compiler_thread */); // generate compiler's intrinsics stubs 93 94 Compile::pd_compiler2_init(); 95 96 CompilerThread* thread = CompilerThread::current(); 97 98 HandleMark handle_mark(thread); 99 return OptoRuntime::generate(thread->env()); 100 } 101 102 void C2Compiler::initialize() { 103 assert(!CompilerConfig::is_c1_or_interpreter_only_no_jvmci(), "C2 compiler is launched, it's not c1/interpreter only mode"); 104 // The first compiler thread that gets here will initialize the 105 // small amount of global state (and runtime stubs) that C2 needs. 106 107 // There is a race possible once at startup and then we're fine 108 109 // Note that this is being called from a compiler thread not the 110 // main startup thread. 111 if (should_perform_init()) { 112 bool successful = C2Compiler::init_c2_runtime(); 113 int new_state = (successful) ? initialized : failed; 114 set_state(new_state); 115 } 116 } 117 118 void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) { 119 assert(is_initialized(), "Compiler thread must be initialized"); 120 121 CompilationMemoryStatisticMark cmsm(directive); 122 123 bool subsume_loads = SubsumeLoads; 124 bool do_escape_analysis = DoEscapeAnalysis; 125 bool do_iterative_escape_analysis = DoEscapeAnalysis; 126 bool do_reduce_allocation_merges = ReduceAllocationMerges && EliminateAllocations; 127 // TODO 8328675 Re-enable 128 bool eliminate_boxing = false; // EliminateAutoBox; 129 bool do_locks_coarsening = EliminateLocks; 130 bool do_superword = UseSuperWord; 131 132 while (!env->failing()) { 133 ResourceMark rm; 134 // Attempt to compile while subsuming loads into machine instructions. 135 Options options(subsume_loads, 136 do_escape_analysis, 137 do_iterative_escape_analysis, 138 do_reduce_allocation_merges, 139 eliminate_boxing, 140 do_locks_coarsening, 141 do_superword, 142 install_code); 143 Compile C(env, target, entry_bci, options, directive); 144 145 // Check result and retry if appropriate. 146 if (C.failure_reason() != nullptr) { 147 if (C.failure_reason_is(retry_no_subsuming_loads())) { 148 assert(subsume_loads, "must make progress"); 149 subsume_loads = false; 150 env->report_failure(C.failure_reason()); 151 continue; // retry 152 } 153 if (C.failure_reason_is(retry_no_escape_analysis())) { 154 assert(do_escape_analysis, "must make progress"); 155 do_escape_analysis = false; 156 env->report_failure(C.failure_reason()); 157 continue; // retry 158 } 159 if (C.failure_reason_is(retry_no_iterative_escape_analysis())) { 160 assert(do_iterative_escape_analysis, "must make progress"); 161 do_iterative_escape_analysis = false; 162 env->report_failure(C.failure_reason()); 163 continue; // retry 164 } 165 if (C.failure_reason_is(retry_no_reduce_allocation_merges())) { 166 assert(do_reduce_allocation_merges, "must make progress"); 167 do_reduce_allocation_merges = false; 168 env->report_failure(C.failure_reason()); 169 continue; // retry 170 } 171 if (C.failure_reason_is(retry_no_locks_coarsening())) { 172 assert(do_locks_coarsening, "must make progress"); 173 do_locks_coarsening = false; 174 env->report_failure(C.failure_reason()); 175 continue; // retry 176 } 177 if (C.failure_reason_is(retry_no_superword())) { 178 assert(do_superword, "must make progress"); 179 do_superword = false; 180 env->report_failure(C.failure_reason()); 181 continue; // retry 182 } 183 if (C.has_boxed_value()) { 184 // Recompile without boxing elimination regardless failure reason. 185 assert(eliminate_boxing, "must make progress"); 186 eliminate_boxing = false; 187 env->report_failure(C.failure_reason()); 188 continue; // retry 189 } 190 // Pass any other failure reason up to the ciEnv. 191 // Note that serious, irreversible failures are already logged 192 // on the ciEnv via env->record_method_not_compilable(). 193 env->record_failure(C.failure_reason()); 194 } 195 if (StressRecompilation) { 196 if (subsume_loads) { 197 subsume_loads = false; 198 continue; // retry 199 } 200 if (do_escape_analysis) { 201 do_escape_analysis = false; 202 continue; // retry 203 } 204 if (do_locks_coarsening) { 205 do_locks_coarsening = false; 206 continue; // retry 207 } 208 } 209 // print inlining for last compilation only 210 C.dump_print_inlining(); 211 212 // No retry; just break the loop. 213 break; 214 } 215 } 216 217 void C2Compiler::print_timers() { 218 Compile::print_timers(); 219 } 220 221 bool C2Compiler::is_intrinsic_supported(const methodHandle& method) { 222 vmIntrinsics::ID id = method->intrinsic_id(); 223 return C2Compiler::is_intrinsic_supported(id); 224 } 225 226 bool C2Compiler::is_intrinsic_supported(vmIntrinsics::ID id) { 227 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); 228 229 if (id < vmIntrinsics::FIRST_ID || id > vmIntrinsics::LAST_COMPILER_INLINE) { 230 return false; 231 } 232 233 switch (id) { 234 case vmIntrinsics::_compressStringC: 235 case vmIntrinsics::_compressStringB: 236 if (!Matcher::match_rule_supported(Op_StrCompressedCopy)) return false; 237 break; 238 case vmIntrinsics::_inflateStringC: 239 case vmIntrinsics::_inflateStringB: 240 if (!Matcher::match_rule_supported(Op_StrInflatedCopy)) return false; 241 break; 242 case vmIntrinsics::_compareToL: 243 case vmIntrinsics::_compareToU: 244 case vmIntrinsics::_compareToLU: 245 case vmIntrinsics::_compareToUL: 246 if (!Matcher::match_rule_supported(Op_StrComp)) return false; 247 break; 248 case vmIntrinsics::_equalsL: 249 if (!Matcher::match_rule_supported(Op_StrEquals)) return false; 250 break; 251 case vmIntrinsics::_vectorizedHashCode: 252 if (!Matcher::match_rule_supported(Op_VectorizedHashCode)) return false; 253 break; 254 case vmIntrinsics::_equalsB: 255 case vmIntrinsics::_equalsC: 256 if (!Matcher::match_rule_supported(Op_AryEq)) return false; 257 break; 258 case vmIntrinsics::_copyMemory: 259 if (StubRoutines::unsafe_arraycopy() == nullptr) return false; 260 break; 261 case vmIntrinsics::_setMemory: 262 if (StubRoutines::unsafe_setmemory() == nullptr) return false; 263 break; 264 case vmIntrinsics::_electronicCodeBook_encryptAESCrypt: 265 if (StubRoutines::electronicCodeBook_encryptAESCrypt() == nullptr) return false; 266 break; 267 case vmIntrinsics::_electronicCodeBook_decryptAESCrypt: 268 if (StubRoutines::electronicCodeBook_decryptAESCrypt() == nullptr) return false; 269 break; 270 case vmIntrinsics::_galoisCounterMode_AESCrypt: 271 if (StubRoutines::galoisCounterMode_AESCrypt() == nullptr) return false; 272 break; 273 case vmIntrinsics::_bigIntegerRightShiftWorker: 274 if (StubRoutines::bigIntegerRightShift() == nullptr) return false; 275 break; 276 case vmIntrinsics::_bigIntegerLeftShiftWorker: 277 if (StubRoutines::bigIntegerLeftShift() == nullptr) return false; 278 break; 279 case vmIntrinsics::_encodeAsciiArray: 280 if (!Matcher::match_rule_supported(Op_EncodeISOArray) || !Matcher::supports_encode_ascii_array) return false; 281 break; 282 case vmIntrinsics::_encodeISOArray: 283 case vmIntrinsics::_encodeByteISOArray: 284 if (!Matcher::match_rule_supported(Op_EncodeISOArray)) return false; 285 break; 286 case vmIntrinsics::_countPositives: 287 if (!Matcher::match_rule_supported(Op_CountPositives)) return false; 288 break; 289 case vmIntrinsics::_bitCount_i: 290 if (!Matcher::match_rule_supported(Op_PopCountI)) return false; 291 break; 292 case vmIntrinsics::_bitCount_l: 293 if (!Matcher::match_rule_supported(Op_PopCountL)) return false; 294 break; 295 case vmIntrinsics::_compress_i: 296 case vmIntrinsics::_compress_l: 297 if (!Matcher::match_rule_supported(Op_CompressBits)) return false; 298 break; 299 case vmIntrinsics::_expand_i: 300 case vmIntrinsics::_expand_l: 301 if (!Matcher::match_rule_supported(Op_ExpandBits)) return false; 302 break; 303 case vmIntrinsics::_numberOfLeadingZeros_i: 304 if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return false; 305 break; 306 case vmIntrinsics::_numberOfLeadingZeros_l: 307 if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return false; 308 break; 309 case vmIntrinsics::_numberOfTrailingZeros_i: 310 if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return false; 311 break; 312 case vmIntrinsics::_numberOfTrailingZeros_l: 313 if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return false; 314 break; 315 case vmIntrinsics::_reverse_i: 316 if (!Matcher::match_rule_supported(Op_ReverseI)) return false; 317 break; 318 case vmIntrinsics::_reverse_l: 319 if (!Matcher::match_rule_supported(Op_ReverseL)) return false; 320 break; 321 case vmIntrinsics::_reverseBytes_c: 322 if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return false; 323 break; 324 case vmIntrinsics::_reverseBytes_s: 325 if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return false; 326 break; 327 case vmIntrinsics::_reverseBytes_i: 328 if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return false; 329 break; 330 case vmIntrinsics::_reverseBytes_l: 331 if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false; 332 break; 333 case vmIntrinsics::_compareUnsigned_i: 334 if (!Matcher::match_rule_supported(Op_CmpU3)) return false; 335 break; 336 case vmIntrinsics::_compareUnsigned_l: 337 if (!Matcher::match_rule_supported(Op_CmpUL3)) return false; 338 break; 339 case vmIntrinsics::_divideUnsigned_i: 340 if (!Matcher::match_rule_supported(Op_UDivI)) return false; 341 break; 342 case vmIntrinsics::_remainderUnsigned_i: 343 if (!Matcher::match_rule_supported(Op_UModI)) return false; 344 break; 345 case vmIntrinsics::_divideUnsigned_l: 346 if (!Matcher::match_rule_supported(Op_UDivL)) return false; 347 break; 348 case vmIntrinsics::_remainderUnsigned_l: 349 if (!Matcher::match_rule_supported(Op_UModL)) return false; 350 break; 351 case vmIntrinsics::_float16ToFloat: 352 if (!Matcher::match_rule_supported(Op_ConvHF2F)) return false; 353 break; 354 case vmIntrinsics::_floatToFloat16: 355 if (!Matcher::match_rule_supported(Op_ConvF2HF)) return false; 356 break; 357 358 /* CompareAndSet, Object: */ 359 case vmIntrinsics::_compareAndSetReference: 360 #ifdef _LP64 361 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false; 362 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; 363 #else 364 if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; 365 #endif 366 break; 367 case vmIntrinsics::_weakCompareAndSetReferencePlain: 368 case vmIntrinsics::_weakCompareAndSetReferenceAcquire: 369 case vmIntrinsics::_weakCompareAndSetReferenceRelease: 370 case vmIntrinsics::_weakCompareAndSetReference: 371 #ifdef _LP64 372 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false; 373 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; 374 #else 375 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; 376 #endif 377 break; 378 /* CompareAndSet, Long: */ 379 case vmIntrinsics::_compareAndSetLong: 380 if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false; 381 break; 382 case vmIntrinsics::_weakCompareAndSetLongPlain: 383 case vmIntrinsics::_weakCompareAndSetLongAcquire: 384 case vmIntrinsics::_weakCompareAndSetLongRelease: 385 case vmIntrinsics::_weakCompareAndSetLong: 386 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false; 387 break; 388 389 /* CompareAndSet, Int: */ 390 case vmIntrinsics::_compareAndSetInt: 391 if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false; 392 break; 393 case vmIntrinsics::_weakCompareAndSetIntPlain: 394 case vmIntrinsics::_weakCompareAndSetIntAcquire: 395 case vmIntrinsics::_weakCompareAndSetIntRelease: 396 case vmIntrinsics::_weakCompareAndSetInt: 397 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapI)) return false; 398 break; 399 400 /* CompareAndSet, Byte: */ 401 case vmIntrinsics::_compareAndSetByte: 402 if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false; 403 break; 404 case vmIntrinsics::_weakCompareAndSetBytePlain: 405 case vmIntrinsics::_weakCompareAndSetByteAcquire: 406 case vmIntrinsics::_weakCompareAndSetByteRelease: 407 case vmIntrinsics::_weakCompareAndSetByte: 408 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false; 409 break; 410 411 /* CompareAndSet, Short: */ 412 case vmIntrinsics::_compareAndSetShort: 413 if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false; 414 break; 415 case vmIntrinsics::_weakCompareAndSetShortPlain: 416 case vmIntrinsics::_weakCompareAndSetShortAcquire: 417 case vmIntrinsics::_weakCompareAndSetShortRelease: 418 case vmIntrinsics::_weakCompareAndSetShort: 419 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false; 420 break; 421 422 /* CompareAndExchange, Object: */ 423 case vmIntrinsics::_compareAndExchangeReference: 424 case vmIntrinsics::_compareAndExchangeReferenceAcquire: 425 case vmIntrinsics::_compareAndExchangeReferenceRelease: 426 #ifdef _LP64 427 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeN)) return false; 428 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; 429 #else 430 if (!Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; 431 #endif 432 break; 433 434 /* CompareAndExchange, Long: */ 435 case vmIntrinsics::_compareAndExchangeLong: 436 case vmIntrinsics::_compareAndExchangeLongAcquire: 437 case vmIntrinsics::_compareAndExchangeLongRelease: 438 if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false; 439 break; 440 441 /* CompareAndExchange, Int: */ 442 case vmIntrinsics::_compareAndExchangeInt: 443 case vmIntrinsics::_compareAndExchangeIntAcquire: 444 case vmIntrinsics::_compareAndExchangeIntRelease: 445 if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false; 446 break; 447 448 /* CompareAndExchange, Byte: */ 449 case vmIntrinsics::_compareAndExchangeByte: 450 case vmIntrinsics::_compareAndExchangeByteAcquire: 451 case vmIntrinsics::_compareAndExchangeByteRelease: 452 if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false; 453 break; 454 455 /* CompareAndExchange, Short: */ 456 case vmIntrinsics::_compareAndExchangeShort: 457 case vmIntrinsics::_compareAndExchangeShortAcquire: 458 case vmIntrinsics::_compareAndExchangeShortRelease: 459 if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false; 460 break; 461 462 case vmIntrinsics::_getAndAddByte: 463 if (!Matcher::match_rule_supported(Op_GetAndAddB)) return false; 464 break; 465 case vmIntrinsics::_getAndAddShort: 466 if (!Matcher::match_rule_supported(Op_GetAndAddS)) return false; 467 break; 468 case vmIntrinsics::_getAndAddInt: 469 if (!Matcher::match_rule_supported(Op_GetAndAddI)) return false; 470 break; 471 case vmIntrinsics::_getAndAddLong: 472 if (!Matcher::match_rule_supported(Op_GetAndAddL)) return false; 473 break; 474 475 case vmIntrinsics::_getAndSetByte: 476 if (!Matcher::match_rule_supported(Op_GetAndSetB)) return false; 477 break; 478 case vmIntrinsics::_getAndSetShort: 479 if (!Matcher::match_rule_supported(Op_GetAndSetS)) return false; 480 break; 481 case vmIntrinsics::_getAndSetInt: 482 if (!Matcher::match_rule_supported(Op_GetAndSetI)) return false; 483 break; 484 case vmIntrinsics::_getAndSetLong: 485 if (!Matcher::match_rule_supported(Op_GetAndSetL)) return false; 486 break; 487 case vmIntrinsics::_getAndSetReference: 488 #ifdef _LP64 489 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return false; 490 if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return false; 491 break; 492 #else 493 if (!Matcher::match_rule_supported(Op_GetAndSetP)) return false; 494 break; 495 #endif 496 case vmIntrinsics::_incrementExactI: 497 case vmIntrinsics::_addExactI: 498 if (!Matcher::match_rule_supported(Op_OverflowAddI)) return false; 499 break; 500 case vmIntrinsics::_incrementExactL: 501 case vmIntrinsics::_addExactL: 502 if (!Matcher::match_rule_supported(Op_OverflowAddL)) return false; 503 break; 504 case vmIntrinsics::_decrementExactI: 505 case vmIntrinsics::_subtractExactI: 506 if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false; 507 break; 508 case vmIntrinsics::_decrementExactL: 509 case vmIntrinsics::_subtractExactL: 510 if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false; 511 break; 512 case vmIntrinsics::_negateExactI: 513 if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false; 514 break; 515 case vmIntrinsics::_negateExactL: 516 if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false; 517 break; 518 case vmIntrinsics::_multiplyExactI: 519 if (!Matcher::match_rule_supported(Op_OverflowMulI)) return false; 520 break; 521 case vmIntrinsics::_multiplyExactL: 522 if (!Matcher::match_rule_supported(Op_OverflowMulL)) return false; 523 break; 524 case vmIntrinsics::_multiplyHigh: 525 if (!Matcher::match_rule_supported(Op_MulHiL)) return false; 526 break; 527 case vmIntrinsics::_unsignedMultiplyHigh: 528 if (!Matcher::match_rule_supported(Op_UMulHiL)) return false; 529 break; 530 case vmIntrinsics::_getCallerClass: 531 if (vmClasses::reflect_CallerSensitive_klass() == nullptr) return false; 532 break; 533 case vmIntrinsics::_onSpinWait: 534 if (!Matcher::match_rule_supported(Op_OnSpinWait)) return false; 535 break; 536 case vmIntrinsics::_fmaD: 537 if (!Matcher::match_rule_supported(Op_FmaD)) return false; 538 break; 539 case vmIntrinsics::_fmaF: 540 if (!Matcher::match_rule_supported(Op_FmaF)) return false; 541 break; 542 case vmIntrinsics::_isDigit: 543 if (!Matcher::match_rule_supported(Op_Digit)) return false; 544 break; 545 case vmIntrinsics::_isLowerCase: 546 if (!Matcher::match_rule_supported(Op_LowerCase)) return false; 547 break; 548 case vmIntrinsics::_isUpperCase: 549 if (!Matcher::match_rule_supported(Op_UpperCase)) return false; 550 break; 551 case vmIntrinsics::_isWhitespace: 552 if (!Matcher::match_rule_supported(Op_Whitespace)) return false; 553 break; 554 case vmIntrinsics::_maxF: 555 case vmIntrinsics::_maxF_strict: 556 if (!Matcher::match_rule_supported(Op_MaxF)) return false; 557 break; 558 case vmIntrinsics::_minF: 559 case vmIntrinsics::_minF_strict: 560 if (!Matcher::match_rule_supported(Op_MinF)) return false; 561 break; 562 case vmIntrinsics::_maxD: 563 case vmIntrinsics::_maxD_strict: 564 if (!Matcher::match_rule_supported(Op_MaxD)) return false; 565 break; 566 case vmIntrinsics::_minD: 567 case vmIntrinsics::_minD_strict: 568 if (!Matcher::match_rule_supported(Op_MinD)) return false; 569 break; 570 case vmIntrinsics::_writeback0: 571 if (!Matcher::match_rule_supported(Op_CacheWB)) return false; 572 break; 573 case vmIntrinsics::_writebackPreSync0: 574 if (!Matcher::match_rule_supported(Op_CacheWBPreSync)) return false; 575 break; 576 case vmIntrinsics::_writebackPostSync0: 577 if (!Matcher::match_rule_supported(Op_CacheWBPostSync)) return false; 578 break; 579 case vmIntrinsics::_rint: 580 case vmIntrinsics::_ceil: 581 case vmIntrinsics::_floor: 582 if (!Matcher::match_rule_supported(Op_RoundDoubleMode)) return false; 583 break; 584 case vmIntrinsics::_dcopySign: 585 if (!Matcher::match_rule_supported(Op_CopySignD)) return false; 586 break; 587 case vmIntrinsics::_fcopySign: 588 if (!Matcher::match_rule_supported(Op_CopySignF)) return false; 589 break; 590 case vmIntrinsics::_dsignum: 591 if (!Matcher::match_rule_supported(Op_SignumD)) return false; 592 break; 593 case vmIntrinsics::_fsignum: 594 if (!Matcher::match_rule_supported(Op_SignumF)) return false; 595 break; 596 case vmIntrinsics::_floatIsInfinite: 597 if (!Matcher::match_rule_supported(Op_IsInfiniteF)) return false; 598 break; 599 case vmIntrinsics::_floatIsFinite: 600 if (!Matcher::match_rule_supported(Op_IsFiniteF)) return false; 601 break; 602 case vmIntrinsics::_doubleIsInfinite: 603 if (!Matcher::match_rule_supported(Op_IsInfiniteD)) return false; 604 break; 605 case vmIntrinsics::_doubleIsFinite: 606 if (!Matcher::match_rule_supported(Op_IsFiniteD)) return false; 607 break; 608 case vmIntrinsics::_hashCode: 609 case vmIntrinsics::_identityHashCode: 610 case vmIntrinsics::_getClass: 611 case vmIntrinsics::_dsin: 612 case vmIntrinsics::_dcos: 613 case vmIntrinsics::_dtan: 614 case vmIntrinsics::_dtanh: 615 case vmIntrinsics::_dabs: 616 case vmIntrinsics::_fabs: 617 case vmIntrinsics::_iabs: 618 case vmIntrinsics::_labs: 619 case vmIntrinsics::_datan2: 620 case vmIntrinsics::_dsqrt: 621 case vmIntrinsics::_dsqrt_strict: 622 case vmIntrinsics::_dexp: 623 case vmIntrinsics::_dlog: 624 case vmIntrinsics::_dlog10: 625 case vmIntrinsics::_dpow: 626 case vmIntrinsics::_roundD: 627 case vmIntrinsics::_roundF: 628 case vmIntrinsics::_min: 629 case vmIntrinsics::_max: 630 case vmIntrinsics::_min_strict: 631 case vmIntrinsics::_max_strict: 632 case vmIntrinsics::_arraycopy: 633 case vmIntrinsics::_arraySort: 634 case vmIntrinsics::_arrayPartition: 635 case vmIntrinsics::_indexOfL: 636 case vmIntrinsics::_indexOfU: 637 case vmIntrinsics::_indexOfUL: 638 case vmIntrinsics::_indexOfIL: 639 case vmIntrinsics::_indexOfIU: 640 case vmIntrinsics::_indexOfIUL: 641 case vmIntrinsics::_indexOfU_char: 642 case vmIntrinsics::_indexOfL_char: 643 case vmIntrinsics::_toBytesStringU: 644 case vmIntrinsics::_getCharsStringU: 645 case vmIntrinsics::_getCharStringU: 646 case vmIntrinsics::_putCharStringU: 647 case vmIntrinsics::_makePrivateBuffer: 648 case vmIntrinsics::_finishPrivateBuffer: 649 case vmIntrinsics::_getReference: 650 case vmIntrinsics::_getBoolean: 651 case vmIntrinsics::_getByte: 652 case vmIntrinsics::_getShort: 653 case vmIntrinsics::_getChar: 654 case vmIntrinsics::_getInt: 655 case vmIntrinsics::_getLong: 656 case vmIntrinsics::_getFloat: 657 case vmIntrinsics::_getDouble: 658 case vmIntrinsics::_getValue: 659 case vmIntrinsics::_putReference: 660 case vmIntrinsics::_putBoolean: 661 case vmIntrinsics::_putByte: 662 case vmIntrinsics::_putShort: 663 case vmIntrinsics::_putChar: 664 case vmIntrinsics::_putInt: 665 case vmIntrinsics::_putLong: 666 case vmIntrinsics::_putFloat: 667 case vmIntrinsics::_putDouble: 668 case vmIntrinsics::_putValue: 669 case vmIntrinsics::_getReferenceVolatile: 670 case vmIntrinsics::_getBooleanVolatile: 671 case vmIntrinsics::_getByteVolatile: 672 case vmIntrinsics::_getShortVolatile: 673 case vmIntrinsics::_getCharVolatile: 674 case vmIntrinsics::_getIntVolatile: 675 case vmIntrinsics::_getLongVolatile: 676 case vmIntrinsics::_getFloatVolatile: 677 case vmIntrinsics::_getDoubleVolatile: 678 case vmIntrinsics::_putReferenceVolatile: 679 case vmIntrinsics::_putBooleanVolatile: 680 case vmIntrinsics::_putByteVolatile: 681 case vmIntrinsics::_putShortVolatile: 682 case vmIntrinsics::_putCharVolatile: 683 case vmIntrinsics::_putIntVolatile: 684 case vmIntrinsics::_putLongVolatile: 685 case vmIntrinsics::_putFloatVolatile: 686 case vmIntrinsics::_putDoubleVolatile: 687 case vmIntrinsics::_getReferenceAcquire: 688 case vmIntrinsics::_getBooleanAcquire: 689 case vmIntrinsics::_getByteAcquire: 690 case vmIntrinsics::_getShortAcquire: 691 case vmIntrinsics::_getCharAcquire: 692 case vmIntrinsics::_getIntAcquire: 693 case vmIntrinsics::_getLongAcquire: 694 case vmIntrinsics::_getFloatAcquire: 695 case vmIntrinsics::_getDoubleAcquire: 696 case vmIntrinsics::_putReferenceRelease: 697 case vmIntrinsics::_putBooleanRelease: 698 case vmIntrinsics::_putByteRelease: 699 case vmIntrinsics::_putShortRelease: 700 case vmIntrinsics::_putCharRelease: 701 case vmIntrinsics::_putIntRelease: 702 case vmIntrinsics::_putLongRelease: 703 case vmIntrinsics::_putFloatRelease: 704 case vmIntrinsics::_putDoubleRelease: 705 case vmIntrinsics::_getReferenceOpaque: 706 case vmIntrinsics::_getBooleanOpaque: 707 case vmIntrinsics::_getByteOpaque: 708 case vmIntrinsics::_getShortOpaque: 709 case vmIntrinsics::_getCharOpaque: 710 case vmIntrinsics::_getIntOpaque: 711 case vmIntrinsics::_getLongOpaque: 712 case vmIntrinsics::_getFloatOpaque: 713 case vmIntrinsics::_getDoubleOpaque: 714 case vmIntrinsics::_putReferenceOpaque: 715 case vmIntrinsics::_putBooleanOpaque: 716 case vmIntrinsics::_putByteOpaque: 717 case vmIntrinsics::_putShortOpaque: 718 case vmIntrinsics::_putCharOpaque: 719 case vmIntrinsics::_putIntOpaque: 720 case vmIntrinsics::_putLongOpaque: 721 case vmIntrinsics::_putFloatOpaque: 722 case vmIntrinsics::_putDoubleOpaque: 723 case vmIntrinsics::_getShortUnaligned: 724 case vmIntrinsics::_getCharUnaligned: 725 case vmIntrinsics::_getIntUnaligned: 726 case vmIntrinsics::_getLongUnaligned: 727 case vmIntrinsics::_putShortUnaligned: 728 case vmIntrinsics::_putCharUnaligned: 729 case vmIntrinsics::_putIntUnaligned: 730 case vmIntrinsics::_putLongUnaligned: 731 case vmIntrinsics::_loadFence: 732 case vmIntrinsics::_storeFence: 733 case vmIntrinsics::_storeStoreFence: 734 case vmIntrinsics::_fullFence: 735 case vmIntrinsics::_currentCarrierThread: 736 case vmIntrinsics::_currentThread: 737 case vmIntrinsics::_setCurrentThread: 738 case vmIntrinsics::_scopedValueCache: 739 case vmIntrinsics::_setScopedValueCache: 740 case vmIntrinsics::_Continuation_pin: 741 case vmIntrinsics::_Continuation_unpin: 742 #ifdef JFR_HAVE_INTRINSICS 743 case vmIntrinsics::_counterTime: 744 case vmIntrinsics::_getEventWriter: 745 case vmIntrinsics::_jvm_commit: 746 #endif 747 case vmIntrinsics::_currentTimeMillis: 748 case vmIntrinsics::_nanoTime: 749 case vmIntrinsics::_allocateInstance: 750 case vmIntrinsics::_allocateUninitializedArray: 751 case vmIntrinsics::_isFlatArray: 752 case vmIntrinsics::_newArray: 753 case vmIntrinsics::_newNullRestrictedArray: 754 case vmIntrinsics::_getLength: 755 case vmIntrinsics::_copyOf: 756 case vmIntrinsics::_copyOfRange: 757 case vmIntrinsics::_clone: 758 case vmIntrinsics::_isAssignableFrom: 759 case vmIntrinsics::_isInstance: 760 case vmIntrinsics::_getModifiers: 761 case vmIntrinsics::_isInterface: 762 case vmIntrinsics::_isArray: 763 case vmIntrinsics::_isPrimitive: 764 case vmIntrinsics::_isHidden: 765 case vmIntrinsics::_getSuperclass: 766 case vmIntrinsics::_getClassAccessFlags: 767 case vmIntrinsics::_floatToRawIntBits: 768 case vmIntrinsics::_floatToIntBits: 769 case vmIntrinsics::_intBitsToFloat: 770 case vmIntrinsics::_doubleToRawLongBits: 771 case vmIntrinsics::_doubleToLongBits: 772 case vmIntrinsics::_longBitsToDouble: 773 case vmIntrinsics::_Reference_get: 774 case vmIntrinsics::_Reference_refersTo0: 775 case vmIntrinsics::_PhantomReference_refersTo0: 776 case vmIntrinsics::_Reference_clear0: 777 case vmIntrinsics::_PhantomReference_clear0: 778 case vmIntrinsics::_Class_cast: 779 case vmIntrinsics::_aescrypt_encryptBlock: 780 case vmIntrinsics::_aescrypt_decryptBlock: 781 case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt: 782 case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt: 783 case vmIntrinsics::_counterMode_AESCrypt: 784 case vmIntrinsics::_md5_implCompress: 785 case vmIntrinsics::_sha_implCompress: 786 case vmIntrinsics::_sha2_implCompress: 787 case vmIntrinsics::_sha5_implCompress: 788 case vmIntrinsics::_sha3_implCompress: 789 case vmIntrinsics::_digestBase_implCompressMB: 790 case vmIntrinsics::_multiplyToLen: 791 case vmIntrinsics::_squareToLen: 792 case vmIntrinsics::_mulAdd: 793 case vmIntrinsics::_montgomeryMultiply: 794 case vmIntrinsics::_montgomerySquare: 795 case vmIntrinsics::_vectorizedMismatch: 796 case vmIntrinsics::_ghash_processBlocks: 797 case vmIntrinsics::_chacha20Block: 798 case vmIntrinsics::_base64_encodeBlock: 799 case vmIntrinsics::_base64_decodeBlock: 800 case vmIntrinsics::_poly1305_processBlocks: 801 case vmIntrinsics::_intpoly_montgomeryMult_P256: 802 case vmIntrinsics::_intpoly_assign: 803 case vmIntrinsics::_updateCRC32: 804 case vmIntrinsics::_updateBytesCRC32: 805 case vmIntrinsics::_updateByteBufferCRC32: 806 case vmIntrinsics::_updateBytesCRC32C: 807 case vmIntrinsics::_updateDirectByteBufferCRC32C: 808 case vmIntrinsics::_updateBytesAdler32: 809 case vmIntrinsics::_updateByteBufferAdler32: 810 case vmIntrinsics::_profileBoolean: 811 case vmIntrinsics::_isCompileConstant: 812 case vmIntrinsics::_Preconditions_checkIndex: 813 case vmIntrinsics::_Preconditions_checkLongIndex: 814 case vmIntrinsics::_getObjectSize: 815 break; 816 case vmIntrinsics::_VectorCompressExpand: 817 case vmIntrinsics::_VectorUnaryOp: 818 case vmIntrinsics::_VectorBinaryOp: 819 case vmIntrinsics::_VectorTernaryOp: 820 case vmIntrinsics::_VectorFromBitsCoerced: 821 case vmIntrinsics::_VectorShuffleIota: 822 case vmIntrinsics::_VectorShuffleToVector: 823 case vmIntrinsics::_VectorWrapShuffleIndexes: 824 case vmIntrinsics::_VectorLoadOp: 825 case vmIntrinsics::_VectorLoadMaskedOp: 826 case vmIntrinsics::_VectorStoreOp: 827 case vmIntrinsics::_VectorStoreMaskedOp: 828 case vmIntrinsics::_VectorSelectFromTwoVectorOp: 829 case vmIntrinsics::_VectorGatherOp: 830 case vmIntrinsics::_VectorScatterOp: 831 case vmIntrinsics::_VectorReductionCoerced: 832 case vmIntrinsics::_VectorTest: 833 case vmIntrinsics::_VectorBlend: 834 case vmIntrinsics::_VectorRearrange: 835 case vmIntrinsics::_VectorSelectFrom: 836 case vmIntrinsics::_VectorCompare: 837 case vmIntrinsics::_VectorBroadcastInt: 838 case vmIntrinsics::_VectorConvert: 839 case vmIntrinsics::_VectorInsert: 840 case vmIntrinsics::_VectorExtract: 841 case vmIntrinsics::_VectorMaskOp: 842 case vmIntrinsics::_IndexVector: 843 case vmIntrinsics::_IndexPartiallyInUpperRange: 844 return EnableVectorSupport; 845 case vmIntrinsics::_blackhole: 846 #if INCLUDE_JVMTI 847 case vmIntrinsics::_notifyJvmtiVThreadStart: 848 case vmIntrinsics::_notifyJvmtiVThreadEnd: 849 case vmIntrinsics::_notifyJvmtiVThreadMount: 850 case vmIntrinsics::_notifyJvmtiVThreadUnmount: 851 case vmIntrinsics::_notifyJvmtiVThreadDisableSuspend: 852 #endif 853 break; 854 855 default: 856 return false; 857 } 858 return true; 859 } 860 861 int C2Compiler::initial_code_buffer_size(int const_size) { 862 // See Compile::init_scratch_buffer_blob 863 int locs_size = sizeof(relocInfo) * PhaseOutput::MAX_locs_size; 864 int slop = 2 * CodeSection::end_slop(); // space between sections 865 return PhaseOutput::MAX_inst_size + PhaseOutput::MAX_stubs_size + const_size + slop + locs_size; 866 }