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::_electronicCodeBook_encryptAESCrypt: 262 if (StubRoutines::electronicCodeBook_encryptAESCrypt() == nullptr) return false; 263 break; 264 case vmIntrinsics::_electronicCodeBook_decryptAESCrypt: 265 if (StubRoutines::electronicCodeBook_decryptAESCrypt() == nullptr) return false; 266 break; 267 case vmIntrinsics::_galoisCounterMode_AESCrypt: 268 if (StubRoutines::galoisCounterMode_AESCrypt() == nullptr) return false; 269 break; 270 case vmIntrinsics::_bigIntegerRightShiftWorker: 271 if (StubRoutines::bigIntegerRightShift() == nullptr) return false; 272 break; 273 case vmIntrinsics::_bigIntegerLeftShiftWorker: 274 if (StubRoutines::bigIntegerLeftShift() == nullptr) return false; 275 break; 276 case vmIntrinsics::_encodeAsciiArray: 277 if (!Matcher::match_rule_supported(Op_EncodeISOArray) || !Matcher::supports_encode_ascii_array) return false; 278 break; 279 case vmIntrinsics::_encodeISOArray: 280 case vmIntrinsics::_encodeByteISOArray: 281 if (!Matcher::match_rule_supported(Op_EncodeISOArray)) return false; 282 break; 283 case vmIntrinsics::_countPositives: 284 if (!Matcher::match_rule_supported(Op_CountPositives)) return false; 285 break; 286 case vmIntrinsics::_bitCount_i: 287 if (!Matcher::match_rule_supported(Op_PopCountI)) return false; 288 break; 289 case vmIntrinsics::_bitCount_l: 290 if (!Matcher::match_rule_supported(Op_PopCountL)) return false; 291 break; 292 case vmIntrinsics::_compress_i: 293 case vmIntrinsics::_compress_l: 294 if (!Matcher::match_rule_supported(Op_CompressBits)) return false; 295 break; 296 case vmIntrinsics::_expand_i: 297 case vmIntrinsics::_expand_l: 298 if (!Matcher::match_rule_supported(Op_ExpandBits)) return false; 299 break; 300 case vmIntrinsics::_numberOfLeadingZeros_i: 301 if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return false; 302 break; 303 case vmIntrinsics::_numberOfLeadingZeros_l: 304 if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return false; 305 break; 306 case vmIntrinsics::_numberOfTrailingZeros_i: 307 if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return false; 308 break; 309 case vmIntrinsics::_numberOfTrailingZeros_l: 310 if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return false; 311 break; 312 case vmIntrinsics::_reverse_i: 313 if (!Matcher::match_rule_supported(Op_ReverseI)) return false; 314 break; 315 case vmIntrinsics::_reverse_l: 316 if (!Matcher::match_rule_supported(Op_ReverseL)) return false; 317 break; 318 case vmIntrinsics::_reverseBytes_c: 319 if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return false; 320 break; 321 case vmIntrinsics::_reverseBytes_s: 322 if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return false; 323 break; 324 case vmIntrinsics::_reverseBytes_i: 325 if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return false; 326 break; 327 case vmIntrinsics::_reverseBytes_l: 328 if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false; 329 break; 330 case vmIntrinsics::_compareUnsigned_i: 331 if (!Matcher::match_rule_supported(Op_CmpU3)) return false; 332 break; 333 case vmIntrinsics::_compareUnsigned_l: 334 if (!Matcher::match_rule_supported(Op_CmpUL3)) return false; 335 break; 336 case vmIntrinsics::_divideUnsigned_i: 337 if (!Matcher::match_rule_supported(Op_UDivI)) return false; 338 break; 339 case vmIntrinsics::_remainderUnsigned_i: 340 if (!Matcher::match_rule_supported(Op_UModI)) return false; 341 break; 342 case vmIntrinsics::_divideUnsigned_l: 343 if (!Matcher::match_rule_supported(Op_UDivL)) return false; 344 break; 345 case vmIntrinsics::_remainderUnsigned_l: 346 if (!Matcher::match_rule_supported(Op_UModL)) return false; 347 break; 348 case vmIntrinsics::_float16ToFloat: 349 if (!Matcher::match_rule_supported(Op_ConvHF2F)) return false; 350 break; 351 case vmIntrinsics::_floatToFloat16: 352 if (!Matcher::match_rule_supported(Op_ConvF2HF)) return false; 353 break; 354 355 /* CompareAndSet, Object: */ 356 case vmIntrinsics::_compareAndSetReference: 357 #ifdef _LP64 358 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false; 359 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; 360 #else 361 if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; 362 #endif 363 break; 364 case vmIntrinsics::_weakCompareAndSetReferencePlain: 365 case vmIntrinsics::_weakCompareAndSetReferenceAcquire: 366 case vmIntrinsics::_weakCompareAndSetReferenceRelease: 367 case vmIntrinsics::_weakCompareAndSetReference: 368 #ifdef _LP64 369 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false; 370 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; 371 #else 372 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; 373 #endif 374 break; 375 /* CompareAndSet, Long: */ 376 case vmIntrinsics::_compareAndSetLong: 377 if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false; 378 break; 379 case vmIntrinsics::_weakCompareAndSetLongPlain: 380 case vmIntrinsics::_weakCompareAndSetLongAcquire: 381 case vmIntrinsics::_weakCompareAndSetLongRelease: 382 case vmIntrinsics::_weakCompareAndSetLong: 383 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false; 384 break; 385 386 /* CompareAndSet, Int: */ 387 case vmIntrinsics::_compareAndSetInt: 388 if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false; 389 break; 390 case vmIntrinsics::_weakCompareAndSetIntPlain: 391 case vmIntrinsics::_weakCompareAndSetIntAcquire: 392 case vmIntrinsics::_weakCompareAndSetIntRelease: 393 case vmIntrinsics::_weakCompareAndSetInt: 394 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapI)) return false; 395 break; 396 397 /* CompareAndSet, Byte: */ 398 case vmIntrinsics::_compareAndSetByte: 399 if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false; 400 break; 401 case vmIntrinsics::_weakCompareAndSetBytePlain: 402 case vmIntrinsics::_weakCompareAndSetByteAcquire: 403 case vmIntrinsics::_weakCompareAndSetByteRelease: 404 case vmIntrinsics::_weakCompareAndSetByte: 405 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false; 406 break; 407 408 /* CompareAndSet, Short: */ 409 case vmIntrinsics::_compareAndSetShort: 410 if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false; 411 break; 412 case vmIntrinsics::_weakCompareAndSetShortPlain: 413 case vmIntrinsics::_weakCompareAndSetShortAcquire: 414 case vmIntrinsics::_weakCompareAndSetShortRelease: 415 case vmIntrinsics::_weakCompareAndSetShort: 416 if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false; 417 break; 418 419 /* CompareAndExchange, Object: */ 420 case vmIntrinsics::_compareAndExchangeReference: 421 case vmIntrinsics::_compareAndExchangeReferenceAcquire: 422 case vmIntrinsics::_compareAndExchangeReferenceRelease: 423 #ifdef _LP64 424 if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeN)) return false; 425 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; 426 #else 427 if (!Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; 428 #endif 429 break; 430 431 /* CompareAndExchange, Long: */ 432 case vmIntrinsics::_compareAndExchangeLong: 433 case vmIntrinsics::_compareAndExchangeLongAcquire: 434 case vmIntrinsics::_compareAndExchangeLongRelease: 435 if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false; 436 break; 437 438 /* CompareAndExchange, Int: */ 439 case vmIntrinsics::_compareAndExchangeInt: 440 case vmIntrinsics::_compareAndExchangeIntAcquire: 441 case vmIntrinsics::_compareAndExchangeIntRelease: 442 if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false; 443 break; 444 445 /* CompareAndExchange, Byte: */ 446 case vmIntrinsics::_compareAndExchangeByte: 447 case vmIntrinsics::_compareAndExchangeByteAcquire: 448 case vmIntrinsics::_compareAndExchangeByteRelease: 449 if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false; 450 break; 451 452 /* CompareAndExchange, Short: */ 453 case vmIntrinsics::_compareAndExchangeShort: 454 case vmIntrinsics::_compareAndExchangeShortAcquire: 455 case vmIntrinsics::_compareAndExchangeShortRelease: 456 if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false; 457 break; 458 459 case vmIntrinsics::_getAndAddByte: 460 if (!Matcher::match_rule_supported(Op_GetAndAddB)) return false; 461 break; 462 case vmIntrinsics::_getAndAddShort: 463 if (!Matcher::match_rule_supported(Op_GetAndAddS)) return false; 464 break; 465 case vmIntrinsics::_getAndAddInt: 466 if (!Matcher::match_rule_supported(Op_GetAndAddI)) return false; 467 break; 468 case vmIntrinsics::_getAndAddLong: 469 if (!Matcher::match_rule_supported(Op_GetAndAddL)) return false; 470 break; 471 472 case vmIntrinsics::_getAndSetByte: 473 if (!Matcher::match_rule_supported(Op_GetAndSetB)) return false; 474 break; 475 case vmIntrinsics::_getAndSetShort: 476 if (!Matcher::match_rule_supported(Op_GetAndSetS)) return false; 477 break; 478 case vmIntrinsics::_getAndSetInt: 479 if (!Matcher::match_rule_supported(Op_GetAndSetI)) return false; 480 break; 481 case vmIntrinsics::_getAndSetLong: 482 if (!Matcher::match_rule_supported(Op_GetAndSetL)) return false; 483 break; 484 case vmIntrinsics::_getAndSetReference: 485 #ifdef _LP64 486 if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return false; 487 if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return false; 488 break; 489 #else 490 if (!Matcher::match_rule_supported(Op_GetAndSetP)) return false; 491 break; 492 #endif 493 case vmIntrinsics::_incrementExactI: 494 case vmIntrinsics::_addExactI: 495 if (!Matcher::match_rule_supported(Op_OverflowAddI)) return false; 496 break; 497 case vmIntrinsics::_incrementExactL: 498 case vmIntrinsics::_addExactL: 499 if (!Matcher::match_rule_supported(Op_OverflowAddL)) return false; 500 break; 501 case vmIntrinsics::_decrementExactI: 502 case vmIntrinsics::_subtractExactI: 503 if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false; 504 break; 505 case vmIntrinsics::_decrementExactL: 506 case vmIntrinsics::_subtractExactL: 507 if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false; 508 break; 509 case vmIntrinsics::_negateExactI: 510 if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false; 511 break; 512 case vmIntrinsics::_negateExactL: 513 if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false; 514 break; 515 case vmIntrinsics::_multiplyExactI: 516 if (!Matcher::match_rule_supported(Op_OverflowMulI)) return false; 517 break; 518 case vmIntrinsics::_multiplyExactL: 519 if (!Matcher::match_rule_supported(Op_OverflowMulL)) return false; 520 break; 521 case vmIntrinsics::_multiplyHigh: 522 if (!Matcher::match_rule_supported(Op_MulHiL)) return false; 523 break; 524 case vmIntrinsics::_unsignedMultiplyHigh: 525 if (!Matcher::match_rule_supported(Op_UMulHiL)) return false; 526 break; 527 case vmIntrinsics::_getCallerClass: 528 if (vmClasses::reflect_CallerSensitive_klass() == nullptr) return false; 529 break; 530 case vmIntrinsics::_onSpinWait: 531 if (!Matcher::match_rule_supported(Op_OnSpinWait)) return false; 532 break; 533 case vmIntrinsics::_fmaD: 534 if (!Matcher::match_rule_supported(Op_FmaD)) return false; 535 break; 536 case vmIntrinsics::_fmaF: 537 if (!Matcher::match_rule_supported(Op_FmaF)) return false; 538 break; 539 case vmIntrinsics::_isDigit: 540 if (!Matcher::match_rule_supported(Op_Digit)) return false; 541 break; 542 case vmIntrinsics::_isLowerCase: 543 if (!Matcher::match_rule_supported(Op_LowerCase)) return false; 544 break; 545 case vmIntrinsics::_isUpperCase: 546 if (!Matcher::match_rule_supported(Op_UpperCase)) return false; 547 break; 548 case vmIntrinsics::_isWhitespace: 549 if (!Matcher::match_rule_supported(Op_Whitespace)) return false; 550 break; 551 case vmIntrinsics::_maxF: 552 case vmIntrinsics::_maxF_strict: 553 if (!Matcher::match_rule_supported(Op_MaxF)) return false; 554 break; 555 case vmIntrinsics::_minF: 556 case vmIntrinsics::_minF_strict: 557 if (!Matcher::match_rule_supported(Op_MinF)) return false; 558 break; 559 case vmIntrinsics::_maxD: 560 case vmIntrinsics::_maxD_strict: 561 if (!Matcher::match_rule_supported(Op_MaxD)) return false; 562 break; 563 case vmIntrinsics::_minD: 564 case vmIntrinsics::_minD_strict: 565 if (!Matcher::match_rule_supported(Op_MinD)) return false; 566 break; 567 case vmIntrinsics::_writeback0: 568 if (!Matcher::match_rule_supported(Op_CacheWB)) return false; 569 break; 570 case vmIntrinsics::_writebackPreSync0: 571 if (!Matcher::match_rule_supported(Op_CacheWBPreSync)) return false; 572 break; 573 case vmIntrinsics::_writebackPostSync0: 574 if (!Matcher::match_rule_supported(Op_CacheWBPostSync)) return false; 575 break; 576 case vmIntrinsics::_rint: 577 case vmIntrinsics::_ceil: 578 case vmIntrinsics::_floor: 579 if (!Matcher::match_rule_supported(Op_RoundDoubleMode)) return false; 580 break; 581 case vmIntrinsics::_dcopySign: 582 if (!Matcher::match_rule_supported(Op_CopySignD)) return false; 583 break; 584 case vmIntrinsics::_fcopySign: 585 if (!Matcher::match_rule_supported(Op_CopySignF)) return false; 586 break; 587 case vmIntrinsics::_dsignum: 588 if (!Matcher::match_rule_supported(Op_SignumD)) return false; 589 break; 590 case vmIntrinsics::_fsignum: 591 if (!Matcher::match_rule_supported(Op_SignumF)) return false; 592 break; 593 case vmIntrinsics::_floatIsInfinite: 594 if (!Matcher::match_rule_supported(Op_IsInfiniteF)) return false; 595 break; 596 case vmIntrinsics::_floatIsFinite: 597 if (!Matcher::match_rule_supported(Op_IsFiniteF)) return false; 598 break; 599 case vmIntrinsics::_doubleIsInfinite: 600 if (!Matcher::match_rule_supported(Op_IsInfiniteD)) return false; 601 break; 602 case vmIntrinsics::_doubleIsFinite: 603 if (!Matcher::match_rule_supported(Op_IsFiniteD)) return false; 604 break; 605 case vmIntrinsics::_hashCode: 606 case vmIntrinsics::_identityHashCode: 607 case vmIntrinsics::_getClass: 608 case vmIntrinsics::_dsin: 609 case vmIntrinsics::_dcos: 610 case vmIntrinsics::_dtan: 611 case vmIntrinsics::_dabs: 612 case vmIntrinsics::_fabs: 613 case vmIntrinsics::_iabs: 614 case vmIntrinsics::_labs: 615 case vmIntrinsics::_datan2: 616 case vmIntrinsics::_dsqrt: 617 case vmIntrinsics::_dsqrt_strict: 618 case vmIntrinsics::_dexp: 619 case vmIntrinsics::_dlog: 620 case vmIntrinsics::_dlog10: 621 case vmIntrinsics::_dpow: 622 case vmIntrinsics::_roundD: 623 case vmIntrinsics::_roundF: 624 case vmIntrinsics::_min: 625 case vmIntrinsics::_max: 626 case vmIntrinsics::_min_strict: 627 case vmIntrinsics::_max_strict: 628 case vmIntrinsics::_arraycopy: 629 case vmIntrinsics::_arraySort: 630 case vmIntrinsics::_arrayPartition: 631 case vmIntrinsics::_indexOfL: 632 case vmIntrinsics::_indexOfU: 633 case vmIntrinsics::_indexOfUL: 634 case vmIntrinsics::_indexOfIL: 635 case vmIntrinsics::_indexOfIU: 636 case vmIntrinsics::_indexOfIUL: 637 case vmIntrinsics::_indexOfU_char: 638 case vmIntrinsics::_indexOfL_char: 639 case vmIntrinsics::_toBytesStringU: 640 case vmIntrinsics::_getCharsStringU: 641 case vmIntrinsics::_getCharStringU: 642 case vmIntrinsics::_putCharStringU: 643 case vmIntrinsics::_makePrivateBuffer: 644 case vmIntrinsics::_finishPrivateBuffer: 645 case vmIntrinsics::_getReference: 646 case vmIntrinsics::_getBoolean: 647 case vmIntrinsics::_getByte: 648 case vmIntrinsics::_getShort: 649 case vmIntrinsics::_getChar: 650 case vmIntrinsics::_getInt: 651 case vmIntrinsics::_getLong: 652 case vmIntrinsics::_getFloat: 653 case vmIntrinsics::_getDouble: 654 case vmIntrinsics::_getValue: 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::_putValue: 665 case vmIntrinsics::_getReferenceVolatile: 666 case vmIntrinsics::_getBooleanVolatile: 667 case vmIntrinsics::_getByteVolatile: 668 case vmIntrinsics::_getShortVolatile: 669 case vmIntrinsics::_getCharVolatile: 670 case vmIntrinsics::_getIntVolatile: 671 case vmIntrinsics::_getLongVolatile: 672 case vmIntrinsics::_getFloatVolatile: 673 case vmIntrinsics::_getDoubleVolatile: 674 case vmIntrinsics::_putReferenceVolatile: 675 case vmIntrinsics::_putBooleanVolatile: 676 case vmIntrinsics::_putByteVolatile: 677 case vmIntrinsics::_putShortVolatile: 678 case vmIntrinsics::_putCharVolatile: 679 case vmIntrinsics::_putIntVolatile: 680 case vmIntrinsics::_putLongVolatile: 681 case vmIntrinsics::_putFloatVolatile: 682 case vmIntrinsics::_putDoubleVolatile: 683 case vmIntrinsics::_getReferenceAcquire: 684 case vmIntrinsics::_getBooleanAcquire: 685 case vmIntrinsics::_getByteAcquire: 686 case vmIntrinsics::_getShortAcquire: 687 case vmIntrinsics::_getCharAcquire: 688 case vmIntrinsics::_getIntAcquire: 689 case vmIntrinsics::_getLongAcquire: 690 case vmIntrinsics::_getFloatAcquire: 691 case vmIntrinsics::_getDoubleAcquire: 692 case vmIntrinsics::_putReferenceRelease: 693 case vmIntrinsics::_putBooleanRelease: 694 case vmIntrinsics::_putByteRelease: 695 case vmIntrinsics::_putShortRelease: 696 case vmIntrinsics::_putCharRelease: 697 case vmIntrinsics::_putIntRelease: 698 case vmIntrinsics::_putLongRelease: 699 case vmIntrinsics::_putFloatRelease: 700 case vmIntrinsics::_putDoubleRelease: 701 case vmIntrinsics::_getReferenceOpaque: 702 case vmIntrinsics::_getBooleanOpaque: 703 case vmIntrinsics::_getByteOpaque: 704 case vmIntrinsics::_getShortOpaque: 705 case vmIntrinsics::_getCharOpaque: 706 case vmIntrinsics::_getIntOpaque: 707 case vmIntrinsics::_getLongOpaque: 708 case vmIntrinsics::_getFloatOpaque: 709 case vmIntrinsics::_getDoubleOpaque: 710 case vmIntrinsics::_putReferenceOpaque: 711 case vmIntrinsics::_putBooleanOpaque: 712 case vmIntrinsics::_putByteOpaque: 713 case vmIntrinsics::_putShortOpaque: 714 case vmIntrinsics::_putCharOpaque: 715 case vmIntrinsics::_putIntOpaque: 716 case vmIntrinsics::_putLongOpaque: 717 case vmIntrinsics::_putFloatOpaque: 718 case vmIntrinsics::_putDoubleOpaque: 719 case vmIntrinsics::_getShortUnaligned: 720 case vmIntrinsics::_getCharUnaligned: 721 case vmIntrinsics::_getIntUnaligned: 722 case vmIntrinsics::_getLongUnaligned: 723 case vmIntrinsics::_putShortUnaligned: 724 case vmIntrinsics::_putCharUnaligned: 725 case vmIntrinsics::_putIntUnaligned: 726 case vmIntrinsics::_putLongUnaligned: 727 case vmIntrinsics::_loadFence: 728 case vmIntrinsics::_storeFence: 729 case vmIntrinsics::_storeStoreFence: 730 case vmIntrinsics::_fullFence: 731 case vmIntrinsics::_currentCarrierThread: 732 case vmIntrinsics::_currentThread: 733 case vmIntrinsics::_setCurrentThread: 734 case vmIntrinsics::_scopedValueCache: 735 case vmIntrinsics::_setScopedValueCache: 736 #ifdef JFR_HAVE_INTRINSICS 737 case vmIntrinsics::_counterTime: 738 case vmIntrinsics::_getEventWriter: 739 case vmIntrinsics::_jvm_commit: 740 #endif 741 case vmIntrinsics::_currentTimeMillis: 742 case vmIntrinsics::_nanoTime: 743 case vmIntrinsics::_allocateInstance: 744 case vmIntrinsics::_allocateUninitializedArray: 745 case vmIntrinsics::_isFlatArray: 746 case vmIntrinsics::_newArray: 747 case vmIntrinsics::_newNullRestrictedArray: 748 case vmIntrinsics::_getLength: 749 case vmIntrinsics::_copyOf: 750 case vmIntrinsics::_copyOfRange: 751 case vmIntrinsics::_clone: 752 case vmIntrinsics::_isAssignableFrom: 753 case vmIntrinsics::_isInstance: 754 case vmIntrinsics::_getModifiers: 755 case vmIntrinsics::_isInterface: 756 case vmIntrinsics::_isArray: 757 case vmIntrinsics::_isPrimitive: 758 case vmIntrinsics::_isHidden: 759 case vmIntrinsics::_getSuperclass: 760 case vmIntrinsics::_getClassAccessFlags: 761 case vmIntrinsics::_floatToRawIntBits: 762 case vmIntrinsics::_floatToIntBits: 763 case vmIntrinsics::_intBitsToFloat: 764 case vmIntrinsics::_doubleToRawLongBits: 765 case vmIntrinsics::_doubleToLongBits: 766 case vmIntrinsics::_longBitsToDouble: 767 case vmIntrinsics::_Reference_get: 768 case vmIntrinsics::_Reference_refersTo0: 769 case vmIntrinsics::_PhantomReference_refersTo0: 770 case vmIntrinsics::_Class_cast: 771 case vmIntrinsics::_aescrypt_encryptBlock: 772 case vmIntrinsics::_aescrypt_decryptBlock: 773 case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt: 774 case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt: 775 case vmIntrinsics::_counterMode_AESCrypt: 776 case vmIntrinsics::_md5_implCompress: 777 case vmIntrinsics::_sha_implCompress: 778 case vmIntrinsics::_sha2_implCompress: 779 case vmIntrinsics::_sha5_implCompress: 780 case vmIntrinsics::_sha3_implCompress: 781 case vmIntrinsics::_digestBase_implCompressMB: 782 case vmIntrinsics::_multiplyToLen: 783 case vmIntrinsics::_squareToLen: 784 case vmIntrinsics::_mulAdd: 785 case vmIntrinsics::_montgomeryMultiply: 786 case vmIntrinsics::_montgomerySquare: 787 case vmIntrinsics::_vectorizedMismatch: 788 case vmIntrinsics::_ghash_processBlocks: 789 case vmIntrinsics::_chacha20Block: 790 case vmIntrinsics::_base64_encodeBlock: 791 case vmIntrinsics::_base64_decodeBlock: 792 case vmIntrinsics::_poly1305_processBlocks: 793 case vmIntrinsics::_updateCRC32: 794 case vmIntrinsics::_updateBytesCRC32: 795 case vmIntrinsics::_updateByteBufferCRC32: 796 case vmIntrinsics::_updateBytesCRC32C: 797 case vmIntrinsics::_updateDirectByteBufferCRC32C: 798 case vmIntrinsics::_updateBytesAdler32: 799 case vmIntrinsics::_updateByteBufferAdler32: 800 case vmIntrinsics::_profileBoolean: 801 case vmIntrinsics::_isCompileConstant: 802 case vmIntrinsics::_Preconditions_checkIndex: 803 case vmIntrinsics::_Preconditions_checkLongIndex: 804 case vmIntrinsics::_getObjectSize: 805 break; 806 case vmIntrinsics::_VectorCompressExpand: 807 case vmIntrinsics::_VectorUnaryOp: 808 case vmIntrinsics::_VectorBinaryOp: 809 case vmIntrinsics::_VectorTernaryOp: 810 case vmIntrinsics::_VectorFromBitsCoerced: 811 case vmIntrinsics::_VectorShuffleIota: 812 case vmIntrinsics::_VectorShuffleToVector: 813 case vmIntrinsics::_VectorLoadOp: 814 case vmIntrinsics::_VectorLoadMaskedOp: 815 case vmIntrinsics::_VectorStoreOp: 816 case vmIntrinsics::_VectorStoreMaskedOp: 817 case vmIntrinsics::_VectorGatherOp: 818 case vmIntrinsics::_VectorScatterOp: 819 case vmIntrinsics::_VectorReductionCoerced: 820 case vmIntrinsics::_VectorTest: 821 case vmIntrinsics::_VectorBlend: 822 case vmIntrinsics::_VectorRearrange: 823 case vmIntrinsics::_VectorCompare: 824 case vmIntrinsics::_VectorBroadcastInt: 825 case vmIntrinsics::_VectorConvert: 826 case vmIntrinsics::_VectorInsert: 827 case vmIntrinsics::_VectorExtract: 828 case vmIntrinsics::_VectorMaskOp: 829 case vmIntrinsics::_IndexVector: 830 case vmIntrinsics::_IndexPartiallyInUpperRange: 831 return EnableVectorSupport; 832 case vmIntrinsics::_blackhole: 833 #if INCLUDE_JVMTI 834 case vmIntrinsics::_notifyJvmtiVThreadStart: 835 case vmIntrinsics::_notifyJvmtiVThreadEnd: 836 case vmIntrinsics::_notifyJvmtiVThreadMount: 837 case vmIntrinsics::_notifyJvmtiVThreadUnmount: 838 case vmIntrinsics::_notifyJvmtiVThreadHideFrames: 839 case vmIntrinsics::_notifyJvmtiVThreadDisableSuspend: 840 #endif 841 break; 842 843 default: 844 return false; 845 } 846 return true; 847 } 848 849 int C2Compiler::initial_code_buffer_size(int const_size) { 850 // See Compile::init_scratch_buffer_blob 851 int locs_size = sizeof(relocInfo) * PhaseOutput::MAX_locs_size; 852 int slop = 2 * CodeSection::end_slop(); // space between sections 853 return PhaseOutput::MAX_inst_size + PhaseOutput::MAX_stubs_size + const_size + slop + locs_size; 854 }