Skip to content

Support for invokedynamic instruction in the engine #386

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

Open
dtim opened this issue Jul 4, 2022 · 0 comments
Open

Support for invokedynamic instruction in the engine #386

dtim opened this issue Jul 4, 2022 · 0 comments
Assignees
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug Issue is a bug ctg-enhancement New feature, improvement or change request

Comments

@dtim
Copy link
Collaborator

dtim commented Jul 4, 2022

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

@dtim dtim added ctg-bug Issue is a bug ctg-enhancement New feature, improvement or change request comp-symbolic-engine Issue is related to the symbolic execution engine labels Jul 4, 2022
@dtim dtim self-assigned this Jul 4, 2022
@dtim dtim changed the title Support for dynamic invoke in the engine Support for invokedynamic instruction in the engine Jul 6, 2022
@CaelmBleidd CaelmBleidd assigned CaelmBleidd and unassigned dtim Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug Issue is a bug ctg-enhancement New feature, improvement or change request
Projects
None yet
Development

No branches or pull requests

2 participants