[Soot-list] Execute several Soot runs in batch mode

Eric Bodden eric.bodden at mail.mcgill.ca
Thu May 3 14:24:00 EDT 2007


Usually, you should call soot.Global.reset() between multiple Soot
runs. This *should* reset all static variables in Soot to their
initial values.

Hope that helps.

Eric

On 03/05/07, Mario Mendez <mario at cs.unm.edu> wrote:
> Hi all,
>
> I'm trying to execute several times the same Soot transformation, in
> order to calculate an average of how much time does my compilation take.
> I'm trying to do it with a Java program, a 'main' that given some
> arguments and after adding my BodyTransformation invokes soot.Main in a
> loop:
>
>         public static void main(String[] args) {
>                 //get actual time
>                 for (int i=1;i<5;i++){
>                     PackManager.v().getPack("jtp").add(new
> Transform("jtp.pl",CiaoGenerator.v()));
>                     soot.Main.main(args);
>                     CiaoGenerator.v().finalize();
>                 }
>                 //get actual time
>         }
>
> This raises an error because of Options trying to parse the same 'args'
> many times. Therefore, I took a look at soot.Main and changed the code
> above to
>
>         public static void main(String[] args) {
>                 //get actual time               PackManager.v().getPack("jtp").add(new
> Transform("jtp.pl",CiaoGenerator.v()));
>                 soot.Main.main(args);
>                 CiaoGenerator.v().finalize();
>                 for (int i=1;i<5;i++){
>                     PackManager.v().runPacks();
>                     PackManager.v().writeOutput();
>                     CiaoGenerator.v().finalize();
>                 }
>                 //get actual time
>         }
> But this also raises an error
>
> Exception in thread "main" java.lang.NullPointerException
>         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
>         at soot.SootMethod.retrieveActiveBody(SootMethod.java:329)
>         at soot.PackManager.retrieveAllBodies(PackManager.java:958)
>         at soot.PackManager.runPacks(PackManager.java:328)
>         at soot.CiaoMain.main(Unknown Source)
>
> I'm using Soot 2.2.4. Any idea about how to run Soot several times in a
> row? I would really like to avoid using shell scripts to do it
>
>
> Thanks!
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


More information about the Soot-list mailing list