Skip to content

Commit cc776c7

Browse files
authored
Merge pull request #2029 from andrew4328/maybe-gc-enabled-fdsklsl
All tests green. Full test suite takes 9.5 minutes to run with GC enabled.
2 parents 7486844 + dc3b449 commit cc776c7

108 files changed

Lines changed: 4082 additions & 4236 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BOOTSTRAP/cli.c

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

Makefile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ LSTSFLAGS = MALLOC_CHECK_=3
88
# recommendation: ulimit -s unlimited
99

1010
dev: install-production
11-
#lm --showalloc SRC/unit-tctx-core.lsts > out.txt
12-
#lm --showalloc SRC/unit-prop-core.lsts > out.txt
13-
#lm --showalloc SRC/unit-ascript-core.lsts > out.txt
14-
#lm --showalloc SRC/index.lsts > out.txt
15-
lm tests/promises/typechecking/misc-linear-error-1.lsts > out.txt
16-
gcc tmp.c;
11+
lm tests/promises/vector/constructor.lsts
12+
#time lm --showalloc SRC/unit-type-core.lsts > out.txt
13+
#time lm --showalloc SRC/unit-tctx-core.lsts > out.txt
14+
#time lm --showalloc SRC/unit-prop-core.lsts > out.txt
15+
#time lm --showalloc SRC/unit-ascript-core.lsts > out.txt
16+
#time lm --showalloc SRC/index.lsts > out.txt
17+
#time lm --showalloc SRC/dev-index.lsts > out.txt
18+
gcc tmp.c
1719
./a.out
1820

1921
build: compile-production
@@ -28,8 +30,15 @@ build: compile-production
2830
deploy: build smoke-test
2931
deploy-lite: build smoke-test-lite
3032

31-
valgrind: install-bootstrap
32-
valgrind --tool=callgrind lm --v2 SRC/index.lsts
33+
gprofng: install-production
34+
gprofng collect app lm SRC/dev-index.lsts
35+
36+
gprofng-view:
37+
gprofng display text -functions test.1.er > gprofng.view
38+
nano gprofng.view
39+
40+
valgrind: install-production
41+
valgrind --tool=callgrind lm SRC/dev-index.lsts
3342

3443
valgrind-view:
3544
callgrind_annotate callgrind.out.18778
@@ -60,17 +69,21 @@ compile-production: compile-bootstrap
6069

6170
install-production: compile-production
6271
ifeq ($(shell test -w /usr/local/bin; echo $$?), 0)
72+
cp production /usr/local/bin/lm-production
6373
mv production /usr/local/bin/lm
6474
else
6575
mkdir -p $${HOME}/.local/bin
76+
cp production $${HOME}/.local/bin/lm-production
6677
mv production $${HOME}/.local/bin/lm
6778
endif
6879

6980
install-bootstrap: compile-bootstrap
7081
ifeq ($(shell test -w /usr/local/bin; echo $$?), 0)
82+
cp bootstrap.exe /usr/local/bin/lm-bootstrap
7183
mv bootstrap.exe /usr/local/bin/lm
7284
else
7385
mkdir -p $${HOME}/.local/bin
86+
cp bootstrap.exe $${HOME}/.local/bin/lm-bootstrap
7487
mv bootstrap.exe $${HOME}/.local/bin/lm
7588
endif
7689

SRC/ascript-ascript-integrated.lsts

Lines changed: 0 additions & 32 deletions
This file was deleted.

SRC/ascript-ascript-normal.lsts

Lines changed: 0 additions & 26 deletions
This file was deleted.

