RFR: 8293170: Improve encoding of the debuginfo nmethod section [v5]
Boris Ulasevich
bulasevich at openjdk.org
Thu Oct 20 12:04:36 UTC 2022
On Wed, 19 Oct 2022 19:38:45 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:
>> Boris Ulasevich has updated the pull request incrementally with one additional commit since the last revision:
>>
>> cleanup and rename
>
> src/hotspot/share/code/compressedStream.cpp line 182:
>
>> 180: return;
>> 181: }
>> 182: int bit0 = 0x80; // first byte upper bit is set to indicate a value is not zero
>
> This is untraditional and confusing. In a byte we are preparing it is bit 7. The same comment is about `bit1`.
Ok
> src/hotspot/share/code/compressedStream.cpp line 190:
>
>> 188: write_byte_impl(bit1 | (next & 0x7f));
>> 189: next >>= 7;
>> 190: }
>
> Could you please document the encoding/decoding schema in comments to the class? Could you also please include examples?
> Why is it chosen to split 32 bits into 6, 7, 7, 7 and 5?
The first bit is occupied by a flag holding a non-zero state, additionally each byte has a last byte flag, leaving only 6/7/7/7/7 bits for the payload.
I have added an examples table:
// integer value encoded as a sequence of 1 to 5 bytes
// - the most frequent case (0 < x < 64) is encoded in one byte
// - the payload of the first byte is 6 bits, the payload of the following bytes is 7 bits
// - the most significant bit in the first byte is occupied by a zero flag
// - each byte has a bit indicating whether it is the last byte in the sequence
//
// value | byte0 | byte1 | byte2 | byte3 | byte4
// -----------+----------+----------+----------+----------+----------
// 0 | 0 | | | |
// 1 | 10000001 | | | |
// 2 | 10000010 | | | |
// 63 | 10111111 | | | |
// 64 | 11000000 | 00000001 | | |
// 65 | 11000001 | 00000001 | | |
// 8191 | 11111111 | 01111111 | | |
// 8192 | 11000000 | 10000000 | 00000001 | |
// 8193 | 11000001 | 10000000 | 00000001 | |
// 1048575 | 11111111 | 11111111 | 01111111 | |
// 1048576 | 11000000 | 10000000 | 10000000 | 00000001 |
// 0xFFFFFFFF | 11111111 | 11111111 | 11111111 | 11111111 | 00011111
//
-------------
PR: https://git.openjdk.org/jdk/pull/10025
More information about the hotspot-compiler-dev
mailing list