You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
SharedInitializationLocalSplitter may transform codes into more complex codes in Soot version 4.3.0-Snapshot
Input file
// Here is the code to be tested in file Test.java in the directory './target/test-classes/mydir'publicclassTest {
publicinttest(booleanb) {
intx = 100;
while (b) {
if (x < 200) {
x = 100;
} else {
x = 200;
}
}
returnx;
}
}
// Here is the minimal code to drive the test in another file 'MyTest.java'publicclassMyTest {
@Testpublicvoidtest() {
// just one file Test.java shown above to be transformed in the directory 'mydir'Options.v().set_process_dir(Arrays.asList("./target/test-classes/mydir"));
Options.v().set_output_format(Options.output_format_jimple);
Scene.v().loadNecessaryClasses();
PackManager.v().runPacks();
PackManager.v().writeOutput();
}
}
To reproduce
Running MyTest#test method to test, can produce 'Test.jimple' in the default directory 'sootOutput'. The produced content is:
In the 'test' method in the jimple file, we can see continuous 3 redundant assignments:
s0 = 200;
s2 = 200;
s1 = 200;
Expected behavior
From a view on programming language semantics, the produced jimple may be correct. But SharedInitializationLocalSplitter optimizer let the codes more complex.
However, In Soot version 4.2.1, it produces optimized codes that are not redundant:
Stacktrace or some my thinkings
By spending time debugging the code between versions 4.2.1 and 4.3.0-snapshot, I found a difference on the method JimpleBodyPack#applyPhaseOptions between two versions that leads to two different output jimple file.
4.3.0-snapshort applied transformer "jb.sils". And I try to remove the code that applies transformer "jb.sils", I found it produce jimple file the same as produced file in the version 4.2.1
The code around what I said:
...
pacman.getTransform("jb.uce").apply(b);
pacman.getTransform("jb.ls").apply(b);
pacman.getTransform("jb.sils").apply(b); // Here differs from version 4.2.1
...
My problem
I want to know:
What is SharedInitializationLocalSplitter(sils)?
What functions there are?
I reviewed the code in SharedInitializationLocalSplitter#internalTransform.
It just collects Units that uses Locals, and the Locals defined in the form 'x = Constant' (x is a Local and Constant is any constant),and inserts a new generated Local definition that assigned by the Constant, and replaces the use place with the generated Local.
Like this:
x = 100;
ifx >= 200gotolabel;
will be transformed into
x = 100;
x_1 = 100;
ifx_1 >= 200gotolabel;
Maybe what I understand is not correct by reviewing the code.
I don't know what 'sils' means? What place it will be useful?
The text was updated successfully, but these errors were encountered:
canliture
changed the title
SharedInitializationLocalSplitter may be produce more complex code. And what's 'sils'?
SharedInitializationLocalSplitter maybe produce more complex code. And what's 'sils'?
Jul 13, 2021
Describe the bug
SharedInitializationLocalSplitter may transform codes into more complex codes in
Soot version 4.3.0-Snapshot
Input file
To reproduce
Running
MyTest#test
method to test, can produce 'Test.jimple' in the default directory 'sootOutput'. The produced content is:In the 'test' method in the jimple file, we can see continuous 3 redundant assignments:
Expected behavior
From a view on programming language semantics, the produced jimple may be correct. But SharedInitializationLocalSplitter optimizer let the codes more complex.
However, In Soot version 4.2.1, it produces optimized codes that are not redundant:
Stacktrace or some my thinkings
By spending time debugging the code between versions 4.2.1 and 4.3.0-snapshot, I found a difference on the method JimpleBodyPack#applyPhaseOptions between two versions that leads to two different output jimple file.
My problem
I want to know:
I reviewed the code in SharedInitializationLocalSplitter#internalTransform.
It just collects Units that uses Locals, and the Locals defined in the form 'x = Constant' (x is a Local and Constant is any constant),and inserts a new generated Local definition that assigned by the Constant, and replaces the use place with the generated Local.
Like this:
will be transformed into
Maybe what I understand is not correct by reviewing the code.
I can't find documents about "jb.sils" at Soot command-line options
I don't know what 'sils' means? What place it will be useful?
The text was updated successfully, but these errors were encountered: