RFR: 8371667: Shenandoah: Re-design alloc request type enum for better efficiency and cleaner code [v7]
Xiaolong Peng
xpeng at openjdk.org
Mon Nov 17 07:10:13 UTC 2025
On Fri, 14 Nov 2025 09:42:46 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> A bit confusing still. How about this:
>
> ```
> [x|xx|xxx|xx]
> ^---- Requester:
> 00 -- mutator
> 10 -- mutator (CDS)
> 01 -- GC
> ^------- Purpose:
> 00 -- shared
> 01 -- TLAB/GCLAB
> 11 -- PLAB
> ^---------- Affiliation:
> 00 -- YOUNG
> 01 -- OLD
> 11 -- OLD, promotion
> ```
>
> Then:
>
> ```
> static constexpr int bit_gc_alloc = 1 << 0;
> static constexpr int bit_cds_alloc = 1 << 1;
> static constexpr int bit_lab_alloc = 1 << 2;
> static constexpr int bit_plab_alloc = 1 << 3;
> static constexpr int bit_old_alloc = 1 << 4;
> static constexpr int bit_promotion_alloc = 1 << 5;
>
> static constexpr Type _alloc_shared = 0;
> static constexpr Type _alloc_tlab = bit_lab_alloc;
> static constexpr Type _alloc_cds = bit_cds_alloc;
> static constexpr Type _alloc_shared_gc = bit_gc_alloc;
> static constexpr Type _alloc_shared_gc_old = bit_gc_alloc | bit_old_alloc;
> static constexpr Type _alloc_shared_gc_promotion = bit_gc_alloc | bit_old_alloc | bit_promotion_alloc;
> static constexpr Type _alloc_gclab = bit_gc_alloc | bit_lab_alloc;
> static constexpr Type _alloc_plab = bit_gc_alloc | bit_plab_alloc | bit_old_alloc;
> ```
Thanks Aleksey! This is good, I have applied the change, and fixed the wrong value for _alloc_plab, it should be `bit_gc_alloc | bit_lab_alloc | bit_plab_alloc | bit_old_alloc`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28247#issuecomment-3540274358
More information about the hotspot-gc-dev
mailing list