KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > options > SparkOptions


1
2 /* Soot - a J*va Optimization Framework
3  * Copyright (C) 2003 Ondrej Lhotak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */

20
21 /* THIS FILE IS AUTO-GENERATED FROM soot_options.xml. DO NOT MODIFY. */
22
23 package soot.options;
24 import java.util.*;
25
26 /** Option parser for Spark. */
27 public class SparkOptions
28 {
29     private Map options;
30
31     public SparkOptions( Map options ) {
32         this.options = options;
33     }
34     
35     /** Enabled --
36     
37      * .
38     
39      *
40      */

41     public boolean enabled() {
42         return soot.PhaseOptions.getBoolean( options, "enabled" );
43     }
44     
45     /** Verbose --
46     
47      * Print detailed information about the execution of Spark.
48     
49      * When this option is set to true, Spark prints detailed
50      * information about its execution.
51      */

52     public boolean verbose() {
53         return soot.PhaseOptions.getBoolean( options, "verbose" );
54     }
55     
56     /** Ignore Types Entirely --
57     
58      * Make Spark completely ignore declared types of variables.
59     
60      * When this option is set to true, all parts of Spark completely
61      * ignore declared types of variables and casts.
62      */

63     public boolean ignore_types() {
64         return soot.PhaseOptions.getBoolean( options, "ignore-types" );
65     }
66     
67     /** Force Garbage Collections --
68     
69      * Force garbage collection for measuring memory usage.
70     
71      * When this option is set to true, calls to System.gc() will be
72      * made at various points to allow memory usage to be measured.
73      *
74      */

75     public boolean force_gc() {
76         return soot.PhaseOptions.getBoolean( options, "force-gc" );
77     }
78     
79     /** Pre Jimplify --
80     
81      * Jimplify all methods before starting Spark.
82     
83      * When this option is set to true, Spark converts all available
84      * methods to Jimple before starting the points-to analysis. This
85      * allows the Jimplification time to be separated from the
86      * points-to time. However, it increases the total time and memory
87      * requirement, because all methods are Jimplified, rather than
88      * only those deemed reachable by the points-to analysis.
89      */

90     public boolean pre_jimplify() {
91         return soot.PhaseOptions.getBoolean( options, "pre-jimplify" );
92     }
93     
94     /** VTA --
95     
96      * Emulate Variable Type Analysis.
97     
98      * Setting VTA to true has the effect of setting field-based,
99      * types-for-sites, and simplify-sccs to true, and on-fly-cg to
100      * false, to simulate Variable Type Analysis, described in our
101      * OOPSLA 2000 paper. Note that the algorithm differs from the
102      * original VTA in that it handles array elements more precisely.
103      *
104      */

105     public boolean vta() {
106         return soot.PhaseOptions.getBoolean( options, "vta" );
107     }
108     
109     /** RTA --
110     
111      * Emulate Rapid Type Analysis.
112     
113      * Setting RTA to true sets types-for-sites to true, and causes
114      * Spark to use a single points-to set for all variables, giving
115      * Rapid Type Analysis.
116      */

117     public boolean rta() {
118         return soot.PhaseOptions.getBoolean( options, "rta" );
119     }
120     
121     /** Field Based --
122     
123      * Use a field-based rather than field-sensitive representation.
124     
125      * When this option is set to true, fields are represented by
126      * variable (Green) nodes, and the object that the field belongs to
127      * is ignored (all objects are lumped together), giving a
128      * field-based analysis. Otherwise, fields are represented by field
129      * reference (Red) nodes, and the objects that they belong to are
130      * distinguished, giving a field-sensitive analysis.
131      */

132     public boolean field_based() {
133         return soot.PhaseOptions.getBoolean( options, "field-based" );
134     }
135     
136     /** Types For Sites --
137     
138      * Represent objects by their actual type rather than allocation
139      * site.
140     
141      * When this option is set to true, types rather than allocation
142      * sites are used as the elements of the points-to sets.
143      */

144     public boolean types_for_sites() {
145         return soot.PhaseOptions.getBoolean( options, "types-for-sites" );
146     }
147     
148     /** Merge String Buffer --
149     
150      * Represent all StringBuffers as one object.
151     
152      * When this option is set to true, all allocation sites creating
153      * java.lang.StringBuffer objects are grouped together as a single
154      * allocation site.
155      */

156     public boolean merge_stringbuffer() {
157         return soot.PhaseOptions.getBoolean( options, "merge-stringbuffer" );
158     }
159     
160     /** Propagate All String Constants --
161     
162      * Propagate all string constants, not just class names.
163     
164      * When this option is set to false, Spark only distinguishes
165      * string constants that may be the name of a class loaded
166      * dynamically using reflection, and all other string constants are
167      * lumped together into a single string constant node. Setting this
168      * option to true causes all string constants to be propagated
169      * individually.
170      */

171     public boolean string_constants() {
172         return soot.PhaseOptions.getBoolean( options, "string-constants" );
173     }
174     
175     /** Simulate Natives --
176     
177      * Simulate effects of native methods in standard class library.
178     
179      * When this option is set to true, the effects of native methods
180      * in the standard Java class library are simulated.
181      */

182     public boolean simulate_natives() {
183         return soot.PhaseOptions.getBoolean( options, "simulate-natives" );
184     }
185     
186     /** Simple Edges Bidirectional --
187     
188      * Equality-based analysis between variable nodes.
189     
190      * When this option is set to true, all edges connecting variable
191      * (Green) nodes are made bidirectional, as in Steensgaard's
192      * analysis.
193      */

194     public boolean simple_edges_bidirectional() {
195         return soot.PhaseOptions.getBoolean( options, "simple-edges-bidirectional" );
196     }
197     
198     /** On Fly Call Graph --
199     
200      * Build call graph as receiver types become known.
201     
202      * When this option is set to true, the call graph is computed
203      * on-the-fly as points-to information is computed. Otherwise, an
204      * initial CHA approximation to the call graph is used.
205      */

206     public boolean on_fly_cg() {
207         return soot.PhaseOptions.getBoolean( options, "on-fly-cg" );
208     }
209     
210     /** Simplify Offline --
211     
212      * Collapse single-entry subgraphs of the PAG.
213     
214      * When this option is set to true, variable (Green) nodes which
215      * form single-entry subgraphs (so they must have the same
216      * points-to set) are merged before propagation begins.
217      */

218     public boolean simplify_offline() {
219         return soot.PhaseOptions.getBoolean( options, "simplify-offline" );
220     }
221     
222     /** Simplify SCCs --
223     
224      * Collapse strongly-connected components of the PAG.
225     
226      * When this option is set to true, variable (Green) nodes which
227      * form strongly-connected components (so they must have the same
228      * points-to set) are merged before propagation begins.
229      */

230     public boolean simplify_sccs() {
231         return soot.PhaseOptions.getBoolean( options, "simplify-sccs" );
232     }
233     
234     /** Ignore Types For SCCs --
235     
236      * Ignore declared types when determining node equivalence for SCCs.
237     
238      * When this option is set to true, when collapsing
239      * strongly-connected components, nodes forming SCCs are collapsed
240      * regardless of their declared type. The collapsed SCC is given
241      * the most general type of all the nodes in the component. When
242      * this option is set to false, only edges connecting nodes of the
243      * same type are considered when detecting SCCs. This option has
244      * no effect unless simplify-sccs is true.
245      */

246     public boolean ignore_types_for_sccs() {
247         return soot.PhaseOptions.getBoolean( options, "ignore-types-for-sccs" );
248     }
249     
250     /** Dump HTML --
251     
252      * Dump pointer assignment graph to HTML for debugging.
253     
254      * When this option is set to true, a browseable HTML
255      * representation of the pointer assignment graph is output to a
256      * file called pag.jar after the analysis completes. Note that this
257      * representation is typically very large.
258      */

259     public boolean dump_html() {
260         return soot.PhaseOptions.getBoolean( options, "dump-html" );
261     }
262     
263     /** Dump PAG --
264     
265      * Dump pointer assignment graph for other solvers.
266     
267      * When this option is set to true, a representation of the
268      * pointer assignment graph suitable for processing with other
269      * solvers (such as the BDD-based solver) is output before the
270      * analysis begins.
271      */

272     public boolean dump_pag() {
273         return soot.PhaseOptions.getBoolean( options, "dump-pag" );
274     }
275     
276     /** Dump Solution --
277     
278      * Dump final solution for comparison with other solvers.
279     
280      * When this option is set to true, a representation of the
281      * resulting points-to sets is dumped. The format is similar to
282      * that of the Dump PAG option, and is therefore suitable for
283      * comparison with the results of other solvers.
284      */

285     public boolean dump_solution() {
286         return soot.PhaseOptions.getBoolean( options, "dump-solution" );
287     }
288     
289     /** Topological Sort --
290     
291      * Sort variable nodes in dump.
292     
293      * When this option is set to true, the representation dumped by
294      * the Dump PAG option is dumped with the variable (green) nodes in
295      * (pseudo-)topological order. This option has no effect unless
296      * Dump PAG is true.
297      */

298     public boolean topo_sort() {
299         return soot.PhaseOptions.getBoolean( options, "topo-sort" );
300     }
301     
302     /** Dump Types --
303     
304      * Include declared types in dump.
305     
306      * When this option is set to true, the representation dumped by
307      * the Dump PAG option includes type information for all nodes.
308      * This option has no effect unless Dump PAG is true.
309      */

310     public boolean dump_types() {
311         return soot.PhaseOptions.getBoolean( options, "dump-types" );
312     }
313     
314     /** Class Method Var --
315     
316      * In dump, label variables by class and method.
317     
318      * When this option is set to true, the representation dumped by
319      * the Dump PAG option represents nodes by numbering each class,
320      * method, and variable within the method separately, rather than
321      * assigning a single integer to each node. This option has no
322      * effect unless Dump PAG is true. Setting Class Method Var to
323      * true has the effect of setting Topological Sort to false.
324      *
325      */

326     public boolean class_method_var() {
327         return soot.PhaseOptions.getBoolean( options, "class-method-var" );
328     }
329     
330     /** Dump Answer --
331     
332      * Dump computed reaching types for comparison with other solvers.
333     
334      * When this option is set to true, the computed reaching types
335      * for each variable are dumped to a file, so that they can be
336      * compared with the results of other analyses (such as the old
337      * VTA).
338      */

339     public boolean dump_answer() {
340         return soot.PhaseOptions.getBoolean( options, "dump-answer" );
341     }
342     
343     /** Add Tags --
344     
345      * Output points-to results in tags for viewing with the Jimple.
346     
347      * When this option is set to true, the results of the
348      * analysis are encoded within tags and printed with the resulting
349      * Jimple code.
350      */

351     public boolean add_tags() {
352         return soot.PhaseOptions.getBoolean( options, "add-tags" );
353     }
354     
355     /** Calculate Set Mass --
356     
357      * Calculate statistics about points-to set sizes.
358     
359      * When this option is set to true, Spark computes and prints
360      * various cryptic statistics about the size of the points-to sets
361      * computed.
362      */

363     public boolean set_mass() {
364         return soot.PhaseOptions.getBoolean( options, "set-mass" );
365     }
366     
367     public static final int propagator_iter = 1;
368     public static final int propagator_worklist = 2;
369     public static final int propagator_cycle = 3;
370     public static final int propagator_merge = 4;
371     public static final int propagator_alias = 5;
372     public static final int propagator_none = 6;
373     /** Propagator --
374     
375      * Select propagation algorithm.
376     
377      * This option tells Spark which propagation algorithm to use.
378      *
379      */

380     public int propagator() {
381         String JavaDoc s = soot.PhaseOptions.getString( options, "propagator" );
382         
383         if( s.equalsIgnoreCase( "iter" ) )
384             return propagator_iter;
385         
386         if( s.equalsIgnoreCase( "worklist" ) )
387             return propagator_worklist;
388         
389         if( s.equalsIgnoreCase( "cycle" ) )
390             return propagator_cycle;
391         
392         if( s.equalsIgnoreCase( "merge" ) )
393             return propagator_merge;
394         
395         if( s.equalsIgnoreCase( "alias" ) )
396             return propagator_alias;
397         
398         if( s.equalsIgnoreCase( "none" ) )
399             return propagator_none;
400         
401         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option propagator" );
402     }
403     
404     public static final int set_impl_hash = 1;
405     public static final int set_impl_bit = 2;
406     public static final int set_impl_hybrid = 3;
407     public static final int set_impl_array = 4;
408     public static final int set_impl_double = 5;
409     public static final int set_impl_shared = 6;
410     /** Set Implementation --
411     
412      * Select points-to set implementation.
413     
414      * Select an implementation of points-to sets for Spark to use.
415      */

416     public int set_impl() {
417         String JavaDoc s = soot.PhaseOptions.getString( options, "set-impl" );
418         
419         if( s.equalsIgnoreCase( "hash" ) )
420             return set_impl_hash;
421         
422         if( s.equalsIgnoreCase( "bit" ) )
423             return set_impl_bit;
424         
425         if( s.equalsIgnoreCase( "hybrid" ) )
426             return set_impl_hybrid;
427         
428         if( s.equalsIgnoreCase( "array" ) )
429             return set_impl_array;
430         
431         if( s.equalsIgnoreCase( "double" ) )
432             return set_impl_double;
433         
434         if( s.equalsIgnoreCase( "shared" ) )
435             return set_impl_shared;
436         
437         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option set-impl" );
438     }
439     
440     public static final int double_set_old_hash = 1;
441     public static final int double_set_old_bit = 2;
442     public static final int double_set_old_hybrid = 3;
443     public static final int double_set_old_array = 4;
444     public static final int double_set_old_shared = 5;
445     /** Double Set Old --
446     
447      * Select implementation of points-to set for old part of double
448      * set.
449     
450      * Select an implementation for sets of old objects in the double
451      * points-to set implementation. This option has no effect unless
452      * Set Implementation is set to double.
453      */

454     public int double_set_old() {
455         String JavaDoc s = soot.PhaseOptions.getString( options, "double-set-old" );
456         
457         if( s.equalsIgnoreCase( "hash" ) )
458             return double_set_old_hash;
459         
460         if( s.equalsIgnoreCase( "bit" ) )
461             return double_set_old_bit;
462         
463         if( s.equalsIgnoreCase( "hybrid" ) )
464             return double_set_old_hybrid;
465         
466         if( s.equalsIgnoreCase( "array" ) )
467             return double_set_old_array;
468         
469         if( s.equalsIgnoreCase( "shared" ) )
470             return double_set_old_shared;
471         
472         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option double-set-old" );
473     }
474     
475     public static final int double_set_new_hash = 1;
476     public static final int double_set_new_bit = 2;
477     public static final int double_set_new_hybrid = 3;
478     public static final int double_set_new_array = 4;
479     public static final int double_set_new_shared = 5;
480     /** Double Set New --
481     
482      * Select implementation of points-to set for new part of double
483      * set.
484     
485      * Select an implementation for sets of new objects in the double
486      * points-to set implementation. This option has no effect unless
487      * Set Implementation is set to double.
488      */

489     public int double_set_new() {
490         String JavaDoc s = soot.PhaseOptions.getString( options, "double-set-new" );
491         
492         if( s.equalsIgnoreCase( "hash" ) )
493             return double_set_new_hash;
494         
495         if( s.equalsIgnoreCase( "bit" ) )
496             return double_set_new_bit;
497         
498         if( s.equalsIgnoreCase( "hybrid" ) )
499             return double_set_new_hybrid;
500         
501         if( s.equalsIgnoreCase( "array" ) )
502             return double_set_new_array;
503         
504         if( s.equalsIgnoreCase( "shared" ) )
505             return double_set_new_shared;
506         
507         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option double-set-new" );
508     }
509     
510 }
511         
Popular Tags