RFR: 8338661: StackMapTable is invalid if frames appear in dead code [v3]

Adam Sotona asotona at openjdk.org
Tue Aug 20 15:08:23 UTC 2024


> ClassFile API allows to build a class with dead code and provide custom `StackMapTable` attribute with user-specified frames covering the dead code.
> `StackCounter` is responsible for calculation of `maxStack` and `maxLocals` in certain situations and it did not include the user-provided `StackMapTable` attribute. Dead code was skipped and `maxStack` or `maxLocals` might became underestimated.
> 
> This patch includes frames from user-provided `StackMapTable` attribute into the `StackCounter` calculations.
> 
> Please review.
> 
> Thanks,
> Adam

Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge remote-tracking branch 'openjdk/master' into JDK-8338661-stack-counter
   
   # Conflicts:
   #	test/jdk/jdk/classfile/StackMapsTest.java
 - 8338661: StackMapTable is invalid if frames appear in dead code
 - 8338623: StackCounter adding extraneous slots for receiver invoke instructions

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20644/files
  - new: https://git.openjdk.org/jdk/pull/20644/files/a5989c97..22c00b99

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20644&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20644&range=01-02

  Stats: 679 lines in 35 files changed: 516 ins; 16 del; 147 mod
  Patch: https://git.openjdk.org/jdk/pull/20644.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20644/head:pull/20644

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


More information about the core-libs-dev mailing list