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