[Soot-list] Using Soot without using soot.Main

Archie Cobbs archie at dellroad.org
Tue Mar 8 17:16:47 EST 2005


Chris Pickett wrote:
> However, as for how you would actually set Options.full_resolver to be 
> true without calling soot.Main, I'm not sure.  Perhaps somebody else can 
> clarify here (and this should probably go in an FAQ too, although it's 
> not really particular to the class resolver)...

The code generator for JC [1] uses Soot in "library mode". Here is a
snippet of code that might be useful:

         // Reset Soot
         G.reset();
         System.gc();

         // Set global Soot options
         Options.v().set_keep_line_number(true);
         Options.v().set_keep_offset(true);

         // Set Jimple optimization options
         PhaseOptions.v().setPhaseOption("jop", "enabled:true");
         PhaseOptions.v().setPhaseOption("tag.ln", "on");
         PhaseOptions.v().setPhaseOption("jb.lp", "on");
         PhaseOptions.v().setPhaseOption("jap", "enabled:true");
         PhaseOptions.v().setPhaseOption("jap.npc", "on");
         PhaseOptions.v().setPhaseOption("jap.abc", "on");
         PhaseOptions.v().setPhaseOption("jap.abc",
             "with-classfield:true");

         // Include cast check elimination tagging
         PackManager.v().getPack("jap").add(
             new Transform("jap.cce", CastCheckEliminatorDumper.v()));
         PhaseOptions.v().setPhaseOption("jap.cce", "on");


Hope this helps.

-Archie

[1] http://jcvm.sourceforge.net/

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


More information about the Soot-list mailing list