@@ -17,8 +17,6 @@ let std-c-finish-forced-imports(): S = (
1717let compile-global-c-main-term = mk-eof();
1818
1919let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
20- print("Compile Global \{k} = \{term}\n");
21- print("Allocated blocks \{safe-alloc-block-count-monotonic}, total memory = \{current_allocated_memory()}\n");
2220 let kt = typeof-term(term);
2321 std-c-force-import-clib(c"string.h");
2422 if k==c"" then ()
@@ -108,19 +106,15 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
108106 }
109107 );
110108 Abs{lhs=lhs,rhs=rhs,tt=tt} => (
111- print("Compile Global 3.1\n");
112109 if k!=c"main" and not(kt.is-t(c"C-FFI_s",0)) {
113110 k = mangle-identifier-function(k, kt.without-phi);
114111 };
115- print("Compile Global 3.2\n");
116112 ctx = std-c-compile-destructure-args( ctx, lhs, false );
117- print("Compile Global 3.3\n");
118113 let loc = term.location;
119114 let initialized = match rhs {
120115 App{ left:Lit{key:c":"}, right:App{ left:ASTNil{}, right:AType{asc-tt=tt} } } => asc-tt.is-t(c"Nil",0);
121116 _ => true;
122117 };
123- print("Compile Global 3.4\n");
124118 if initialized or can-unify(t1(c"C",t0(c"typedef")), tt) {
125119 let text = SNil();
126120 if not(config-strip-debug) and loc.filename != c"Unknown" {
@@ -143,10 +137,8 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
143137 assemble-gdecl-section = assemble-gdecl-section + text;
144138 }
145139 };
146- print("Compile Global 3.5\n");
147140
148141 if initialized {
149- print("Compile Global 3.5.1\n");
150142 let text = SNil();
151143 if not(config-strip-debug) and loc.filename != c"Unknown" {
152144 text = text + SAtom(c"\n#line ");
@@ -155,39 +147,29 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
155147 text = text + SAtom(loc.filename);
156148 text = text + SAtom(c"\"\n");
157149 };
158- print("Compile Global 3.5.2\n");
159150 if k==c"main" then text = text + SAtom(c"int")
160151 else text = text + std-c-mangle-type(typeof-term(rhs), term);
161- print("Compile Global 3.5.3\n");
162152 text = text + SAtom(c" ");
163153 text = text + SAtom(k);
164154 text = text + SAtom(c"(");
165155 text = text + std-c-compile-function-args(ctx, lhs);
166156 text = text + SAtom(c")");
167- print("Compile Global 3.5.4\n");
168157
169158 let e = std-c-compile-call(ctx, c"cdecl::return", rhs);
170- print("Compile Global 3.5.5\n");
171159 text = text + SAtom(c"{");
172160 if k==c"main" then text = text + assemble-string-initializer-section + assemble-global-initializer-section;
173161 text = text + e.get(c"frame") + e.get(c"expression") + SAtom(c"}");
174- print("Compile Global 3.5.6\n");
175162
176163 assemble-text-section = assemble-text-section + text + SAtom(c"\n");
177- print("Compile Global 3.5.7\n");
178164 };
179- print("Compile Global 3.6\n");
180165 );
181166 t => (
182- print("Compile Global 4.1\n");
183167 let tt = kt;
184168 if not(kt.is-t(c"C-FFI",0)) and not(tt.is-t(c"C-Fragment",0)) {
185169 k = mangle-identifier(k, tt.without-phi);
186170 };
187- print("Compile Global 4.2\n");
188171
189172 (let pre-decl, let post-decl) = std-c-mangle-declaration(tt, term);
190- print("Compile Global 4.3\n");
191173 let text = SNil();
192174 text = text + pre-decl;
193175 text = text + SAtom(c" ");
@@ -196,18 +178,15 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
196178 text = text + SAtom(c";\n");
197179 if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) then ()
198180 else assemble-gdecl-section = assemble-gdecl-section + text;
199- print("Compile Global 4.4\n");
200181
201182 let inner-expr = std-c-compile-expr( ctx, t, false );
202- print("Compile Global 4.5\n");
203183 if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) {
204184 text = inner-expr.get(c"expression") + SAtom(c";\n");
205185 assemble-global-initializer-section = assemble-global-initializer-section + text;
206186 } else {
207187 text = SAtom(k) + SAtom(c" = ") + inner-expr.get(c"expression") + SAtom(c";\n");
208188 assemble-global-initializer-section = assemble-global-initializer-section + text;
209189 };
210- print("Compile Global 4.6\n");
211190 );
212191 }
213192);
0 commit comments