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