Skip to content

Commit

Permalink
purity status of a method can now be persisted in bytecode
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Bodden committed Dec 14, 2011
1 parent 333d7ad commit e854fc6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ Improvements and API changes in trunk
The code was contributed to Soot by Richard (Xiao) Xiao. Thanks for
this! You can find the code in soot.jimple.spark.geom. There are
new phase options in cg.spark to enable and configure this
analysis.
analysis.
9. Improved support for custom entry points in the points-to analysis.
10.Added option allowing putiry analysis to add a "Pure" bytecode
attribute for pure methods.

Improvements and API changes in version 2.4.0

Expand Down
6 changes: 6 additions & 0 deletions generated/options/soot/AntTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,12 @@ public void setprint(boolean arg) {
addArg("print:"+(arg?"true":"false"));
}

public void setannotate(boolean arg) {
addArg("-p");
addArg("wjap.purity");
addArg("annotate:"+(arg?"true":"false"));
}

public void setverbose(boolean arg) {
addArg("-p");
addArg("wjap.purity");
Expand Down
5 changes: 4 additions & 1 deletion generated/options/soot/options/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ public String getPhaseHelp( String phaseName ) {

+padOpt( "geom-dump-verbose ()", "Filename for detailed execution log" )
+padOpt( "geom-verify-name ()", "Filename for verification file" )
+padOpt( "geom-eval (0)", "precision evaluation methodologies" )
+padOpt( "geom-eval (0)", "Precision evaluation methodologies" )
+padOpt( "geom-trans (false)", "Transform to context-insensitive result" )
+padOpt( "geom-frac-base (40)", "Fractional parameter for precision/performance trade-off" )
+padOpt( "geom-blocking (true)", "Enable blocking strategy for recursive calls" )
Expand Down Expand Up @@ -1951,6 +1951,7 @@ public String getPhaseHelp( String phaseName ) {
+padOpt( "dump-cg (false)", "" )
+padOpt( "dump-intra (false)", "" )
+padOpt( "print (true)", "" )
+padOpt( "annotate (true)", "Marks pure methods with a purity bytecode attribute" )
+padOpt( "verbose (false)", "" );

if( phaseName.equals( "shimple" ) )
Expand Down Expand Up @@ -2680,6 +2681,7 @@ public static String getDeclaredOptionsForPhase( String phaseName ) {
+"dump-cg "
+"dump-intra "
+"print "
+"annotate "
+"verbose ";

if( phaseName.equals( "shimple" ) )
Expand Down Expand Up @@ -3283,6 +3285,7 @@ public static String getDefaultOptionsForPhase( String phaseName ) {
+"dump-cg:false "
+"dump-intra:false "
+"print:true "
+"annotate:true "
+"verbose:false ";

if( phaseName.equals( "shimple" ) )
Expand Down
10 changes: 10 additions & 0 deletions generated/options/soot/options/PurityOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public boolean print() {
return soot.PhaseOptions.getBoolean( options, "print" );
}

/** Annotate class files --
* Marks pure methods with a purity bytecode attribute.
*
*/
public boolean annotate() {
return soot.PhaseOptions.getBoolean( options, "annotate" );
}

/** Be (quite) verbose --
* .
Expand Down
2 changes: 1 addition & 1 deletion generated/options/soot/options/SparkOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public int passes() {

/** Precision evaluation methodologies --
* precision evaluation methodologies.
* Precision evaluation methodologies.
* We internally provide some precision evaluation
* methodologies, and classify the evaluation strength into three
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ public boolean want(SootMethod method) {
(new String(isPure?"yes":"no")).getBytes()));
*/
m.addTag(new StringTag("purity: "+(isPure?"pure":"impure")));
if(isPure && opts.annotate())
m.addTag(new GenericAttribute("Pure", new byte[0]));
if (opts.print())
G.v().out.println(" |- method "+m.toString()+" is "+(isPure?"pure":"impure"));

Expand Down
6 changes: 6 additions & 0 deletions src/soot/options/soot_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3852,6 +3852,12 @@ Alexandru Salcianu and Martin Rinard.
<alias>print</alias>
<default>true</default>
</boolopt>
<boolopt>
<name>Annotate class files</name>
<short_desc>Marks pure methods with a purity bytecode attribute</short_desc>
<alias>annotate</alias>
<default>true</default>
</boolopt>
<boolopt>
<name>Be (quite) verbose</name>
<alias>verbose</alias>
Expand Down

0 comments on commit e854fc6

Please sign in to comment.