diff -r 13588c901957 -r 9cf78a70fa4f src/hotspot/share/interpreter/bytecodeInterpreter.cpp --- a/src/hotspot/share/interpreter/bytecodeInterpreter.cpp Thu Oct 17 20:27:44 2019 +0100 +++ b/src/hotspot/share/interpreter/bytecodeInterpreter.cpp Thu Oct 17 20:53:35 2019 +0100 @@ -666,17 +666,17 @@ BasicObjectLock* mon = &istate->monitor_base()[-1]; mon->set_obj(rcvr); bool success = false; - uintptr_t epoch_mask_in_place = (uintptr_t)markOopDesc::epoch_mask_in_place; - markOop mark = rcvr->mark(); - intptr_t hash = (intptr_t) markOopDesc::no_hash; + uintptr_t epoch_mask_in_place = 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) markOopDesc::age_mask_in_place); + ((rcvr->klass()->prototype_header().value() | thread_ident) ^ mark.value()) & + ~(markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // Already biased towards this thread, nothing to do. @@ -684,11 +684,11 @@ (* BiasedLocking::biased_lock_entry_count_addr())++; } success = true; - } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) { + } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // Try to revoke bias. - markOop header = rcvr->klass()->prototype_header(); - if (hash != markOopDesc::no_hash) { - header = header->copy_set_hash(hash); + 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) @@ -696,9 +696,9 @@ } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) != 0) { // Try to rebias. - markOop new_header = (markOop) ( (intptr_t) rcvr->klass()->prototype_header() | thread_ident); - if (hash != markOopDesc::no_hash) { - new_header = new_header->copy_set_hash(hash); + 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) { @@ -710,15 +710,15 @@ success = true; } else { // Try to bias towards thread in case object is anonymously biased. - markOop header = (markOop) ((uintptr_t) mark & - ((uintptr_t)markOopDesc::biased_lock_mask_in_place | - (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place)); - if (hash != markOopDesc::no_hash) { - header = header->copy_set_hash(hash); + markWord header(mark.value() & + (markWord::biased_lock_mask_in_place | + markWord::age_mask_in_place | epoch_mask_in_place)); + if (hash != markWord::no_hash) { + header = header.copy_set_hash(hash); } - markOop new_header = (markOop) ((uintptr_t) header | thread_ident); + markWord new_header(header.value() | thread_ident); // Debugging hint. - DEBUG_ONLY(mon->lock()->set_displaced_header((markOop) (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())++; @@ -732,13 +732,13 @@ // Traditional lightweight locking. if (!success) { - markOop 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((markOop)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); } @@ -851,18 +851,18 @@ assert(entry->obj() == NULL, "Frame manager didn't allocate the monitor"); entry->set_obj(lockee); bool success = false; - uintptr_t epoch_mask_in_place = (uintptr_t)markOopDesc::epoch_mask_in_place; - - markOop mark = lockee->mark(); - intptr_t hash = (intptr_t) markOopDesc::no_hash; + uintptr_t epoch_mask_in_place = 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) markOopDesc::age_mask_in_place); + ((lockee->klass()->prototype_header().value() | thread_ident) ^ mark.value()) & + ~(markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // already biased towards this thread, nothing to do @@ -870,11 +870,11 @@ (* BiasedLocking::biased_lock_entry_count_addr())++; } success = true; - } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) { + } else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // try revoke bias - markOop header = lockee->klass()->prototype_header(); - if (hash != markOopDesc::no_hash) { - header = header->copy_set_hash(hash); + 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) { @@ -883,9 +883,9 @@ } } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { // try rebias - markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident); - if (hash != markOopDesc::no_hash) { - new_header = new_header->copy_set_hash(hash); + 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) { @@ -897,14 +897,14 @@ success = true; } else { // try to bias towards thread in case object is anonymously biased - markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place | - (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place)); - if (hash != markOopDesc::no_hash) { - header = header->copy_set_hash(hash); + markWord header(mark.value() & (markWord::biased_lock_mask_in_place | + markWord::age_mask_in_place | epoch_mask_in_place)); + if (hash != markWord::no_hash) { + header = header.copy_set_hash(hash); } - markOop new_header = (markOop) ((uintptr_t) header | thread_ident); + markWord new_header(header.value() | thread_ident); // debugging hint - DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (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())++; @@ -918,13 +918,13 @@ // traditional lightweight locking if (!success) { - markOop 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((markOop)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); } @@ -1791,18 +1791,18 @@ if (entry != NULL) { entry->set_obj(lockee); int success = false; - uintptr_t epoch_mask_in_place = (uintptr_t)markOopDesc::epoch_mask_in_place; - - markOop mark = lockee->mark(); - intptr_t hash = (intptr_t) markOopDesc::no_hash; + uintptr_t epoch_mask_in_place = 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) markOopDesc::age_mask_in_place); + ((lockee->klass()->prototype_header().value() | thread_ident) ^ mark.value()) & + ~(markWord::age_mask_in_place); if (anticipated_bias_locking_value == 0) { // already biased towards this thread, nothing to do @@ -1811,11 +1811,11 @@ } success = true; } - else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) { + else if ((anticipated_bias_locking_value & markWord::biased_lock_mask_in_place) != 0) { // try revoke bias - markOop header = lockee->klass()->prototype_header(); - if (hash != markOopDesc::no_hash) { - header = header->copy_set_hash(hash); + 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) @@ -1824,9 +1824,9 @@ } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { // try rebias - markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident); - if (hash != markOopDesc::no_hash) { - new_header = new_header->copy_set_hash(hash); + 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) @@ -1839,15 +1839,15 @@ } else { // try to bias towards thread in case object is anonymously biased - markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place | - (uintptr_t)markOopDesc::age_mask_in_place | - epoch_mask_in_place)); - if (hash != markOopDesc::no_hash) { - header = header->copy_set_hash(hash); + markWord header(mark.value() & (markWord::biased_lock_mask_in_place | + markWord::age_mask_in_place | + epoch_mask_in_place)); + if (hash != markWord::no_hash) { + header = header.copy_set_hash(hash); } - markOop new_header = (markOop) ((uintptr_t) header | thread_ident); + markWord new_header(header.value() | thread_ident); // debugging hint - DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (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())++; @@ -1861,13 +1861,13 @@ // traditional lightweight locking if (!success) { - markOop 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((markOop)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,13 +1890,13 @@ while (most_recent != limit ) { if ((most_recent)->obj() == lockee) { BasicLock* lock = most_recent->lock(); - markOop header = lock->displaced_header(); + 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) { - markOop old_header = markOopDesc::encode(lock); + 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); @@ -2182,7 +2182,7 @@ if (UseBiasedLocking) { result->set_mark(ik->prototype_header()); } else { - result->set_mark(markOopDesc::prototype()); + result->set_mark(markWord::prototype()); } result->set_klass_gap(0); result->set_klass(ik); @@ -2436,7 +2436,7 @@ handle_exception); result = THREAD->vm_result(); } - if (oopDesc::equals(result, Universe::the_null_sentinel())) + if (result == Universe::the_null_sentinel()) result = NULL; VERIFY_OOP(result); @@ -3035,13 +3035,13 @@ oop lockee = end->obj(); if (lockee != NULL) { BasicLock* lock = end->lock(); - markOop header = lock->displaced_header(); + 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) { - markOop old_header = markOopDesc::encode(lock); + 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); @@ -3110,14 +3110,14 @@ } } else { BasicLock* lock = base->lock(); - markOop header = lock->displaced_header(); + 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) { - markOop old_header = markOopDesc::encode(lock); + 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);