Stuck in loop when making slices.
Hi there,
I'm slicing a Test.java recently, and I stuck in a endless loop like below:
I'm trying to slice in traditional style(DataDependenceOptions and ControlDependenceOptions are both FULL). Since there is no error or exception message, so I'm puzzled about what caused this. Maybe I have passed a wrong seed? I use the follwing steps to find a seed:
1) I traverse every Instruction in every node whose toString() contains "Application",
2) map instruction to its source code, and if the the source code contains "assert", then it will be a
seed. Codes are as follows:
List<Statement> seeds = new ArrayList<>();
String targetMethodName = "assert";
cg.stream().filter((node) -> node.getMethod().toString().contains("Application"))
.forEach((node) -> {
System.out.println("NodeID-" + node.getGraphNodeId() + ": " + node);
IR ir = node.getIR();
Iterator<SSAInstruction> it = ir.iterateAllInstructions();
while(it.hasNext()) {
SSAInstruction instruction = it.next();
Statement statement = new NormalStatement(node, instruction.iIndex());
int lineNumber = AtomUtil.srcLineNumberOf(statement);
String line = null;
try {
line = FileUtil.readContentByLineNumber(javaPath, lineNumber);
} catch (IOException e) {
e.printStackTrace();
}
/*
System.out.println(line);
System.out.println();
*/
if(line.contains(targetMethodName)) {
seeds.add(statement);
}
}
});
I have already known that each source line is usually corresponding more than one Instruction, since it has cause some duplicate slice result. I want to know whether a seed has a specification? Or are there any other reasons may lead to a endless loop above?Please reply to me at your convenience, thank u :-) !
Hi @QRXqrx.
I want to know whether a seed has a specification?
I'm not sure what you mean by this?
Or are there any other reasons may lead to a endless loop above?
Most likely, this is not an infinite loop, but instead the slicer taking a very long time to process library code. You can experiment by reducing the types of data and control dependence edges considered to see if that fixes the problem. At the very least I would try with NO_EXCEPTIONAL_EDGES for control dependence. Have you experimented in this way?
Hi@msridhar, Thank you for you replying. Actually,
I want to know whether a seed has a specification?
means: "Are there any requirement for a seed?" If I want to choose a statement as a seed, are there any type rules(seed should be a specific type of Statement), or sth else, I need to obey?
And I have just tried NO_EXCEPTIONAL_EDGES just now. I'm still stuck at the same place, but the slice results are closer to what I need. Like follows:
Could you please offer any other common settings for experiment? I'm very curious about this. :-) 👍
There are no particular rules / restrictions on seeds that I know of. As far as other things to try for scalability, see here:
https://github.com/wala/WALA/wiki/Pointer-Analysis#improving-scalability
In particular, exclusions of irrelevant classes in the AnalysisScope can help a lot.
On Fri, Feb 14, 2020 at 6:16 PM Adian Qian [email protected] wrote:
Hi@msridhar, Thank you for you replying. Actually this: I want to know whether a seed has a specification? means: "Are there any requirement for a seed?" If I want to choose a statement as a seed, are there any type rules(seed should be a specific type of Statement), or sth else, I need to obey?
And I have just tried NO_EXCEPTIONAL_EDGES just now. I'm still stuck at the same place, but the slice results are closer to what I need. Like follows: [image: image] https://user-images.githubusercontent.com/49576982/74580105-7fdf6380-4fdb-11ea-8eb9-faadc7541655.png Could you please offer any other common settings for experiment? I'm very curious about this. :-) 👍
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wala/WALA/issues/694?email_source=notifications&email_token=AABPEUOGGCT7R46RHFFDMDLRC5F6RA5CNFSM4KVHQCF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL27ERQ#issuecomment-586543686, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPEULA3I6JJC5BGYTNVX3RC5F6RANCNFSM4KVHQCFQ .
I have tried all possible option combinations, and I found several usable pairs of options from them. I'm going to close this issue, thank u for your patient replying :-) @msridhar
Great, thanks!
@msridhar Hi, I am analysing a project through slicing, but the program has been running,DataDependenceOptions:FULL,ControlDependenceOptions:NO_EXCEPTIONAL_EDGES
the running status is as follows:

When I exclude the entire java.util.* package, the slicer can run normally and exit。I would like to ask a few questions:
- What the slicer is doing, what caused the program to fail to exit
- Besides adjusting DataDependencyOption, ControlDependenceOptions, what can I do to speed up the analysis? Normally, I cannot exclude the entire
java.util.*package ?
Please reply me at your convenience, thanks a lot
Hi @ligenPro sorry for the slow response. Have you looked at the Slicer performance tips?
https://github.com/wala/WALA/wiki/Slicer#performance-tips
There might be something helpful there. Besides adjusting data- and control-dependence options, you can try:
- Adding exclusions besides
java.util.*, e.g., excluding GUI libraries like Swing - Analyzing an earlier version of the Java standard library (this can make a huge difference)
- Using different reflection options when building the call graph (not sure if this will help much)