RFR: 8339576: Speed up raw bytecode processing in ClassFile API
Chen Liang
liach at openjdk.org
Thu Sep 5 04:50:24 UTC 2024
Currently, raw bytecode access goes through multiple wrappers, include one from ClassFile API and another ByteBuffer for merged big endian value reads. We can merge the ByteBuffer =into the ClassFile API one (RawBytecodeHelper) for safer access.
RawBytecodeHelper is also restructured so we avoid allocating it on the heap. Large `rawNext` method is now also inlined into the smaller `next` method.
Current benchmark results show this significantly speeds up `jdk.classfile.Write` and some degree of speedup for simple lambda startup. The impact on general application workloads is minuscule, but this doesn't seem to bring any regression.
Pinging @wenshao and @cl4es for review.
-------------
Commit messages:
- Simplify state transition logic, fix dump logical error and comment error
- Use inlined representation for class initializer, loop initialization too costly
- Bad assertion
- Encapsulate RawBytecodeHelper, controlled unchecked access
- remove benchmark
- Inline ByteBuffer into RawBytecodeHelper, and try to make it eligible for escape analysis
- simplify ByteBuffer improve startup performance
- add benchmark
Changes: https://git.openjdk.org/jdk/pull/20863/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20863&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8339576
Stats: 471 lines in 9 files changed: 196 ins; 101 del; 174 mod
Patch: https://git.openjdk.org/jdk/pull/20863.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20863/head:pull/20863
PR: https://git.openjdk.org/jdk/pull/20863
More information about the core-libs-dev
mailing list