< prev index next >

src/hotspot/share/interpreter/bytecodeInterpreter.cpp

Print this page

        

*** 668,683 **** bool success = false; uintptr_t epoch_mask_in_place = (uintptr_t)markWord::epoch_mask_in_place; markWord mark = rcvr->mark(); intptr_t hash = (intptr_t) markWord::no_hash; // Implies UseBiasedLocking. ! if (mark->has_bias_pattern()) { uintptr_t thread_ident; uintptr_t anticipated_bias_locking_value; thread_ident = (uintptr_t)istate->thread(); anticipated_bias_locking_value = ! (((uintptr_t)rcvr->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) & ~((uintptr_t) markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // Already biased towards this thread, nothing to do. if (PrintBiasedLockingStatistics) { --- 668,683 ---- bool success = false; uintptr_t epoch_mask_in_place = (uintptr_t)markWord::epoch_mask_in_place; markWord mark = rcvr->mark(); intptr_t hash = (intptr_t) markWord::no_hash; // Implies UseBiasedLocking. ! if (mark.has_bias_pattern()) { uintptr_t thread_ident; uintptr_t anticipated_bias_locking_value; thread_ident = (uintptr_t)istate->thread(); anticipated_bias_locking_value = ! (((uintptr_t)rcvr->klass()->prototype_header().value() | thread_ident) ^ mark.value()) & ~((uintptr_t) markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // Already biased towards this thread, nothing to do. if (PrintBiasedLockingStatistics) {
*** 686,706 **** success = true; } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // Try to revoke bias. markWord header = rcvr->klass()->prototype_header(); if (hash != markWord::no_hash) { ! header = header->copy_set_hash(hash); } if (rcvr->cas_set_mark(header, mark) == mark) { if (PrintBiasedLockingStatistics) (*BiasedLocking::revoked_lock_entry_count_addr())++; } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) != 0) { // Try to rebias. ! markWord new_header = (markWord) ( (intptr_t) rcvr->klass()->prototype_header() | thread_ident); if (hash != markWord::no_hash) { ! new_header = new_header->copy_set_hash(hash); } if (rcvr->cas_set_mark(new_header, mark) == mark) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::rebiased_lock_entry_count_addr())++; } --- 686,706 ---- success = true; } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // Try to revoke bias. markWord header = rcvr->klass()->prototype_header(); if (hash != markWord::no_hash) { ! header = header.copy_set_hash(hash); } if (rcvr->cas_set_mark(header, mark) == mark) { if (PrintBiasedLockingStatistics) (*BiasedLocking::revoked_lock_entry_count_addr())++; } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) != 0) { // Try to rebias. ! markWord new_header( (intptr_t) rcvr->klass()->prototype_header().value() | thread_ident); if (hash != markWord::no_hash) { ! new_header = new_header.copy_set_hash(hash); } if (rcvr->cas_set_mark(new_header, mark) == mark) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::rebiased_lock_entry_count_addr())++; }
*** 708,726 **** CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); } success = true; } else { // Try to bias towards thread in case object is anonymously biased. ! markWord header = (markWord) ((uintptr_t) mark & ! ((uintptr_t)markWord::biased_lock_mask_in_place | ! (uintptr_t)markWord::age_mask_in_place | epoch_mask_in_place)); if (hash != markWord::no_hash) { ! header = header->copy_set_hash(hash); } ! markWord new_header = (markWord) ((uintptr_t) header | thread_ident); // Debugging hint. ! DEBUG_ONLY(mon->lock()->set_displaced_header((markWord) (uintptr_t) 0xdeaddead);) if (rcvr->cas_set_mark(new_header, header) == header) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; } } else { --- 708,726 ---- CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); } success = true; } else { // Try to bias towards thread in case object is anonymously biased. ! markWord header(mark.value() & ! ((uintptr_t)markWord::biased_lock_mask_in_place | ! (uintptr_t)markWord::age_mask_in_place | epoch_mask_in_place)); if (hash != markWord::no_hash) { ! header = header.copy_set_hash(hash); } ! markWord new_header(header.value() | thread_ident); // Debugging hint. ! DEBUG_ONLY(mon->lock()->set_displaced_header(markWord((uintptr_t) 0xdeaddead));) if (rcvr->cas_set_mark(new_header, header) == header) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; } } else {
*** 730,746 **** } } // Traditional lightweight locking. if (!success) { ! markWord displaced = rcvr->mark()->set_unlocked(); mon->lock()->set_displaced_header(displaced); bool call_vm = UseHeavyMonitors; ! if (call_vm || rcvr->cas_set_mark((markWord)mon, displaced) != displaced) { // Is it simple recursive case? ! if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) { ! mon->lock()->set_displaced_header(NULL); } else { CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); } } } --- 730,746 ---- } } // Traditional lightweight locking. if (!success) { ! markWord displaced = rcvr->mark().set_unlocked(); mon->lock()->set_displaced_header(displaced); bool call_vm = UseHeavyMonitors; ! if (call_vm || rcvr->cas_set_mark(markWord::from_pointer(mon), displaced) != displaced) { // Is it simple recursive case? ! if (!call_vm && THREAD->is_lock_owned((address) displaced.clear_lock_bits().to_pointer())) { ! mon->lock()->set_displaced_header(markWord::from_pointer(NULL)); } else { CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); } } }
*** 854,869 **** uintptr_t epoch_mask_in_place = (uintptr_t)markWord::epoch_mask_in_place; markWord mark = lockee->mark(); intptr_t hash = (intptr_t) markWord::no_hash; // implies UseBiasedLocking ! if (mark->has_bias_pattern()) { uintptr_t thread_ident; uintptr_t anticipated_bias_locking_value; thread_ident = (uintptr_t)istate->thread(); anticipated_bias_locking_value = ! (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) & ~((uintptr_t) markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // already biased towards this thread, nothing to do if (PrintBiasedLockingStatistics) { --- 854,869 ---- uintptr_t epoch_mask_in_place = (uintptr_t)markWord::epoch_mask_in_place; markWord mark = lockee->mark(); intptr_t hash = (intptr_t) markWord::no_hash; // implies UseBiasedLocking ! if (mark.has_bias_pattern()) { uintptr_t thread_ident; uintptr_t anticipated_bias_locking_value; thread_ident = (uintptr_t)istate->thread(); anticipated_bias_locking_value = ! (((uintptr_t)lockee->klass()->prototype_header().value() | thread_ident) ^ mark.value()) & ~((uintptr_t) markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // already biased towards this thread, nothing to do if (PrintBiasedLockingStatistics) {
*** 872,893 **** success = true; } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // try revoke bias markWord header = lockee->klass()->prototype_header(); if (hash != markWord::no_hash) { ! header = header->copy_set_hash(hash); } if (lockee->cas_set_mark(header, mark) == mark) { if (PrintBiasedLockingStatistics) { (*BiasedLocking::revoked_lock_entry_count_addr())++; } } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { // try rebias ! markWord new_header = (markWord) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident); if (hash != markWord::no_hash) { ! new_header = new_header->copy_set_hash(hash); } if (lockee->cas_set_mark(new_header, mark) == mark) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::rebiased_lock_entry_count_addr())++; } --- 872,893 ---- success = true; } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // try revoke bias markWord header = lockee->klass()->prototype_header(); if (hash != markWord::no_hash) { ! header = header.copy_set_hash(hash); } if (lockee->cas_set_mark(header, mark) == mark) { if (PrintBiasedLockingStatistics) { (*BiasedLocking::revoked_lock_entry_count_addr())++; } } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { // try rebias ! markWord new_header( (intptr_t) lockee->klass()->prototype_header().value() | thread_ident); if (hash != markWord::no_hash) { ! new_header = new_header.copy_set_hash(hash); } if (lockee->cas_set_mark(new_header, mark) == mark) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::rebiased_lock_entry_count_addr())++; }
*** 895,912 **** CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); } success = true; } else { // try to bias towards thread in case object is anonymously biased ! markWord header = (markWord) ((uintptr_t) mark & ((uintptr_t)markWord::biased_lock_mask_in_place | ! (uintptr_t)markWord::age_mask_in_place | epoch_mask_in_place)); if (hash != markWord::no_hash) { ! header = header->copy_set_hash(hash); } ! markWord new_header = (markWord) ((uintptr_t) header | thread_ident); // debugging hint ! DEBUG_ONLY(entry->lock()->set_displaced_header((markWord) (uintptr_t) 0xdeaddead);) if (lockee->cas_set_mark(new_header, header) == header) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; } } else { --- 895,912 ---- CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); } success = true; } else { // try to bias towards thread in case object is anonymously biased ! markWord header(mark.value() & ((uintptr_t)markWord::biased_lock_mask_in_place | ! (uintptr_t)markWord::age_mask_in_place | epoch_mask_in_place)); if (hash != markWord::no_hash) { ! header = header.copy_set_hash(hash); } ! markWord new_header(header.value() | thread_ident); // debugging hint ! DEBUG_ONLY(entry->lock()->set_displaced_header(markWord((uintptr_t) 0xdeaddead));) if (lockee->cas_set_mark(new_header, header) == header) { if (PrintBiasedLockingStatistics) { (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; } } else {
*** 916,932 **** } } // traditional lightweight locking if (!success) { ! markWord displaced = lockee->mark()->set_unlocked(); entry->lock()->set_displaced_header(displaced); bool call_vm = UseHeavyMonitors; ! if (call_vm || lockee->cas_set_mark((markWord)entry, displaced) != displaced) { // Is it simple recursive case? ! if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) { ! entry->lock()->set_displaced_header(NULL); } else { CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); } } } --- 916,932 ---- } } // traditional lightweight locking if (!success) { ! markWord displaced = lockee->mark().set_unlocked(); entry->lock()->set_displaced_header(displaced); bool call_vm = UseHeavyMonitors; ! if (call_vm || lockee->cas_set_mark(markWord::from_pointer(entry), displaced) != displaced) { // Is it simple recursive case? ! if (!call_vm && THREAD->is_lock_owned((address) displaced.clear_lock_bits().to_pointer())) { ! entry->lock()->set_displaced_header(markWord::from_pointer(NULL)); } else { CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); } } }
*** 1794,1809 **** uintptr_t epoch_mask_in_place = (uintptr_t)markWord::epoch_mask_in_place; markWord mark = lockee->mark(); intptr_t hash = (intptr_t) markWord::no_hash; // implies UseBiasedLocking ! if (mark->has_bias_pattern()) { uintptr_t thread_ident; uintptr_t anticipated_bias_locking_value; thread_ident = (uintptr_t)istate->thread(); anticipated_bias_locking_value = ! (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) & ~((uintptr_t) markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // already biased towards this thread, nothing to do if (PrintBiasedLockingStatistics) { --- 1794,1809 ---- uintptr_t epoch_mask_in_place = (uintptr_t)markWord::epoch_mask_in_place; markWord mark = lockee->mark(); intptr_t hash = (intptr_t) markWord::no_hash; // implies UseBiasedLocking ! if (mark.has_bias_pattern()) { uintptr_t thread_ident; uintptr_t anticipated_bias_locking_value; thread_ident = (uintptr_t)istate->thread(); anticipated_bias_locking_value = ! (((uintptr_t)lockee->klass()->prototype_header().value() | thread_ident) ^ mark.value()) & ~((uintptr_t) markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // already biased towards this thread, nothing to do if (PrintBiasedLockingStatistics) {
*** 1813,1834 **** } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // try revoke bias markWord header = lockee->klass()->prototype_header(); if (hash != markWord::no_hash) { ! header = header->copy_set_hash(hash); } if (lockee->cas_set_mark(header, mark) == mark) { if (PrintBiasedLockingStatistics) (*BiasedLocking::revoked_lock_entry_count_addr())++; } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { // try rebias ! markWord new_header = (markWord) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident); if (hash != markWord::no_hash) { ! new_header = new_header->copy_set_hash(hash); } if (lockee->cas_set_mark(new_header, mark) == mark) { if (PrintBiasedLockingStatistics) (* BiasedLocking::rebiased_lock_entry_count_addr())++; } --- 1813,1834 ---- } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // try revoke bias markWord header = lockee->klass()->prototype_header(); if (hash != markWord::no_hash) { ! header = header.copy_set_hash(hash); } if (lockee->cas_set_mark(header, mark) == mark) { if (PrintBiasedLockingStatistics) (*BiasedLocking::revoked_lock_entry_count_addr())++; } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { // try rebias ! markWord new_header( (intptr_t) lockee->klass()->prototype_header().value() | thread_ident); if (hash != markWord::no_hash) { ! new_header = new_header.copy_set_hash(hash); } if (lockee->cas_set_mark(new_header, mark) == mark) { if (PrintBiasedLockingStatistics) (* BiasedLocking::rebiased_lock_entry_count_addr())++; }
*** 1837,1855 **** } success = true; } else { // try to bias towards thread in case object is anonymously biased ! markWord header = (markWord) ((uintptr_t) mark & ((uintptr_t)markWord::biased_lock_mask_in_place | ! (uintptr_t)markWord::age_mask_in_place | ! epoch_mask_in_place)); if (hash != markWord::no_hash) { ! header = header->copy_set_hash(hash); } ! markWord new_header = (markWord) ((uintptr_t) header | thread_ident); // debugging hint ! DEBUG_ONLY(entry->lock()->set_displaced_header((markWord) (uintptr_t) 0xdeaddead);) if (lockee->cas_set_mark(new_header, header) == header) { if (PrintBiasedLockingStatistics) (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; } else { --- 1837,1855 ---- } success = true; } else { // try to bias towards thread in case object is anonymously biased ! markWord header(mark.value() & ((uintptr_t)markWord::biased_lock_mask_in_place | ! (uintptr_t)markWord::age_mask_in_place | ! epoch_mask_in_place)); if (hash != markWord::no_hash) { ! header = header.copy_set_hash(hash); } ! markWord new_header(header.value() | thread_ident); // debugging hint ! DEBUG_ONLY(entry->lock()->set_displaced_header(markWord((uintptr_t) 0xdeaddead));) if (lockee->cas_set_mark(new_header, header) == header) { if (PrintBiasedLockingStatistics) (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; } else {
*** 1859,1875 **** } } // traditional lightweight locking if (!success) { ! markWord displaced = lockee->mark()->set_unlocked(); entry->lock()->set_displaced_header(displaced); bool call_vm = UseHeavyMonitors; ! if (call_vm || lockee->cas_set_mark((markWord)entry, displaced) != displaced) { // Is it simple recursive case? ! if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) { ! entry->lock()->set_displaced_header(NULL); } else { CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); } } } --- 1859,1875 ---- } } // traditional lightweight locking if (!success) { ! markWord displaced = lockee->mark().set_unlocked(); entry->lock()->set_displaced_header(displaced); bool call_vm = UseHeavyMonitors; ! if (call_vm || lockee->cas_set_mark(markWord::from_pointer(entry), displaced) != displaced) { // Is it simple recursive case? ! if (!call_vm && THREAD->is_lock_owned((address) displaced.clear_lock_bits().to_pointer())) { ! entry->lock()->set_displaced_header(markWord::from_pointer(NULL)); } else { CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); } } }
*** 1890,1903 **** while (most_recent != limit ) { if ((most_recent)->obj() == lockee) { BasicLock* lock = most_recent->lock(); markWord header = lock->displaced_header(); most_recent->set_obj(NULL); ! if (!lockee->mark()->has_bias_pattern()) { bool call_vm = UseHeavyMonitors; // If it isn't recursive we either must swap old header or call the runtime ! if (header != NULL || call_vm) { markWord old_header = markWord::encode(lock); if (call_vm || lockee->cas_set_mark(header, old_header) != old_header) { // restore object for the slow case most_recent->set_obj(lockee); CALL_VM(InterpreterRuntime::monitorexit(THREAD, most_recent), handle_exception); --- 1890,1903 ---- while (most_recent != limit ) { if ((most_recent)->obj() == lockee) { BasicLock* lock = most_recent->lock(); markWord header = lock->displaced_header(); most_recent->set_obj(NULL); ! if (!lockee->mark().has_bias_pattern()) { bool call_vm = UseHeavyMonitors; // If it isn't recursive we either must swap old header or call the runtime ! if (header.to_pointer() != NULL || call_vm) { markWord old_header = markWord::encode(lock); if (call_vm || lockee->cas_set_mark(header, old_header) != old_header) { // restore object for the slow case most_recent->set_obj(lockee); CALL_VM(InterpreterRuntime::monitorexit(THREAD, most_recent), handle_exception);
*** 3036,3048 **** if (lockee != NULL) { BasicLock* lock = end->lock(); markWord header = lock->displaced_header(); end->set_obj(NULL); ! if (!lockee->mark()->has_bias_pattern()) { // If it isn't recursive we either must swap old header or call the runtime ! if (header != NULL) { markWord old_header = markWord::encode(lock); if (lockee->cas_set_mark(header, old_header) != old_header) { // restore object for the slow case end->set_obj(lockee); { --- 3036,3048 ---- if (lockee != NULL) { BasicLock* lock = end->lock(); markWord header = lock->displaced_header(); end->set_obj(NULL); ! if (!lockee->mark().has_bias_pattern()) { // If it isn't recursive we either must swap old header or call the runtime ! if (header.to_pointer() != NULL) { markWord old_header = markWord::encode(lock); if (lockee->cas_set_mark(header, old_header) != old_header) { // restore object for the slow case end->set_obj(lockee); {
*** 3111,3124 **** } else { BasicLock* lock = base->lock(); markWord header = lock->displaced_header(); base->set_obj(NULL); ! if (!rcvr->mark()->has_bias_pattern()) { base->set_obj(NULL); // If it isn't recursive we either must swap old header or call the runtime ! if (header != NULL) { markWord old_header = markWord::encode(lock); if (rcvr->cas_set_mark(header, old_header) != old_header) { // restore object for the slow case base->set_obj(rcvr); { --- 3111,3124 ---- } else { BasicLock* lock = base->lock(); markWord header = lock->displaced_header(); base->set_obj(NULL); ! if (!rcvr->mark().has_bias_pattern()) { base->set_obj(NULL); // If it isn't recursive we either must swap old header or call the runtime ! if (header.to_pointer() != NULL) { markWord old_header = markWord::encode(lock); if (rcvr->cas_set_mark(header, old_header) != old_header) { // restore object for the slow case base->set_obj(rcvr); {
< prev index next >