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/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/compiledIC.hpp"
30 #include "code/icBuffer.hpp"
31 #include "code/nmethod.hpp"
32 #include "code/pcDesc.hpp"
33 #include "code/scopeDesc.hpp"
34 #include "code/vtableStubs.hpp"
35 #include "compiler/compileBroker.hpp"
36 #include "compiler/oopMap.hpp"
37 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
38 #include "gc/g1/heapRegion.hpp"
39 #include "gc/shared/barrierSet.hpp"
40 #include "gc/shared/collectedHeap.hpp"
41 #include "gc/shared/gcLocker.inline.hpp"
42 #include "interpreter/bytecode.hpp"
43 #include "interpreter/interpreter.hpp"
44 #include "interpreter/linkResolver.hpp"
45 #include "memory/oopFactory.hpp"
46 #include "oops/objArrayKlass.hpp"
47 #include "oops/oop.inline.hpp"
48 #include "opto/ad.hpp"
49 #include "opto/addnode.hpp"
50 #include "opto/callnode.hpp"
51 #include "opto/cfgnode.hpp"
52 #include "opto/graphKit.hpp"
53 #include "opto/machnode.hpp"
54 #include "opto/matcher.hpp"
55 #include "opto/memnode.hpp"
56 #include "opto/mulnode.hpp"
403 assert(elem_type->is_klass(), "not a class");
404 jint dims[5];
405 dims[0] = len1;
406 dims[1] = len2;
407 dims[2] = len3;
408 dims[3] = len4;
409 dims[4] = len5;
410 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
411 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
412 thread->set_vm_result(obj);
413 JRT_END
414
415 JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* dims, JavaThread *thread))
416 assert(check_compiled_frame(thread), "incorrect caller");
417 assert(elem_type->is_klass(), "not a class");
418 assert(oop(dims)->is_typeArray(), "not an array");
419
420 ResourceMark rm;
421 jint len = dims->length();
422 assert(len > 0, "Dimensions array should contain data");
423 jint *j_dims = typeArrayOop(dims)->int_at_addr(0);
424 jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
425 Copy::conjoint_jints_atomic(j_dims, c_dims, len);
426
427 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
428 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
429 thread->set_vm_result(obj);
430 JRT_END
431
432 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notify_C(oopDesc* obj, JavaThread *thread))
433
434 // Very few notify/notifyAll operations find any threads on the waitset, so
435 // the dominant fast-path is to simply return.
436 // Relatedly, it's critical that notify/notifyAll be fast in order to
437 // reduce lock hold times.
438 if (!SafepointSynchronize::is_synchronizing()) {
439 if (ObjectSynchronizer::quick_notify(obj, thread, false)) {
440 return;
441 }
442 }
443
444 // This is the case the fast-path above isn't provisioned to handle.
445 // The fast-path is designed to handle frequently arising cases in an efficient manner.
446 // (The fast-path is just a degenerate variant of the slow-path).
447 // Perform the dreaded state transition and pass control into the slow-path.
448 JRT_BLOCK;
449 Handle h_obj(THREAD, obj);
450 ObjectSynchronizer::notify(h_obj, CHECK);
451 JRT_BLOCK_END;
452 JRT_END
453
454 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread *thread))
455
456 if (!SafepointSynchronize::is_synchronizing() ) {
457 if (ObjectSynchronizer::quick_notify(obj, thread, true)) {
458 return;
459 }
460 }
461
462 // This is the case the fast-path above isn't provisioned to handle.
463 // The fast-path is designed to handle frequently arising cases in an efficient manner.
464 // (The fast-path is just a degenerate variant of the slow-path).
465 // Perform the dreaded state transition and pass control into the slow-path.
466 JRT_BLOCK;
467 Handle h_obj(THREAD, obj);
468 ObjectSynchronizer::notifyall(h_obj, CHECK);
469 JRT_BLOCK_END;
470 JRT_END
471
472 const TypeFunc *OptoRuntime::new_instance_Type() {
473 // create input type (domain)
474 const Type **fields = TypeTuple::fields(1);
475 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
570 fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
571 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
572
573 // create result type (range)
574 fields = TypeTuple::fields(0);
575 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
576
577 return TypeFunc::make(domain, range);
578 }
579
580 const TypeFunc *OptoRuntime::g1_wb_post_Type() {
581
582 const Type **fields = TypeTuple::fields(2);
583 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr
584 fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
585 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
586
587 // create result type (range)
588 fields = TypeTuple::fields(0);
589 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields);
590
591 return TypeFunc::make(domain, range);
592 }
593
594 const TypeFunc *OptoRuntime::uncommon_trap_Type() {
595 // create input type (domain)
596 const Type **fields = TypeTuple::fields(1);
597 fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action)
598 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
599
600 // create result type (range)
601 fields = TypeTuple::fields(0);
602 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
603
604 return TypeFunc::make(domain, range);
605 }
606
607 # ifdef ENABLE_ZAP_DEAD_LOCALS
608 // Type used for stub generation for zap_dead_locals.
609 // No inputs or outputs
|
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/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/compiledIC.hpp"
30 #include "code/icBuffer.hpp"
31 #include "code/nmethod.hpp"
32 #include "code/pcDesc.hpp"
33 #include "code/scopeDesc.hpp"
34 #include "code/vtableStubs.hpp"
35 #include "compiler/compileBroker.hpp"
36 #include "compiler/oopMap.hpp"
37 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
38 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
39 #include "gc/g1/heapRegion.hpp"
40 #include "gc/shared/barrierSet.hpp"
41 #include "gc/shared/collectedHeap.hpp"
42 #include "gc/shared/gcLocker.inline.hpp"
43 #include "interpreter/bytecode.hpp"
44 #include "interpreter/interpreter.hpp"
45 #include "interpreter/linkResolver.hpp"
46 #include "memory/oopFactory.hpp"
47 #include "oops/objArrayKlass.hpp"
48 #include "oops/oop.inline.hpp"
49 #include "opto/ad.hpp"
50 #include "opto/addnode.hpp"
51 #include "opto/callnode.hpp"
52 #include "opto/cfgnode.hpp"
53 #include "opto/graphKit.hpp"
54 #include "opto/machnode.hpp"
55 #include "opto/matcher.hpp"
56 #include "opto/memnode.hpp"
57 #include "opto/mulnode.hpp"
404 assert(elem_type->is_klass(), "not a class");
405 jint dims[5];
406 dims[0] = len1;
407 dims[1] = len2;
408 dims[2] = len3;
409 dims[3] = len4;
410 dims[4] = len5;
411 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
412 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
413 thread->set_vm_result(obj);
414 JRT_END
415
416 JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* dims, JavaThread *thread))
417 assert(check_compiled_frame(thread), "incorrect caller");
418 assert(elem_type->is_klass(), "not a class");
419 assert(oop(dims)->is_typeArray(), "not an array");
420
421 ResourceMark rm;
422 jint len = dims->length();
423 assert(len > 0, "Dimensions array should contain data");
424 jint *j_dims = typeArrayOop(oopDesc::bs()->read_barrier(dims))->int_at_addr(0);
425 jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
426 Copy::conjoint_jints_atomic(j_dims, c_dims, len);
427
428 oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
429 deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
430 thread->set_vm_result(obj);
431 JRT_END
432
433 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notify_C(oopDesc* obj, JavaThread *thread))
434
435 // Very few notify/notifyAll operations find any threads on the waitset, so
436 // the dominant fast-path is to simply return.
437 // Relatedly, it's critical that notify/notifyAll be fast in order to
438 // reduce lock hold times.
439 obj = oopDesc::bs()->write_barrier(obj);
440 if (!SafepointSynchronize::is_synchronizing()) {
441 if (ObjectSynchronizer::quick_notify(obj, thread, false)) {
442 return;
443 }
444 }
445
446 // This is the case the fast-path above isn't provisioned to handle.
447 // The fast-path is designed to handle frequently arising cases in an efficient manner.
448 // (The fast-path is just a degenerate variant of the slow-path).
449 // Perform the dreaded state transition and pass control into the slow-path.
450 JRT_BLOCK;
451 Handle h_obj(THREAD, obj);
452 ObjectSynchronizer::notify(h_obj, CHECK);
453 JRT_BLOCK_END;
454 JRT_END
455
456 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread *thread))
457
458 obj = oopDesc::bs()->write_barrier(obj);
459 if (!SafepointSynchronize::is_synchronizing() ) {
460 if (ObjectSynchronizer::quick_notify(obj, thread, true)) {
461 return;
462 }
463 }
464
465 // This is the case the fast-path above isn't provisioned to handle.
466 // The fast-path is designed to handle frequently arising cases in an efficient manner.
467 // (The fast-path is just a degenerate variant of the slow-path).
468 // Perform the dreaded state transition and pass control into the slow-path.
469 JRT_BLOCK;
470 Handle h_obj(THREAD, obj);
471 ObjectSynchronizer::notifyall(h_obj, CHECK);
472 JRT_BLOCK_END;
473 JRT_END
474
475 const TypeFunc *OptoRuntime::new_instance_Type() {
476 // create input type (domain)
477 const Type **fields = TypeTuple::fields(1);
478 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated
573 fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
574 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
575
576 // create result type (range)
577 fields = TypeTuple::fields(0);
578 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
579
580 return TypeFunc::make(domain, range);
581 }
582
583 const TypeFunc *OptoRuntime::g1_wb_post_Type() {
584
585 const Type **fields = TypeTuple::fields(2);
586 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr
587 fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
588 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
589
590 // create result type (range)
591 fields = TypeTuple::fields(0);
592 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields);
593
594 return TypeFunc::make(domain, range);
595 }
596
597 const TypeFunc *OptoRuntime::shenandoah_clone_barrier_Type() {
598 const Type **fields = TypeTuple::fields(1);
599 fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
600 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
601
602 // create result type (range)
603 fields = TypeTuple::fields(0);
604 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
605
606 return TypeFunc::make(domain, range);
607 }
608
609 const TypeFunc *OptoRuntime::shenandoah_cas_obj_Type() {
610 const Type **fields = TypeTuple::fields(3);
611 fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Address
612 fields[TypeFunc::Parms+1] = TypeInstPtr::BOTTOM; // New value
613 fields[TypeFunc::Parms+2] = TypeInstPtr::BOTTOM; // Expected value
614 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
615
616 // create result type (range)
617 fields = TypeTuple::fields(1);
618 fields[TypeFunc::Parms+0] = TypeInt::BOOL;
619 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
620
621 return TypeFunc::make(domain, range);
622 }
623
624 const TypeFunc *OptoRuntime::uncommon_trap_Type() {
625 // create input type (domain)
626 const Type **fields = TypeTuple::fields(1);
627 fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action)
628 const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
629
630 // create result type (range)
631 fields = TypeTuple::fields(0);
632 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
633
634 return TypeFunc::make(domain, range);
635 }
636
637 # ifdef ENABLE_ZAP_DEAD_LOCALS
638 // Type used for stub generation for zap_dead_locals.
639 // No inputs or outputs
|