27 #include "code/codeCache.hpp"
28 #include "code/compiledIC.hpp"
29 #include "code/nmethod.hpp"
30 #include "code/pcDesc.hpp"
31 #include "code/scopeDesc.hpp"
32 #include "code/vtableStubs.hpp"
33 #include "compiler/compilationMemoryStatistic.hpp"
34 #include "compiler/compileBroker.hpp"
35 #include "compiler/oopMap.hpp"
36 #include "gc/g1/g1HeapRegion.hpp"
37 #include "gc/shared/barrierSet.hpp"
38 #include "gc/shared/collectedHeap.hpp"
39 #include "gc/shared/gcLocker.hpp"
40 #include "interpreter/bytecode.hpp"
41 #include "interpreter/interpreter.hpp"
42 #include "interpreter/linkResolver.hpp"
43 #include "logging/log.hpp"
44 #include "logging/logStream.hpp"
45 #include "memory/oopFactory.hpp"
46 #include "memory/resourceArea.hpp"
47 #include "oops/klass.inline.hpp"
48 #include "oops/objArrayKlass.hpp"
49 #include "oops/oop.inline.hpp"
50 #include "oops/typeArrayOop.inline.hpp"
51 #include "opto/ad.hpp"
52 #include "opto/addnode.hpp"
53 #include "opto/callnode.hpp"
54 #include "opto/cfgnode.hpp"
55 #include "opto/graphKit.hpp"
56 #include "opto/machnode.hpp"
57 #include "opto/matcher.hpp"
58 #include "opto/memnode.hpp"
59 #include "opto/mulnode.hpp"
60 #include "opto/output.hpp"
61 #include "opto/runtime.hpp"
62 #include "opto/subnode.hpp"
63 #include "prims/jvmtiExport.hpp"
64 #include "runtime/atomicAccess.hpp"
65 #include "runtime/frame.inline.hpp"
66 #include "runtime/handles.inline.hpp"
171
172 C2_STUBS_DO(GEN_C2_BLOB, GEN_C2_STUB, GEN_C2_JVMTI_STUB)
173
174 return true;
175 }
176
177 #undef GEN_C2_BLOB
178
179 #undef C2_STUB_FIELD_NAME
180 #undef C2_STUB_TYPEFUNC
181 #undef C2_STUB_C_FUNC
182 #undef C2_STUB_NAME
183 #undef GEN_C2_STUB
184
185 #undef C2_JVMTI_STUB_C_FUNC
186 #undef GEN_C2_JVMTI_STUB
187 // #undef gen
188
189 const TypeFunc* OptoRuntime::_new_instance_Type = nullptr;
190 const TypeFunc* OptoRuntime::_new_array_Type = nullptr;
191 const TypeFunc* OptoRuntime::_multianewarray2_Type = nullptr;
192 const TypeFunc* OptoRuntime::_multianewarray3_Type = nullptr;
193 const TypeFunc* OptoRuntime::_multianewarray4_Type = nullptr;
194 const TypeFunc* OptoRuntime::_multianewarray5_Type = nullptr;
195 const TypeFunc* OptoRuntime::_multianewarrayN_Type = nullptr;
196 const TypeFunc* OptoRuntime::_complete_monitor_enter_Type = nullptr;
197 const TypeFunc* OptoRuntime::_complete_monitor_exit_Type = nullptr;
198 const TypeFunc* OptoRuntime::_monitor_notify_Type = nullptr;
199 const TypeFunc* OptoRuntime::_uncommon_trap_Type = nullptr;
200 const TypeFunc* OptoRuntime::_athrow_Type = nullptr;
201 const TypeFunc* OptoRuntime::_rethrow_Type = nullptr;
202 const TypeFunc* OptoRuntime::_Math_D_D_Type = nullptr;
203 const TypeFunc* OptoRuntime::_Math_DD_D_Type = nullptr;
204 const TypeFunc* OptoRuntime::_modf_Type = nullptr;
205 const TypeFunc* OptoRuntime::_l2f_Type = nullptr;
206 const TypeFunc* OptoRuntime::_void_long_Type = nullptr;
207 const TypeFunc* OptoRuntime::_void_void_Type = nullptr;
208 const TypeFunc* OptoRuntime::_jfr_write_checkpoint_Type = nullptr;
209 const TypeFunc* OptoRuntime::_flush_windows_Type = nullptr;
210 const TypeFunc* OptoRuntime::_fast_arraycopy_Type = nullptr;
301 oopDesc* dest, jint dest_pos,
302 jint length, JavaThread* thread) {
303 SharedRuntime::slow_arraycopy_C(src, src_pos, dest, dest_pos, length, thread);
304 }
305
306 void OptoRuntime::complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current) {
307 SharedRuntime::complete_monitor_locking_C(obj, lock, current);
308 }
309
310
311 //=============================================================================
312 // Opto compiler runtime routines
313 //=============================================================================
314
315
316 //=============================allocation======================================
317 // We failed the fast-path allocation. Now we need to do a scavenge or GC
318 // and try allocation again.
319
320 // object allocation
321 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* current))
322 JRT_BLOCK;
323 #ifndef PRODUCT
324 SharedRuntime::_new_instance_ctr++; // new instance requires GC
325 #endif
326 assert(check_compiled_frame(current), "incorrect caller");
327
328 // These checks are cheap to make and support reflective allocation.
329 int lh = klass->layout_helper();
330 if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) {
331 Handle holder(current, klass->klass_holder()); // keep the klass alive
332 klass->check_valid_for_instantiation(false, THREAD);
333 if (!HAS_PENDING_EXCEPTION) {
334 InstanceKlass::cast(klass)->initialize(THREAD);
335 }
336 }
337
338 if (!HAS_PENDING_EXCEPTION) {
339 // Scavenge and allocate an instance.
340 Handle holder(current, klass->klass_holder()); // keep the klass alive
341 oop result = InstanceKlass::cast(klass)->allocate_instance(THREAD);
342 current->set_vm_result_oop(result);
343
344 // Pass oops back through thread local storage. Our apparent type to Java
345 // is that we return an oop, but we can block on exit from this routine and
346 // a GC can trash the oop in C's return register. The generated stub will
347 // fetch the oop from TLS after any possible GC.
348 }
349
350 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
351 JRT_BLOCK_END;
352
353 // inform GC that we won't do card marks for initializing writes.
354 SharedRuntime::on_slowpath_allocation_exit(current);
355 JRT_END
356
357
358 // array allocation
359 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaThread* current))
360 JRT_BLOCK;
361 #ifndef PRODUCT
362 SharedRuntime::_new_array_ctr++; // new array requires GC
363 #endif
364 assert(check_compiled_frame(current), "incorrect caller");
365
366 // Scavenge and allocate an instance.
367 oop result;
368
369 if (array_type->is_typeArray_klass()) {
370 // The oopFactory likes to work with the element type.
371 // (We could bypass the oopFactory, since it doesn't add much value.)
372 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
373 result = oopFactory::new_typeArray(elem_type, len, THREAD);
374 } else {
375 // Although the oopFactory likes to work with the elem_type,
376 // the compiler prefers the array_type, since it must already have
377 // that latter value in hand for the fast path.
378 Handle holder(current, array_type->klass_holder()); // keep the array klass alive
379 Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass();
380 result = oopFactory::new_objArray(elem_type, len, THREAD);
381 }
382
383 // Pass oops back through thread local storage. Our apparent type to Java
384 // is that we return an oop, but we can block on exit from this routine and
385 // a GC can trash the oop in C's return register. The generated stub will
386 // fetch the oop from TLS after any possible GC.
387 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
388 current->set_vm_result_oop(result);
389 JRT_BLOCK_END;
390
391 // inform GC that we won't do card marks for initializing writes.
392 SharedRuntime::on_slowpath_allocation_exit(current);
393 JRT_END
394
395 // array allocation without zeroing
396 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len, JavaThread* current))
397 JRT_BLOCK;
398 #ifndef PRODUCT
399 SharedRuntime::_new_array_ctr++; // new array requires GC
400 #endif
557 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread* current))
558
559 if (!SafepointSynchronize::is_synchronizing() ) {
560 if (ObjectSynchronizer::quick_notify(obj, current, true)) {
561 return;
562 }
563 }
564
565 // This is the case the fast-path above isn't provisioned to handle.
566 // The fast-path is designed to handle frequently arising cases in an efficient manner.
567 // (The fast-path is just a degenerate variant of the slow-path).
568 // Perform the dreaded state transition and pass control into the slow-path.
569 JRT_BLOCK;
570 Handle h_obj(current, obj);
571 ObjectSynchronizer::notifyall(h_obj, CHECK);
572 JRT_BLOCK_END;
573 JRT_END
574
575 static const TypeFunc* make_new_instance_Type() {
576 // create input type (domain)
577 const Type **fields = TypeTuple::fields(1);
578 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
579 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
580
581 // create result type (range)
582 fields = TypeTuple::fields(1);
583 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop
584
585 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
586
587 return TypeFunc::make(domain, range);
588 }
589
590 #if INCLUDE_JVMTI
591 static const TypeFunc* make_notify_jvmti_vthread_Type() {
592 // create input type (domain)
593 const Type **fields = TypeTuple::fields(2);
594 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // VirtualThread oop
595 fields[TypeFunc::Parms+1] = TypeInt::BOOL; // jboolean
596 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
597
598 // no result type needed
599 fields = TypeTuple::fields(1);
602
603 return TypeFunc::make(domain,range);
604 }
605 #endif
606
607 static const TypeFunc* make_athrow_Type() {
608 // create input type (domain)
609 const Type **fields = TypeTuple::fields(1);
610 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
611 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
612
613 // create result type (range)
614 fields = TypeTuple::fields(0);
615
616 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
617
618 return TypeFunc::make(domain, range);
619 }
620
621 static const TypeFunc* make_new_array_Type() {
622 // create input type (domain)
623 const Type **fields = TypeTuple::fields(2);
624 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass
625 fields[TypeFunc::Parms+1] = TypeInt::INT; // array size
626 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
627
628 // create result type (range)
629 fields = TypeTuple::fields(1);
630 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop
631
632 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
633
634 return TypeFunc::make(domain, range);
635 }
636
637 const TypeFunc* OptoRuntime::multianewarray_Type(int ndim) {
638 // create input type (domain)
639 const int nargs = ndim + 1;
640 const Type **fields = TypeTuple::fields(nargs);
641 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass
677 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
678
679 return TypeFunc::make(domain, range);
680 }
681
682 //-----------------------------------------------------------------------------
683 // Monitor Handling
684
685 static const TypeFunc* make_complete_monitor_enter_Type() {
686 // create input type (domain)
687 const Type **fields = TypeTuple::fields(2);
688 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked
689 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock
690 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
691
692 // create result type (range)
693 fields = TypeTuple::fields(0);
694
695 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
696
697 return TypeFunc::make(domain,range);
698 }
699
700 //-----------------------------------------------------------------------------
701
702 static const TypeFunc* make_complete_monitor_exit_Type() {
703 // create input type (domain)
704 const Type **fields = TypeTuple::fields(3);
705 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked
706 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock - BasicLock
707 fields[TypeFunc::Parms+2] = TypeRawPtr::BOTTOM; // Thread pointer (Self)
708 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
709
710 // create result type (range)
711 fields = TypeTuple::fields(0);
712
713 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
714
715 return TypeFunc::make(domain, range);
716 }
717
2111 RegisterMap::WalkContinuation::skip);
2112 frame stub_frame = thread->last_frame();
2113 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
2114 frame caller_frame = stub_frame.sender(®_map);
2115 return caller_frame.is_deoptimized_frame();
2116 }
2117
2118 static const TypeFunc* make_register_finalizer_Type() {
2119 // create input type (domain)
2120 const Type **fields = TypeTuple::fields(1);
2121 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver
2122 // // The JavaThread* is passed to each routine as the last argument
2123 // fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // JavaThread *; Executing thread
2124 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields);
2125
2126 // create result type (range)
2127 fields = TypeTuple::fields(0);
2128
2129 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2130
2131 return TypeFunc::make(domain,range);
2132 }
2133
2134 #if INCLUDE_JFR
2135 static const TypeFunc* make_class_id_load_barrier_Type() {
2136 // create input type (domain)
2137 const Type **fields = TypeTuple::fields(1);
2138 fields[TypeFunc::Parms+0] = TypeInstPtr::KLASS;
2139 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms + 1, fields);
2140
2141 // create result type (range)
2142 fields = TypeTuple::fields(0);
2143
2144 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms + 0, fields);
2145
2146 return TypeFunc::make(domain,range);
2147 }
2148 #endif // INCLUDE_JFR
2149
2150 //-----------------------------------------------------------------------------
2151 static const TypeFunc* make_dtrace_method_entry_exit_Type() {
2152 // create input type (domain)
2153 const Type **fields = TypeTuple::fields(2);
2154 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2155 fields[TypeFunc::Parms+1] = TypeMetadataPtr::BOTTOM; // Method*; Method we are entering
2156 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2157
2158 // create result type (range)
2159 fields = TypeTuple::fields(0);
2160
2161 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2162
2163 return TypeFunc::make(domain,range);
2164 }
2165
2166 static const TypeFunc* make_dtrace_object_alloc_Type() {
2167 // create input type (domain)
2168 const Type **fields = TypeTuple::fields(2);
2169 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2170 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // oop; newly allocated object
2171
2172 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2173
2174 // create result type (range)
2175 fields = TypeTuple::fields(0);
2176
2177 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2178
2179 return TypeFunc::make(domain,range);
2180 }
2181
2182 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer_C(oopDesc* obj, JavaThread* current))
2183 assert(oopDesc::is_oop(obj), "must be a valid oop");
2184 assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
2185 InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
2186 JRT_END
2187
2188 //-----------------------------------------------------------------------------
2189
2190 NamedCounter * volatile OptoRuntime::_named_counters = nullptr;
2191
2192 //
2193 // dump the collected NamedCounters.
2194 //
2195 void OptoRuntime::print_named_counters() {
2196 int total_lock_count = 0;
2197 int eliminated_lock_count = 0;
2198
2199 NamedCounter* c = _named_counters;
2250 }
2251 st.print("@%d", bci);
2252 // To print linenumbers instead of bci use: m->line_number_from_bci(bci)
2253 }
2254 NamedCounter* c = new NamedCounter(st.freeze(), tag);
2255
2256 // atomically add the new counter to the head of the list. We only
2257 // add counters so this is safe.
2258 NamedCounter* head;
2259 do {
2260 c->set_next(nullptr);
2261 head = _named_counters;
2262 c->set_next(head);
2263 } while (AtomicAccess::cmpxchg(&_named_counters, head, c) != head);
2264 return c;
2265 }
2266
2267 void OptoRuntime::initialize_types() {
2268 _new_instance_Type = make_new_instance_Type();
2269 _new_array_Type = make_new_array_Type();
2270 _multianewarray2_Type = multianewarray_Type(2);
2271 _multianewarray3_Type = multianewarray_Type(3);
2272 _multianewarray4_Type = multianewarray_Type(4);
2273 _multianewarray5_Type = multianewarray_Type(5);
2274 _multianewarrayN_Type = make_multianewarrayN_Type();
2275 _complete_monitor_enter_Type = make_complete_monitor_enter_Type();
2276 _complete_monitor_exit_Type = make_complete_monitor_exit_Type();
2277 _monitor_notify_Type = make_monitor_notify_Type();
2278 _uncommon_trap_Type = make_uncommon_trap_Type();
2279 _athrow_Type = make_athrow_Type();
2280 _rethrow_Type = make_rethrow_Type();
2281 _Math_D_D_Type = make_Math_D_D_Type();
2282 _Math_DD_D_Type = make_Math_DD_D_Type();
2283 _modf_Type = make_modf_Type();
2284 _l2f_Type = make_l2f_Type();
2285 _void_long_Type = make_void_long_Type();
2286 _void_void_Type = make_void_void_Type();
2287 _jfr_write_checkpoint_Type = make_jfr_write_checkpoint_Type();
2288 _flush_windows_Type = make_flush_windows_Type();
2289 _fast_arraycopy_Type = make_arraycopy_Type(ac_fast);
2350 static void trace_exception(outputStream* st, oop exception_oop, address exception_pc, const char* msg) {
2351 trace_exception_counter++;
2352 stringStream tempst;
2353
2354 tempst.print("%d [Exception (%s): ", trace_exception_counter, msg);
2355 exception_oop->print_value_on(&tempst);
2356 tempst.print(" in ");
2357 CodeBlob* blob = CodeCache::find_blob(exception_pc);
2358 if (blob->is_nmethod()) {
2359 blob->as_nmethod()->method()->print_value_on(&tempst);
2360 } else if (blob->is_runtime_stub()) {
2361 tempst.print("<runtime-stub>");
2362 } else {
2363 tempst.print("<unknown>");
2364 }
2365 tempst.print(" at " INTPTR_FORMAT, p2i(exception_pc));
2366 tempst.print("]");
2367
2368 st->print_raw_cr(tempst.freeze());
2369 }
|
27 #include "code/codeCache.hpp"
28 #include "code/compiledIC.hpp"
29 #include "code/nmethod.hpp"
30 #include "code/pcDesc.hpp"
31 #include "code/scopeDesc.hpp"
32 #include "code/vtableStubs.hpp"
33 #include "compiler/compilationMemoryStatistic.hpp"
34 #include "compiler/compileBroker.hpp"
35 #include "compiler/oopMap.hpp"
36 #include "gc/g1/g1HeapRegion.hpp"
37 #include "gc/shared/barrierSet.hpp"
38 #include "gc/shared/collectedHeap.hpp"
39 #include "gc/shared/gcLocker.hpp"
40 #include "interpreter/bytecode.hpp"
41 #include "interpreter/interpreter.hpp"
42 #include "interpreter/linkResolver.hpp"
43 #include "logging/log.hpp"
44 #include "logging/logStream.hpp"
45 #include "memory/oopFactory.hpp"
46 #include "memory/resourceArea.hpp"
47 #include "oops/flatArrayKlass.hpp"
48 #include "oops/flatArrayOop.inline.hpp"
49 #include "oops/klass.inline.hpp"
50 #include "oops/objArrayKlass.hpp"
51 #include "oops/oop.inline.hpp"
52 #include "oops/typeArrayOop.inline.hpp"
53 #include "opto/ad.hpp"
54 #include "opto/addnode.hpp"
55 #include "opto/callnode.hpp"
56 #include "opto/cfgnode.hpp"
57 #include "opto/graphKit.hpp"
58 #include "opto/machnode.hpp"
59 #include "opto/matcher.hpp"
60 #include "opto/memnode.hpp"
61 #include "opto/mulnode.hpp"
62 #include "opto/output.hpp"
63 #include "opto/runtime.hpp"
64 #include "opto/subnode.hpp"
65 #include "prims/jvmtiExport.hpp"
66 #include "runtime/atomicAccess.hpp"
67 #include "runtime/frame.inline.hpp"
68 #include "runtime/handles.inline.hpp"
173
174 C2_STUBS_DO(GEN_C2_BLOB, GEN_C2_STUB, GEN_C2_JVMTI_STUB)
175
176 return true;
177 }
178
179 #undef GEN_C2_BLOB
180
181 #undef C2_STUB_FIELD_NAME
182 #undef C2_STUB_TYPEFUNC
183 #undef C2_STUB_C_FUNC
184 #undef C2_STUB_NAME
185 #undef GEN_C2_STUB
186
187 #undef C2_JVMTI_STUB_C_FUNC
188 #undef GEN_C2_JVMTI_STUB
189 // #undef gen
190
191 const TypeFunc* OptoRuntime::_new_instance_Type = nullptr;
192 const TypeFunc* OptoRuntime::_new_array_Type = nullptr;
193 const TypeFunc* OptoRuntime::_new_array_nozero_Type = nullptr;
194 const TypeFunc* OptoRuntime::_multianewarray2_Type = nullptr;
195 const TypeFunc* OptoRuntime::_multianewarray3_Type = nullptr;
196 const TypeFunc* OptoRuntime::_multianewarray4_Type = nullptr;
197 const TypeFunc* OptoRuntime::_multianewarray5_Type = nullptr;
198 const TypeFunc* OptoRuntime::_multianewarrayN_Type = nullptr;
199 const TypeFunc* OptoRuntime::_complete_monitor_enter_Type = nullptr;
200 const TypeFunc* OptoRuntime::_complete_monitor_exit_Type = nullptr;
201 const TypeFunc* OptoRuntime::_monitor_notify_Type = nullptr;
202 const TypeFunc* OptoRuntime::_uncommon_trap_Type = nullptr;
203 const TypeFunc* OptoRuntime::_athrow_Type = nullptr;
204 const TypeFunc* OptoRuntime::_rethrow_Type = nullptr;
205 const TypeFunc* OptoRuntime::_Math_D_D_Type = nullptr;
206 const TypeFunc* OptoRuntime::_Math_DD_D_Type = nullptr;
207 const TypeFunc* OptoRuntime::_modf_Type = nullptr;
208 const TypeFunc* OptoRuntime::_l2f_Type = nullptr;
209 const TypeFunc* OptoRuntime::_void_long_Type = nullptr;
210 const TypeFunc* OptoRuntime::_void_void_Type = nullptr;
211 const TypeFunc* OptoRuntime::_jfr_write_checkpoint_Type = nullptr;
212 const TypeFunc* OptoRuntime::_flush_windows_Type = nullptr;
213 const TypeFunc* OptoRuntime::_fast_arraycopy_Type = nullptr;
304 oopDesc* dest, jint dest_pos,
305 jint length, JavaThread* thread) {
306 SharedRuntime::slow_arraycopy_C(src, src_pos, dest, dest_pos, length, thread);
307 }
308
309 void OptoRuntime::complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current) {
310 SharedRuntime::complete_monitor_locking_C(obj, lock, current);
311 }
312
313
314 //=============================================================================
315 // Opto compiler runtime routines
316 //=============================================================================
317
318
319 //=============================allocation======================================
320 // We failed the fast-path allocation. Now we need to do a scavenge or GC
321 // and try allocation again.
322
323 // object allocation
324 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, bool is_larval, JavaThread* current))
325 JRT_BLOCK;
326 #ifndef PRODUCT
327 SharedRuntime::_new_instance_ctr++; // new instance requires GC
328 #endif
329 assert(check_compiled_frame(current), "incorrect caller");
330
331 // These checks are cheap to make and support reflective allocation.
332 int lh = klass->layout_helper();
333 if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) {
334 Handle holder(current, klass->klass_holder()); // keep the klass alive
335 klass->check_valid_for_instantiation(false, THREAD);
336 if (!HAS_PENDING_EXCEPTION) {
337 InstanceKlass::cast(klass)->initialize(THREAD);
338 }
339 }
340
341 if (!HAS_PENDING_EXCEPTION) {
342 // Scavenge and allocate an instance.
343 Handle holder(current, klass->klass_holder()); // keep the klass alive
344 instanceOop result = InstanceKlass::cast(klass)->allocate_instance(THREAD);
345 if (is_larval) {
346 // Check if this is a larval buffer allocation
347 result->set_mark(result->mark().enter_larval_state());
348 }
349 current->set_vm_result_oop(result);
350
351 // Pass oops back through thread local storage. Our apparent type to Java
352 // is that we return an oop, but we can block on exit from this routine and
353 // a GC can trash the oop in C's return register. The generated stub will
354 // fetch the oop from TLS after any possible GC.
355 }
356
357 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
358 JRT_BLOCK_END;
359
360 // inform GC that we won't do card marks for initializing writes.
361 SharedRuntime::on_slowpath_allocation_exit(current);
362 JRT_END
363
364
365 // array allocation
366 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, oopDesc* init_val, JavaThread* current))
367 JRT_BLOCK;
368 #ifndef PRODUCT
369 SharedRuntime::_new_array_ctr++; // new array requires GC
370 #endif
371 assert(check_compiled_frame(current), "incorrect caller");
372
373 // Scavenge and allocate an instance.
374 oop result;
375 Handle h_init_val(current, init_val); // keep the init_val object alive
376
377 if (array_type->is_flatArray_klass()) {
378 Handle holder(current, array_type->klass_holder()); // keep the array klass alive
379 FlatArrayKlass* fak = FlatArrayKlass::cast(array_type);
380 InlineKlass* vk = fak->element_klass();
381 ArrayKlass::ArrayProperties props = ArrayKlass::ArrayProperties::DEFAULT;
382 switch(fak->layout_kind()) {
383 case LayoutKind::ATOMIC_FLAT:
384 props = ArrayKlass::ArrayProperties::NULL_RESTRICTED;
385 break;
386 case LayoutKind::NON_ATOMIC_FLAT:
387 props = (ArrayKlass::ArrayProperties)(ArrayKlass::ArrayProperties::NULL_RESTRICTED | ArrayKlass::ArrayProperties::NON_ATOMIC);
388 break;
389 case LayoutKind::NULLABLE_ATOMIC_FLAT:
390 props = ArrayKlass::ArrayProperties::NON_ATOMIC;
391 break;
392 default:
393 ShouldNotReachHere();
394 }
395 result = oopFactory::new_flatArray(vk, len, props, fak->layout_kind(), THREAD);
396 if (array_type->is_null_free_array_klass() && !h_init_val.is_null()) {
397 // Null-free arrays need to be initialized
398 for (int i = 0; i < len; i++) {
399 vk->write_value_to_addr(h_init_val(), ((flatArrayOop)result)->value_at_addr(i, fak->layout_helper()), fak->layout_kind(), true, CHECK);
400 }
401 }
402 } else if (array_type->is_typeArray_klass()) {
403 // The oopFactory likes to work with the element type.
404 // (We could bypass the oopFactory, since it doesn't add much value.)
405 BasicType elem_type = TypeArrayKlass::cast(array_type)->element_type();
406 result = oopFactory::new_typeArray(elem_type, len, THREAD);
407 } else {
408 Handle holder(current, array_type->klass_holder()); // keep the array klass alive
409 result = oopFactory::new_refArray(array_type, len, THREAD);
410 if (array_type->is_null_free_array_klass() && !h_init_val.is_null()) {
411 // Null-free arrays need to be initialized
412 for (int i = 0; i < len; i++) {
413 ((objArrayOop)result)->obj_at_put(i, h_init_val());
414 }
415 }
416 }
417
418 // Pass oops back through thread local storage. Our apparent type to Java
419 // is that we return an oop, but we can block on exit from this routine and
420 // a GC can trash the oop in C's return register. The generated stub will
421 // fetch the oop from TLS after any possible GC.
422 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
423 current->set_vm_result_oop(result);
424 JRT_BLOCK_END;
425
426 // inform GC that we won't do card marks for initializing writes.
427 SharedRuntime::on_slowpath_allocation_exit(current);
428 JRT_END
429
430 // array allocation without zeroing
431 JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_nozero_C(Klass* array_type, int len, JavaThread* current))
432 JRT_BLOCK;
433 #ifndef PRODUCT
434 SharedRuntime::_new_array_ctr++; // new array requires GC
435 #endif
592 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread* current))
593
594 if (!SafepointSynchronize::is_synchronizing() ) {
595 if (ObjectSynchronizer::quick_notify(obj, current, true)) {
596 return;
597 }
598 }
599
600 // This is the case the fast-path above isn't provisioned to handle.
601 // The fast-path is designed to handle frequently arising cases in an efficient manner.
602 // (The fast-path is just a degenerate variant of the slow-path).
603 // Perform the dreaded state transition and pass control into the slow-path.
604 JRT_BLOCK;
605 Handle h_obj(current, obj);
606 ObjectSynchronizer::notifyall(h_obj, CHECK);
607 JRT_BLOCK_END;
608 JRT_END
609
610 static const TypeFunc* make_new_instance_Type() {
611 // create input type (domain)
612 const Type **fields = TypeTuple::fields(2);
613 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
614 fields[TypeFunc::Parms+1] = TypeInt::BOOL; // is_larval
615 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
616
617 // create result type (range)
618 fields = TypeTuple::fields(1);
619 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop
620
621 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
622
623 return TypeFunc::make(domain, range);
624 }
625
626 #if INCLUDE_JVMTI
627 static const TypeFunc* make_notify_jvmti_vthread_Type() {
628 // create input type (domain)
629 const Type **fields = TypeTuple::fields(2);
630 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // VirtualThread oop
631 fields[TypeFunc::Parms+1] = TypeInt::BOOL; // jboolean
632 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
633
634 // no result type needed
635 fields = TypeTuple::fields(1);
638
639 return TypeFunc::make(domain,range);
640 }
641 #endif
642
643 static const TypeFunc* make_athrow_Type() {
644 // create input type (domain)
645 const Type **fields = TypeTuple::fields(1);
646 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
647 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
648
649 // create result type (range)
650 fields = TypeTuple::fields(0);
651
652 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
653
654 return TypeFunc::make(domain, range);
655 }
656
657 static const TypeFunc* make_new_array_Type() {
658 // create input type (domain)
659 const Type **fields = TypeTuple::fields(3);
660 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass
661 fields[TypeFunc::Parms+1] = TypeInt::INT; // array size
662 fields[TypeFunc::Parms+2] = TypeInstPtr::NOTNULL; // init value
663 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
664
665 // create result type (range)
666 fields = TypeTuple::fields(1);
667 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop
668
669 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
670
671 return TypeFunc::make(domain, range);
672 }
673
674 static const TypeFunc* make_new_array_nozero_Type() {
675 // create input type (domain)
676 const Type **fields = TypeTuple::fields(2);
677 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass
678 fields[TypeFunc::Parms+1] = TypeInt::INT; // array size
679 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
680
681 // create result type (range)
682 fields = TypeTuple::fields(1);
683 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Returned oop
684
685 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
686
687 return TypeFunc::make(domain, range);
688 }
689
690 const TypeFunc* OptoRuntime::multianewarray_Type(int ndim) {
691 // create input type (domain)
692 const int nargs = ndim + 1;
693 const Type **fields = TypeTuple::fields(nargs);
694 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // element klass
730 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
731
732 return TypeFunc::make(domain, range);
733 }
734
735 //-----------------------------------------------------------------------------
736 // Monitor Handling
737
738 static const TypeFunc* make_complete_monitor_enter_Type() {
739 // create input type (domain)
740 const Type **fields = TypeTuple::fields(2);
741 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked
742 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock
743 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
744
745 // create result type (range)
746 fields = TypeTuple::fields(0);
747
748 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
749
750 return TypeFunc::make(domain, range);
751 }
752
753 //-----------------------------------------------------------------------------
754
755 static const TypeFunc* make_complete_monitor_exit_Type() {
756 // create input type (domain)
757 const Type **fields = TypeTuple::fields(3);
758 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Object to be Locked
759 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // Address of stack location for lock - BasicLock
760 fields[TypeFunc::Parms+2] = TypeRawPtr::BOTTOM; // Thread pointer (Self)
761 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
762
763 // create result type (range)
764 fields = TypeTuple::fields(0);
765
766 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
767
768 return TypeFunc::make(domain, range);
769 }
770
2164 RegisterMap::WalkContinuation::skip);
2165 frame stub_frame = thread->last_frame();
2166 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
2167 frame caller_frame = stub_frame.sender(®_map);
2168 return caller_frame.is_deoptimized_frame();
2169 }
2170
2171 static const TypeFunc* make_register_finalizer_Type() {
2172 // create input type (domain)
2173 const Type **fields = TypeTuple::fields(1);
2174 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver
2175 // // The JavaThread* is passed to each routine as the last argument
2176 // fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // JavaThread *; Executing thread
2177 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields);
2178
2179 // create result type (range)
2180 fields = TypeTuple::fields(0);
2181
2182 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2183
2184 return TypeFunc::make(domain, range);
2185 }
2186
2187 #if INCLUDE_JFR
2188 static const TypeFunc* make_class_id_load_barrier_Type() {
2189 // create input type (domain)
2190 const Type **fields = TypeTuple::fields(1);
2191 fields[TypeFunc::Parms+0] = TypeInstPtr::KLASS;
2192 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms + 1, fields);
2193
2194 // create result type (range)
2195 fields = TypeTuple::fields(0);
2196
2197 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms + 0, fields);
2198
2199 return TypeFunc::make(domain,range);
2200 }
2201 #endif // INCLUDE_JFR
2202
2203 //-----------------------------------------------------------------------------
2204 static const TypeFunc* make_dtrace_method_entry_exit_Type() {
2205 // create input type (domain)
2206 const Type **fields = TypeTuple::fields(2);
2207 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2208 fields[TypeFunc::Parms+1] = TypeMetadataPtr::BOTTOM; // Method*; Method we are entering
2209 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2210
2211 // create result type (range)
2212 fields = TypeTuple::fields(0);
2213
2214 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2215
2216 return TypeFunc::make(domain, range);
2217 }
2218
2219 static const TypeFunc* make_dtrace_object_alloc_Type() {
2220 // create input type (domain)
2221 const Type **fields = TypeTuple::fields(2);
2222 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2223 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // oop; newly allocated object
2224
2225 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2226
2227 // create result type (range)
2228 fields = TypeTuple::fields(0);
2229
2230 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2231
2232 return TypeFunc::make(domain, range);
2233 }
2234
2235 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer_C(oopDesc* obj, JavaThread* current))
2236 assert(oopDesc::is_oop(obj), "must be a valid oop");
2237 assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
2238 InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
2239 JRT_END
2240
2241 //-----------------------------------------------------------------------------
2242
2243 NamedCounter * volatile OptoRuntime::_named_counters = nullptr;
2244
2245 //
2246 // dump the collected NamedCounters.
2247 //
2248 void OptoRuntime::print_named_counters() {
2249 int total_lock_count = 0;
2250 int eliminated_lock_count = 0;
2251
2252 NamedCounter* c = _named_counters;
2303 }
2304 st.print("@%d", bci);
2305 // To print linenumbers instead of bci use: m->line_number_from_bci(bci)
2306 }
2307 NamedCounter* c = new NamedCounter(st.freeze(), tag);
2308
2309 // atomically add the new counter to the head of the list. We only
2310 // add counters so this is safe.
2311 NamedCounter* head;
2312 do {
2313 c->set_next(nullptr);
2314 head = _named_counters;
2315 c->set_next(head);
2316 } while (AtomicAccess::cmpxchg(&_named_counters, head, c) != head);
2317 return c;
2318 }
2319
2320 void OptoRuntime::initialize_types() {
2321 _new_instance_Type = make_new_instance_Type();
2322 _new_array_Type = make_new_array_Type();
2323 _new_array_nozero_Type = make_new_array_nozero_Type();
2324 _multianewarray2_Type = multianewarray_Type(2);
2325 _multianewarray3_Type = multianewarray_Type(3);
2326 _multianewarray4_Type = multianewarray_Type(4);
2327 _multianewarray5_Type = multianewarray_Type(5);
2328 _multianewarrayN_Type = make_multianewarrayN_Type();
2329 _complete_monitor_enter_Type = make_complete_monitor_enter_Type();
2330 _complete_monitor_exit_Type = make_complete_monitor_exit_Type();
2331 _monitor_notify_Type = make_monitor_notify_Type();
2332 _uncommon_trap_Type = make_uncommon_trap_Type();
2333 _athrow_Type = make_athrow_Type();
2334 _rethrow_Type = make_rethrow_Type();
2335 _Math_D_D_Type = make_Math_D_D_Type();
2336 _Math_DD_D_Type = make_Math_DD_D_Type();
2337 _modf_Type = make_modf_Type();
2338 _l2f_Type = make_l2f_Type();
2339 _void_long_Type = make_void_long_Type();
2340 _void_void_Type = make_void_void_Type();
2341 _jfr_write_checkpoint_Type = make_jfr_write_checkpoint_Type();
2342 _flush_windows_Type = make_flush_windows_Type();
2343 _fast_arraycopy_Type = make_arraycopy_Type(ac_fast);
2404 static void trace_exception(outputStream* st, oop exception_oop, address exception_pc, const char* msg) {
2405 trace_exception_counter++;
2406 stringStream tempst;
2407
2408 tempst.print("%d [Exception (%s): ", trace_exception_counter, msg);
2409 exception_oop->print_value_on(&tempst);
2410 tempst.print(" in ");
2411 CodeBlob* blob = CodeCache::find_blob(exception_pc);
2412 if (blob->is_nmethod()) {
2413 blob->as_nmethod()->method()->print_value_on(&tempst);
2414 } else if (blob->is_runtime_stub()) {
2415 tempst.print("<runtime-stub>");
2416 } else {
2417 tempst.print("<unknown>");
2418 }
2419 tempst.print(" at " INTPTR_FORMAT, p2i(exception_pc));
2420 tempst.print("]");
2421
2422 st->print_raw_cr(tempst.freeze());
2423 }
2424
2425 const TypeFunc *OptoRuntime::store_inline_type_fields_Type() {
2426 // create input type (domain)
2427 uint total = SharedRuntime::java_return_convention_max_int + SharedRuntime::java_return_convention_max_float*2;
2428 const Type **fields = TypeTuple::fields(total);
2429 // We don't know the number of returned values and their
2430 // types. Assume all registers available to the return convention
2431 // are used.
2432 fields[TypeFunc::Parms] = TypePtr::BOTTOM;
2433 uint i = 1;
2434 for (; i < SharedRuntime::java_return_convention_max_int; i++) {
2435 fields[TypeFunc::Parms+i] = TypeInt::INT;
2436 }
2437 for (; i < total; i+=2) {
2438 fields[TypeFunc::Parms+i] = Type::DOUBLE;
2439 fields[TypeFunc::Parms+i+1] = Type::HALF;
2440 }
2441 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + total, fields);
2442
2443 // create result type (range)
2444 fields = TypeTuple::fields(1);
2445 fields[TypeFunc::Parms+0] = TypeInstPtr::BOTTOM;
2446
2447 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1,fields);
2448
2449 return TypeFunc::make(domain, range);
2450 }
2451
2452 const TypeFunc *OptoRuntime::pack_inline_type_Type() {
2453 // create input type (domain)
2454 uint total = 1 + SharedRuntime::java_return_convention_max_int + SharedRuntime::java_return_convention_max_float*2;
2455 const Type **fields = TypeTuple::fields(total);
2456 // We don't know the number of returned values and their
2457 // types. Assume all registers available to the return convention
2458 // are used.
2459 fields[TypeFunc::Parms] = TypeRawPtr::BOTTOM;
2460 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM;
2461 uint i = 2;
2462 for (; i < SharedRuntime::java_return_convention_max_int+1; i++) {
2463 fields[TypeFunc::Parms+i] = TypeInt::INT;
2464 }
2465 for (; i < total; i+=2) {
2466 fields[TypeFunc::Parms+i] = Type::DOUBLE;
2467 fields[TypeFunc::Parms+i+1] = Type::HALF;
2468 }
2469 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + total, fields);
2470
2471 // create result type (range)
2472 fields = TypeTuple::fields(1);
2473 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL;
2474
2475 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1,fields);
2476
2477 return TypeFunc::make(domain, range);
2478 }
2479
2480 JRT_BLOCK_ENTRY(void, OptoRuntime::load_unknown_inline_C(flatArrayOopDesc* array, int index, JavaThread* current))
2481 JRT_BLOCK;
2482 oop buffer = array->obj_at(index, THREAD);
2483 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
2484 current->set_vm_result_oop(buffer);
2485 JRT_BLOCK_END;
2486 JRT_END
2487
2488 const TypeFunc* OptoRuntime::load_unknown_inline_Type() {
2489 // create input type (domain)
2490 const Type** fields = TypeTuple::fields(2);
2491 fields[TypeFunc::Parms] = TypeOopPtr::NOTNULL;
2492 fields[TypeFunc::Parms+1] = TypeInt::POS;
2493
2494 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+2, fields);
2495
2496 // create result type (range)
2497 fields = TypeTuple::fields(1);
2498 fields[TypeFunc::Parms] = TypeInstPtr::BOTTOM;
2499
2500 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
2501
2502 return TypeFunc::make(domain, range);
2503 }
2504
2505 JRT_BLOCK_ENTRY(void, OptoRuntime::store_unknown_inline_C(instanceOopDesc* buffer, flatArrayOopDesc* array, int index, JavaThread* current))
2506 JRT_BLOCK;
2507 array->obj_at_put(index, buffer, THREAD);
2508 if (HAS_PENDING_EXCEPTION) {
2509 fatal("This entry must be changed to be a non-leaf entry because writing to a flat array can now throw an exception");
2510 }
2511 JRT_BLOCK_END;
2512 JRT_END
2513
2514 const TypeFunc* OptoRuntime::store_unknown_inline_Type() {
2515 // create input type (domain)
2516 const Type** fields = TypeTuple::fields(3);
2517 fields[TypeFunc::Parms] = TypeInstPtr::NOTNULL;
2518 fields[TypeFunc::Parms+1] = TypeOopPtr::NOTNULL;
2519 fields[TypeFunc::Parms+2] = TypeInt::POS;
2520
2521 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+3, fields);
2522
2523 // create result type (range)
2524 fields = TypeTuple::fields(0);
2525 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
2526
2527 return TypeFunc::make(domain, range);
2528 }
|