Граф коммитов

20 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
3c22f5731c
all: replace _extern_* workaround with //go:extern pragma 2018-09-21 14:37:11 +02:00
Ayke van Laethem
2ca2220e44
compiler: move SSA construction to ir.go 2018-09-21 14:37:11 +02:00
Ayke van Laethem
1f2af7d848
compiler: do not remove dead globals
These were not removed when they contain data, and will be removed by
LLVM anyway.
2018-09-17 15:15:03 +02:00
Ayke van Laethem
43b8c24226
compiler: implement interface assertions
This is a lot harder than 'regular' type assertions as the actual
methods need to be checked.
2018-09-06 20:18:18 +02:00
Ayke van Laethem
83ad0b6137
all: move bootstrapping IR to Go runtime
This has the benefit of not requiring a 'runtime' IR file, so that
complete relocatable files can be built without requiring input IR.
This makes the compiler a lot easier to use without the Makefile.

Code size is not affected.
2018-09-04 21:18:26 +02:00
Ayke van Laethem
bfff0c33e4
Fix external globals
This broke the allocator on ARM, and with that the blinky example.
2018-09-02 18:37:28 +02:00
Ayke van Laethem
88b6b2e7f5
Optimize/eliminate bounds checking
TODO: do better at it by tracking min/max values of integers. The
following straightforward code doesn't have its bounds checks removed:

    for _, n := range slice {
        println(n)
    }
2018-09-02 16:28:46 +02:00
Ayke van Laethem
58c87329d4
Implement closures and bound methods 2018-09-02 03:39:37 +02:00
Ayke van Laethem
b13cfc5255
Be able to deal with anonymous functions 2018-08-30 22:52:00 +02:00
Ayke van Laethem
74bd378c29
Replace _llvm_* workaround in the scheduler with //go:linkname
This also removes the need for the _llvm_ special case in the compiler.
And it makes the scheduler code a whole lot nicer!
2018-08-30 22:30:16 +02:00
Ayke van Laethem
771f23e320
Implement //go:linkname pragma 2018-08-30 22:27:19 +02:00
Ayke van Laethem
6e0c60a7a1
Some extra header docs 2018-08-30 02:36:13 +02:00
Ayke van Laethem
309de00fd6
Simplify function names by removing $async suffix 2018-08-26 21:45:28 +02:00
Ayke van Laethem
c25b448758
Rewrite init() interpretation to a real interpreter
Instead of mostly heuristics, actually execute the init() instruction in
an interpreter to calculate initializers for globals. This is far more
flexible and extensible, and gives the option of extending the
interpreter to other code and make it a partial evaluator.
2018-08-25 02:07:01 +02:00
Ayke van Laethem
7460e10894
Add dead code elimination (DCE) pass
This should make it much easier (in the future) to use the standard
library when unused functions contain unimplemented features. But more
importantly, it makes later passes better and makes compiling faster by
not having to scan dead code.
2018-08-19 20:47:58 +02:00
Ayke van Laethem
bce33bbf41
Rename {Function,Global}.Name -> LinkName 2018-08-19 20:42:24 +02:00
Ayke van Laethem
3146cc86d4
Move Compiler.program to Program.program 2018-08-19 20:41:05 +02:00
Ayke van Laethem
ad9a62f260
Make sure we handle all package members 2018-08-18 01:13:35 +02:00
Ayke van Laethem
a475233f36
Support recursive types 2018-08-18 01:12:52 +02:00
Ayke van Laethem
574c7ec047
Refactor: Use our own types as much as possible from the analysis
Previously, mostly the types from the ssa package were used directly
with the types from analysis.go as an overlay. This commit uses these
types everywhere and renames a few things here and there to make things
clearer.
2018-08-17 23:13:32 +02:00