Skip to content

Commit 50db377

Browse files
committed
another 10MB freed
1 parent 630ea3a commit 50db377

9 files changed

Lines changed: 3418 additions & 3403 deletions

File tree

BOOTSTRAP/cli.c

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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ let .rewrite-if-reserved(s: CString): CString = (
6868
let std-c-compile-expr(ctx: FContext, t: AST, is-stmt: Bool): Fragment = (
6969
let f = match t {
7070
Var{ key=key } => (
71-
if typeof-term(t) <: t1(c"C",t0(c"void")) {
71+
if typeof-term(t) <: type-c-void {
7272
mk-fragment().set(c"expression",SAtom(c"({})"));
7373
} else if typeof-term(t).is-t(c"C-FFI",0) {
7474
mk-fragment().set(c"expression",SAtom(key.replace(c"-",c"_").rewrite-if-reserved));
@@ -89,12 +89,12 @@ let std-c-compile-expr(ctx: FContext, t: AST, is-stmt: Bool): Fragment = (
8989
);
9090
App{ left:Abs{lhs=lhs:Var{name=key}, rhs:ASTNil{}}, rhs=right } => (
9191
let lt = typeof-term(lhs).without-modifiers;
92-
let vid = if lt.is-t(c"Nil",0) or lt <: t1(c"C",t0(c"void")) then SAtom(c"({})") else if std-c-is-ctype(lt) then SAtom(name.replace(c"-",c"_").rewrite-if-reserved) else SAtom(uuid());
92+
let vid = if lt.is-t(c"Nil",0) or lt <: type-c-void then SAtom(c"({})") else if std-c-is-ctype(lt) then SAtom(name.replace(c"-",c"_").rewrite-if-reserved) else SAtom(uuid());
9393
let v = mk-fragment().set(c"expression",vid);
9494
let f = mk-fragment();
9595
std-c-fragment-context = std-c-fragment-context.bind( lhs, v );
9696
ctx = ctx.bind( name, lt, v );
97-
if lt.is-t(c"Nil",0) or lt.is-t(c"Never",0) or lt <: t1(c"C",t0(c"void")) {
97+
if lt.is-t(c"Nil",0) or lt.is-t(c"Never",0) or lt <: type-c-void {
9898
} else if lt <: t1(c"C",t0(c":Label")) {
9999
f = f.set(c"expression", v.get(c"expression") + SAtom(c":"));
100100
} else {
@@ -110,7 +110,7 @@ let std-c-compile-expr(ctx: FContext, t: AST, is-stmt: Bool): Fragment = (
110110
_ => (
111111
let rf = std-c-compile-expr(ctx, rhs, false);
112112
f = f.set(c"frame", f.get(c"frame") + rf.get(c"frame"));
113-
if lt.is-t(c"Nil",0) or lt.is-t(c"Never",0) or lt <: t1(c"C",t0(c"void")) {
113+
if lt.is-t(c"Nil",0) or lt.is-t(c"Never",0) or lt <: type-c-void {
114114
f = f.set(c"expression", SAtom(c"({") + rf.get(c"expression") + SAtom(c";({});})"));
115115
} else {
116116
f = f.set(c"expression", SAtom(c"({")

PLUGINS/BACKEND/C/std-c-compile-function-args.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let std-c-compile-function-args(ctx: FContext, lhs: AST): S = (
77
text = text + SAtom(c",");
88
if can-unify( t1(c"C",t0(c"...")), kt ) {
99
text = text + SAtom(c"...");
10-
} else if can-unify( t1(c"C",t0(c"void")), kt ) {
10+
} else if can-unify( type-c-void, kt ) {
1111
text = text + SAtom(c"void");
1212
} else {
1313
text = text + decl.first;
@@ -23,7 +23,7 @@ let std-c-compile-function-args(ctx: FContext, lhs: AST): S = (
2323
let text = SNil();
2424
if can-unify( t1(c"C",t0(c"...")), kt ) {
2525
text = text + SAtom(c"...");
26-
} else if can-unify( t1(c"C",t0(c"void")), kt ) {
26+
} else if can-unify( type-c-void, kt ) {
2727
text = text + SAtom(c"void");
2828
} else {
2929
text = text + decl.first;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
5656
text = text + SAtom(k);
5757
text = text + post-decl;
5858
text = text + SAtom(c";\n");
59-
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) then ()
59+
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: type-c-void then ()
6060
else if can-unify(t1(c"C",t0(c"typedef")), tt) or can-unify(t2(c"Array",t1(c"C",t0(c"typedef")),ta), tt) {
6161
assemble-header-typedef-section = assemble-header-typedef-section + text;
6262
} else {
@@ -72,14 +72,14 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
7272
if tt.is-t(c"C-Fragment",0) {
7373
match t {
7474
Lit{key=key} => (
75-
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) then ()
75+
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: type-c-void then ()
7676
else assemble-gdecl-section = assemble-gdecl-section + SAtom(key);
7777
gend = true;
7878
);
7979
_ => ();
8080
}
8181
};
82-
if not(gend) and (kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void"))) {
82+
if not(gend) and (kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: type-c-void) {
8383
let inner-expr = std-c-compile-expr( ctx, t, false );
8484
let text = inner-expr.get(c"expression") + SAtom(c";\n");
8585
assemble-global-initializer-section = assemble-global-initializer-section + text;
@@ -93,7 +93,7 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
9393
text = text + SAtom(c";\n");
9494

9595
let inner-expr = std-c-compile-expr( ctx, t, false );
96-
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) then {
96+
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: type-c-void then {
9797
text = SNil;
9898
text = SAtom(k) + SAtom(c" = ") + inner-expr.get(c"expression") + SAtom(c";\n");
9999
} else if can-unify(t1(c"C",t0(c"typedef")), tt) or can-unify(t2(c"Array",t1(c"C",t0(c"typedef")),ta), tt) {
@@ -176,11 +176,11 @@ let std-c-compile-global(ctx: FContext, k: CString, term: AST): Nil = (
176176
text = text + SAtom(k);
177177
text = text + post-decl;
178178
text = text + SAtom(c";\n");
179-
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) then ()
179+
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: type-c-void then ()
180180
else assemble-gdecl-section = assemble-gdecl-section + text;
181181

182182
let inner-expr = std-c-compile-expr( ctx, t, false );
183-
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: t1(c"C",t0(c"void")) {
183+
if kt.is-t(c"Nil",0) or kt.is-t(c"Never",0) or kt <: type-c-void {
184184
text = inner-expr.get(c"expression") + SAtom(c";\n");
185185
assemble-global-initializer-section = assemble-global-initializer-section + text;
186186
} else {

PLUGINS/FRONTEND/C/c-ast-to-lm-ast.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ let std-c-paramstype-of-params-list(params: List<CTerm>, is-vararg: Bool): Type
159159
return = tt;
160160
}
161161
};
162-
if non-zero(return) then return else t1(c"C",t0(c"void"))
162+
if non-zero(return) then return else type-c-void
163163
);
164164

165165
let std-c-type-of-arrow(spec: CTerm, decl: CTerm, params: List<CTerm>): (CString, Type) = (

PLUGINS/FRONTEND/LSTS/lsts-parse.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ let lsts-parse-type-conjugate(tokens: List<Token>): Tuple<Type,List<Token>> = (
331331
lsts-parse-expect(c"_", tokens); tokens = tail(tokens);
332332
ta
333333
} else if lsts-parse-head(tokens).has-prefix(c"'") and not(lsts-parse-head(tokens).has-suffix(c"'")) {
334-
let new-tt = t1(c"Linear",t0(c"Phi::Live"));
334+
let new-tt = type-linear-live;
335335
tokens = tail(tokens);
336336
new-tt
337337
} else if lsts-is-ident-head(lsts-parse-head(tokens)) and not(lsts-is-type-tag(lsts-parse-head(tokens))) {
@@ -952,7 +952,7 @@ let lsts-parse-typedef(tokens: List<Token>): (AST, List<Token>) = (
952952
for vector i in infers {
953953
if i.is-t(c"MustRelease",0) and not(implied-phi.slot(c"MustRelease::ToRelease",1).l1.is-t(c"Linear",1))
954954
then {
955-
let mt = t1(c"MustRelease::ToRelease",t1(c"Linear",t0(c"Phi::Live")));
955+
let mt = t1(c"MustRelease::ToRelease",type-linear-live);
956956
implied-phi = implied-phi && mt;
957957
implied-phi-index = implied-phi-index.bind(lhs-type.ground-tag-and-arity, mt);
958958
};

SRC/type-constructor.lsts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ let type-nil = t0(c"Nil");
2626
# new allocations = 0 (constant)
2727
let type-any = t0(c"Any");
2828

29+
# new allocations = 0 (constant)
30+
let type-linear-moved = t1(c"Linear",t0(c"Phi::Moved"));
31+
32+
# new allocations = 0 (constant)
33+
let type-linear-live = t1(c"Linear",t0(c"Phi::Live"));
34+
35+
# new allocations = 0 (constant)
36+
let type-c-void = t1(c"C",t0(c"void"));
37+
2938
# new allocations = 0 (constant)
3039
let type-any-arrow = t2(c"Arrow", type-any, type-any);
3140

SRC/type-move-linear.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let .move-linear(tt: Type): Type = (
88
};
99
TAnd(new-conjugate)
1010
);
11-
TGround{tag:c"Linear", parameters:[_..]} => t1(c"Linear",t0(c"Phi::Moved"));
11+
TGround{tag:c"Linear", parameters:[_..]} => type-linear-moved;
1212
TGround{tag=tag, parameters=parameters} => (
1313
let new-parameters = mk-vector(type(Type));
1414
for vector p in parameters {

SRC/type-resurrect.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let .resurrect(tt: Type): Type = (
33
match tt {
44
TGround{tag:c"Linear", parameters:[TGround{tag:c"Phi::Moved",parameters:[]}..]} => (
5-
t1(c"Linear", t0(c"Phi::Live"))
5+
type-linear-live
66
);
77
TGround{tag=tag, parameters=parameters} => (
88
ts(tag, parameters.resurrect);

0 commit comments

Comments
 (0)