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

WIP: Synthetic LambdaMetaFactory implementation to handle invokeDynamic #1056

Closed
wants to merge 13 commits into from

Conversation

mbenz89
Copy link
Contributor

@mbenz89 mbenz89 commented Nov 2, 2018

Origins from #701 with additional test cases and some major bug fixes

balliet-gt and others added 11 commits April 17, 2018 10:04
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
…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.
@mbenz89 mbenz89 closed this Dec 20, 2018
@mbenz89
Copy link
Contributor Author

mbenz89 commented Dec 20, 2018

Merged with #1078

@mbenz89 mbenz89 deleted the GrammaTech-develop branch October 16, 2019 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants