| 1 | /* |
| 2 | * Copyright (c) 1999, 2019, 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 "runtime/handles.inline.hpp" |
| 27 | #include "jfr/support/jfrIntrinsics.hpp" |
| 28 | #include "opto/c2compiler.hpp" |
| 29 | #include "opto/compile.hpp" |
| 30 | #include "opto/optoreg.hpp" |
| 31 | #include "opto/output.hpp" |
| 32 | #include "opto/runtime.hpp" |
| 33 | #include "utilities/macros.hpp" |
| 34 | |
| 35 | |
| 36 | // register information defined by ADLC |
| 37 | extern const char register_save_policy[]; |
| 38 | extern const int register_save_type[]; |
| 39 | |
| 40 | const char* C2Compiler::retry_no_subsuming_loads() { |
| 41 | return "retry without subsuming loads" ; |
| 42 | } |
| 43 | const char* C2Compiler::retry_no_escape_analysis() { |
| 44 | return "retry without escape analysis" ; |
| 45 | } |
| 46 | const char* C2Compiler::retry_class_loading_during_parsing() { |
| 47 | return "retry class loading during parsing" ; |
| 48 | } |
| 49 | bool C2Compiler::init_c2_runtime() { |
| 50 | |
| 51 | // Check assumptions used while running ADLC |
| 52 | Compile::adlc_verification(); |
| 53 | assert(REG_COUNT <= ConcreteRegisterImpl::number_of_registers, "incompatible register counts" ); |
| 54 | |
| 55 | for (int i = 0; i < ConcreteRegisterImpl::number_of_registers ; i++ ) { |
| 56 | OptoReg::vm2opto[i] = OptoReg::Bad; |
| 57 | } |
| 58 | |
| 59 | for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(REG_COUNT); i = OptoReg::add(i,1) ) { |
| 60 | VMReg r = OptoReg::as_VMReg(i); |
| 61 | if (r->is_valid()) { |
| 62 | OptoReg::vm2opto[r->value()] = i; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // Check that runtime and architecture description agree on callee-saved-floats |
| 67 | bool callee_saved_floats = false; |
| 68 | for( OptoReg::Name i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) { |
| 69 | // Is there a callee-saved float or double? |
| 70 | if( register_save_policy[i] == 'E' /* callee-saved */ && |
| 71 | (register_save_type[i] == Op_RegF || register_save_type[i] == Op_RegD) ) { |
| 72 | callee_saved_floats = true; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | DEBUG_ONLY( Node::init_NodeProperty(); ) |
| 77 | |
| 78 | Compile::pd_compiler2_init(); |
| 79 | |
| 80 | CompilerThread* thread = CompilerThread::current(); |
| 81 | |
| 82 | HandleMark handle_mark(thread); |
| 83 | return OptoRuntime::generate(thread->env()); |
| 84 | } |
| 85 | |
| 86 | void C2Compiler::initialize() { |
| 87 | // The first compiler thread that gets here will initialize the |
| 88 | // small amount of global state (and runtime stubs) that C2 needs. |
| 89 | |
| 90 | // There is a race possible once at startup and then we're fine |
| 91 | |
| 92 | // Note that this is being called from a compiler thread not the |
| 93 | // main startup thread. |
| 94 | if (should_perform_init()) { |
| 95 | bool successful = C2Compiler::init_c2_runtime(); |
| 96 | int new_state = (successful) ? initialized : failed; |
| 97 | set_state(new_state); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) { |
| 102 | assert(is_initialized(), "Compiler thread must be initialized" ); |
| 103 | |
| 104 | bool subsume_loads = SubsumeLoads; |
| 105 | bool do_escape_analysis = DoEscapeAnalysis && !env->should_retain_local_variables(); |
| 106 | bool eliminate_boxing = EliminateAutoBox; |
| 107 | |
| 108 | while (!env->failing()) { |
| 109 | // Attempt to compile while subsuming loads into machine instructions. |
| 110 | Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, directive); |
| 111 | |
| 112 | // Check result and retry if appropriate. |
| 113 | if (C.failure_reason() != NULL) { |
| 114 | if (C.failure_reason_is(retry_class_loading_during_parsing())) { |
| 115 | env->report_failure(C.failure_reason()); |
| 116 | continue; // retry |
| 117 | } |
| 118 | if (C.failure_reason_is(retry_no_subsuming_loads())) { |
| 119 | assert(subsume_loads, "must make progress" ); |
| 120 | subsume_loads = false; |
| 121 | env->report_failure(C.failure_reason()); |
| 122 | continue; // retry |
| 123 | } |
| 124 | if (C.failure_reason_is(retry_no_escape_analysis())) { |
| 125 | assert(do_escape_analysis, "must make progress" ); |
| 126 | do_escape_analysis = false; |
| 127 | env->report_failure(C.failure_reason()); |
| 128 | continue; // retry |
| 129 | } |
| 130 | if (C.has_boxed_value()) { |
| 131 | // Recompile without boxing elimination regardless failure reason. |
| 132 | assert(eliminate_boxing, "must make progress" ); |
| 133 | eliminate_boxing = false; |
| 134 | env->report_failure(C.failure_reason()); |
| 135 | continue; // retry |
| 136 | } |
| 137 | // Pass any other failure reason up to the ciEnv. |
| 138 | // Note that serious, irreversible failures are already logged |
| 139 | // on the ciEnv via env->record_method_not_compilable(). |
| 140 | env->record_failure(C.failure_reason()); |
| 141 | } |
| 142 | if (StressRecompilation) { |
| 143 | if (subsume_loads) { |
| 144 | subsume_loads = false; |
| 145 | continue; // retry |
| 146 | } |
| 147 | if (do_escape_analysis) { |
| 148 | do_escape_analysis = false; |
| 149 | continue; // retry |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | // print inlining for last compilation only |
| 154 | C.dump_print_inlining(); |
| 155 | |
| 156 | // No retry; just break the loop. |
| 157 | break; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | void C2Compiler::print_timers() { |
| 162 | Compile::print_timers(); |
| 163 | } |
| 164 | |
| 165 | bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virtual) { |
| 166 | vmIntrinsics::ID id = method->intrinsic_id(); |
| 167 | assert(id != vmIntrinsics::_none, "must be a VM intrinsic" ); |
| 168 | |
| 169 | if (id < vmIntrinsics::FIRST_ID || id > vmIntrinsics::LAST_COMPILER_INLINE) { |
| 170 | return false; |
| 171 | } |
| 172 | |
| 173 | // Only Object.hashCode and Object.clone intrinsics implement also a virtual |
| 174 | // dispatch because calling both methods is expensive but both methods are |
| 175 | // frequently overridden. All other intrinsics implement only a non-virtual |
| 176 | // dispatch. |
| 177 | if (is_virtual) { |
| 178 | switch (id) { |
| 179 | case vmIntrinsics::_hashCode: |
| 180 | case vmIntrinsics::_clone: |
| 181 | break; |
| 182 | default: |
| 183 | return false; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | switch (id) { |
| 188 | case vmIntrinsics::_compressStringC: |
| 189 | case vmIntrinsics::_compressStringB: |
| 190 | if (!Matcher::has_match_rule(Op_StrCompressedCopy)) return false; |
| 191 | break; |
| 192 | case vmIntrinsics::_inflateStringC: |
| 193 | case vmIntrinsics::_inflateStringB: |
| 194 | if (!Matcher::has_match_rule(Op_StrInflatedCopy)) return false; |
| 195 | break; |
| 196 | case vmIntrinsics::_compareToL: |
| 197 | case vmIntrinsics::_compareToU: |
| 198 | case vmIntrinsics::_compareToLU: |
| 199 | case vmIntrinsics::_compareToUL: |
| 200 | if (!Matcher::match_rule_supported(Op_StrComp)) return false; |
| 201 | break; |
| 202 | case vmIntrinsics::_equalsL: |
| 203 | case vmIntrinsics::_equalsU: |
| 204 | if (!Matcher::match_rule_supported(Op_StrEquals)) return false; |
| 205 | break; |
| 206 | case vmIntrinsics::_equalsB: |
| 207 | case vmIntrinsics::_equalsC: |
| 208 | if (!Matcher::match_rule_supported(Op_AryEq)) return false; |
| 209 | break; |
| 210 | case vmIntrinsics::_copyMemory: |
| 211 | if (StubRoutines::unsafe_arraycopy() == NULL) return false; |
| 212 | break; |
| 213 | case vmIntrinsics::_encodeISOArray: |
| 214 | case vmIntrinsics::_encodeByteISOArray: |
| 215 | if (!Matcher::match_rule_supported(Op_EncodeISOArray)) return false; |
| 216 | break; |
| 217 | case vmIntrinsics::_hasNegatives: |
| 218 | if (!Matcher::match_rule_supported(Op_HasNegatives)) return false; |
| 219 | break; |
| 220 | case vmIntrinsics::_bitCount_i: |
| 221 | if (!Matcher::match_rule_supported(Op_PopCountI)) return false; |
| 222 | break; |
| 223 | case vmIntrinsics::_bitCount_l: |
| 224 | if (!Matcher::match_rule_supported(Op_PopCountL)) return false; |
| 225 | break; |
| 226 | case vmIntrinsics::_numberOfLeadingZeros_i: |
| 227 | if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return false; |
| 228 | break; |
| 229 | case vmIntrinsics::_numberOfLeadingZeros_l: |
| 230 | if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return false; |
| 231 | break; |
| 232 | case vmIntrinsics::_numberOfTrailingZeros_i: |
| 233 | if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return false; |
| 234 | break; |
| 235 | case vmIntrinsics::_numberOfTrailingZeros_l: |
| 236 | if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return false; |
| 237 | break; |
| 238 | case vmIntrinsics::_reverseBytes_c: |
| 239 | if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return false; |
| 240 | break; |
| 241 | case vmIntrinsics::_reverseBytes_s: |
| 242 | if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return false; |
| 243 | break; |
| 244 | case vmIntrinsics::_reverseBytes_i: |
| 245 | if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return false; |
| 246 | break; |
| 247 | case vmIntrinsics::_reverseBytes_l: |
| 248 | if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false; |
| 249 | break; |
| 250 | |
| 251 | /* CompareAndSet, Object: */ |
| 252 | case vmIntrinsics::_compareAndSetReference: |
| 253 | #ifdef _LP64 |
| 254 | if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false; |
| 255 | if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; |
| 256 | #else |
| 257 | if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false; |
| 258 | #endif |
| 259 | break; |
| 260 | case vmIntrinsics::_weakCompareAndSetReferencePlain: |
| 261 | case vmIntrinsics::_weakCompareAndSetReferenceAcquire: |
| 262 | case vmIntrinsics::_weakCompareAndSetReferenceRelease: |
| 263 | case vmIntrinsics::_weakCompareAndSetReference: |
| 264 | #ifdef _LP64 |
| 265 | if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false; |
| 266 | if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; |
| 267 | #else |
| 268 | if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false; |
| 269 | #endif |
| 270 | break; |
| 271 | /* CompareAndSet, Long: */ |
| 272 | case vmIntrinsics::_compareAndSetLong: |
| 273 | if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false; |
| 274 | break; |
| 275 | case vmIntrinsics::_weakCompareAndSetLongPlain: |
| 276 | case vmIntrinsics::_weakCompareAndSetLongAcquire: |
| 277 | case vmIntrinsics::_weakCompareAndSetLongRelease: |
| 278 | case vmIntrinsics::_weakCompareAndSetLong: |
| 279 | if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false; |
| 280 | break; |
| 281 | |
| 282 | /* CompareAndSet, Int: */ |
| 283 | case vmIntrinsics::_compareAndSetInt: |
| 284 | if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false; |
| 285 | break; |
| 286 | case vmIntrinsics::_weakCompareAndSetIntPlain: |
| 287 | case vmIntrinsics::_weakCompareAndSetIntAcquire: |
| 288 | case vmIntrinsics::_weakCompareAndSetIntRelease: |
| 289 | case vmIntrinsics::_weakCompareAndSetInt: |
| 290 | if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapI)) return false; |
| 291 | break; |
| 292 | |
| 293 | /* CompareAndSet, Byte: */ |
| 294 | case vmIntrinsics::_compareAndSetByte: |
| 295 | if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false; |
| 296 | break; |
| 297 | case vmIntrinsics::_weakCompareAndSetBytePlain: |
| 298 | case vmIntrinsics::_weakCompareAndSetByteAcquire: |
| 299 | case vmIntrinsics::_weakCompareAndSetByteRelease: |
| 300 | case vmIntrinsics::_weakCompareAndSetByte: |
| 301 | if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false; |
| 302 | break; |
| 303 | |
| 304 | /* CompareAndSet, Short: */ |
| 305 | case vmIntrinsics::_compareAndSetShort: |
| 306 | if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false; |
| 307 | break; |
| 308 | case vmIntrinsics::_weakCompareAndSetShortPlain: |
| 309 | case vmIntrinsics::_weakCompareAndSetShortAcquire: |
| 310 | case vmIntrinsics::_weakCompareAndSetShortRelease: |
| 311 | case vmIntrinsics::_weakCompareAndSetShort: |
| 312 | if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false; |
| 313 | break; |
| 314 | |
| 315 | /* CompareAndExchange, Object: */ |
| 316 | case vmIntrinsics::_compareAndExchangeReference: |
| 317 | case vmIntrinsics::_compareAndExchangeReferenceAcquire: |
| 318 | case vmIntrinsics::_compareAndExchangeReferenceRelease: |
| 319 | #ifdef _LP64 |
| 320 | if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeN)) return false; |
| 321 | if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; |
| 322 | #else |
| 323 | if (!Matcher::match_rule_supported(Op_CompareAndExchangeP)) return false; |
| 324 | #endif |
| 325 | break; |
| 326 | |
| 327 | /* CompareAndExchange, Long: */ |
| 328 | case vmIntrinsics::_compareAndExchangeLong: |
| 329 | case vmIntrinsics::_compareAndExchangeLongAcquire: |
| 330 | case vmIntrinsics::_compareAndExchangeLongRelease: |
| 331 | if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false; |
| 332 | break; |
| 333 | |
| 334 | /* CompareAndExchange, Int: */ |
| 335 | case vmIntrinsics::_compareAndExchangeInt: |
| 336 | case vmIntrinsics::_compareAndExchangeIntAcquire: |
| 337 | case vmIntrinsics::_compareAndExchangeIntRelease: |
| 338 | if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false; |
| 339 | break; |
| 340 | |
| 341 | /* CompareAndExchange, Byte: */ |
| 342 | case vmIntrinsics::_compareAndExchangeByte: |
| 343 | case vmIntrinsics::_compareAndExchangeByteAcquire: |
| 344 | case vmIntrinsics::_compareAndExchangeByteRelease: |
| 345 | if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false; |
| 346 | break; |
| 347 | |
| 348 | /* CompareAndExchange, Short: */ |
| 349 | case vmIntrinsics::_compareAndExchangeShort: |
| 350 | case vmIntrinsics::_compareAndExchangeShortAcquire: |
| 351 | case vmIntrinsics::_compareAndExchangeShortRelease: |
| 352 | if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false; |
| 353 | break; |
| 354 | |
| 355 | case vmIntrinsics::_getAndAddByte: |
| 356 | if (!Matcher::match_rule_supported(Op_GetAndAddB)) return false; |
| 357 | break; |
| 358 | case vmIntrinsics::_getAndAddShort: |
| 359 | if (!Matcher::match_rule_supported(Op_GetAndAddS)) return false; |
| 360 | break; |
| 361 | case vmIntrinsics::_getAndAddInt: |
| 362 | if (!Matcher::match_rule_supported(Op_GetAndAddI)) return false; |
| 363 | break; |
| 364 | case vmIntrinsics::_getAndAddLong: |
| 365 | if (!Matcher::match_rule_supported(Op_GetAndAddL)) return false; |
| 366 | break; |
| 367 | |
| 368 | case vmIntrinsics::_getAndSetByte: |
| 369 | if (!Matcher::match_rule_supported(Op_GetAndSetB)) return false; |
| 370 | break; |
| 371 | case vmIntrinsics::_getAndSetShort: |
| 372 | if (!Matcher::match_rule_supported(Op_GetAndSetS)) return false; |
| 373 | break; |
| 374 | case vmIntrinsics::_getAndSetInt: |
| 375 | if (!Matcher::match_rule_supported(Op_GetAndSetI)) return false; |
| 376 | break; |
| 377 | case vmIntrinsics::_getAndSetLong: |
| 378 | if (!Matcher::match_rule_supported(Op_GetAndSetL)) return false; |
| 379 | break; |
| 380 | case vmIntrinsics::_getAndSetReference: |
| 381 | #ifdef _LP64 |
| 382 | if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return false; |
| 383 | if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return false; |
| 384 | break; |
| 385 | #else |
| 386 | if (!Matcher::match_rule_supported(Op_GetAndSetP)) return false; |
| 387 | break; |
| 388 | #endif |
| 389 | case vmIntrinsics::_incrementExactI: |
| 390 | case vmIntrinsics::_addExactI: |
| 391 | if (!Matcher::match_rule_supported(Op_OverflowAddI)) return false; |
| 392 | break; |
| 393 | case vmIntrinsics::_incrementExactL: |
| 394 | case vmIntrinsics::_addExactL: |
| 395 | if (!Matcher::match_rule_supported(Op_OverflowAddL)) return false; |
| 396 | break; |
| 397 | case vmIntrinsics::_decrementExactI: |
| 398 | case vmIntrinsics::_subtractExactI: |
| 399 | if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false; |
| 400 | break; |
| 401 | case vmIntrinsics::_decrementExactL: |
| 402 | case vmIntrinsics::_subtractExactL: |
| 403 | if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false; |
| 404 | break; |
| 405 | case vmIntrinsics::_negateExactI: |
| 406 | if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false; |
| 407 | break; |
| 408 | case vmIntrinsics::_negateExactL: |
| 409 | if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false; |
| 410 | break; |
| 411 | case vmIntrinsics::_multiplyExactI: |
| 412 | if (!Matcher::match_rule_supported(Op_OverflowMulI)) return false; |
| 413 | break; |
| 414 | case vmIntrinsics::_multiplyExactL: |
| 415 | if (!Matcher::match_rule_supported(Op_OverflowMulL)) return false; |
| 416 | break; |
| 417 | case vmIntrinsics::_multiplyHigh: |
| 418 | if (!Matcher::match_rule_supported(Op_MulHiL)) return false; |
| 419 | break; |
| 420 | case vmIntrinsics::_getCallerClass: |
| 421 | if (SystemDictionary::reflect_CallerSensitive_klass() == NULL) return false; |
| 422 | break; |
| 423 | case vmIntrinsics::_onSpinWait: |
| 424 | if (!Matcher::match_rule_supported(Op_OnSpinWait)) return false; |
| 425 | break; |
| 426 | case vmIntrinsics::_fmaD: |
| 427 | if (!UseFMA || !Matcher::match_rule_supported(Op_FmaD)) return false; |
| 428 | break; |
| 429 | case vmIntrinsics::_fmaF: |
| 430 | if (!UseFMA || !Matcher::match_rule_supported(Op_FmaF)) return false; |
| 431 | break; |
| 432 | case vmIntrinsics::_isDigit: |
| 433 | if (!Matcher::match_rule_supported(Op_Digit)) return false; |
| 434 | break; |
| 435 | case vmIntrinsics::_isLowerCase: |
| 436 | if (!Matcher::match_rule_supported(Op_LowerCase)) return false; |
| 437 | break; |
| 438 | case vmIntrinsics::_isUpperCase: |
| 439 | if (!Matcher::match_rule_supported(Op_UpperCase)) return false; |
| 440 | break; |
| 441 | case vmIntrinsics::_isWhitespace: |
| 442 | if (!Matcher::match_rule_supported(Op_Whitespace)) return false; |
| 443 | break; |
| 444 | case vmIntrinsics::_maxF: |
| 445 | if (!Matcher::match_rule_supported(Op_MaxF)) return false; |
| 446 | break; |
| 447 | case vmIntrinsics::_minF: |
| 448 | if (!Matcher::match_rule_supported(Op_MinF)) return false; |
| 449 | break; |
| 450 | case vmIntrinsics::_maxD: |
| 451 | if (!Matcher::match_rule_supported(Op_MaxD)) return false; |
| 452 | break; |
| 453 | case vmIntrinsics::_minD: |
| 454 | if (!Matcher::match_rule_supported(Op_MinD)) return false; |
| 455 | break; |
| 456 | case vmIntrinsics::_hashCode: |
| 457 | case vmIntrinsics::_identityHashCode: |
| 458 | case vmIntrinsics::_getClass: |
| 459 | case vmIntrinsics::_dsin: |
| 460 | case vmIntrinsics::_dcos: |
| 461 | case vmIntrinsics::_dtan: |
| 462 | case vmIntrinsics::_dabs: |
| 463 | case vmIntrinsics::_fabs: |
| 464 | case vmIntrinsics::_iabs: |
| 465 | case vmIntrinsics::_labs: |
| 466 | case vmIntrinsics::_datan2: |
| 467 | case vmIntrinsics::_dsqrt: |
| 468 | case vmIntrinsics::_dexp: |
| 469 | case vmIntrinsics::_dlog: |
| 470 | case vmIntrinsics::_dlog10: |
| 471 | case vmIntrinsics::_dpow: |
| 472 | case vmIntrinsics::_min: |
| 473 | case vmIntrinsics::_max: |
| 474 | case vmIntrinsics::_arraycopy: |
| 475 | case vmIntrinsics::_indexOfL: |
| 476 | case vmIntrinsics::_indexOfU: |
| 477 | case vmIntrinsics::_indexOfUL: |
| 478 | case vmIntrinsics::_indexOfIL: |
| 479 | case vmIntrinsics::_indexOfIU: |
| 480 | case vmIntrinsics::_indexOfIUL: |
| 481 | case vmIntrinsics::_indexOfU_char: |
| 482 | case vmIntrinsics::_toBytesStringU: |
| 483 | case vmIntrinsics::_getCharsStringU: |
| 484 | case vmIntrinsics::_getCharStringU: |
| 485 | case vmIntrinsics::_putCharStringU: |
| 486 | case vmIntrinsics::_getReference: |
| 487 | case vmIntrinsics::_getBoolean: |
| 488 | case vmIntrinsics::_getByte: |
| 489 | case vmIntrinsics::_getShort: |
| 490 | case vmIntrinsics::_getChar: |
| 491 | case vmIntrinsics::_getInt: |
| 492 | case vmIntrinsics::_getLong: |
| 493 | case vmIntrinsics::_getFloat: |
| 494 | case vmIntrinsics::_getDouble: |
| 495 | case vmIntrinsics::_putReference: |
| 496 | case vmIntrinsics::_putBoolean: |
| 497 | case vmIntrinsics::_putByte: |
| 498 | case vmIntrinsics::_putShort: |
| 499 | case vmIntrinsics::_putChar: |
| 500 | case vmIntrinsics::_putInt: |
| 501 | case vmIntrinsics::_putLong: |
| 502 | case vmIntrinsics::_putFloat: |
| 503 | case vmIntrinsics::_putDouble: |
| 504 | case vmIntrinsics::_getReferenceVolatile: |
| 505 | case vmIntrinsics::_getBooleanVolatile: |
| 506 | case vmIntrinsics::_getByteVolatile: |
| 507 | case vmIntrinsics::_getShortVolatile: |
| 508 | case vmIntrinsics::_getCharVolatile: |
| 509 | case vmIntrinsics::_getIntVolatile: |
| 510 | case vmIntrinsics::_getLongVolatile: |
| 511 | case vmIntrinsics::_getFloatVolatile: |
| 512 | case vmIntrinsics::_getDoubleVolatile: |
| 513 | case vmIntrinsics::_putReferenceVolatile: |
| 514 | case vmIntrinsics::_putBooleanVolatile: |
| 515 | case vmIntrinsics::_putByteVolatile: |
| 516 | case vmIntrinsics::_putShortVolatile: |
| 517 | case vmIntrinsics::_putCharVolatile: |
| 518 | case vmIntrinsics::_putIntVolatile: |
| 519 | case vmIntrinsics::_putLongVolatile: |
| 520 | case vmIntrinsics::_putFloatVolatile: |
| 521 | case vmIntrinsics::_putDoubleVolatile: |
| 522 | case vmIntrinsics::_getReferenceAcquire: |
| 523 | case vmIntrinsics::_getBooleanAcquire: |
| 524 | case vmIntrinsics::_getByteAcquire: |
| 525 | case vmIntrinsics::_getShortAcquire: |
| 526 | case vmIntrinsics::_getCharAcquire: |
| 527 | case vmIntrinsics::_getIntAcquire: |
| 528 | case vmIntrinsics::_getLongAcquire: |
| 529 | case vmIntrinsics::_getFloatAcquire: |
| 530 | case vmIntrinsics::_getDoubleAcquire: |
| 531 | case vmIntrinsics::_putReferenceRelease: |
| 532 | case vmIntrinsics::_putBooleanRelease: |
| 533 | case vmIntrinsics::_putByteRelease: |
| 534 | case vmIntrinsics::_putShortRelease: |
| 535 | case vmIntrinsics::_putCharRelease: |
| 536 | case vmIntrinsics::_putIntRelease: |
| 537 | case vmIntrinsics::_putLongRelease: |
| 538 | case vmIntrinsics::_putFloatRelease: |
| 539 | case vmIntrinsics::_putDoubleRelease: |
| 540 | case vmIntrinsics::_getReferenceOpaque: |
| 541 | case vmIntrinsics::_getBooleanOpaque: |
| 542 | case vmIntrinsics::_getByteOpaque: |
| 543 | case vmIntrinsics::_getShortOpaque: |
| 544 | case vmIntrinsics::_getCharOpaque: |
| 545 | case vmIntrinsics::_getIntOpaque: |
| 546 | case vmIntrinsics::_getLongOpaque: |
| 547 | case vmIntrinsics::_getFloatOpaque: |
| 548 | case vmIntrinsics::_getDoubleOpaque: |
| 549 | case vmIntrinsics::_putReferenceOpaque: |
| 550 | case vmIntrinsics::_putBooleanOpaque: |
| 551 | case vmIntrinsics::_putByteOpaque: |
| 552 | case vmIntrinsics::_putShortOpaque: |
| 553 | case vmIntrinsics::_putCharOpaque: |
| 554 | case vmIntrinsics::_putIntOpaque: |
| 555 | case vmIntrinsics::_putLongOpaque: |
| 556 | case vmIntrinsics::_putFloatOpaque: |
| 557 | case vmIntrinsics::_putDoubleOpaque: |
| 558 | case vmIntrinsics::_getShortUnaligned: |
| 559 | case vmIntrinsics::_getCharUnaligned: |
| 560 | case vmIntrinsics::_getIntUnaligned: |
| 561 | case vmIntrinsics::_getLongUnaligned: |
| 562 | case vmIntrinsics::_putShortUnaligned: |
| 563 | case vmIntrinsics::_putCharUnaligned: |
| 564 | case vmIntrinsics::_putIntUnaligned: |
| 565 | case vmIntrinsics::_putLongUnaligned: |
| 566 | case vmIntrinsics::_loadFence: |
| 567 | case vmIntrinsics::_storeFence: |
| 568 | case vmIntrinsics::_fullFence: |
| 569 | case vmIntrinsics::_currentThread: |
| 570 | case vmIntrinsics::_isInterrupted: |
| 571 | #ifdef JFR_HAVE_INTRINSICS |
| 572 | case vmIntrinsics::_counterTime: |
| 573 | case vmIntrinsics::_getClassId: |
| 574 | case vmIntrinsics::_getEventWriter: |
| 575 | #endif |
| 576 | case vmIntrinsics::_currentTimeMillis: |
| 577 | case vmIntrinsics::_nanoTime: |
| 578 | case vmIntrinsics::_allocateInstance: |
| 579 | case vmIntrinsics::_allocateUninitializedArray: |
| 580 | case vmIntrinsics::_newArray: |
| 581 | case vmIntrinsics::_getLength: |
| 582 | case vmIntrinsics::_copyOf: |
| 583 | case vmIntrinsics::_copyOfRange: |
| 584 | case vmIntrinsics::_clone: |
| 585 | case vmIntrinsics::_isAssignableFrom: |
| 586 | case vmIntrinsics::_isInstance: |
| 587 | case vmIntrinsics::_getModifiers: |
| 588 | case vmIntrinsics::_isInterface: |
| 589 | case vmIntrinsics::_isArray: |
| 590 | case vmIntrinsics::_isPrimitive: |
| 591 | case vmIntrinsics::_getSuperclass: |
| 592 | case vmIntrinsics::_getClassAccessFlags: |
| 593 | case vmIntrinsics::_floatToRawIntBits: |
| 594 | case vmIntrinsics::_floatToIntBits: |
| 595 | case vmIntrinsics::_intBitsToFloat: |
| 596 | case vmIntrinsics::_doubleToRawLongBits: |
| 597 | case vmIntrinsics::_doubleToLongBits: |
| 598 | case vmIntrinsics::_longBitsToDouble: |
| 599 | case vmIntrinsics::_Reference_get: |
| 600 | case vmIntrinsics::_Class_cast: |
| 601 | case vmIntrinsics::_aescrypt_encryptBlock: |
| 602 | case vmIntrinsics::_aescrypt_decryptBlock: |
| 603 | case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt: |
| 604 | case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt: |
| 605 | case vmIntrinsics::_counterMode_AESCrypt: |
| 606 | case vmIntrinsics::_sha_implCompress: |
| 607 | case vmIntrinsics::_sha2_implCompress: |
| 608 | case vmIntrinsics::_sha5_implCompress: |
| 609 | case vmIntrinsics::_digestBase_implCompressMB: |
| 610 | case vmIntrinsics::_multiplyToLen: |
| 611 | case vmIntrinsics::_squareToLen: |
| 612 | case vmIntrinsics::_mulAdd: |
| 613 | case vmIntrinsics::_montgomeryMultiply: |
| 614 | case vmIntrinsics::_montgomerySquare: |
| 615 | case vmIntrinsics::_vectorizedMismatch: |
| 616 | case vmIntrinsics::_ghash_processBlocks: |
| 617 | case vmIntrinsics::_base64_encodeBlock: |
| 618 | case vmIntrinsics::_updateCRC32: |
| 619 | case vmIntrinsics::_updateBytesCRC32: |
| 620 | case vmIntrinsics::_updateByteBufferCRC32: |
| 621 | case vmIntrinsics::_updateBytesCRC32C: |
| 622 | case vmIntrinsics::_updateDirectByteBufferCRC32C: |
| 623 | case vmIntrinsics::_updateBytesAdler32: |
| 624 | case vmIntrinsics::_updateByteBufferAdler32: |
| 625 | case vmIntrinsics::_profileBoolean: |
| 626 | case vmIntrinsics::_isCompileConstant: |
| 627 | case vmIntrinsics::_Preconditions_checkIndex: |
| 628 | break; |
| 629 | default: |
| 630 | return false; |
| 631 | } |
| 632 | return true; |
| 633 | } |
| 634 | |
| 635 | int C2Compiler::initial_code_buffer_size(int const_size) { |
| 636 | // See Compile::init_scratch_buffer_blob |
| 637 | int locs_size = sizeof(relocInfo) * Compile::MAX_locs_size; |
| 638 | int slop = 2 * CodeSection::end_slop(); // space between sections |
| 639 | return Compile::MAX_inst_size + Compile::MAX_stubs_size + const_size + slop + locs_size; |
| 640 | } |
| 641 | |