< prev index next >
src/hotspot/share/interpreter/bytecodeInterpreter.cpp
Print this page
@@ -668,16 +668,16 @@
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()) {
+ 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)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,21 +686,21 @@
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);
+ 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);
+ 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);
+ 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,19 +708,19 @@
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));
+ 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);
+ header = header.copy_set_hash(hash);
}
- markWord new_header = (markWord) ((uintptr_t) header | thread_ident);
+ markWord new_header(header.value() | thread_ident);
// Debugging hint.
- DEBUG_ONLY(mon->lock()->set_displaced_header((markWord) (uintptr_t) 0xdeaddead);)
+ 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,17 +730,17 @@
}
}
// Traditional lightweight locking.
if (!success) {
- markWord displaced = rcvr->mark()->set_unlocked();
+ 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) {
+ 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())) {
- mon->lock()->set_displaced_header(NULL);
+ 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,16 +854,16 @@
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()) {
+ 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)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,22 +872,22 @@
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);
+ 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);
+ 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);
+ 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,18 +895,18 @@
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));
+ 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);
+ header = header.copy_set_hash(hash);
}
- markWord new_header = (markWord) ((uintptr_t) header | thread_ident);
+ markWord new_header(header.value() | thread_ident);
// debugging hint
- DEBUG_ONLY(entry->lock()->set_displaced_header((markWord) (uintptr_t) 0xdeaddead);)
+ 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,17 +916,17 @@
}
}
// traditional lightweight locking
if (!success) {
- markWord displaced = lockee->mark()->set_unlocked();
+ 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) {
+ 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())) {
- entry->lock()->set_displaced_header(NULL);
+ 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,16 +1794,16 @@
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()) {
+ 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)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,22 +1813,22 @@
}
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);
+ 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);
+ 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);
+ 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,19 +1837,19 @@
}
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));
+ 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);
+ header = header.copy_set_hash(hash);
}
- markWord new_header = (markWord) ((uintptr_t) header | thread_ident);
+ markWord new_header(header.value() | thread_ident);
// debugging hint
- DEBUG_ONLY(entry->lock()->set_displaced_header((markWord) (uintptr_t) 0xdeaddead);)
+ 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,17 +1859,17 @@
}
}
// traditional lightweight locking
if (!success) {
- markWord displaced = lockee->mark()->set_unlocked();
+ 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) {
+ 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())) {
- entry->lock()->set_displaced_header(NULL);
+ 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,14 +1890,14 @@
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()) {
+ 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) {
+ 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,13 +3036,13 @@
if (lockee != NULL) {
BasicLock* lock = end->lock();
markWord header = lock->displaced_header();
end->set_obj(NULL);
- if (!lockee->mark()->has_bias_pattern()) {
+ if (!lockee->mark().has_bias_pattern()) {
// If it isn't recursive we either must swap old header or call the runtime
- if (header != NULL) {
+ 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,14 +3111,14 @@
} else {
BasicLock* lock = base->lock();
markWord header = lock->displaced_header();
base->set_obj(NULL);
- if (!rcvr->mark()->has_bias_pattern()) {
+ 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) {
+ 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 >