Skip to content

Conversation

@liach
Copy link
Member

@liach liach commented Apr 27, 2025

Internal explicit counter support for Code max_stack and max_locals has been already added in #24807. Since that example works well, we may consider opening this functionality up to general users under strict restrictions.

This is an advanced API; thus, I chose a more complex name withExplicitStackAndLocals that discourages accidental use, and indicates the exact order of stack and locals arguments. For integrity, the argument checks are unconditional. And this is also barred behind DROP_STACK_MAPS advanced option.

I have enhanced the tests with a CodeBuilderType utility to test all types of code builders; it is already effective at increasing coverage in some of our existing tests that only cover DirectCodeBuilder, and simplify other tests. It is particularly helpful for my new BuilderExplicitMaxsTest.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issues

  • JDK-8341275: Explicit counter support for Code attribute building (Enhancement - P4)
  • JDK-8355653: Explicit counter support for Code attribute building (CSR) (Withdrawn)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24903/head:pull/24903
$ git checkout pull/24903

Update a local copy of the PR:
$ git checkout pull/24903
$ git pull https://git.openjdk.org/jdk.git pull/24903/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24903

View PR using the GUI difftool:
$ git pr show -t 24903

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24903.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 27, 2025

👋 Welcome back liach! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 27, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels Apr 27, 2025
@openjdk
Copy link

openjdk bot commented Apr 27, 2025

@liach The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Apr 27, 2025

Webrevs

@liach
Copy link
Member Author

liach commented Apr 27, 2025

Testing: tier 1-3

@asotona
Copy link
Member

asotona commented Apr 28, 2025

Stack counter already serves to very limited set of use cases.
In a hunt for the maximum JDK performance #24705 called specific implementation method and saved some CPU cycles by setting explicit maxLocals and maxStack in the SwitchBootstraps.
However I'm not sure this single corner case of the corner cases is enough to make it a public API.

@liach
Copy link
Member Author

liach commented Apr 28, 2025

I think the original issue was created in response to a public request https://mail.openjdk.org/pipermail/classfile-api-dev/2024-August/000545.html. It just happens that we and another public audience both want this API, so I guess it is not too much of a "corner case"?

@liach
Copy link
Member Author

liach commented Apr 29, 2025

Thanks, withdrawing this for now. A better approach may be to optimize StackCounter when a SMT is present.

@liach liach closed this Apr 29, 2025
@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants