--- old/src/hotspot/share/interpreter/bytecodeInterpreter.cpp 2019-08-13 12:39:47.384179712 +0200 +++ new/src/hotspot/share/interpreter/bytecodeInterpreter.cpp 2019-08-13 12:39:47.068174231 +0200 @@ -670,12 +670,12 @@ 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) { @@ -688,7 +688,7 @@ // 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) @@ -696,9 +696,9 @@ } } 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) { @@ -710,15 +710,15 @@ 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())++; @@ -732,13 +732,13 @@ // 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); } @@ -856,12 +856,12 @@ 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) { @@ -874,7 +874,7 @@ // 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) { @@ -883,9 +883,9 @@ } } 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) { @@ -897,14 +897,14 @@ 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())++; @@ -918,13 +918,13 @@ // 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); } @@ -1796,12 +1796,12 @@ 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) { @@ -1815,7 +1815,7 @@ // 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) @@ -1824,9 +1824,9 @@ } 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) @@ -1839,15 +1839,15 @@ } 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())++; @@ -1861,13 +1861,13 @@ // 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); } @@ -1892,10 +1892,10 @@ 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 @@ -3038,9 +3038,9 @@ 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 @@ -3113,10 +3113,10 @@ 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