Navigation Menu

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

8264805: Remove the experimental Ahead-of-Time Compiler #3398

Closed
wants to merge 6 commits into from

Conversation

vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Apr 8, 2021

As part of JEP 410 remove code related to Ahead-of-Time Compiler from JDK:

  • jdk.aot module — the jaotc tool
  • src/hotspot/share/aot — loads AoT compiled code into VM for execution
  • related HotSpot code guarded by #if INCLUDE_AOT

Additionally, remove tests as well as code in makefiles related to AoT compilation.

Tested hs-tier1-4


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8264805: Remove the experimental Ahead-of-Time Compiler

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3398/head:pull/3398
$ git checkout pull/3398

Update a local copy of the PR:
$ git checkout pull/3398
$ git pull https://git.openjdk.java.net/jdk pull/3398/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3398

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3398.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 8, 2021

👋 Welcome back kvn! 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 8, 2021

@vnkozlov this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8264805
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch rfr Pull request is ready for review labels Apr 8, 2021
@openjdk
Copy link

openjdk bot commented Apr 8, 2021

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

  • build
  • core-libs
  • hotspot
  • serviceability
  • shenandoah

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.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Apr 8, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 8, 2021

Webrevs

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 8, 2021

/label remove merge-conflict

@coleenp
Copy link
Contributor

coleenp commented Apr 8, 2021

void CodeCache::mark_for_evol_deoptimization(InstanceKlass* dependee) {
This function, its caller and the function in jvmtiRedefineClasses.cpp that calls it can be deleted also, but you can file a separate RFE for that if you want.

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the changes in oops, runtime, classfile and code directories.

Copy link
Member

@erikj79 erikj79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build changes look good.

Copy link
Member

@stefank stefank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GC changes look good.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 8, 2021

void CodeCache::mark_for_evol_deoptimization(InstanceKlass* dependee) {
This function, its caller and the function in jvmtiRedefineClasses.cpp that calls it can be deleted also, but you can file a separate RFE for that if you want.

Thank you, Coleen, for review. I will wait other comments and will remove this code.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 8, 2021

Thank you, Erik and Stefan.

Copy link
Member

@iignatev iignatev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test changes look good to me.

@coleenp
Copy link
Contributor

coleenp commented Apr 8, 2021

There's a comment above
void VM_RedefineClasses::mark_dependent_code(InstanceKlass* ik) {
that should be rewritten, so I think we should just file an RFE to remove it afterwards.

@openjdk
Copy link

openjdk bot commented Apr 8, 2021

@vnkozlov This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8264805: Remove the experimental Ahead-of-Time Compiler

Reviewed-by: coleenp, erikj, stefank, iignatyev, dholmes, aph, shade, iklam, mchung, iveresov

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 6 new commits pushed to the master branch:

  • 1d37b98: 8265972: Remove declarations with no implementations in javaClasses.hpp
  • cb29b19: 8184134: HeapRegion::LogOfHRGrainWords is unused
  • 41daa88: 8265899: Use pattern matching for instanceof at module jdk.compiler(part 1)
  • a6f2863: 8266003: ProblemList sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java on macosx-all
  • 852a41d: 8258625: [JVMCI] refactor and unify JVMCI readFieldValue path
  • b5c6351: 8264663: Update test SuspendWithCurrentThread.java to verify that suspend doesn't exit until resumed

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Apr 8, 2021
@openjdk
Copy link

openjdk bot commented Apr 8, 2021

@vnkozlov The label merge-conflict is not a valid label. These labels are valid:

  • serviceability
  • hotspot
  • sound
  • hotspot-compiler
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • 2d
  • security
  • swing
  • hotspot-runtime
  • jmx
  • build
  • nio
  • beans
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr
  • awt

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 8, 2021

There's a comment above
void VM_RedefineClasses::mark_dependent_code(InstanceKlass* ik) {
that should be rewritten, so I think we should just file an RFE to remove it afterwards.

https://bugs.openjdk.java.net/browse/JDK-8264941

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vladimir,

This looks good to me - I went through all the files.

It was nice to see how nicely compartmentalized the AOT feature was - that made checking the changes quite simple. The one exception was the fingerprinting code, which for some reason was AOT-only but not marked that way, so I'm not sure what the story is there. ??

I was also surprised to see some of the flags were not marked experimental, so there will need to a CSR request to remove those without going through the normal deprecation process.

Thanks,
David

@@ -193,11 +131,11 @@ void CompiledDirectStaticCall::verify() {

#ifdef ASSERT
CodeBlob *cb = CodeCache::find_blob_unsafe((address) _call);
assert(cb && !cb->is_aot(), "CompiledDirectStaticCall cannot be used on AOTCompiledMethod");
assert(cb, "sanity");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: implied boolean - use "cb != NULL"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// of the actual code an AOTCompiledMethod object is pointing to in order to locate it.
// Notice that for an ordinary CodeBlob with code size zero, code_begin() may point beyond the object!
const void* start = AOT_ONLY( (code_blob_type() == CodeBlobType::AOT) ? blob->code_begin() : ) (void*)blob;
const void* start = (void*)blob;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start seems redundant now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done:

   bool contains_blob(const CodeBlob* blob) const {
-    const void* start = (void*)blob;
-    return contains(start);
+    return contains((void*)blob);
   }

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Apr 9, 2021
@openjdk
Copy link

openjdk bot commented Apr 9, 2021

@dholmes-ora has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@vnkozlov please create a CSR request and add link to it in JDK-8264805. This pull request cannot be integrated until the CSR request is approved.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Apr 9, 2021
Copy link
Contributor

@theRealAph theRealAph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AArch64 looks fine.

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shenandoah parts look good. I have a few minor comments after reading the rest.

@@ -70,7 +70,7 @@ const bool CCallingConventionRequiresIntsAsLongs = false;
#endif

#if INCLUDE_JVMCI
#define COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS (EnableJVMCI || UseAOT)
#define COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS (EnableJVMCI)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: can probably drop parentheses here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 714 to 715
} else {
tty->print("unknown");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably split this cleanup into the minor issue, your call. The benefit of separate issue: backportability.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -255,8 +254,7 @@ class InstanceKlass: public Klass {
_misc_has_nonstatic_concrete_methods = 1 << 5, // class/superclass/implemented interfaces has non-static, concrete methods
_misc_declares_nonstatic_concrete_methods = 1 << 6, // directly declares non-static, concrete methods
_misc_has_been_redefined = 1 << 7, // class has been redefined
_misc_has_passed_fingerprint_check = 1 << 8, // when this class was loaded, the fingerprint computed from its
// code source was found to be matching the value recorded by AOT.
_unused = 1 << 8, //
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason we don't want to remove this gap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less changes. We don't get any benefits from removing it. It is opposite - if we need a new value we will use it without changing following values again.

@@ -1331,12 +1184,6 @@ void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, JVMCIObje
if (!_immutable_pic_compilation) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All _immutable_pic_compilation mentions can be removed as well. It is true only for AOT compiles produced by Graal. It's never going to be used without AOT.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I removed _immutable_pic_compilation in JVMCI in Hotspot.

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a small nit.

@@ -79,9 +76,6 @@ void MethodCounters::clear_counters() {

void MethodCounters::metaspace_pointers_do(MetaspaceClosure* it) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MethodCounters::metaspace_pointers_do can be removed altogether (also need to remove the declaration in methodCounter.hpp).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 9, 2021

/label add hotspot-compiler

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Apr 9, 2021
@openjdk
Copy link

openjdk bot commented Apr 9, 2021

@vnkozlov
The hotspot-compiler label was successfully added.

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 9, 2021

Hi Vladimir,

This looks good to me - I went through all the files.

It was nice to see how nicely compartmentalized the AOT feature was - that made checking the changes quite simple. The one exception was the fingerprinting code, which for some reason was AOT-only but not marked that way, so I'm not sure what the story is there. ??

I was also surprised to see some of the flags were not marked experimental, so there will need to a CSR request to remove those without going through the normal deprecation process.

Thanks,
David

Thank you, David.
We thought that we could use fingerprint code for other cases that is why we did not put it under #if INCLUDE_AOT.
I filed CSR for AOT product flags removal: https://bugs.openjdk.java.net/browse/JDK-8265000

@vnkozlov
Copy link
Contributor Author

vnkozlov commented Apr 9, 2021

Thank you, Igor Ignatyev, Igor Veresov, Ioi, Aleksey and Andrew for reviews.
I will update changes based on your comments.

Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the module-loader-map and non-hotspot non-AOT tests.

@dean-long
Copy link
Member

@iklam
I thought the fingerprint code was also used by CDS.

@iklam
Copy link
Member

iklam commented Apr 10, 2021

@iklam
I thought the fingerprint code was also used by CDS.

CDS actually uses a different mechanism (CRC of the classfile bytes) to validate that a class has not changed between archive dumping time and runtime. See

int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
if (!record->matches(clsfile_size, clsfile_crc32)) {
return NULL;
}

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed csr Pull request needs approved CSR before integration labels Apr 14, 2021
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Apr 26, 2021
@vnkozlov
Copy link
Contributor Author

/integrate

@openjdk openjdk bot closed this Apr 27, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 27, 2021
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

@vnkozlov Since your change was applied there have been 7 commits pushed to the master branch:

  • 15d4787: 8265496: improve null check in DeflaterOutputStream/InflaterInputStream
  • 1d37b98: 8265972: Remove declarations with no implementations in javaClasses.hpp
  • cb29b19: 8184134: HeapRegion::LogOfHRGrainWords is unused
  • 41daa88: 8265899: Use pattern matching for instanceof at module jdk.compiler(part 1)
  • a6f2863: 8266003: ProblemList sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java on macosx-all
  • 852a41d: 8258625: [JVMCI] refactor and unify JVMCI readFieldValue path
  • b5c6351: 8264663: Update test SuspendWithCurrentThread.java to verify that suspend doesn't exit until resumed

Your commit was automatically rebased without conflicts.

Pushed as commit 694aced.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@vnkozlov vnkozlov deleted the JDK-8264805 branch April 27, 2021 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org hotspot hotspot-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org