KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > options > SIOptions


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 Static Inliner. */
27 public class SIOptions
28 {
29     private Map options;
30
31     public SIOptions( 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     /** Reconstruct Jimple body after inlining --
46     
47      * .
48     
49      * When a method with array parameters is inlined, its variables
50      * may need to be assigned different types than they had in the
51      * original method to produce compilable code. When this option is
52      * set, Soot re-runs the Jimple Body pack on each method body which
53      * has had another method inlined into it so that the typing
54      * algorithm can reassign the types.
55      */

56     public boolean rerun_jb() {
57         return soot.PhaseOptions.getBoolean( options, "rerun-jb" );
58     }
59     
60     /** Insert Null Checks --
61     
62      * .
63     
64      * Insert, before the inlined body of the target method, a check
65      * that throws a NullPointerException if the receiver object is
66      * null. This ensures that inlining will not eliminate exceptions
67      * which would have occurred in its absence.
68      */

69     public boolean insert_null_checks() {
70         return soot.PhaseOptions.getBoolean( options, "insert-null-checks" );
71     }
72     
73     /** Insert Redundant Casts --
74     
75      * .
76     
77      * Insert extra casts for the Java bytecode verifier. The
78      * verifier may complain if the inlined method uses this and the
79      * declared type of the receiver of the call being inlined is
80      * different from the type implementing the target method being
81      * inlined. Say, for example, that Singer is an interface declaring
82      * the sing() method and that the call graph shows that all
83      * receiver objects at a particular call site, singer.sing() (with
84      * singer declared as a Singer) are in fact Bird objects (Bird
85      * being a class that implements Singer). The implementation of
86      * Bird.sing() may perform operations on this which are only
87      * allowed on Birds, rather than Singers. The Insert Redundant
88      * Casts option ensures that this cannot lead to verification
89      * errors, by inserting a cast of bird to the Bird type before
90      * inlining the body of Bird.sing().
91      */

92     public boolean insert_redundant_casts() {
93         return soot.PhaseOptions.getBoolean( options, "insert-redundant-casts" );
94     }
95     
96     /** Max Container Size --
97     
98      * .
99     
100      * Determines the maximum number of Jimple statements for a
101      * container method. If a method has more than this number of
102      * Jimple statements, then no methods will be inlined into it.
103      *
104      */

105     public int max_container_size() {
106         return soot.PhaseOptions.getInt( options, "max-container-size" );
107     }
108     
109     /** Max Inlinee Size --
110     
111      * .
112     
113      * Determines the maximum number of Jimple statements for an
114      * inlinee method. If a method has more than this number of Jimple
115      * statements, then it will not be inlined into other methods.
116      *
117      */

118     public int max_inlinee_size() {
119         return soot.PhaseOptions.getInt( options, "max-inlinee-size" );
120     }
121     
122     /** Expansion Factor --
123     
124      * .
125     
126      * Determines the maximum allowed expansion of a method. Inlining
127      * will cause the method to grow by a factor of no more than the
128      * Expansion Factor.
129      */

130     public float expansion_factor() {
131         return soot.PhaseOptions.getFloat( options, "expansion-factor" );
132     }
133     
134     public static final int allowed_modifier_changes_unsafe = 1;
135     public static final int allowed_modifier_changes_safe = 2;
136     public static final int allowed_modifier_changes_none = 3;
137     /** Allowed Modifier Changes --
138     
139      * .
140     
141      * Specify which changes in visibility modifiers are allowed.
142      */

143     public int allowed_modifier_changes() {
144         String JavaDoc s = soot.PhaseOptions.getString( options, "allowed-modifier-changes" );
145         
146         if( s.equalsIgnoreCase( "unsafe" ) )
147             return allowed_modifier_changes_unsafe;
148         
149         if( s.equalsIgnoreCase( "safe" ) )
150             return allowed_modifier_changes_safe;
151         
152         if( s.equalsIgnoreCase( "none" ) )
153             return allowed_modifier_changes_none;
154         
155         throw new RuntimeException JavaDoc( "Invalid value "+s+" of phase option allowed-modifier-changes" );
156     }
157     
158 }
159         
Popular Tags