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
WIP: Synthetic LambdaMetaFactory implementation to handle invokeDynamic #1056
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This subsumes the following commits from the old pull request: commit b28f85d Author: Brian Alliet <balliet@grammatech.com> Date: Thu Mar 15 14:52:06 2018 -0400 Generate bridge methods if FLAG_BRIDGES is specified for altMetafactory This isn't that well tested (and could use some tests). The only compiler I've found that actually generates these is ejc. This works for the one example (involving covariant return types) I have though. commit 3579b02 Author: Brian Alliet <balliet@grammatech.com> Date: Tue Jan 16 11:41:15 2018 -0500 Support LambdaMetaFactory.altMetaFactory (in addition to metaFactory) This adds a few extra pieces of info for the runtime generated class (extra interfaces, bridge methods, and a serializable bit) commit 003a053 Author: Brian Alliet <balliet@grammatech.com> Date: Tue Feb 28 09:39:02 2017 -0500 Wire up LambdaMetaFactory to src/soot/asm/AsmMethodSource We rewrite invokedynamic 'calls' to LambdaMetaFactory to normal invokestatic calls to the bootstrap method of the thunk created by our LambdaMetaFactory models. We *probably* want to keep these invokedynamic instructions actually, just with some special modeled target or something... I'm not sure. Doing it this way means nobody else needs to know anything about invokedynamic now. commit 027281f Author: Brian Alliet <balliet@grammatech.com> Date: Tue Feb 28 09:34:30 2017 -0500 Add 'LambdaMetaFactory' (maybe this should be renamed) which implements the 'modeling' of java.lang.invoke.LambdaMetaFactory. We model this by making a real 'thunk' class which implements the functional interface of the lambda and dispatches to the real implementation. This is sort of like what RetroLambda does. This isn't wired up to the rest of soot yet.
Converted G.out calls to logging
…s to functional interfaces with generic types.
The factory need to implement java.lang.Object and the FastHierarchy has to be invalidated after adding the MetaFactory to the Scene, so that it is found as valid implementer of the functional interface during call graph generation
…graph. Test case is copied from the 'Java Call Graph Test Suite (JCG)' project (https://bitbucket.org/delors/jcg/src/master/)
VTA and SPARK is currently failing. More tests to follow
Fixes a parameter indexing bug.
…etic LambdaMetaFactory for years! The TypeManager cached the FastHierarchy and thereby missed its invalidation after adding the synthetic LambdaMetaFactory. The TypeManager now uses a Scene managed FastHierarchy and thus can correctly find implementers of functional interfaces added after the first instance of FastHierarchy was built.
Implemented modeling of parameter adaptation. This is required to handle conversion of primitives to their wrapper types (boxing and unboxing). Enabled writing generated classes to another format, such as .class. Generated class names follow an inner class naming pattern. Removed BridgeMethodSource; ThunkMethodSource handles all cases. The samMethodType and the bridges are signatures to be implemented by the functional object, and each one delegates to the implMethod.
Merged with #1078 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Origins from #701 with additional test cases and some major bug fixes