RFR: 8287292: Improve TransformKey to pack more kinds of transforms efficiently

Jorn Vernee jvernee at openjdk.java.net
Wed May 25 13:33:02 UTC 2022


On Wed, 25 May 2022 13:28:52 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java line 239:
>> 
>>> 237:             for (int i = 0; i < b23456.length; i++) {
>>> 238:                 int b = b23456[i] & 0xFF;
>>> 239:                 bitset |= b;
>> 
>> Looks like `b` is always truncated. I wonder what happens if the ints in this array are larger than a byte (which seems to be possible in e.g. the case of argument positions). Some higher order bits might be dropped, but the resulting `b` might only have the least significant 4 bits set.
>> 
>> I think the untruncated value should be used to compute the bitset? `butset |= b23456[i]`? Then the `inRange` check should reject that case.
>
> Maybe not... argument positions should fit in a byte as well. But, maybe there are other problematic cases? Or are the ints guaranteed to fit in a byte?

Maybe an `assert b == b23456[i]` would be nice here.

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

PR: https://git.openjdk.java.net/jdk/pull/8881


More information about the core-libs-dev mailing list