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