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/atomic.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
2057 RegisterMap::WalkContinuation::skip);
2058 frame stub_frame = thread->last_frame();
2059 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
2060 frame caller_frame = stub_frame.sender(®_map);
2061 return caller_frame.is_deoptimized_frame();
2062 }
2063
2064 static const TypeFunc* make_register_finalizer_Type() {
2065 // create input type (domain)
2066 const Type **fields = TypeTuple::fields(1);
2067 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver
2068 // // The JavaThread* is passed to each routine as the last argument
2069 // fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // JavaThread *; Executing thread
2070 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields);
2071
2072 // create result type (range)
2073 fields = TypeTuple::fields(0);
2074
2075 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2076
2077 return TypeFunc::make(domain,range);
2078 }
2079
2080 #if INCLUDE_JFR
2081 static const TypeFunc* make_class_id_load_barrier_Type() {
2082 // create input type (domain)
2083 const Type **fields = TypeTuple::fields(1);
2084 fields[TypeFunc::Parms+0] = TypeInstPtr::KLASS;
2085 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms + 1, fields);
2086
2087 // create result type (range)
2088 fields = TypeTuple::fields(0);
2089
2090 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms + 0, fields);
2091
2092 return TypeFunc::make(domain,range);
2093 }
2094 #endif // INCLUDE_JFR
2095
2096 //-----------------------------------------------------------------------------
2097 static const TypeFunc* make_dtrace_method_entry_exit_Type() {
2098 // create input type (domain)
2099 const Type **fields = TypeTuple::fields(2);
2100 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2101 fields[TypeFunc::Parms+1] = TypeMetadataPtr::BOTTOM; // Method*; Method we are entering
2102 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2103
2104 // create result type (range)
2105 fields = TypeTuple::fields(0);
2106
2107 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2108
2109 return TypeFunc::make(domain,range);
2110 }
2111
2112 static const TypeFunc* make_dtrace_object_alloc_Type() {
2113 // create input type (domain)
2114 const Type **fields = TypeTuple::fields(2);
2115 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2116 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // oop; newly allocated object
2117
2118 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2119
2120 // create result type (range)
2121 fields = TypeTuple::fields(0);
2122
2123 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2124
2125 return TypeFunc::make(domain,range);
2126 }
2127
2128 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer_C(oopDesc* obj, JavaThread* current))
2129 assert(oopDesc::is_oop(obj), "must be a valid oop");
2130 assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
2131 InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
2132 JRT_END
2133
2134 //-----------------------------------------------------------------------------
2135
2136 NamedCounter * volatile OptoRuntime::_named_counters = nullptr;
2137
2138 //
2139 // dump the collected NamedCounters.
2140 //
2141 void OptoRuntime::print_named_counters() {
2142 int total_lock_count = 0;
2143 int eliminated_lock_count = 0;
2144
2145 NamedCounter* c = _named_counters;
2196 }
2197 st.print("@%d", bci);
2198 // To print linenumbers instead of bci use: m->line_number_from_bci(bci)
2199 }
2200 NamedCounter* c = new NamedCounter(st.freeze(), tag);
2201
2202 // atomically add the new counter to the head of the list. We only
2203 // add counters so this is safe.
2204 NamedCounter* head;
2205 do {
2206 c->set_next(nullptr);
2207 head = _named_counters;
2208 c->set_next(head);
2209 } while (Atomic::cmpxchg(&_named_counters, head, c) != head);
2210 return c;
2211 }
2212
2213 void OptoRuntime::initialize_types() {
2214 _new_instance_Type = make_new_instance_Type();
2215 _new_array_Type = make_new_array_Type();
2216 _multianewarray2_Type = multianewarray_Type(2);
2217 _multianewarray3_Type = multianewarray_Type(3);
2218 _multianewarray4_Type = multianewarray_Type(4);
2219 _multianewarray5_Type = multianewarray_Type(5);
2220 _multianewarrayN_Type = make_multianewarrayN_Type();
2221 _complete_monitor_enter_Type = make_complete_monitor_enter_Type();
2222 _complete_monitor_exit_Type = make_complete_monitor_exit_Type();
2223 _monitor_notify_Type = make_monitor_notify_Type();
2224 _uncommon_trap_Type = make_uncommon_trap_Type();
2225 _athrow_Type = make_athrow_Type();
2226 _rethrow_Type = make_rethrow_Type();
2227 _Math_D_D_Type = make_Math_D_D_Type();
2228 _Math_DD_D_Type = make_Math_DD_D_Type();
2229 _modf_Type = make_modf_Type();
2230 _l2f_Type = make_l2f_Type();
2231 _void_long_Type = make_void_long_Type();
2232 _void_void_Type = make_void_void_Type();
2233 _jfr_write_checkpoint_Type = make_jfr_write_checkpoint_Type();
2234 _flush_windows_Type = make_flush_windows_Type();
2235 _fast_arraycopy_Type = make_arraycopy_Type(ac_fast);
2296 static void trace_exception(outputStream* st, oop exception_oop, address exception_pc, const char* msg) {
2297 trace_exception_counter++;
2298 stringStream tempst;
2299
2300 tempst.print("%d [Exception (%s): ", trace_exception_counter, msg);
2301 exception_oop->print_value_on(&tempst);
2302 tempst.print(" in ");
2303 CodeBlob* blob = CodeCache::find_blob(exception_pc);
2304 if (blob->is_nmethod()) {
2305 blob->as_nmethod()->method()->print_value_on(&tempst);
2306 } else if (blob->is_runtime_stub()) {
2307 tempst.print("<runtime-stub>");
2308 } else {
2309 tempst.print("<unknown>");
2310 }
2311 tempst.print(" at " INTPTR_FORMAT, p2i(exception_pc));
2312 tempst.print("]");
2313
2314 st->print_raw_cr(tempst.freeze());
2315 }
|
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/atomic.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
2110 RegisterMap::WalkContinuation::skip);
2111 frame stub_frame = thread->last_frame();
2112 assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
2113 frame caller_frame = stub_frame.sender(®_map);
2114 return caller_frame.is_deoptimized_frame();
2115 }
2116
2117 static const TypeFunc* make_register_finalizer_Type() {
2118 // create input type (domain)
2119 const Type **fields = TypeTuple::fields(1);
2120 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // oop; Receiver
2121 // // The JavaThread* is passed to each routine as the last argument
2122 // fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // JavaThread *; Executing thread
2123 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1,fields);
2124
2125 // create result type (range)
2126 fields = TypeTuple::fields(0);
2127
2128 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2129
2130 return TypeFunc::make(domain, range);
2131 }
2132
2133 #if INCLUDE_JFR
2134 static const TypeFunc* make_class_id_load_barrier_Type() {
2135 // create input type (domain)
2136 const Type **fields = TypeTuple::fields(1);
2137 fields[TypeFunc::Parms+0] = TypeInstPtr::KLASS;
2138 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms + 1, fields);
2139
2140 // create result type (range)
2141 fields = TypeTuple::fields(0);
2142
2143 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms + 0, fields);
2144
2145 return TypeFunc::make(domain,range);
2146 }
2147 #endif // INCLUDE_JFR
2148
2149 //-----------------------------------------------------------------------------
2150 static const TypeFunc* make_dtrace_method_entry_exit_Type() {
2151 // create input type (domain)
2152 const Type **fields = TypeTuple::fields(2);
2153 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2154 fields[TypeFunc::Parms+1] = TypeMetadataPtr::BOTTOM; // Method*; Method we are entering
2155 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2156
2157 // create result type (range)
2158 fields = TypeTuple::fields(0);
2159
2160 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2161
2162 return TypeFunc::make(domain, range);
2163 }
2164
2165 static const TypeFunc* make_dtrace_object_alloc_Type() {
2166 // create input type (domain)
2167 const Type **fields = TypeTuple::fields(2);
2168 fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
2169 fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL; // oop; newly allocated object
2170
2171 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
2172
2173 // create result type (range)
2174 fields = TypeTuple::fields(0);
2175
2176 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
2177
2178 return TypeFunc::make(domain, range);
2179 }
2180
2181 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer_C(oopDesc* obj, JavaThread* current))
2182 assert(oopDesc::is_oop(obj), "must be a valid oop");
2183 assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
2184 InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
2185 JRT_END
2186
2187 //-----------------------------------------------------------------------------
2188
2189 NamedCounter * volatile OptoRuntime::_named_counters = nullptr;
2190
2191 //
2192 // dump the collected NamedCounters.
2193 //
2194 void OptoRuntime::print_named_counters() {
2195 int total_lock_count = 0;
2196 int eliminated_lock_count = 0;
2197
2198 NamedCounter* c = _named_counters;
2249 }
2250 st.print("@%d", bci);
2251 // To print linenumbers instead of bci use: m->line_number_from_bci(bci)
2252 }
2253 NamedCounter* c = new NamedCounter(st.freeze(), tag);
2254
2255 // atomically add the new counter to the head of the list. We only
2256 // add counters so this is safe.
2257 NamedCounter* head;
2258 do {
2259 c->set_next(nullptr);
2260 head = _named_counters;
2261 c->set_next(head);
2262 } while (Atomic::cmpxchg(&_named_counters, head, c) != head);
2263 return c;
2264 }
2265
2266 void OptoRuntime::initialize_types() {
2267 _new_instance_Type = make_new_instance_Type();
2268 _new_array_Type = make_new_array_Type();
2269 _new_array_nozero_Type = make_new_array_nozero_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 }
2370
2371 const TypeFunc *OptoRuntime::store_inline_type_fields_Type() {
2372 // create input type (domain)
2373 uint total = SharedRuntime::java_return_convention_max_int + SharedRuntime::java_return_convention_max_float*2;
2374 const Type **fields = TypeTuple::fields(total);
2375 // We don't know the number of returned values and their
2376 // types. Assume all registers available to the return convention
2377 // are used.
2378 fields[TypeFunc::Parms] = TypePtr::BOTTOM;
2379 uint i = 1;
2380 for (; i < SharedRuntime::java_return_convention_max_int; i++) {
2381 fields[TypeFunc::Parms+i] = TypeInt::INT;
2382 }
2383 for (; i < total; i+=2) {
2384 fields[TypeFunc::Parms+i] = Type::DOUBLE;
2385 fields[TypeFunc::Parms+i+1] = Type::HALF;
2386 }
2387 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + total, fields);
2388
2389 // create result type (range)
2390 fields = TypeTuple::fields(1);
2391 fields[TypeFunc::Parms+0] = TypeInstPtr::BOTTOM;
2392
2393 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1,fields);
2394
2395 return TypeFunc::make(domain, range);
2396 }
2397
2398 const TypeFunc *OptoRuntime::pack_inline_type_Type() {
2399 // create input type (domain)
2400 uint total = 1 + SharedRuntime::java_return_convention_max_int + SharedRuntime::java_return_convention_max_float*2;
2401 const Type **fields = TypeTuple::fields(total);
2402 // We don't know the number of returned values and their
2403 // types. Assume all registers available to the return convention
2404 // are used.
2405 fields[TypeFunc::Parms] = TypeRawPtr::BOTTOM;
2406 fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM;
2407 uint i = 2;
2408 for (; i < SharedRuntime::java_return_convention_max_int+1; i++) {
2409 fields[TypeFunc::Parms+i] = TypeInt::INT;
2410 }
2411 for (; i < total; i+=2) {
2412 fields[TypeFunc::Parms+i] = Type::DOUBLE;
2413 fields[TypeFunc::Parms+i+1] = Type::HALF;
2414 }
2415 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + total, fields);
2416
2417 // create result type (range)
2418 fields = TypeTuple::fields(1);
2419 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL;
2420
2421 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1,fields);
2422
2423 return TypeFunc::make(domain, range);
2424 }
2425
2426 JRT_BLOCK_ENTRY(void, OptoRuntime::load_unknown_inline_C(flatArrayOopDesc* array, int index, JavaThread* current))
2427 JRT_BLOCK;
2428 oop buffer = array->obj_at(index, THREAD);
2429 deoptimize_caller_frame(current, HAS_PENDING_EXCEPTION);
2430 current->set_vm_result_oop(buffer);
2431 JRT_BLOCK_END;
2432 JRT_END
2433
2434 const TypeFunc* OptoRuntime::load_unknown_inline_Type() {
2435 // create input type (domain)
2436 const Type** fields = TypeTuple::fields(2);
2437 fields[TypeFunc::Parms] = TypeOopPtr::NOTNULL;
2438 fields[TypeFunc::Parms+1] = TypeInt::POS;
2439
2440 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+2, fields);
2441
2442 // create result type (range)
2443 fields = TypeTuple::fields(1);
2444 fields[TypeFunc::Parms] = TypeInstPtr::BOTTOM;
2445
2446 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
2447
2448 return TypeFunc::make(domain, range);
2449 }
2450
2451 JRT_BLOCK_ENTRY(void, OptoRuntime::store_unknown_inline_C(instanceOopDesc* buffer, flatArrayOopDesc* array, int index, JavaThread* current))
2452 JRT_BLOCK;
2453 array->obj_at_put(index, buffer, THREAD);
2454 if (HAS_PENDING_EXCEPTION) {
2455 fatal("This entry must be changed to be a non-leaf entry because writing to a flat array can now throw an exception");
2456 }
2457 JRT_BLOCK_END;
2458 JRT_END
2459
2460 const TypeFunc* OptoRuntime::store_unknown_inline_Type() {
2461 // create input type (domain)
2462 const Type** fields = TypeTuple::fields(3);
2463 fields[TypeFunc::Parms] = TypeInstPtr::NOTNULL;
2464 fields[TypeFunc::Parms+1] = TypeOopPtr::NOTNULL;
2465 fields[TypeFunc::Parms+2] = TypeInt::POS;
2466
2467 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+3, fields);
2468
2469 // create result type (range)
2470 fields = TypeTuple::fields(0);
2471 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
2472
2473 return TypeFunc::make(domain, range);
2474 }
|