Mercurial > hg > truffle
comparison src/share/vm/c1/c1_Runtime1.cpp @ 3714:b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 13 Dec 2011 21:17:46 -0800 |
parents | bc95d122df79 |
children | 82f88223fcff |
comparison
equal
deleted
inserted
replaced
3713:d6a0c46a73b2 | 3714:b648304ba4ff |
---|---|
653 | 653 |
654 JRT_ENTRY(void, Runtime1::throw_incompatible_class_change_error(JavaThread* thread)) | 654 JRT_ENTRY(void, Runtime1::throw_incompatible_class_change_error(JavaThread* thread)) |
655 NOT_PRODUCT(_throw_incompatible_class_change_error_count++;) | 655 NOT_PRODUCT(_throw_incompatible_class_change_error_count++;) |
656 ResourceMark rm(thread); | 656 ResourceMark rm(thread); |
657 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IncompatibleClassChangeError()); | 657 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IncompatibleClassChangeError()); |
658 JRT_END | |
659 | |
660 | |
661 JRT_ENTRY_NO_ASYNC(void, Runtime1::graal_monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) | |
662 NOT_PRODUCT(_monitorenter_slowcase_cnt++;) | |
663 #ifdef ASSERT | |
664 if (TraceGraal >= 3) { | |
665 tty->print_cr("entered locking slow case with obj=" INTPTR_FORMAT " and lock= " INTPTR_FORMAT, obj, lock); | |
666 } | |
667 if (PrintBiasedLockingStatistics) { | |
668 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); | |
669 } | |
670 #endif | |
671 Handle h_obj(thread, obj); | |
672 assert(h_obj()->is_oop(), "must be NULL or an object"); | |
673 if (UseBiasedLocking) { | |
674 // Retry fast entry if bias is revoked to avoid unnecessary inflation | |
675 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); | |
676 } else { | |
677 if (UseFastLocking) { | |
678 // When using fast locking, the compiled code has already tried the fast case | |
679 ObjectSynchronizer::slow_enter(h_obj, lock, THREAD); | |
680 } else { | |
681 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); | |
682 } | |
683 } | |
684 #ifdef ASSERT | |
685 if (TraceGraal >= 3) { | |
686 tty->print_cr("exiting locking"); | |
687 lock->lock()->print_on(tty); | |
688 tty->print_cr(""); | |
689 tty->print_cr("done"); | |
690 } | |
691 #endif | |
692 JRT_END | |
693 | |
694 | |
695 JRT_LEAF(void, Runtime1::graal_monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) | |
696 NOT_PRODUCT(_monitorexit_slowcase_cnt++;) | |
697 assert(thread == JavaThread::current(), "threads must correspond"); | |
698 assert(thread->last_Java_sp(), "last_Java_sp must be set"); | |
699 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown | |
700 EXCEPTION_MARK; | |
701 | |
702 #ifdef DEBUG | |
703 if (!obj->is_oop()) { | |
704 ResetNoHandleMark rhm; | |
705 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); | |
706 if (method != NULL) { | |
707 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), obj); | |
708 } | |
709 thread->print_stack_on(tty); | |
710 assert(false, "invalid lock object pointer dected"); | |
711 } | |
712 #endif | |
713 | |
714 if (UseFastLocking) { | |
715 // When using fast locking, the compiled code has already tried the fast case | |
716 ObjectSynchronizer::slow_exit(obj, lock, THREAD); | |
717 } else { | |
718 ObjectSynchronizer::fast_exit(obj, lock, THREAD); | |
719 } | |
658 JRT_END | 720 JRT_END |
659 | 721 |
660 | 722 |
661 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock)) | 723 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock)) |
662 NOT_PRODUCT(_monitorenter_slowcase_cnt++;) | 724 NOT_PRODUCT(_monitorenter_slowcase_cnt++;) |