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