Skip to content

Support for invokedynamic instruction in the engine #386

Open
@dtim

Description

@dtim

Description

Engine currently does not support the dynamicinvoke bytecode instruction introduced in JDK 7.

An important case where invokedynamic is necessary is string concatenation: starting from Java 9, the operator + for String is implemented using dynamicinvoke. As a result, the plugin fails to generate tests for string concatenation when the code is compiled using JDK 9 or later (the primary concern is JDK 11).

To support + operator for String in Java 11, a fallback implementation has been provided that triggers concrete execution every time invokedynamic is encountered (PR . It is clearly a hack, and a proper implementation of invokedynamic is necessary.

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.

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 invokedynamic instruction is present in JDK 7 or later.

The feature does not depend on any specific UnitTestBot configuration.

Potential alternatives

Possible approaches to support dynamicinvoke are under investigation.

Context

Metadata

Metadata

Assignees

Labels

comp-symbolic-engineIssue is related to the symbolic execution enginectg-bugIssue is a bugctg-enhancementNew feature, improvement or change request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions