-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8293336: AOT-linking of invokedynamic for lambda expression and string concat #21143
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
8293336: AOT-linking of invokedynamic for lambda expression and string concat #21143
Conversation
…s' of /jdk3/yak/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
…s' of /jdk3/yak/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
…s' of /jdk3/yam/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…s' of /jdk3/yam/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
…s' of /jdk3/yam/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
…s' of /jdk3/yam/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
|
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
…s' of /jdk3/yam/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
|
I read through it fairly thoroughly. I made a lot of suggestions. Rather than edit comments into lots of spots in this PR, I made the following patch file. The first lines of the patch file state which revision the patch applies to, which is 4be6a25 from Tuesday. |
Just happened to notice you aren't checking |
…ot-inited; removed is_trivial_clinit() as it is used only in logging but the meaning is unclear
Hi John, Thank you so much for the code. I have merged most of your diffs into the PR. There are a few items left which I will go over tomorrow. I simplified the I also moved the I also cleaned up the "firewall" check in |
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
…le name needs to be lifted out of MetaspaceShared::serialize()
…s::is_enum_subclass()
I consulted with John and removed the |
The change is actually necessary -- the main module name used to be restored inside With aot-linked classes, the main module is needed early to decide whether to reject a CDS archive altogether. Therefore, I needed to lift its processing our of (This change could have been included in #20843 , but that might be too much work now that the review for JEP 483 is winding down). |
…llel and Serial GCs when running with AOTClassLinking enabled
… and added checks for only hidden classes
…annot enqueue events before the service thread runs" in case AOTClassLinking enabled
…ils with "should never leak JDK internal class" in case AOTClassLinking enabled
…uilder::has_been_buffered(src_ik)
|
Mailing list message from John Rose on core-libs-dev: On 15 Oct 2024, at 12:35, Ioi Lam wrote:
Is it necessary to get constant folding from NCPU? I guess a division is slow, but it does not seem to be a hot path, at all. The division is not in any loop. If there is no performance issue, it?s perhaps more honest just to use a mutable variable. I guess what we need here is something that means ?stable except for AOT activity?. Normally, making something stable means it should be used according to the contract of stable, which is only one second value, and no third, after the initial default. There is a sub-rosa contract, as well, which is that we can add third values if they do not conflict with the second values. But we have to convince ourselves that is safe, because the second and third values can (in general) co-exist as folded constants in JIT code. We currently refuse to fold stable constants in AOT code (and there?s no AOT code in this JEP anyway) so the AOT-only stable binding is tolerable. Here?s what I think we should do later (not in this PR): Amend the contract for @Stable that the value is allowed to be different during the AOT assembly phase than later. Working out the details will require some discussion: Should the AOT-AP reset stable values that need new bindings? (Probably??) Or should there be a warmup method that takes full responsibility for managing the stable value during the production run? For now, I?m content to make this guy NCPU either stable or not. But it is clear that, along with other details, we will need an amended story for the life-cycle of a stable variable that includes the AOT assembly phase. Eventually, something like this may well play into a similar Leyden story for user-visible stables. Those would be declared by an object API, not the private annotation we use in the JDK. User-visible stable objects are likely to be wrappers for JDK-level stable-annotated fields, and that?s how the turtles tend to stack up. No PR change requested here! |
…with Parallel and Serial GCs when running with AOTClassLinking enabled
…s' of /jdk3/yam/open into jep-483-step-06-8311071-avoid-soft-refs-in-java-lang-invoke
…voke' into jep-483-step-07-8293336-store-lambda-forms-in-cds-archive
|
Closing this PR as its changes have been combined into #21642. |
|
The parent pull request that this pull request depends on has been closed without being integrated and the target branch of this pull request has been updated as the previous branch was deleted. This means that changes from the parent pull request will start to show up in this pull request. If closing the parent pull request was done in error, it will need to be re-opened and this pull request will need to manually be retargeted again. |
This is the 7th and final PR for JEP 483: Ahead-of-Time Class Loading & Linking.
This PR implements the AOT-linking of invokedynamic callsites:
LambdaMetafactory::metafactory) and string concat (StringConcatFactory::makeConcatWithConstants()) as the results of these bootstrap methods do not have environment dependencies and can be safely cached.Review Notes:
AOTConstantPoolResolver::preresolve_indy_cp_entries()-- it checks all indys that were linked during the training run, and aot-links only those for lambdas and string concatsSystemDictionaryShared::find_all_archivable_classes()finds all the hidden classes that are reachable from the indy CallSitesMetaspaceShared::preload_and_dump_impl()we callMethodType::createArchivedObjects()to record all MethodTypes that were created in the assembly phase. This is necessary because the identity of MethodTypes is significant (they are compared with the==operator). Also see MethodType.java for the corresponding code that are used in the production run.VM_PopulateDumpSharedSpace::doit()). In this safepoint,ConstantPoolCache::remove_resolved_indy_entries_if_non_deterministic()is called to remove any resolved indy callsites that cannot be archived. (Such CallSites may be created as a side effect of Java code execution in the assembly phase. E.g., the bootstrap of the module system).Rough Edges:
AOTClassInitializer::can_archive_initialized_mirror(), where the object identity of these static fields is significant. Therefore, we must preserve the initialized states of these classes. Otherwise, we might run into problems such as JDK-8340836. Unfortunately, the list is created by trial-and-error, and may need to be updated to match changes in thejava.lang.invokeandjdk.internal.constantpackages. We expect Project Leyden to come with a general solution to this problem.AOTHolderpattern to break out the fields that need to be archived. See discussion on leyden-dev.See here for the sequence of dependent RFEs for implementing JEP 483.
Progress
Integration blocker
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21143/head:pull/21143$ git checkout pull/21143Update a local copy of the PR:
$ git checkout pull/21143$ git pull https://git.openjdk.org/jdk.git pull/21143/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21143View PR using the GUI difftool:
$ git pr show -t 21143Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21143.diff
Webrev
Link to Webrev Comment