SRC/ascript-ascript.lsts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let .ascript(tctx: TypeContext?, t: AST, tt: Type): TypeContext? = (
1010
exit-error("Type Ascription Inequality\n\{typeof-term-normal(t)} does not imply \{norm-tt}", t);
1111
}
1212
};
13-
if tt.slot(c"Phi::Id",1).l1.simple-tag != prev-tt.slot(c"Phi::Id",1).l1.simple-tag {
13+
if tt.slot(c"Phi::Id",1).l1.simple-id != prev-tt.slot(c"Phi::Id",1).l1.simple-id {
1414
tctx = tctx.phi-move(prev-tt, t);
1515
}
1616
};
@@ -22,5 +22,11 @@ let .ascript(tctx: TypeContext?, t: AST, tt: Type): TypeContext? = (
2222
let ascript-force(t: AST, tt: Type): Nil = (
2323
add-concrete-type-instance(tt, t);
2424
ascript-natural(t, tt);
25+
26+
# these initializations are necessary to prevent stale phi types
27+
# I don't remember why that is, but just try removing them and debug from there
28+
type-index-normal = type-index-normal.bind(t, ta);
29+
type-index-denormal = type-index-denormal.bind(t, ta);
30+
2531
types-have-changed = true;
2632
);

SRC/ascript-tctx-resurrect.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let .resurrect(tctx: TypeContext?, tt: Type, t: AST): (TypeContext?, Type) = (
33
# TODO: fix tt2, tt3 workaround which was for linear variable bug
44
# NOTE: make sure to create a promise test covering this phi/linear bug
5-
let phi-id = tt.slot(c"Phi::Id",1).l1.simple-tag;
5+
let phi-id = tt.slot(c"Phi::Id",1).l1.simple-id;
66
if non-zero(phi-id) {
77
let tt2 = tctx.with-phi(tt, t);
88
let phi-state = tt2.slot(c"Phi::State",1).l1;

SRC/dev-index.lsts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11

22
import SRC/unit-util.lsts;
3-
import SRC/dev-unit-type-core.lsts;
4-
import SRC/dev-unit-ast-core.lsts;
5-
import SRC/dev-unit-tctx-core.lsts;
6-
import SRC/dev-unit-prop-core.lsts;
7-
import SRC/dev-unit-ascript-core.lsts;
8-
import SRC/dev-unit-typecheck-core.lsts;
9-
import SRC/dev-unit-backend-core.lsts;
3+
import SRC/unit-type-core.lsts;
4+
import SRC/unit-ast-core.lsts;
5+
import SRC/unit-tctx-core.lsts;
6+
import SRC/unit-prop-core.lsts;
7+
import SRC/unit-ascript-core.lsts;
8+
import SRC/unit-typecheck-core.lsts;
9+
import SRC/unit-backend-core.lsts;
1010
import SRC/unit-main-core.lsts;
11-
12-
import PLUGINS/FRONTEND/LSTS/dev-index.lsts;
13-
import PLUGINS/BACKEND/C/dev-index.lsts;
14-
import PLUGINS/FRONTEND/C/index.lsts;

SRC/dev-unit-ascript-core.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import SRC/ascript-type-index.lsts;
66
import SRC/dev-ascript-concrete-index.lsts;
77
import SRC/ascript-datatype-index.lsts;
88
import SRC/ascript-with-only-datatype.lsts;
9-
import SRC/ascript-ascript-integrated.lsts;
9+
import SRC/ascript-ascript.lsts;
1010
import SRC/ascript-tctx-resurrect.lsts;

SRC/prop-phi-override.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
let .phi-override(tctx: TypeContext?, dst: Type, src: Type, blame: AST): TypeContext? = (
3-
let dst-id = dst.slot(c"Phi::Id",1).l1.simple-tag;
3+
let dst-id = dst.slot(c"Phi::Id",1).l1.simple-id;
44
let src-tt = src.slot(c"Phi::State",1).l1;
55
if non-zero(dst-id) and non-zero(src-tt) {
66
tctx = tctx.bind-phi(dst-id, src-tt, blame, dst.is-t(c"GlobalVariable",0));

SRC/prop-tctx-least-upper-bound.lsts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,23 @@ let .least-upper-bound(tctx: TypeContext?, left: Type, right: Type, blame: AST):
4747
if ps.is-some then rt = ts(ltag,ps.get-or-panic);
4848
}
4949
);
50+
Tuple{ first:TId{lid=id}, second:TId{rid=id} } => if lid==rid then rt = left;
5051
Tuple{ first:TAny{}, second:TAny{} } => ();
5152
_ => ();
5253
};
5354

5455
if non-zero(rt) and left.is-t(c"Phi::State",1) and right.is-t(c"Phi::State",1) {
5556
# Merge and bind new phi state
5657
let new-phi-state = tctx.phi-merge(left.slot(c"Phi::State",1).l1, right.slot(c"Phi::State",1).l1, blame);
57-
let new-phi-id = uuid();
58+
let new-phi-id = iuid();
5859
tctx = tctx.bind-phi(new-phi-id, new-phi-state, blame);
5960

6061
# Move linear variables in left and right types
61-
tctx = tctx.bind-phi(left.slot(c"Phi::Id",1).l1.simple-tag, left.slot(c"Phi::State",1).l1.move-linear, blame);
62-
tctx = tctx.bind-phi(right.slot(c"Phi::Id",1).l1.simple-tag, right.slot(c"Phi::State",1).l1.move-linear, blame);
62+
tctx = tctx.bind-phi(left.slot(c"Phi::Id",1).l1.simple-id, left.slot(c"Phi::State",1).l1.move-linear, blame);
63+
tctx = tctx.bind-phi(right.slot(c"Phi::Id",1).l1.simple-id, right.slot(c"Phi::State",1).l1.move-linear, blame);
6364

6465
# Add Phi::Id to least-upper-bound
65-
rt = rt && t1(c"Phi::Id",t0(new-phi-id));
66+
rt = rt && t1(c"Phi::Id",ti(new-phi-id));
6667
};
6768

6869
if left.is-t(c"Phi::State",1) or right.is-t(c"Phi::State",1) and not(rt.is-t(c"Phi::Id",1))

0 commit comments

Comments
 (0)