RFR: 8349923: Refactor StackMapTable constructor and StackMapReader [v2]

Coleen Phillimore coleenp at openjdk.org
Tue Feb 18 18:55:40 UTC 2025


On Fri, 14 Feb 2025 20:13:48 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> This patch refactors the `StackMapReader` to clean up the `StackMapTable` constructor. The `StackMapReader` class is extended to hold more fields used for verification purposes and allows for a simpler StackMapTable constructor. Additionally, in preparation for further changes to verification, the `_frame_count` may not be equal to the value reported by the classfile, so a new structure is used to generate the `_frame_array`. Verified with tier 1-5 tests
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Coleen comments

This looks really good.  I have one small comment.

src/hotspot/share/classfile/stackMapTable.cpp line 36:

> 34:   _frame_count = reader->get_frame_count();
> 35:   if (_frame_count > 0) {
> 36:     _frame_array = new GrowableArray<StackMapFrame*>();

I think if you give GrowableArray() an initial capacity of _frame_count, that should be the right count unless you have assert_unset_field stackmap modifiers, in which case you'll use less but only a little bit less.  The default size is 2 of GrowableArray.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23645#pullrequestreview-2624579757
PR Review Comment: https://git.openjdk.org/jdk/pull/23645#discussion_r1960310952


More information about the hotspot-runtime-dev mailing list