Package sootup.callgraph.invokedynamic
Interface DynamicInvokeResolver
- All Known Implementing Classes:
BootstrapMethodHandleResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Decides which methods an invokedynamic call site transfers control to. Shared by CHA, RTA, Spark
and Qilin (configured via
CallGraphConfigBuilder.dynamicInvokeResolver(...)), so all
algorithms agree on which lambda bodies / method references are reachable.
A LambdaMetafactory implementation is reached through the FunctionalObject the
call site creates: calls on that object dispatch to it, with arguments and return value. Only
with withCreationSiteEdges() is it additionally called from the invokedynamic statement
itself (for views that lack the code calling the lambda). All other targets are called from the
invokedynamic statement, see creationSiteTargets(sootup.core.jimple.common.expr.JDynamicInvokeExpr).
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull DynamicInvokeResolverEvery method referenced by aMethodHandlebootstrap argument is a target, e.g. the synthetic lambda body passed toLambdaMetafactory.default booleanWhether lambda implementations are also called from their invokedynamic statement.default @NonNull List<DynamicInvokeTarget>creationSiteTargets(@NonNull JDynamicInvokeExpr expr) Targets called from the invokedynamic statement itself (see class doc).default @NonNull Bodydesugar(@NonNull SootMethod method, @NonNull Body body, @NonNull View view) Makes the implicit calls of other invokedynamics explicit (string concatenation'stoString(), records'equals/hashCode/toString).default booleanisNone()Whether this resolver isnone().static @NonNull DynamicInvokeResolvernone()Resolves nothing: invokedynamic call sites get no call targets.@NonNull List<DynamicInvokeTarget>resolve(@NonNull JDynamicInvokeExpr expr) default @NonNull DynamicInvokeResolverThis resolver, plus edges from each invokedynamic statement to its lambda implementation.
-
Method Details
-
resolve
- Parameters:
expr- the invokedynamic expression- Returns:
- the methods
exprmay transfer control to; empty if unresolved
-
none
Resolves nothing: invokedynamic call sites get no call targets. -
bootstrapMethodHandles
Every method referenced by aMethodHandlebootstrap argument is a target, e.g. the synthetic lambda body passed toLambdaMetafactory. The default everywhere. -
isNone
default boolean isNone()Whether this resolver isnone(). -
creationSiteEdges
default boolean creationSiteEdges()Whether lambda implementations are also called from their invokedynamic statement. -
withCreationSiteEdges
This resolver, plus edges from each invokedynamic statement to its lambda implementation. -
creationSiteTargets
Targets called from the invokedynamic statement itself (see class doc). -
desugar
Makes the implicit calls of other invokedynamics explicit (string concatenation'stoString(), records'equals/hashCode/toString). Identity by default.- Returns:
bodyitself if nothing changed, else a rewritten copy - the same one on each call, so statements of call graph edges and of later passes over the body match
-