RFR: 8339492: StackMapDecoder::writeFrames makes lots of allocations [v2]

David M. Lloyd duke at openjdk.org
Wed Sep 4 14:14:19 UTC 2024


On Wed, 4 Sep 2024 13:08:49 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> LGTM
> 
> AFAICT before this we'd only call `DirectCodeBuilder::labelToBci` once per label, but now we'll do so roughly `2*n*log(n) + n` times. I would assume getting rid of the `TreeMap` and `Integer` key allocations more than makes up for this, though. Do we have any JMH tests where `writeFrames` is a significant contributor we could check?

My expectation was that the short path of `DirectCodeBuilder` (where `context == this` and thus we directly return `lab.getBCI()`, which is a simple field getter) would be used in most, if not all, cases. If so, then this amounts to a fairly minimal and direct code path, thus I approached this as being an "obvious" (as opposed to theoretical) improvement.

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

PR Comment: https://git.openjdk.org/jdk/pull/20841#issuecomment-2329181476


More information about the core-libs-dev mailing list