-
Notifications
You must be signed in to change notification settings - Fork 45
Description
Description
Java 7 introduced the invokedynamic
instruction. It is intended to implement dynamic languages targeting JVM (e.g., JRuby), but it is also used to implement at least lambdas (Java 8+) and operator +
on String
(Java 9+).
Soot sometimes replaces invokedynamic
with other invoke*
opcodes (e.g., for lambdas), but it is supposedly a special case. For example, the Jimple graph for String
concatenation with +
includes JDynamicInvokeExpr
expression.
Previously the engine had not implemented invokedynamic
. To support +
operator in String
in Java 11, a fallback implementation has been provided that triggers concrete execution every time invokedynamic
is encountered. It is clearly a hack, and a proper implementation of invokedynamic
is necessary.
Expected behavior
The implementation of invokedynamic
instruction in the engine should update the global graph with the graph of the bootstrap method and generate branches corresponding to possible outcomes of invokedynamic
along with type and/or value constraints to discard unnecessary paths.
Environment
The feature does not depend on any specific environment.
Potential alternatives
Current implementation (concrete execution of the branch) seems to cover the simplest cases, but prevents further symbolic analysis.
Context
The paper that describes invokedynamic
representation in Soot: https://www.bodden.de/pubs/bodden12invokedynamic.pdf