1 /*
2 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
671 if (mark->has_bias_pattern()) {
672 uintptr_t thread_ident;
673 uintptr_t anticipated_bias_locking_value;
674 thread_ident = (uintptr_t)istate->thread();
675 anticipated_bias_locking_value =
676 (((uintptr_t)rcvr->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) &
677 ~((uintptr_t) markOopDesc::age_mask_in_place);
678
679 if (anticipated_bias_locking_value == 0) {
680 // Already biased towards this thread, nothing to do.
681 if (PrintBiasedLockingStatistics) {
682 (* BiasedLocking::biased_lock_entry_count_addr())++;
683 }
684 success = true;
685 } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) {
686 // Try to revoke bias.
687 markOop header = rcvr->klass()->prototype_header();
688 if (hash != markOopDesc::no_hash) {
689 header = header->copy_set_hash(hash);
690 }
691 if (Atomic::cmpxchg(header, rcvr->mark_addr(), mark) == mark) {
692 if (PrintBiasedLockingStatistics)
693 (*BiasedLocking::revoked_lock_entry_count_addr())++;
694 }
695 } else if ((anticipated_bias_locking_value & epoch_mask_in_place) != 0) {
696 // Try to rebias.
697 markOop new_header = (markOop) ( (intptr_t) rcvr->klass()->prototype_header() | thread_ident);
698 if (hash != markOopDesc::no_hash) {
699 new_header = new_header->copy_set_hash(hash);
700 }
701 if (Atomic::cmpxchg(new_header, rcvr->mark_addr(), mark) == mark) {
702 if (PrintBiasedLockingStatistics) {
703 (* BiasedLocking::rebiased_lock_entry_count_addr())++;
704 }
705 } else {
706 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
707 }
708 success = true;
709 } else {
710 // Try to bias towards thread in case object is anonymously biased.
711 markOop header = (markOop) ((uintptr_t) mark &
712 ((uintptr_t)markOopDesc::biased_lock_mask_in_place |
713 (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place));
714 if (hash != markOopDesc::no_hash) {
715 header = header->copy_set_hash(hash);
716 }
717 markOop new_header = (markOop) ((uintptr_t) header | thread_ident);
718 // Debugging hint.
719 DEBUG_ONLY(mon->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);)
720 if (Atomic::cmpxchg(new_header, rcvr->mark_addr(), header) == header) {
721 if (PrintBiasedLockingStatistics) {
722 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++;
723 }
724 } else {
725 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
726 }
727 success = true;
728 }
729 }
730
731 // Traditional lightweight locking.
732 if (!success) {
733 markOop displaced = rcvr->mark()->set_unlocked();
734 mon->lock()->set_displaced_header(displaced);
735 bool call_vm = UseHeavyMonitors;
736 if (call_vm || Atomic::cmpxchg((markOop)mon, rcvr->mark_addr(), displaced) != displaced) {
737 // Is it simple recursive case?
738 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) {
739 mon->lock()->set_displaced_header(NULL);
740 } else {
741 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
742 }
743 }
744 }
745 }
746 THREAD->clr_do_not_unlock();
747
748 // Notify jvmti
749 #ifdef VM_JVMTI
750 if (_jvmti_interp_events) {
751 // Whenever JVMTI puts a thread in interp_only_mode, method
752 // entry/exit events are sent for that thread to track stack depth.
753 if (THREAD->is_interp_only_mode()) {
754 CALL_VM(InterpreterRuntime::post_method_entry(THREAD),
755 handle_exception);
756 }
857 if (mark->has_bias_pattern()) {
858 uintptr_t thread_ident;
859 uintptr_t anticipated_bias_locking_value;
860 thread_ident = (uintptr_t)istate->thread();
861 anticipated_bias_locking_value =
862 (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) &
863 ~((uintptr_t) markOopDesc::age_mask_in_place);
864
865 if (anticipated_bias_locking_value == 0) {
866 // already biased towards this thread, nothing to do
867 if (PrintBiasedLockingStatistics) {
868 (* BiasedLocking::biased_lock_entry_count_addr())++;
869 }
870 success = true;
871 } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) {
872 // try revoke bias
873 markOop header = lockee->klass()->prototype_header();
874 if (hash != markOopDesc::no_hash) {
875 header = header->copy_set_hash(hash);
876 }
877 if (Atomic::cmpxchg(header, lockee->mark_addr(), mark) == mark) {
878 if (PrintBiasedLockingStatistics) {
879 (*BiasedLocking::revoked_lock_entry_count_addr())++;
880 }
881 }
882 } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) {
883 // try rebias
884 markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident);
885 if (hash != markOopDesc::no_hash) {
886 new_header = new_header->copy_set_hash(hash);
887 }
888 if (Atomic::cmpxchg(new_header, lockee->mark_addr(), mark) == mark) {
889 if (PrintBiasedLockingStatistics) {
890 (* BiasedLocking::rebiased_lock_entry_count_addr())++;
891 }
892 } else {
893 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
894 }
895 success = true;
896 } else {
897 // try to bias towards thread in case object is anonymously biased
898 markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place |
899 (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place));
900 if (hash != markOopDesc::no_hash) {
901 header = header->copy_set_hash(hash);
902 }
903 markOop new_header = (markOop) ((uintptr_t) header | thread_ident);
904 // debugging hint
905 DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);)
906 if (Atomic::cmpxchg(new_header, lockee->mark_addr(), header) == header) {
907 if (PrintBiasedLockingStatistics) {
908 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++;
909 }
910 } else {
911 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
912 }
913 success = true;
914 }
915 }
916
917 // traditional lightweight locking
918 if (!success) {
919 markOop displaced = lockee->mark()->set_unlocked();
920 entry->lock()->set_displaced_header(displaced);
921 bool call_vm = UseHeavyMonitors;
922 if (call_vm || Atomic::cmpxchg((markOop)entry, lockee->mark_addr(), displaced) != displaced) {
923 // Is it simple recursive case?
924 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) {
925 entry->lock()->set_displaced_header(NULL);
926 } else {
927 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
928 }
929 }
930 }
931 UPDATE_PC_AND_TOS(1, -1);
932 goto run;
933 }
934 default: {
935 fatal("Unexpected message from frame manager");
936 }
937 }
938
939 run:
940
941 DO_UPDATE_INSTRUCTION_COUNT(*pc)
942 DEBUGGER_SINGLE_STEP_NOTIFY();
1798 uintptr_t thread_ident;
1799 uintptr_t anticipated_bias_locking_value;
1800 thread_ident = (uintptr_t)istate->thread();
1801 anticipated_bias_locking_value =
1802 (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) &
1803 ~((uintptr_t) markOopDesc::age_mask_in_place);
1804
1805 if (anticipated_bias_locking_value == 0) {
1806 // already biased towards this thread, nothing to do
1807 if (PrintBiasedLockingStatistics) {
1808 (* BiasedLocking::biased_lock_entry_count_addr())++;
1809 }
1810 success = true;
1811 }
1812 else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) {
1813 // try revoke bias
1814 markOop header = lockee->klass()->prototype_header();
1815 if (hash != markOopDesc::no_hash) {
1816 header = header->copy_set_hash(hash);
1817 }
1818 if (Atomic::cmpxchg(header, lockee->mark_addr(), mark) == mark) {
1819 if (PrintBiasedLockingStatistics)
1820 (*BiasedLocking::revoked_lock_entry_count_addr())++;
1821 }
1822 }
1823 else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) {
1824 // try rebias
1825 markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident);
1826 if (hash != markOopDesc::no_hash) {
1827 new_header = new_header->copy_set_hash(hash);
1828 }
1829 if (Atomic::cmpxchg(new_header, lockee->mark_addr(), mark) == mark) {
1830 if (PrintBiasedLockingStatistics)
1831 (* BiasedLocking::rebiased_lock_entry_count_addr())++;
1832 }
1833 else {
1834 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
1835 }
1836 success = true;
1837 }
1838 else {
1839 // try to bias towards thread in case object is anonymously biased
1840 markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place |
1841 (uintptr_t)markOopDesc::age_mask_in_place |
1842 epoch_mask_in_place));
1843 if (hash != markOopDesc::no_hash) {
1844 header = header->copy_set_hash(hash);
1845 }
1846 markOop new_header = (markOop) ((uintptr_t) header | thread_ident);
1847 // debugging hint
1848 DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);)
1849 if (Atomic::cmpxchg(new_header, lockee->mark_addr(), header) == header) {
1850 if (PrintBiasedLockingStatistics)
1851 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++;
1852 }
1853 else {
1854 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
1855 }
1856 success = true;
1857 }
1858 }
1859
1860 // traditional lightweight locking
1861 if (!success) {
1862 markOop displaced = lockee->mark()->set_unlocked();
1863 entry->lock()->set_displaced_header(displaced);
1864 bool call_vm = UseHeavyMonitors;
1865 if (call_vm || Atomic::cmpxchg((markOop)entry, lockee->mark_addr(), displaced) != displaced) {
1866 // Is it simple recursive case?
1867 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) {
1868 entry->lock()->set_displaced_header(NULL);
1869 } else {
1870 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
1871 }
1872 }
1873 }
1874 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1);
1875 } else {
1876 istate->set_msg(more_monitors);
1877 UPDATE_PC_AND_RETURN(0); // Re-execute
1878 }
1879 }
1880
1881 CASE(_monitorexit): {
1882 oop lockee = STACK_OBJECT(-1);
1883 CHECK_NULL(lockee);
1884 // derefing's lockee ought to provoke implicit null check
1885 // find our monitor slot
|
1 /*
2 * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
671 if (mark->has_bias_pattern()) {
672 uintptr_t thread_ident;
673 uintptr_t anticipated_bias_locking_value;
674 thread_ident = (uintptr_t)istate->thread();
675 anticipated_bias_locking_value =
676 (((uintptr_t)rcvr->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) &
677 ~((uintptr_t) markOopDesc::age_mask_in_place);
678
679 if (anticipated_bias_locking_value == 0) {
680 // Already biased towards this thread, nothing to do.
681 if (PrintBiasedLockingStatistics) {
682 (* BiasedLocking::biased_lock_entry_count_addr())++;
683 }
684 success = true;
685 } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) {
686 // Try to revoke bias.
687 markOop header = rcvr->klass()->prototype_header();
688 if (hash != markOopDesc::no_hash) {
689 header = header->copy_set_hash(hash);
690 }
691 if (rcvr->cas_set_mark(header, mark) == mark) {
692 if (PrintBiasedLockingStatistics)
693 (*BiasedLocking::revoked_lock_entry_count_addr())++;
694 }
695 } else if ((anticipated_bias_locking_value & epoch_mask_in_place) != 0) {
696 // Try to rebias.
697 markOop new_header = (markOop) ( (intptr_t) rcvr->klass()->prototype_header() | thread_ident);
698 if (hash != markOopDesc::no_hash) {
699 new_header = new_header->copy_set_hash(hash);
700 }
701 if (rcvr->cas_set_mark(new_header, mark) == mark) {
702 if (PrintBiasedLockingStatistics) {
703 (* BiasedLocking::rebiased_lock_entry_count_addr())++;
704 }
705 } else {
706 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
707 }
708 success = true;
709 } else {
710 // Try to bias towards thread in case object is anonymously biased.
711 markOop header = (markOop) ((uintptr_t) mark &
712 ((uintptr_t)markOopDesc::biased_lock_mask_in_place |
713 (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place));
714 if (hash != markOopDesc::no_hash) {
715 header = header->copy_set_hash(hash);
716 }
717 markOop new_header = (markOop) ((uintptr_t) header | thread_ident);
718 // Debugging hint.
719 DEBUG_ONLY(mon->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);)
720 if (rcvr->cas_set_mark(new_header, header) == header) {
721 if (PrintBiasedLockingStatistics) {
722 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++;
723 }
724 } else {
725 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
726 }
727 success = true;
728 }
729 }
730
731 // Traditional lightweight locking.
732 if (!success) {
733 markOop displaced = rcvr->mark()->set_unlocked();
734 mon->lock()->set_displaced_header(displaced);
735 bool call_vm = UseHeavyMonitors;
736 if (call_vm || rcvr->cas_set_mark((markOop)mon, displaced) != displaced) {
737 // Is it simple recursive case?
738 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) {
739 mon->lock()->set_displaced_header(NULL);
740 } else {
741 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
742 }
743 }
744 }
745 }
746 THREAD->clr_do_not_unlock();
747
748 // Notify jvmti
749 #ifdef VM_JVMTI
750 if (_jvmti_interp_events) {
751 // Whenever JVMTI puts a thread in interp_only_mode, method
752 // entry/exit events are sent for that thread to track stack depth.
753 if (THREAD->is_interp_only_mode()) {
754 CALL_VM(InterpreterRuntime::post_method_entry(THREAD),
755 handle_exception);
756 }
857 if (mark->has_bias_pattern()) {
858 uintptr_t thread_ident;
859 uintptr_t anticipated_bias_locking_value;
860 thread_ident = (uintptr_t)istate->thread();
861 anticipated_bias_locking_value =
862 (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) &
863 ~((uintptr_t) markOopDesc::age_mask_in_place);
864
865 if (anticipated_bias_locking_value == 0) {
866 // already biased towards this thread, nothing to do
867 if (PrintBiasedLockingStatistics) {
868 (* BiasedLocking::biased_lock_entry_count_addr())++;
869 }
870 success = true;
871 } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) {
872 // try revoke bias
873 markOop header = lockee->klass()->prototype_header();
874 if (hash != markOopDesc::no_hash) {
875 header = header->copy_set_hash(hash);
876 }
877 if (lockee->cas_set_mark(header, mark) == mark) {
878 if (PrintBiasedLockingStatistics) {
879 (*BiasedLocking::revoked_lock_entry_count_addr())++;
880 }
881 }
882 } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) {
883 // try rebias
884 markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident);
885 if (hash != markOopDesc::no_hash) {
886 new_header = new_header->copy_set_hash(hash);
887 }
888 if (lockee->cas_set_mark(new_header, mark) == mark) {
889 if (PrintBiasedLockingStatistics) {
890 (* BiasedLocking::rebiased_lock_entry_count_addr())++;
891 }
892 } else {
893 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
894 }
895 success = true;
896 } else {
897 // try to bias towards thread in case object is anonymously biased
898 markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place |
899 (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place));
900 if (hash != markOopDesc::no_hash) {
901 header = header->copy_set_hash(hash);
902 }
903 markOop new_header = (markOop) ((uintptr_t) header | thread_ident);
904 // debugging hint
905 DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);)
906 if (lockee->cas_set_mark(new_header, header) == header) {
907 if (PrintBiasedLockingStatistics) {
908 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++;
909 }
910 } else {
911 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
912 }
913 success = true;
914 }
915 }
916
917 // traditional lightweight locking
918 if (!success) {
919 markOop displaced = lockee->mark()->set_unlocked();
920 entry->lock()->set_displaced_header(displaced);
921 bool call_vm = UseHeavyMonitors;
922 if (call_vm || lockee->cas_set_mark((markOop)entry, displaced) != displaced) {
923 // Is it simple recursive case?
924 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) {
925 entry->lock()->set_displaced_header(NULL);
926 } else {
927 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
928 }
929 }
930 }
931 UPDATE_PC_AND_TOS(1, -1);
932 goto run;
933 }
934 default: {
935 fatal("Unexpected message from frame manager");
936 }
937 }
938
939 run:
940
941 DO_UPDATE_INSTRUCTION_COUNT(*pc)
942 DEBUGGER_SINGLE_STEP_NOTIFY();
1798 uintptr_t thread_ident;
1799 uintptr_t anticipated_bias_locking_value;
1800 thread_ident = (uintptr_t)istate->thread();
1801 anticipated_bias_locking_value =
1802 (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) &
1803 ~((uintptr_t) markOopDesc::age_mask_in_place);
1804
1805 if (anticipated_bias_locking_value == 0) {
1806 // already biased towards this thread, nothing to do
1807 if (PrintBiasedLockingStatistics) {
1808 (* BiasedLocking::biased_lock_entry_count_addr())++;
1809 }
1810 success = true;
1811 }
1812 else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) {
1813 // try revoke bias
1814 markOop header = lockee->klass()->prototype_header();
1815 if (hash != markOopDesc::no_hash) {
1816 header = header->copy_set_hash(hash);
1817 }
1818 if (lockee->cas_set_mark(header, mark) == mark) {
1819 if (PrintBiasedLockingStatistics)
1820 (*BiasedLocking::revoked_lock_entry_count_addr())++;
1821 }
1822 }
1823 else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) {
1824 // try rebias
1825 markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident);
1826 if (hash != markOopDesc::no_hash) {
1827 new_header = new_header->copy_set_hash(hash);
1828 }
1829 if (lockee->cas_set_mark(new_header, mark) == mark) {
1830 if (PrintBiasedLockingStatistics)
1831 (* BiasedLocking::rebiased_lock_entry_count_addr())++;
1832 }
1833 else {
1834 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
1835 }
1836 success = true;
1837 }
1838 else {
1839 // try to bias towards thread in case object is anonymously biased
1840 markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place |
1841 (uintptr_t)markOopDesc::age_mask_in_place |
1842 epoch_mask_in_place));
1843 if (hash != markOopDesc::no_hash) {
1844 header = header->copy_set_hash(hash);
1845 }
1846 markOop new_header = (markOop) ((uintptr_t) header | thread_ident);
1847 // debugging hint
1848 DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);)
1849 if (lockee->cas_set_mark(new_header, header) == header) {
1850 if (PrintBiasedLockingStatistics)
1851 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++;
1852 }
1853 else {
1854 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
1855 }
1856 success = true;
1857 }
1858 }
1859
1860 // traditional lightweight locking
1861 if (!success) {
1862 markOop displaced = lockee->mark()->set_unlocked();
1863 entry->lock()->set_displaced_header(displaced);
1864 bool call_vm = UseHeavyMonitors;
1865 if (call_vm || lockee->cas_set_mark((markOop)entry, displaced) != displaced) {
1866 // Is it simple recursive case?
1867 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) {
1868 entry->lock()->set_displaced_header(NULL);
1869 } else {
1870 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
1871 }
1872 }
1873 }
1874 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1);
1875 } else {
1876 istate->set_msg(more_monitors);
1877 UPDATE_PC_AND_RETURN(0); // Re-execute
1878 }
1879 }
1880
1881 CASE(_monitorexit): {
1882 oop lockee = STACK_OBJECT(-1);
1883 CHECK_NULL(lockee);
1884 // derefing's lockee ought to provoke implicit null check
1885 // find our monitor slot
|