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