Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8346986: Remove ASM from java.base #22946

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

asotona
Copy link
Member

@asotona asotona commented Jan 7, 2025

There are no more consumers of ASM library except for hotspot tests.
This patch moves ASM library from java.base module to the hotspot test libraries location and fixes the tests.

Please review.

Thanks,
Adam


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

Issue

  • JDK-8346986: Remove ASM from java.base (Sub-task - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22946

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 7, 2025

👋 Welcome back asotona! 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 Jan 7, 2025

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

@openjdk
Copy link

openjdk bot commented Jan 7, 2025

@asotona The following labels will be automatically applied to this pull request:

  • build
  • core-libs

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

@asotona asotona marked this pull request as ready for review January 7, 2025 20:03
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 7, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 7, 2025

Webrevs

@AlanBateman
Copy link
Contributor

Moving it to test/hotspot/jtreg is initially surprising, I assumed it would move to test/lib. Did you choose the hotspot tree as only tests in hotspot/jtreg use it and you didn't want to add or change the @library tag on these tests?

The other thing is the package name, maybe it should move back to org.objectweb.asm as it won't be a JDK internal package.

@asotona
Copy link
Member Author

asotona commented Jan 7, 2025

I've decided to move it under hotspot/jtreg test root as all other tests have been already converted to Class-File API and there is no other consumer of the library outside of the hotspot/jtreg test root.

Despite the 265 modified files is this PR trying to be minimalistic. Repackaging of the library would be far more complex and would affect significantly more files, including the library itself. I would recommend to invest that effort into the tests conversion into Class-File API instead.

@dholmes-ora
Copy link
Member

/label add hotspot

@openjdk
Copy link

openjdk bot commented Jan 8, 2025

@dholmes-ora
The hotspot label was successfully added.

@dholmes-ora
Copy link
Member

Test libraries belong in test/lib even if only hotspot is using this one IMO. I'd like to hear @lmesnik 's opinion on this.

Also how is this library being built for the tests to use? If relying on jtreg facilities we will likely hit the known problems that jtreg has in this area - and this library would seem a good candidate for the proposal to prebuild some test libraries when the test image is built.

@dholmes-ora
Copy link
Member

I also agree with @AlanBateman about the package name. It is not appropriate for anything outside the platform modules to claim to be part of jdk.internal. In fact I'm surprised we are even allowed to add to that from outside the module!

@lmesnik
Copy link
Member

lmesnik commented Jan 8, 2025

I think it is make sense to put ASM into hotspot testlibrary if there are no any other users. So it is clear that non-hotspot tests don't depend on it.
There is a location
test/hotspot/jtreg/testlibrary
for hotstpot specific libraries.
Could you please move it here.

Before renaming packages, I would like to understand if we can move to standard ASM? We are no planning to develop new tests and maintain this library for newer releases. Otherwise, keeping jdk.internal simplify backporting changes.

It is not possible to implement it as a precompiled library because of jtreg limitations to find jars in test-images. So I'll implement this later.

@asotona
Copy link
Member Author

asotona commented Jan 8, 2025

I agree with @lmesnik that any unnecessary repackaging would affect backporting compatibility (>1200 unnecessary changes across >250 source files causing potential conflicts).

My question to test/hotspot/jtreg/testlibrary - is it effective to mix existing testlibrary with ASM. From the hotspot tests I see not all tests requiring testlibrary need ASM and vice versa. And many tests include other test libraries. However maybe it is irrelevant.

BTW: purpose of this PR is to seamlessly remove ASM from java.base and it is slightly turning into a massive synchronous refactoring of several hundreds of hotspot tests.

@AlanBateman
Copy link
Contributor

Despite the 265 modified files is this PR trying to be minimalistic. Repackaging of the library would be far more complex and would affect significantly more files, including the library itself. I would recommend to invest that effort into the tests conversion into Class-File API instead.

I'm not suggesting any re-packaging or pre-packaging, just saying that you can revert the changes that we have in the jdk repo so it goes back to .org.objectweb.asm. If we aren't doing that then okay but we still need to change all the tests that use it to remove "@modules java.base/jdk.internal.org.objectweb.asm".

@asotona
Copy link
Member Author

asotona commented Jan 8, 2025

you can revert the changes that we have in the jdk repo so it goes back to .org.objectweb.asm

That represents a refactoring with >1200 changes in >250 files across multiple repositories.

I can do it as it is not technically complex however is it desired?

@AlanBateman
Copy link
Contributor

It is not appropriate for anything outside the platform modules to claim to be part of jdk.internal. In fact I'm surprised we are even allowed to add to that from outside the module!

There's nothing to prohibit this, it's just surprising to have classes in jdk.internal.obj.objectweb.asm in an unnamed module, it will work of course.

@lmesnik
Copy link
Member

lmesnik commented Jan 8, 2025

/testlibrary consists of 3 independent sub-libraries: ctw, jittester & jvmti
so you if add asm and use it like
* @library /testlibrary/asm
it should fit.
There are tests that use
* @library /testlibrary
but seems it is redundant and leftover after merging hostpot and jdk. I'll file bug to clean up this.

@openjdk
Copy link

openjdk bot commented Jan 8, 2025

@lmesnik Unknown command testlibrary - for a list of valid commands use /help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants