Skip to content

Commit 16c58ba

Browse files
authored
Merge pull request #2024 from andrew-johnson-4/maybe-gc-enabled-now-fdsklell
universal zero initializer is much faster than memset
2 parents 07e6a0e + be74af4 commit 16c58ba

File tree

6 files changed

+3340
-3338
lines changed

6 files changed

+3340
-3338
lines changed

BOOTSTRAP/cli.c

Lines changed: 3328 additions & 3328 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ dev: install-production
1111
#lm --showalloc SRC/unit-tctx-core.lsts > out.txt
1212
#lm --showalloc SRC/unit-prop-core.lsts > out.txt
1313
#lm --showalloc SRC/unit-ascript-core.lsts > out.txt
14-
lm --showalloc --v23 SRC/index.lsts > out.txt
14+
#lm --showalloc SRC/index.lsts > out.txt
15+
lm tests/promises/typechecking/misc-linear-error-1.lsts
1516

1617
build: compile-production
1718
time env $(LSTSFLAGS) ./production --v23 --c -o deploy1.c SRC/index.lsts

PLUGINS/BACKEND/C/std-c-compile-expr.lsts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ let std-c-compile-expr(ctx: FContext, t: AST, is-stmt: Bool): Fragment = (
102102
f = f.set(c"frame",
103103
f.get(c"frame") + pre + SAtom(c" ")
104104
+ v.get(c"expression")
105-
+ SAtom(c" ") + post + SAtom(c";")
106-
+ SAtom(c"memset(&") + v.get(c"expression")
107-
+ SAtom(c",0,sizeof(") + v.get(c"expression") + SAtom(c"));")
105+
+ SAtom(c" ") + post + SAtom(c"={0};")
108106
);
109107
};
110108
match rhs {

SRC/typecheck-infer-expr.lsts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
173173
};
174174
if non-zero(term-phi-id) and term-phi-id != t-phi-id then tctx = tctx.phi-move(typeof-term(t), t);
175175
if non-zero(term-phi-id) and term-phi-id != f-phi-id then tctx = tctx.phi-move(typeof-term(f), f);
176+
if (typeof-term(term).is-t(c"Nil",0) or typeof-term(term).is-t(c"Never",0)) and non-zero(t-phi-id) then tctx = tctx.phi-move(typeof-term(t), t);
177+
if (typeof-term(term).is-t(c"Nil",0) or typeof-term(term).is-t(c"Never",0)) and non-zero(f-phi-id) then tctx = tctx.phi-move(typeof-term(f), f);
176178
}
177179
);
178180
ASTEOF{} => tctx = tctx.ascript(term, t0(c"Nil"));

SRC/typecheck-infer-type-definition.lsts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,7 @@ let infer-type-yield-constructor(base-type: Type, case-tag: CString, case-number
168168
body = mk-cons(body, mk-lit(c" ").ascript(t0(c"L") && t0(c"Literal")));
169169
body = mk-cons(body, mk-lit(return-id).ascript(t0(c"L") && t0(c"Literal")));
170170
body = mk-cons(body, mk-app(mk-var(c"mangle-post"),mk-atype(t1(c"Type",base-type))) );
171-
body = mk-cons(body, mk-lit(c";").ascript(t0(c"L") && t0(c"Literal")));
172-
body = mk-cons(body, mk-lit(c"memset(&").ascript(t0(c"L") && t0(c"Literal")));
173-
body = mk-cons(body, mk-lit(return-id).ascript(t0(c"L") && t0(c"Literal")));
174-
body = mk-cons(body, mk-lit(c",0,sizeof ").ascript(t0(c"L") && t0(c"Literal")));
175-
body = mk-cons(body, mk-lit(return-id).ascript(t0(c"L") && t0(c"Literal")));
176-
body = mk-cons(body, mk-lit(c");").ascript(t0(c"L") && t0(c"Literal")));
171+
body = mk-cons(body, mk-lit(c"={0};").ascript(t0(c"L") && t0(c"Literal")));
177172

178173
if has-tag-case {
179174
body = mk-cons(body, mk-lit(return-id).ascript(t0(c"L") && t0(c"Literal")) );
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import lib/core/bedrock.lsts;
3+
4+
let f(): Nil = (
5+
if true then "";
6+
);

0 commit comments

Comments
 (0)