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

David M. Lloyd duke at openjdk.org
Wed Sep 4 15:02:23 UTC 2024


On Wed, 4 Sep 2024 14:18:09 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> > 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.
> 
> I agree that it looks like the typical path is trivial, but I don't have the full picture to understand when we might do more complicated work here. It would be nice to have some reasonably realistic benchmark to lean on.

I wrote a trivial scratch file which exercises the code using a regular code builder and it did indeed use the expected path, FWIW. I'm honestly not sure what (if any) valid circumstances would cause this particular code to run on a label whose contest is not the code builder itself, so if anyone has any thoughts on that, please share.

> @dmlloyd I think we might need a benchmark that uses `ClassFile.of(StackMapsOption.DROP_STACK_MAPS)` to build a class with method with code, and supply the stack maps to generate. That is the best way to measure the gains from this patch. (Something like what we do in ProxyGenerator, but proxy generation has too many uncertainties)

I'll see if I can get the benchmarks in `test/micro/org/openjdk/bench/jdk/classfile` working. It looks like there may be one or more of them which would reach into this code.

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

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


More information about the core-libs-dev mailing list