c_src : Regenerated c_src to prevent use of String contructors
[nit.git] / c_src / global___dead_method_removal._sep.c
1 /* This C file is generated by NIT to compile module global___dead_method_removal. */
2 #include "global___dead_method_removal._sep.h"
3 static const char LOCATE_global___dead_method_removal___Program___nb_removed_iroutines[] = "dead_method_removal::Program::nb_removed_iroutines";
4 val_t global___dead_method_removal___Program___nb_removed_iroutines(val_t p0){
5 struct {struct stack_frame_t me;} fra;
6 val_t REGB0;
7 val_t tmp;
8 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
9 fra.me.file = LOCATE_global___dead_method_removal;
10 fra.me.line = 23;
11 fra.me.meth = LOCATE_global___dead_method_removal___Program___nb_removed_iroutines;
12 fra.me.has_broke = 0;
13 fra.me.REG_size = 1;
14 fra.me.nitni_local_ref_head = NULL;
15 fra.me.REG[0] = NIT_NULL;
16 fra.me.REG[0] = p0;
17 /* global/dead_method_removal.nit:23 */
18 REGB0 = TAG_Bool(ATTR_global___dead_method_removal___Program____nb_removed_iroutines(fra.me.REG[0])!=NIT_NULL);
19 if (UNTAG_Bool(REGB0)) {
20 } else {
21 nit_abort("Uninitialized attribute %s", "_nb_removed_iroutines", LOCATE_global___dead_method_removal, 23);
22 }
23 REGB0 = ATTR_global___dead_method_removal___Program____nb_removed_iroutines(fra.me.REG[0]);
24 stack_frame_head = fra.me.prev;
25 return REGB0;
26 }
27 static const char LOCATE_global___dead_method_removal___Program___nb_not_removed_iroutines[] = "dead_method_removal::Program::nb_not_removed_iroutines";
28 val_t global___dead_method_removal___Program___nb_not_removed_iroutines(val_t p0){
29 struct {struct stack_frame_t me;} fra;
30 val_t REGB0;
31 val_t tmp;
32 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
33 fra.me.file = LOCATE_global___dead_method_removal;
34 fra.me.line = 24;
35 fra.me.meth = LOCATE_global___dead_method_removal___Program___nb_not_removed_iroutines;
36 fra.me.has_broke = 0;
37 fra.me.REG_size = 1;
38 fra.me.nitni_local_ref_head = NULL;
39 fra.me.REG[0] = NIT_NULL;
40 fra.me.REG[0] = p0;
41 /* global/dead_method_removal.nit:24 */
42 REGB0 = TAG_Bool(ATTR_global___dead_method_removal___Program____nb_not_removed_iroutines(fra.me.REG[0])!=NIT_NULL);
43 if (UNTAG_Bool(REGB0)) {
44 } else {
45 nit_abort("Uninitialized attribute %s", "_nb_not_removed_iroutines", LOCATE_global___dead_method_removal, 24);
46 }
47 REGB0 = ATTR_global___dead_method_removal___Program____nb_not_removed_iroutines(fra.me.REG[0]);
48 stack_frame_head = fra.me.prev;
49 return REGB0;
50 }
51 static const char LOCATE_global___dead_method_removal___Program___optimize_dead_methods[] = "dead_method_removal::Program::optimize_dead_methods";
52 void global___dead_method_removal___Program___optimize_dead_methods(val_t p0){
53 struct {struct stack_frame_t me;} fra;
54 val_t tmp;
55 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
56 fra.me.file = LOCATE_global___dead_method_removal;
57 fra.me.line = 26;
58 fra.me.meth = LOCATE_global___dead_method_removal___Program___optimize_dead_methods;
59 fra.me.has_broke = 0;
60 fra.me.REG_size = 1;
61 fra.me.nitni_local_ref_head = NULL;
62 fra.me.REG[0] = NIT_NULL;
63 fra.me.REG[0] = p0;
64 CALL_program___Program___with_each_iroutines(fra.me.REG[0])(fra.me.REG[0], (&(fra.me)), ((fun_t)OC_global___dead_method_removal___Program___optimize_dead_methods_1));
65 stack_frame_head = fra.me.prev;
66 return;
67 }
68 void OC_global___dead_method_removal___Program___optimize_dead_methods_1(struct stack_frame_t *closctx, val_t p0, val_t p1){
69 struct {struct stack_frame_t me; val_t MORE_REG[2];} fra;
70 val_t REGB0;
71 val_t REGB1;
72 val_t tmp;
73 /* global/dead_method_removal.nit:29 */
74 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
75 fra.me.file = LOCATE_global___dead_method_removal;
76 fra.me.line = 29;
77 fra.me.meth = LOCATE_global___dead_method_removal___Program___optimize_dead_methods;
78 fra.me.has_broke = 0;
79 fra.me.REG_size = 3;
80 fra.me.nitni_local_ref_head = NULL;
81 fra.me.REG[0] = NIT_NULL;
82 fra.me.REG[1] = NIT_NULL;
83 fra.me.REG[2] = NIT_NULL;
84 fra.me.REG[0] = p0;
85 fra.me.REG[1] = p1;
86 /* global/dead_method_removal.nit:30 */
87 fra.me.REG[2] = CALL_global___reachable_method_analysis___Program___rma(closctx->REG[0])(closctx->REG[0]);
88 REGB0 = TAG_Bool(fra.me.REG[2]==NIT_NULL);
89 if (UNTAG_Bool(REGB0)) {
90 nit_abort("Reciever is null", NULL, LOCATE_global___dead_method_removal, 30);
91 }
92 REGB0 = CALL_global___reachable_method_analysis___ReachableMethodAnalysis___is_iroutine_reachable(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[0]);
93 REGB0 = TAG_Bool(!UNTAG_Bool(REGB0));
94 if (UNTAG_Bool(REGB0)) {
95 /* global/dead_method_removal.nit:31 */
96 CALL_global___dead_method_removal___IRoutine___set_not_reachable(fra.me.REG[0])(fra.me.REG[0], fra.me.REG[1]);
97 /* global/dead_method_removal.nit:32 */
98 REGB0 = CALL_global___dead_method_removal___Program___nb_removed_iroutines(closctx->REG[0])(closctx->REG[0]);
99 REGB1 = TAG_Int(1);
100 /* ../lib/standard/kernel.nit:245 */
101 REGB1 = TAG_Int(UNTAG_Int(REGB0)+UNTAG_Int(REGB1));
102 /* global/dead_method_removal.nit:32 */
103 ATTR_global___dead_method_removal___Program____nb_removed_iroutines(closctx->REG[0]) = REGB1;
104 } else {
105 /* global/dead_method_removal.nit:34 */
106 REGB1 = CALL_global___dead_method_removal___Program___nb_not_removed_iroutines(closctx->REG[0])(closctx->REG[0]);
107 REGB0 = TAG_Int(1);
108 /* ../lib/standard/kernel.nit:245 */
109 REGB0 = TAG_Int(UNTAG_Int(REGB1)+UNTAG_Int(REGB0));
110 /* global/dead_method_removal.nit:34 */
111 ATTR_global___dead_method_removal___Program____nb_not_removed_iroutines(closctx->REG[0]) = REGB0;
112 }
113 stack_frame_head = fra.me.prev;
114 return;
115 }
116 static const char LOCATE_global___dead_method_removal___Program___dump_dead_method_optimization[] = "dead_method_removal::Program::dump_dead_method_optimization";
117 void global___dead_method_removal___Program___dump_dead_method_optimization(val_t p0, val_t p1){
118 struct {struct stack_frame_t me; val_t MORE_REG[3];} fra;
119 val_t REGB0;
120 val_t tmp;
121 static val_t once_value_1; /* Once value */
122 static val_t once_value_2; /* Once value */
123 static val_t once_value_3; /* Once value */
124 static val_t once_value_4; /* Once value */
125 static val_t once_value_5; /* Once value */
126 static val_t once_value_6; /* Once value */
127 static val_t once_value_7; /* Once value */
128 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
129 fra.me.file = LOCATE_global___dead_method_removal;
130 fra.me.line = 39;
131 fra.me.meth = LOCATE_global___dead_method_removal___Program___dump_dead_method_optimization;
132 fra.me.has_broke = 0;
133 fra.me.REG_size = 4;
134 fra.me.nitni_local_ref_head = NULL;
135 fra.me.REG[0] = NIT_NULL;
136 fra.me.REG[1] = NIT_NULL;
137 fra.me.REG[2] = NIT_NULL;
138 fra.me.REG[3] = NIT_NULL;
139 fra.me.REG[0] = p0;
140 fra.me.REG[1] = p1;
141 /* global/dead_method_removal.nit:41 */
142 REGB0 = TAG_Int(5);
143 fra.me.REG[2] = NEW_Array_standard___collection___array___Array___with_capacity(REGB0);
144 if (!once_value_1) {
145 fra.me.REG[3] = BOX_NativeString("");
146 REGB0 = TAG_Int(0);
147 fra.me.REG[3] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[3])(fra.me.REG[3], REGB0);
148 once_value_1 = fra.me.REG[3];
149 register_static_object(&once_value_1);
150 } else fra.me.REG[3] = once_value_1;
151 fra.me.REG[3] = fra.me.REG[3];
152 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[3]);
153 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[1]);
154 if (!once_value_2) {
155 fra.me.REG[1] = BOX_NativeString("/");
156 REGB0 = TAG_Int(1);
157 fra.me.REG[1] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[1])(fra.me.REG[1], REGB0);
158 once_value_2 = fra.me.REG[1];
159 register_static_object(&once_value_2);
160 } else fra.me.REG[1] = once_value_2;
161 fra.me.REG[1] = fra.me.REG[1];
162 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[1]);
163 fra.me.REG[1] = CALL_program___Program___main_module(fra.me.REG[0])(fra.me.REG[0]);
164 fra.me.REG[1] = CALL_metamodel___abstractmetamodel___MMModule___name(fra.me.REG[1])(fra.me.REG[1]);
165 fra.me.REG[1] = CALL_standard___string___Object___to_s(fra.me.REG[1])(fra.me.REG[1]);
166 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[1]);
167 if (!once_value_3) {
168 fra.me.REG[1] = BOX_NativeString(".dmr_opt.log");
169 REGB0 = TAG_Int(12);
170 fra.me.REG[1] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[1])(fra.me.REG[1], REGB0);
171 once_value_3 = fra.me.REG[1];
172 register_static_object(&once_value_3);
173 } else fra.me.REG[1] = once_value_3;
174 fra.me.REG[1] = fra.me.REG[1];
175 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[1]);
176 fra.me.REG[2] = CALL_standard___string___Object___to_s(fra.me.REG[2])(fra.me.REG[2]);
177 fra.me.REG[2] = NEW_OFStream_standard___file___OFStream___open(fra.me.REG[2]);
178 /* global/dead_method_removal.nit:43 */
179 REGB0 = TAG_Int(3);
180 fra.me.REG[1] = NEW_Array_standard___collection___array___Array___with_capacity(REGB0);
181 if (!once_value_4) {
182 fra.me.REG[3] = BOX_NativeString("Nb. dead iroutines removed: ");
183 REGB0 = TAG_Int(28);
184 fra.me.REG[3] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[3])(fra.me.REG[3], REGB0);
185 once_value_4 = fra.me.REG[3];
186 register_static_object(&once_value_4);
187 } else fra.me.REG[3] = once_value_4;
188 fra.me.REG[3] = fra.me.REG[3];
189 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[3]);
190 REGB0 = CALL_global___dead_method_removal___Program___nb_removed_iroutines(fra.me.REG[0])(fra.me.REG[0]);
191 fra.me.REG[3] = CALL_standard___string___Object___to_s(REGB0)(REGB0);
192 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[3]);
193 if (!once_value_5) {
194 fra.me.REG[3] = BOX_NativeString("\n");
195 REGB0 = TAG_Int(1);
196 fra.me.REG[3] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[3])(fra.me.REG[3], REGB0);
197 once_value_5 = fra.me.REG[3];
198 register_static_object(&once_value_5);
199 } else fra.me.REG[3] = once_value_5;
200 fra.me.REG[3] = fra.me.REG[3];
201 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[3]);
202 fra.me.REG[1] = CALL_standard___string___Object___to_s(fra.me.REG[1])(fra.me.REG[1]);
203 CALL_standard___stream___OStream___write(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[1]);
204 /* global/dead_method_removal.nit:44 */
205 REGB0 = TAG_Int(3);
206 fra.me.REG[1] = NEW_Array_standard___collection___array___Array___with_capacity(REGB0);
207 if (!once_value_6) {
208 fra.me.REG[3] = BOX_NativeString("Nb. live iroutines: ");
209 REGB0 = TAG_Int(20);
210 fra.me.REG[3] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[3])(fra.me.REG[3], REGB0);
211 once_value_6 = fra.me.REG[3];
212 register_static_object(&once_value_6);
213 } else fra.me.REG[3] = once_value_6;
214 fra.me.REG[3] = fra.me.REG[3];
215 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[3]);
216 REGB0 = CALL_global___dead_method_removal___Program___nb_not_removed_iroutines(fra.me.REG[0])(fra.me.REG[0]);
217 fra.me.REG[0] = CALL_standard___string___Object___to_s(REGB0)(REGB0);
218 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[0]);
219 if (!once_value_7) {
220 fra.me.REG[0] = BOX_NativeString("\n");
221 REGB0 = TAG_Int(1);
222 fra.me.REG[0] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[0])(fra.me.REG[0], REGB0);
223 once_value_7 = fra.me.REG[0];
224 register_static_object(&once_value_7);
225 } else fra.me.REG[0] = once_value_7;
226 fra.me.REG[0] = fra.me.REG[0];
227 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[0]);
228 fra.me.REG[1] = CALL_standard___string___Object___to_s(fra.me.REG[1])(fra.me.REG[1]);
229 CALL_standard___stream___OStream___write(fra.me.REG[2])(fra.me.REG[2], fra.me.REG[1]);
230 /* global/dead_method_removal.nit:46 */
231 CALL_standard___stream___IOS___close(fra.me.REG[2])(fra.me.REG[2]);
232 stack_frame_head = fra.me.prev;
233 return;
234 }
235 static const char LOCATE_global___dead_method_removal___IRoutine___set_not_reachable[] = "dead_method_removal::IRoutine::set_not_reachable";
236 void global___dead_method_removal___IRoutine___set_not_reachable(val_t p0, val_t p1){
237 struct {struct stack_frame_t me; val_t MORE_REG[2];} fra;
238 val_t REGB0;
239 val_t tmp;
240 static val_t once_value_1; /* Once value */
241 fra.me.prev = stack_frame_head; stack_frame_head = &fra.me;
242 fra.me.file = LOCATE_global___dead_method_removal;
243 fra.me.line = 51;
244 fra.me.meth = LOCATE_global___dead_method_removal___IRoutine___set_not_reachable;
245 fra.me.has_broke = 0;
246 fra.me.REG_size = 3;
247 fra.me.nitni_local_ref_head = NULL;
248 fra.me.REG[0] = NIT_NULL;
249 fra.me.REG[1] = NIT_NULL;
250 fra.me.REG[2] = NIT_NULL;
251 fra.me.REG[0] = p0;
252 fra.me.REG[1] = p1;
253 /* global/dead_method_removal.nit:53 */
254 fra.me.REG[0] = NEW_ICodeBuilder_icode___icode_builder___ICodeBuilder___init(fra.me.REG[1], fra.me.REG[0]);
255 /* global/dead_method_removal.nit:54 */
256 fra.me.REG[1] = CALL_icode___icode_builder___ICodeBuilder___seq(fra.me.REG[0])(fra.me.REG[0]);
257 fra.me.REG[1] = CALL_icode___icode_base___ISeq___icodes(fra.me.REG[1])(fra.me.REG[1]);
258 CALL_standard___collection___abstract_collection___RemovableCollection___clear(fra.me.REG[1])(fra.me.REG[1]);
259 /* global/dead_method_removal.nit:55 */
260 REGB0 = TAG_Int(0);
261 fra.me.REG[1] = NEW_Array_standard___collection___array___Array___with_capacity(REGB0);
262 if (!once_value_1) {
263 fra.me.REG[2] = BOX_NativeString("This method should not be called !");
264 REGB0 = TAG_Int(34);
265 fra.me.REG[2] = CALL_standard___string___NativeString___to_s_with_length(fra.me.REG[2])(fra.me.REG[2], REGB0);
266 once_value_1 = fra.me.REG[2];
267 register_static_object(&once_value_1);
268 } else fra.me.REG[2] = once_value_1;
269 fra.me.REG[2] = fra.me.REG[2];
270 CALL_standard___collection___abstract_collection___SimpleCollection___add(fra.me.REG[1])(fra.me.REG[1], fra.me.REG[2]);
271 CALL_icode___icode_builder___ICodeBuilder___add_abort(fra.me.REG[0])(fra.me.REG[0], fra.me.REG[1]);
272 stack_frame_head = fra.me.prev;
273 return;
274 }