RFR: 8293170: Improve encoding of the debuginfo nmethod section [v6]
Evgeny Astigeevich
eastigeevich at openjdk.org
Mon Oct 24 19:35:50 UTC 2022
On Thu, 20 Oct 2022 12:04:32 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:
>> The nmethod "scopes data" section is 10% of the size of nmethod. Now the data is compressed using the Pack200 algorithm, which is good for encoding small integers (LineNumberTable, etc). Using the fact that half of the data in the partition contains zeros, I reduce its size by another 30%.
>>
>> Testing: jtreg hotspot&jdk, Renaissance benchmarks
>
> Boris Ulasevich has updated the pull request incrementally with one additional commit since the last revision:
>
> minor renaming. adding encoding examples table
src/hotspot/share/code/compressedStream.cpp line 191:
> 189: write((_curr_byte << (8 - _bit_pos)) | (b >> _bit_pos));
> 190: _curr_byte = (0xff >> (8 - _bit_pos)) & b;
> 191: }
I am trying to understand this function. Please correct me if I am wrong.
`write_byte_impl(b)`, where `b` is non-zero.
It combines low `_bit_pos` bits of `_curr_byte` shifted left with high `8 - _bit_pos` bits of `b` shifted right.
It stores low `_bit_pos` bits of `b` into `_curr_byte`. `_bit_pos` is not changed.
Let's start from `_curr_byte` 0 and `_bit_pos` 0.
We have:
write_int(0) -> _curr_byte: 0, _bit_pos: 1
write_int(0) -> _curr_byte: 0, _bit_pos: 2
write_int(2) -> write(00100000), _curr_byte: 00000010, _bit_pos: 3
write_int(0) -> _curr_byte: 00000100, _bit_pos: 4
write_int(2) -> write(01001000), _curr_byte: 00000010, _bit_pos: 4
Written bytes:
00100000, 01001000
If there are no more `write_int`, `_curr_byte` will be lost. I don't see what causes it to be written.
The similar issue of the lost `_curr_byte` if there are 7 or less `write_int(0)` and `_bit_pos` is 0.
I think `_bit_pos` is actually the number of used low bits in `_curr_byte`. Am I correct?
-------------
PR: https://git.openjdk.org/jdk/pull/10025
More information about the hotspot-compiler-dev
mailing list