[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-serviceability-dev
Subject: Re: RFR: 8291555: Implement alternative fast-locking scheme [v47]
From: Dean Long <dlong () openjdk ! org>
Date: 2023-03-31 22:41:56
Message-ID: eFKylrRhxzxD-uJVDa7spgeImzrULap7LvWpAkHCahI=.b7d92c9e-86e1-4dec-9e86-cedbc5057384 () github ! com
[Download RAW message or body]
On Fri, 31 Mar 2023 07:25:48 GMT, Thomas Stuefe <stuefe@openjdk.org> wrote:
> > Roman Kennke has updated the pull request incrementally with one additional \
> > commit since the last revision:
> > Use int instead of size_t for cached offsets, to match the uncached offset type \
> > and avoid build failures
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 6234:
>
> > 6232: orr(hdr, hdr, markWord::unlocked_value);
> > 6233: // Clear lock-bits, into t2
> > 6234: eor(t2, hdr, markWord::unlocked_value);
>
> In arm, I use a combination of bic and orr instead. That gives me, with just two \
> instructions, added safety against someone handing in a "11" marked MW. I know, \
> should never happen, but better safe.
>
> ldr(new_hdr, Address(obj, oopDesc::mark_offset_in_bytes()));
> bic(new_hdr, new_hdr, markWord::lock_mask_in_place); // new header (00)
> orr(old_hdr, new_hdr, markWord::unlocked_value); // old header (01)
>
> (note that I moved MW loading down into MA::fast_lock for unrelated reasons).
>
> Unfortunately, on aarch64 there seem to be no bic variants that accept immediates. \
> So it would take one more instruction to get the same result:
>
> - // Load (object->mark() | 1) into hdr
> - orr(hdr, hdr, markWord::unlocked_value);
> - // Clear lock-bits, into t2
> - eor(t2, hdr, markWord::unlocked_value);
> + // Prepare new and old header
> + mov(t2, markWord::lock_mask_in_place);
> + bic(t2, hdr, t2);
> + orr(hdr, t2, markWord::unlocked_value);
>
>
> But maybe there is a better way that does not need three instructions.
There is a BFC (Bitfield Clear) pseudo-instruction that uses the BFM instruction.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10907#discussion_r1154955795
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic