KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > options > PaddleOptions


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 Paddle. */
27 public class PaddleOptions
28 {
29     private Map options;
30
31     public PaddleOptions( 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 Paddle.
48     
49      * When this option is set to true, Paddle prints detailed
50      * information about its execution.
51      */

52     public boolean verbose() {
53         return soot.PhaseOptions.getBoolean( options, "verbose" );
54     }
55     
56     /** Use BDDs --
57     
58      * Use BDD version of Paddle.
59     
60      * Causes
61      * Paddle to use BDD versions of its components
62      */

63     public boolean bdd() {
64         return soot.PhaseOptions.getBoolean( options, "bdd" );
65     }
66     
67     /** Dynamic reordering --
68     
69      * .
70     
71      * Allows the BDD package
72      * to perform dynamic variable ordering.
73      */

74     public boolean dynamic_order() {
75         return soot.PhaseOptions.getBoolean( options, "dynamic-order" );
76     }
77     
78     /** Profile --
79     
80      * Profile BDDs using JeddProfiler.
81     
82      * Turns on JeddProfiler for profiling BDD operations.
83      */

84     public boolean profile() {
85         return soot.PhaseOptions.getBoolean( options, "profile" );
86     }
87     
88     /** Ignore Types Entirely --
89     
90      * Make Paddle completely ignore declared types of variables.
91     
92      * When this option is set to true, all parts of Paddle completely
93      * ignore declared types of variables and casts.
94      */

95     public boolean ignore_types() {
96         return soot.PhaseOptions.getBoolean( options, "ignore-types" );
97     }
98     
99     /** Pre Jimplify --
100     
101      * Jimplify all methods before starting Paddle.
102     
103      * When this option is set to true, Paddle converts all available
104      * methods to Jimple before starting the points-to analysis. This
105      * allows the Jimplification time to be separated from the
106      * points-to time. However, it increases the total time and memory
107      * requirement, because all methods are Jimplified, rather than
108      * only those deemed reachable by the points-to analysis.
109      */

110     public boolean pre_jimplify() {
111         return soot.PhaseOptions.getBoolean( options, "pre-jimplify" );
112     }
113     
114     /** Context-sensitive Heap Locations --
115     
116      * Treat allocation sites context-sensitively.
117     
118      * When this option is set to true, the context-sensitivity level
119      * that is set for the context-sensitive call graph and for pointer
120      * variables is also used to model heap locations
121      * context-sensitively. When this option is false, heap locations
122      * are modelled context-insensitively regardless of the
123      * context-sensitivity level.
124      */

125     public boolean context_heap() {
126         return soot.PhaseOptions.getBoolean( options, "context-heap" );
127     }
128     
129     /** RTA --
130     
131      * Emulate Rapid Type Analysis.
132     
133      * Setting RTA to true sets types-for-sites to true, and causes
134      * Paddle to use a single points-to set for all variables, giving
135      * Rapid Type Analysis.
136      */

137     public boolean rta() {
138         return soot.PhaseOptions.getBoolean( options, "rta" );
139     }
140     
141     /** Field Based --
142     
143      * Use a field-based rather than field-sensitive representation.
144     
145      * When this option is set to true, fields are represented by
146      * variable (Green) nodes, and the object that the field belongs to
147      * is ignored (all objects are lumped together), giving a
148      * field-based analysis. Otherwise, fields are represented by field
149      * reference (Red) nodes, and the objects that they belong to are
150      * distinguished, giving a field-sensitive analysis.
151      */

152     public boolean field_based() {
153         return soot.PhaseOptions.getBoolean( options, "field-based" );
154     }
155     
156     /** Types For Sites --
157     
158      * Represent objects by their actual type rather than allocation
159      * site.
160     
161      * When this option is set to true, types rather than allocation
162      * sites are used as the elements of the points-to sets.
163      */

164     public boolean types_for_sites() {
165         return soot.PhaseOptions.getBoolean( options, "types-for-sites" );
166     }
167     
168     /** Merge String Buffer --
169     
170      * Represent all StringBuffers as one object.
171     
172      * When this option is set to true, all allocation sites creating
173      * java.lang.StringBuffer objects are grouped together as a single
174      * allocation site.
175      */

176     public boolean merge_stringbuffer() {
177         return soot.PhaseOptions.getBoolean( options, "merge-stringbuffer" );
178     }
179     
180     /** Propagate All String Constants --
181     
182      * Propagate all string constants, not just class names.
183     
184      * When this option is set to false, Paddle only distinguishes
185      * string constants that may be the name of a class loaded
186      * dynamically using reflection, and all other string constants are
187      * lumped together into a single string constant node. Setting this
188      * option to true causes all string constants to be propagated
189      * individually.
190      */

191     public boolean string_constants() {
192         return soot.PhaseOptions.getBoolean( options, "string-constants" );
193     }
194     
195     /** Simulate Natives --
196     
197      * Simulate effects of native methods in standard class library.
198     
199      * When this option is set to true, the effects of native methods
200      * in the standard Java class library are simulated.
201      */

202     public boolean simulate_natives() {
203         return soot.PhaseOptions.getBoolean( options, "simulate-natives" );
204     }
205     
206     /** Global Nodes in Simulated Natives --
207     
208      * Use global node to model variables in simulations of native
209      * methods.
210     
211      * The simulations of native methods such as System.arraycopy()
212      * use temporary local variable nodes. Setting this switch to true
213      * causes them to use global variable nodes instead, reducing
214      * precision. The switch exists only to make it possible to measure
215      * this effect on precision; there is no other practical reason to
216      * set it to true.
217      */

218     public boolean global_nodes_in_natives() {
219         return soot.PhaseOptions.getBoolean( options, "global-nodes-in-natives" );
220     }
221     
222     /** Simple Edges Bidirectional --
223     
224      * Equality-based analysis between variable nodes.
225     
226      * When this option is set to true, all edges connecting variable
227      * (Green) nodes are made bidirectional, as in Steensgaard's
228      * analysis.
229      */

230     public boolean simple_edges_bidirectional() {
231         return soot.PhaseOptions.getBoolean( options, "simple-edges-bidirectional" );
232     }
233     
234     /** this Pointer Assignment Edge --
235     
236      * Use pointer assignment edges to model this parameters.
237     
238      * When constructing a call graph on-the-fly during points-to
239      * analysis, Paddle normally propagates only those receivers that
240      * cause a method to be invoked to the this pointer of the method.
241      * When this option is set to true, however, Paddle instead models
242      * flow of receivers as an assignnment edge from the receiver at
243      * the call site to the this pointer of the method, reducing
244      * precision.
245      */

246     public boolean this_edges() {
247         return soot.PhaseOptions.getBoolean( options, "this-edges" );
248     }
249     
250     /** Precise newInstance --
251     
252      * Make newInstance only allocate objects of dynamic classes.
253     
254      * Normally, newInstance() calls are treated as if they may
255      * return an object of any type. Setting this option to true
256      * causes them to be treated as if they return only objects of
257      * the type of some dynamic class.
258      */

259     public boolean precise_newinstance() {
260         return soot.PhaseOptions.getBoolean( options, "precise-newinstance" );
261     }
262     
263     /** Print Context Counts --
264     
265      * Print number of contexts for each method.
266     
267      * Causes Paddle to print the number of contexts for each method
268      * and call edge, and the number of equivalence classes of contexts
269      * for each variable node.
270      */

271     public boolean context_counts() {
272         return soot.PhaseOptions.getBoolean( options, "context-counts" );
273     }
274     
275     /** Print Context Counts (Totals only) --
276     
277      * Print total number of contexts.
278     
279      * Causes Paddle to print the number of contexts and number of
280      * context equivalence classes.
281      */

282     public boolean total_context_counts() {
283         return soot.PhaseOptions.getBoolean( options, "total-context-counts" );
284     }
285     
286     /** Method Context Counts (Totals only) --
287     
288      * Print number of contexts for each method.
289     
290      * Causes Paddle to print the number of contexts and number of
291      * context equivalence classes split out by method. Requires
292      * total-context-counts to also be turned on.
293      */

294     public boolean method_context_counts() {
295         return soot.PhaseOptions.getBoolean( options, "method-context-counts" );
296     }
297     
298     /** Calculate Set Mass --
299     
300      * Calculate statistics about points-to set sizes.
301     
302      * When this option is set to true, Paddle computes and prints
303      * various cryptic statistics about the size of the points-to sets
304      * computed.
305      */

306     public boolean set_mass() {
307         return soot.PhaseOptions.getBoolean( options, "set-mass" );
308     }
309     
310     /** Number nodes --
311     
312      * Print node numbers in dumps.
313     
314      * When printing debug information about nodes, this option causes
315      * the node number of each node to be printed.
316      */

317     public boolean number_nodes() {
318         return soot.PhaseOptions.getBoolean( options, "number-nodes" );
319     }
320     
321     /** Variable ordering --
322     
323      * .
324     
325      * Selects one of the BDD
326      * variable orderings hard-coded in Paddle.
327      */

328     public int order() {
329         return soot.PhaseOptions.getInt( options, "order" );
330     }
331     
332     /** Context length (k) --
333     
334      * .
335     
336      * The maximum length of
337      * call string or receiver object string used as context.
338      *
339      */

340     public int k() {
341         return soot.PhaseOptions.getInt( options, "k" );
342     }
343     
344     public static final int conf_ofcg = 1;
345     public static final int conf_cha = 2;
346     public static final int conf_cha_aot = 3;
347     public static final int conf_ofcg_aot = 4;
348     public static final int conf_cha_context_aot = 5;
349     public static final int conf_ofcg_context_aot = 6;
350     public static final int conf_cha_context = 7;
351     public static final int conf_ofcg_context = 8;
352     /** Configuration --
353     
354      * Select Paddle configuration.
355     
356      * Selects the configuration of points-to analysis and call graph
357      * construction to be used in Paddle.
358      */

359     public int conf() {
360         String JavaDoc s = soot.PhaseOptions.getString( options, "conf" );
361         
362         if( s.equalsIgnoreCase( "ofcg" ) )
363             return conf_ofcg;
364         
365         if( s.equalsIgnoreCase( "cha" ) )
366             return conf_cha;
367         
368         if( s.equalsIgnoreCase( "cha-aot" ) )
369             return conf_cha_aot;
370         
371         if( s.equalsIgnoreCase( "ofcg-aot" ) )
372             return conf_ofcg_aot;
373         
374         if( s.equalsIgnoreCase( "cha-context-aot" ) )
375             return conf_cha_context_aot;
376         
377         if( s.equalsIgnoreCase( "ofcg-context-aot" ) )
378             return conf_ofcg_context_aot;
379         
380         if( s.equalsIgnoreCase( "cha-context" ) )
381             return conf_cha_context;
382         
383         if( s.equalsIgnoreCase( "ofcg-context" ) )
384             return conf_ofcg_context;
385         
386         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option conf" );
387     }
388     
389     public static final int q_auto = 1;
390     public static final int q_trad = 2;
391     public static final int q_bdd = 3;
392     public static final int q_debug = 4;
393     public static final int q_trace = 5;
394     public static final int q_numtrace = 6;
395     /** Worklist Implementation --
396     
397      * Select queue implementation.
398     
399      * Select the implementation of worklists to be used in Paddle.
400      *
401      */

402     public int q() {
403         String JavaDoc s = soot.PhaseOptions.getString( options, "q" );
404         
405         if( s.equalsIgnoreCase( "auto" ) )
406             return q_auto;
407         
408         if( s.equalsIgnoreCase( "trad" ) )
409             return q_trad;
410         
411         if( s.equalsIgnoreCase( "bdd" ) )
412             return q_bdd;
413         
414         if( s.equalsIgnoreCase( "debug" ) )
415             return q_debug;
416         
417         if( s.equalsIgnoreCase( "trace" ) )
418             return q_trace;
419         
420         if( s.equalsIgnoreCase( "numtrace" ) )
421             return q_numtrace;
422         
423         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option q" );
424     }
425     
426     public static final int backend_buddy = 1;
427     public static final int backend_cudd = 2;
428     public static final int backend_sable = 3;
429     public static final int backend_javabdd = 4;
430     public static final int backend_none = 5;
431     /** Backend --
432     
433      * Select BDD backend.
434     
435      * This option tells Paddle which implementation of BDDs to use.
436      *
437      */

438     public int backend() {
439         String JavaDoc s = soot.PhaseOptions.getString( options, "backend" );
440         
441         if( s.equalsIgnoreCase( "buddy" ) )
442             return backend_buddy;
443         
444         if( s.equalsIgnoreCase( "cudd" ) )
445             return backend_cudd;
446         
447         if( s.equalsIgnoreCase( "sable" ) )
448             return backend_sable;
449         
450         if( s.equalsIgnoreCase( "javabdd" ) )
451             return backend_javabdd;
452         
453         if( s.equalsIgnoreCase( "none" ) )
454             return backend_none;
455         
456         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option backend" );
457     }
458     
459     public static final int context_insens = 1;
460     public static final int context_1cfa = 2;
461     public static final int context_kcfa = 3;
462     public static final int context_objsens = 4;
463     public static final int context_kobjsens = 5;
464     public static final int context_uniqkobjsens = 6;
465     /** Context abstraction --
466     
467      * Select context-sensitivity level.
468     
469      * This option tells Paddle which level of context-sensitivity to
470      * use in constructing the call graph.
471      */

472     public int context() {
473         String JavaDoc s = soot.PhaseOptions.getString( options, "context" );
474         
475         if( s.equalsIgnoreCase( "insens" ) )
476             return context_insens;
477         
478         if( s.equalsIgnoreCase( "1cfa" ) )
479             return context_1cfa;
480         
481         if( s.equalsIgnoreCase( "kcfa" ) )
482             return context_kcfa;
483         
484         if( s.equalsIgnoreCase( "objsens" ) )
485             return context_objsens;
486         
487         if( s.equalsIgnoreCase( "kobjsens" ) )
488             return context_kobjsens;
489         
490         if( s.equalsIgnoreCase( "uniqkobjsens" ) )
491             return context_uniqkobjsens;
492         
493         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option context" );
494     }
495     
496     public static final int propagator_auto = 1;
497     public static final int propagator_iter = 2;
498     public static final int propagator_worklist = 3;
499     public static final int propagator_alias = 4;
500     public static final int propagator_bdd = 5;
501     public static final int propagator_incbdd = 6;
502     /** Propagator --
503     
504      * Select propagation algorithm.
505     
506      * This option tells Paddle which propagation algorithm to use.
507      *
508      */

509     public int propagator() {
510         String JavaDoc s = soot.PhaseOptions.getString( options, "propagator" );
511         
512         if( s.equalsIgnoreCase( "auto" ) )
513             return propagator_auto;
514         
515         if( s.equalsIgnoreCase( "iter" ) )
516             return propagator_iter;
517         
518         if( s.equalsIgnoreCase( "worklist" ) )
519             return propagator_worklist;
520         
521         if( s.equalsIgnoreCase( "alias" ) )
522             return propagator_alias;
523         
524         if( s.equalsIgnoreCase( "bdd" ) )
525             return propagator_bdd;
526         
527         if( s.equalsIgnoreCase( "incbdd" ) )
528             return propagator_incbdd;
529         
530         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option propagator" );
531     }
532     
533     public static final int set_impl_hash = 1;
534     public static final int set_impl_bit = 2;
535     public static final int set_impl_hybrid = 3;
536     public static final int set_impl_array = 4;
537     public static final int set_impl_double = 5;
538     /** Set Implementation --
539     
540      * Select points-to set implementation.
541     
542      * Select an implementation of points-to sets for Paddle to use.
543      */

544     public int set_impl() {
545         String JavaDoc s = soot.PhaseOptions.getString( options, "set-impl" );
546         
547         if( s.equalsIgnoreCase( "hash" ) )
548             return set_impl_hash;
549         
550         if( s.equalsIgnoreCase( "bit" ) )
551             return set_impl_bit;
552         
553         if( s.equalsIgnoreCase( "hybrid" ) )
554             return set_impl_hybrid;
555         
556         if( s.equalsIgnoreCase( "array" ) )
557             return set_impl_array;
558         
559         if( s.equalsIgnoreCase( "double" ) )
560             return set_impl_double;
561         
562         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option set-impl" );
563     }
564     
565     public static final int double_set_old_hash = 1;
566     public static final int double_set_old_bit = 2;
567     public static final int double_set_old_hybrid = 3;
568     public static final int double_set_old_array = 4;
569     /** Double Set Old --
570     
571      * Select implementation of points-to set for old part of double
572      * set.
573     
574      * Select an implementation for sets of old objects in the double
575      * points-to set implementation. This option has no effect unless
576      * Set Implementation is set to double.
577      */

578     public int double_set_old() {
579         String JavaDoc s = soot.PhaseOptions.getString( options, "double-set-old" );
580         
581         if( s.equalsIgnoreCase( "hash" ) )
582             return double_set_old_hash;
583         
584         if( s.equalsIgnoreCase( "bit" ) )
585             return double_set_old_bit;
586         
587         if( s.equalsIgnoreCase( "hybrid" ) )
588             return double_set_old_hybrid;
589         
590         if( s.equalsIgnoreCase( "array" ) )
591             return double_set_old_array;
592         
593         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option double-set-old" );
594     }
595     
596     public static final int double_set_new_hash = 1;
597     public static final int double_set_new_bit = 2;
598     public static final int double_set_new_hybrid = 3;
599     public static final int double_set_new_array = 4;
600     /** Double Set New --
601     
602      * Select implementation of points-to set for new part of double
603      * set.
604     
605      * Select an implementation for sets of new objects in the double
606      * points-to set implementation. This option has no effect unless
607      * Set Implementation is set to double.
608      */

609     public int double_set_new() {
610         String JavaDoc s = soot.PhaseOptions.getString( options, "double-set-new" );
611         
612         if( s.equalsIgnoreCase( "hash" ) )
613             return double_set_new_hash;
614         
615         if( s.equalsIgnoreCase( "bit" ) )
616             return double_set_new_bit;
617         
618         if( s.equalsIgnoreCase( "hybrid" ) )
619             return double_set_new_hybrid;
620         
621         if( s.equalsIgnoreCase( "array" ) )
622             return double_set_new_array;
623         
624         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option double-set-new" );
625     }
626     
627 }
628         
Popular Tags