On Fri, 13 Nov 2026 08:03:36 GMT, Shawn Emery <[email protected]> wrote:
>> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 9175:
>>
>>> 9173: for (int i = 0; i < 7; i++) {
>>> 9174: __ ldr(aArg, Address(aLimbs, i * 8));
>>> 9175: __ smulh(high, aArg, aArg);
>>
>> Hmm, yet more DEJA_VU.
>>
>> Can we have an auxiliary generator method mul55(c_lo, c_hi, a, b, h, l) for
>> this repeated sequence. That serves to clarify that the same higher level
>> operation that is being performed and makes it harder for a maintainer to
>> avoid introducing errors.
>
> This is not a repeated sequence from the multiplication method.
I'm not sure what you mean by that or how it answers what I asked for. Perhaps
I could clarify my request in order to be sure either that you understand what
I was asking for or, if I am not following correctly what this code is doing,
expose why it is inappropiate.
This sequence appears to be squaring the 55-bit input found in register `aArg`
then accumulating the 55-bit lower and upper halves of the product into
adjacent registers `c[i * 2]` and `c[i * 2 + 1]`.
Earlier, in `generate_intpoly_mult_P384`, we appear to have a similar generated
sequence which multiplies the two 55 bit inputs found in registers `a` and `b`
then accumulating the 55-bit lower and upper halves of the product into
adjacent registers `c[i + j]` and `c[i + j + 1]`.
So, it looks like this is essentially the same abstract operation implemented
using essentially the same generated instruction sequence modulo different
input and output registers.
The suggestion was that you use a separate generator sub-method to generate
this sequence at each occurrence and document the sub-method as performing that
multiply and accumulate operation. I used the name `mul55` but you could call
it `mull55_accumulate` or whatever other name you think would make most sense.
I'm not suggesting this corresponds directly to a method in the original Java
code. The rationale is simply that the resulting code is easier for a
maintainer to understand (and update, if that were ever needed) when it is
structured using building blocks that perform a coherent, independent and
easily recognized step in the computation.
>> src/hotspot/share/runtime/stubDeclarations.hpp line 823:
>>
>>> 821: do_entry(compiler, intpoly_square_25519,
>>> \
>>> 822: intpoly_square_25519, intpoly_square_25519)
>>> \
>>> 823: do_stub(compiler, intpoly_mult_P384)
>>> \
>>
>> Adding an implementation for a new intrinsic on any given architecture
>> increases the amount of code generated. That could potentially lead to
>> overflow of the compiler StubGen blob on that architecture. Can you report
>> how much this change contributes to the blob on AArch64. If it is
>> significant then you will need to update the arch-specific StubGen compiler
>> blob sizing in file stubDeclarations_aarch64.hpp
>>
>> n.b. You can get a printout of the StubGen blob sizes by running with
>> `-Xlog:stubs=info` and enabling/disabling the intrinsic to obtain a delta.
>> Alternatively, you could eyeball the actual stub code and measure its size
>> by running with `-XX:+UnlockDiagnosticVMOptions -XX:+PrintStubCode`.
>
> On my AArch64 system (M3 Pro) the two new stubs allocate an additional 3,584
> bytes which still leaves a 200 byte reserve with a 75,000 byte base. Ergo,
> the free bytes for the VM with the two new stubs is 3,984 bytes for 64 byte
> alignment, 2,768 bytes for 32 byte alignment, and 2,128 bytes at 16 byte
> alignment.
I think it would be a good idea to add a bit more headroom. Please add another
3000 to the sizing in stubDeclarations_aarch64.hpp.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33618#discussion_r4585094005
PR Review Comment: https://git.openjdk.org/jdk/pull/33618#discussion_r4585132561