RFR (S) 8148787: StringConcatFactory exactness check produces bad bytecode when a non-arg concat is requested
Paul Sandoz
paul.sandoz at oracle.com
Tue Feb 2 14:57:43 UTC 2016
> On 2 Feb 2016, at 07:00, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
>
> Anyone? This looks like a trivial fix.
>
+1. The comment on stack logic is really helpful.
Paul.
> -Aleksey
>
> On 02/01/2016 10:47 PM, Aleksey Shipilev wrote:
>> Hi,
>>
>> Please review the fix for a corner case in StringConcatFactory exactness
>> check, which produces invalid bytecode:
>> https://bugs.openjdk.java.net/browse/JDK-8148787
>>
>> Note that this happens when all three things align:
>> a) BSM is called directly, as Java method -- javac would never produce
>> such a String concat shape;
>> b) BC_SB_SIZED_EXACT strategy is used, so exactness check can be applied;
>> c) -Djava.lang.invoke.stringConcat.debug=true is set, forcing
>> exactness check to run;
>>
>> The issue is with exactness debug check using a temporary local variable
>> when the local variable table is small (like it is in non-arg case). The
>> code can be reformulated without using temporary variables, with a
>> creative use of "swap" instruction.
>>
>> Ironically, the bug is within the debugging code, so we don't care about
>> its performance at all:
>> http://cr.openjdk.java.net/~shade/8148787/webrev.01/
>>
>> Cheers,
>> -Aleksey
>>
>
>
More information about the core-libs-dev
mailing list