RFR: 8293170: Improve encoding of the debuginfo nmethod section [v9]

Boris Ulasevich bulasevich at openjdk.org
Tue Nov 15 07:06:01 UTC 2022


On Mon, 14 Nov 2022 17:29:20 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:

>> Boris Ulasevich has refreshed the contents of this pull request, and previous commits have been removed. Incremental views are not available.
>
> src/hotspot/share/code/compressedStream.cpp line 192:
> 
>> 190:   if (_position >= _size) {
>> 191:     grow();
>> 192:   }
> 
> Now we have these checks spread across the code.
> There are two actions changing `_postion`:
> - `_position++`
> - `set_position`
> 
> We can replace `_position++` with `inc_position` where we can have the check with `grow`.
> Regarding `set_position `, I have looked at its current uses.
> Its uses are to support shared debug info:
> - We write info.
> - We check if we have written the same info.
> - If yes, we use the one written before and roll back position.
> 
> If I haven't missed other uses, the meaning of `set_position` is to roll back. In such  case, no `grow` is needed. I suggest to rename `set_position` to `roll_back_to` or `move_back_to`.

(1) we have a few _position increments
(2) we have a few _buffer[_position] access places

The check `if (_position >= _size) { grow(); }` can go either to either after (1) of before (2). I prefer the latter because we do not need to extend a buffer if we do not write there.

> src/hotspot/share/code/compressedStream.hpp line 184:
> 
>> 182:   }
>> 183: 
>> 184:   void flush() {
> 
> Why do we need `flush` if we modify data in place?

now it is align()

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

PR: https://git.openjdk.org/jdk/pull/10025


More information about the hotspot-compiler-dev mailing list