[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Soot typing failure
While investigating...
SOOT PROBLEM #1
===============
PackManager.v().getTransform( "jb.a" ).apply( b );
PackManager.v().getTransform( "jb.ule" ).apply( b );
is applied BEFORE typing in soot-2.0.1/soot/src/soot/JimpleBodyPack.java
This is a bug of Soot. Putting this code AFTER typing is the right approach
to solving the case of
public class Test2
{
public void main()
{
if (null instanceof String)
System.out.println("is String");
else
System.out.println("is not String");
}
}
So with
private void applyPhaseOptions(JimpleBody b, Map opts)
{
JBOptions options = new JBOptions( opts );
if(options.use_original_names())
PhaseOptions.v().setPhaseOptionIfUnset( "jb.lns", "only-stack-locals");
if(Options.v().time()) Timers.v().splitTimer.start();
PackManager.v().getTransform( "jb.ls" ).apply( b );
if(Options.v().time()) Timers.v().splitTimer.end();
if(Options.v().time()) Timers.v().assignTimer.start();
PackManager.v().getTransform( "jb.tr" ).apply( b );
if(Options.v().time()) Timers.v().assignTimer.end();
if(typingFailed(b))
throw new RuntimeException("type inference failed!");
PackManager.v().getTransform( "jb.a" ).apply( b );
PackManager.v().getTransform( "jb.ule" ).apply( b );
...
one gets:
java soot.Main --soot-class-path /usr/lib/sablevm/classes-1.0.9:. -f jimple Test2
=>
$ cat sootOutput/Test2.jimple
public class Test2 extends java.lang.Object
{
public void main()
{
Test2 r0;
java.io.PrintStream $r1;
r0 := @this: Test2;
goto label0;
label0:
$r1 = <java.lang.System: java.io.PrintStream out>;
virtualinvoke $r1.<java.io.PrintStream: void println(java.lang.String)>("is not String");
return;
}
public void <init>()
{
Test2 r0;
r0 := @this: Test2;
specialinvoke r0.<java.lang.Object: void <init>()>();
return;
}
}
SOOT PROBLEM #2
===============
In the code:
if(Options.v().time()) Timers.v().assignTimer.start();
PackManager.v().getTransform( "jb.tr" ).apply( b );
if(Options.v().time()) Timers.v().assignTimer.end();
if(typingFailed(b))
throw new RuntimeException("type inference failed!");
of soot-2.0.1/soot/src/soot/JimpleBodyPack.java, verification of typing
failure is done EVEN WHEN typing is disabled! (e.g. -p jb.tr enabled:false )
This is obviously a bug.
NOTE
====
I guess some people reordered soot phases without knowing the implications on
typing. Also, not being able to get untyped jimple is a problem for debugging
the type-inference engine. Please make sure it remains possible to get the
plain jimple sent to the type inference engine in a textual .jimple format.
REQUEST
=======
Please let me know how I can get the jimple produced by
PackManager.v().getTransform( "jb.ls" ).apply( b );
just before calling the typing algorithm.
Thanks.
Etienne
Etienne Gagnon wrote:
Ondrej, what are the soot options to get the following:
I would like to get a .jimple dump of the code as handed to the typing
algorithm.
(no optimization applied, just splitting according to used-def chains.)
The following does not work...
java soot.Main --app --soot-class-path /usr/lib/sablevm/classes-1.0.9:.
-f jimple -p jb.tr enabled:false Test1
Etienne
--
Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/
SableVM: http://www.sablevm.org/
SableCC: http://www.sablecc.org/