> John Rose suggests in > https://github.com/openjdk/jdk/pull/26802#issuecomment-3201402304 that > ClassFile API should validate Utf8Entry length eagerly upon construction. > Currently we validate upon writing to bytes, which avoids validation > overhead. However, given that most class file utf8 data are shorter than 1/3 > of the max length, which is always an encodable length, the performance > impact should be low. > > Preventing the creation of unrepresentable UTF8 entries can prevent passing > such invalid instances around, making such problems easier to debug than a > failure at building. > > Tier 1-3 seems clear. The performance impact to jdk.classfile.Write or any of > the regularly run transformation benchmarks seems neutral, less than 5% > perturbations. > > I will update docs to reflect this change, given how widespread this is > across JDK - it seems the only exempt classes are Signature, ClassSignature, > and MethodSignature.
Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits: - Redundant changes, improve stuff - Stage - Merge branch 'master' of https://github.com/openjdk/jdk into feature/cf-utf8-length-early - Merge branch 'master' of https://github.com/openjdk/jdk into feature/cf-utf8-length-early - Merge branch 'master' of https://github.com/openjdk/jdk into feature/cf-utf8-length-early - Stage - Merge branch 'master' of https://github.com/openjdk/jdk into feature/cf-utf8-length-early - Merge branch 'master' of https://github.com/openjdk/jdk into feature/cf-utf8-length-early - Merge branch 'master' of https://github.com/openjdk/jdk into feature/cf-utf8-length-early - Avoid being too specific - ... and 3 more: https://git.openjdk.org/jdk/compare/58b601ac...8973a15d ------------- Changes: https://git.openjdk.org/jdk/pull/27281/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27281&range=01 Stats: 382 lines in 10 files changed: 212 ins; 53 del; 117 mod Patch: https://git.openjdk.org/jdk/pull/27281.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27281/head:pull/27281 PR: https://git.openjdk.org/jdk/pull/27281
