RFR: 8366224: Introduce DecimalDigits.appendPair for efficient two-digit formatting and refactor DateTimeHelper [v22]

Emanuel Peter epeter at openjdk.org
Fri Nov 14 07:09:28 UTC 2025


On Fri, 14 Nov 2025 05:17:12 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> We can see there are two SotreC instructions here. Is it possible to merge these into OrI + StoreI, writing 4 bytes at a time?

Can you describe the pattern in a bit more detail here?

Currently, we only merge stores where the inputs are either:
- All constants -> merge to a new constant
- All extracts of the same larger value -> when merging we just get the larger value. Example: Integer value is split into its 4 bytes, and each byte is stored separately -> we can merge the byte stores to an integer store, and just store the original integer value.

What you seem to ask for is a third category:
You have two consecutive stores, with two unrelated values. You could merge the two values with shift/or, and then store it with a larger store. Example:

a[i+0] = x; // StoreI
a[i+1] = y; // StoreI

Turns into `StoreL`, with value `x | ((long)(y) << 32)`.

One would also have to prove that this is in general profitable:
- Before: 2 stores
- After: 1 store + shift + or

It's not immediately clear that there are not cases where this could not lead to regressions, though they would probably be quite rare and hard to find.

Is that what you are asking for? I suppose that is in theory possible. I personally don't have time for it, but maybe someone volunteers for it?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26911#issuecomment-3531215264


More information about the core-libs-dev mailing list