Skip to content

Commit

Permalink
Improve specializer and C99 output. (#318)
Browse files Browse the repository at this point in the history
* Improves the specializer so it can deduplicate specializations

* Decouple specialization from inlining.

* Inlined arrows are "codipped" properly during code generation, meaning
they ignore extra things on the stack.

* Detect panic-like functions by type signature, and track unreachable
branches, to improve code generation.

Fixes issue #239
  • Loading branch information
typeswitch-dev authored Dec 19, 2024
1 parent a37e29b commit ef5f46e
Show file tree
Hide file tree
Showing 21 changed files with 29,087 additions and 49,571 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ default: show bin/snake.c bin/fractal.c
show: bin/mirth0.c bin/mirth1.c bin/mirth2.c bin/mirth3.c
diff --strip-trailing-cr bin/mirth0.c bin/mirth1.c | head -n 5
diff --strip-trailing-cr bin/mirth1.c bin/mirth2.c | head -n 10
diff --strip-trailing-cr bin/mirth2.c bin/mirth3.c
diff --strip-trailing-cr bin/mirth2.c bin/mirth3.c | head -n 10
showsan: bin/mirth0.c bin/mirth1.c bin/mirth2.c bin/mirth3san.c
diff --strip-trailing-cr bin/mirth0.c bin/mirth1.c | head -n 5
diff --strip-trailing-cr bin/mirth1.c bin/mirth2.c | head -n 10
diff --strip-trailing-cr bin/mirth2.c bin/mirth3san.c
diff --strip-trailing-cr bin/mirth2.c bin/mirth3san.c | head -n 10

build: bin/mirth0 bin/mirth1 bin/mirth2 bin/mirth1.c bin/mirth2.c bin/mirth3.c
buildsan: bin/mirth0 bin/mirth1 bin/mirth2san bin/mirth1.c bin/mirth2.c bin/mirth3san.c
Expand Down Expand Up @@ -107,10 +107,10 @@ bin/mirth1.c: bin/mirth0 $(SRCS)
bin/mirth0 src/main.mth -o bin/mirth1.c

bin/mirth2.c: bin/mirth1 $(SRCS)
bin/mirth1 src/main.mth -o bin/mirth2.c
rm -f bin/mirth2.c && bin/mirth1 src/main.mth -o bin/mirth2.c

bin/mirth3.c: bin/mirth2 $(SRCS)
bin/mirth2 src/main.mth -o bin/mirth3.c
rm -f bin/mirth3.c && bin/mirth2 src/main.mth -o bin/mirth3.c

bin/mirth1debug.c: bin/mirth0 $(SRCS)
bin/mirth0 --debug src/main.mth -o bin/mirth1debug.c
Expand Down
Loading

0 comments on commit ef5f46e

Please sign in to comment.