On Tue, 6 May 2025 07:44:29 GMT, Claes Redestad <redes...@openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Increased min heap size to 8G.
>
> src/java.base/share/classes/java/lang/StringConcatHelper.java line 435:
> 
>> 433:     static String doConcat(String s1, String s2) {
>> 434:         byte coder = (byte) (s1.coder() | s2.coder());
>> 435:         int newLength = checkOverflow(s1.length() + s2.length()) << 
>> coder;
> 
> Might be mildly inefficient for this case since `checkOverflow` is designed 
> for the compound length+coder `long`. Since this is only used in the simple 
> path it should be easy for JITs to optimize, though.

@ForceInline
    static int checkOverflow(int value) {
        if (value >= 0) {
            return value;
        }
        throw new OutOfMemoryError("Overflow: String length out of range");
    }

    private static long checkOverflow(long lengthCoder) {
        if ((int)lengthCoder >= 0) {
            return lengthCoder;
        }
        throw new OutOfMemoryError("Overflow: String length out of range");
    }

@cl4es There are two checkOverflow methods

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25038#discussion_r2074971917

Reply via email to