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

3777 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
58e31fd470
Simplify a bit of code 2018-08-26 21:38:55 +02:00
Ayke van Laethem
de6c20f1bd
Implement untyped bool 2018-08-25 03:24:06 +02:00
Ayke van Laethem
c9e6a52d05
Implement constant slice
It's used somewhere in the sync package, but I'm not sure where.
2018-08-25 02:58:59 +02:00
Ayke van Laethem
9f2bcfe5e3
Implement global interface variable constant 2018-08-25 02:58:00 +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
9b4ac0459b
Make strings constant
For some reason this was disabled.
2018-08-24 05:18:41 +02:00
Ayke van Laethem
f49ceddd73
Enable elimination of dead globals by marking them private
This eliminates most of the newly created dead globals.
2018-08-24 04:25:16 +02:00
Ayke van Laethem
5f28b07f75
Enable aggressive code size optimizations: -Oz 2018-08-24 03:35:39 +02:00
Ayke van Laethem
f9f92de1c3
Add a test for the unicode package
This massively increases .data size, possibly because loads of unused
globals are included. I'll need to investigate what's going on here. For
now, increase the RAM size for nrf chips (the nrf52 has 64kB of RAM).
2018-08-24 03:35:03 +02:00
Ayke van Laethem
36a5af9e6d
README: dead code elimination 2018-08-24 03:02:06 +02:00
Ayke van Laethem
ab3358e5a3
Add make fmt 2018-08-24 02:59:18 +02:00
Ayke van Laethem
fa12da95e2
Some documentation fixes 2018-08-24 02:56:09 +02:00
Ayke van Laethem
0defed9677
Resolve named types 2018-08-24 02:55:06 +02:00
Ayke van Laethem
1229667f7c
Support pointers in global variables 2018-08-24 02:54:37 +02:00
Ayke van Laethem
68b1100c89
Support maps bigger than 8 elements in .data 2018-08-24 02:53:23 +02:00
Ayke van Laethem
4ef271d4c6
Fix double addition in init map update 2018-08-24 02:48:59 +02:00
Ayke van Laethem
179cf74b01
Implement package-global maps (of max 8 entries) 2018-08-24 00:56:20 +02:00
Ayke van Laethem
2b78b6d7e8
Fix bug in runtime.memzero
Not the memory itself, but the byte after the memory was zeroed.
2018-08-23 23:45:39 +02:00
Ayke van Laethem
e884221fad
Implement len() for map types 2018-08-23 23:14:54 +02:00
Ayke van Laethem
005665aee6
Move hashmap creation to runtime 2018-08-23 23:13:38 +02:00
Ayke van Laethem
ae2fc3c8a7
Add support for package-level slice variables
They are initialized from .data and not at init time.
2018-08-23 22:08:03 +02:00
Ayke van Laethem
c99faf468d
Refactor initializing of global data
This makes it easier to add more types.
2018-08-23 22:04:48 +02:00
Ayke van Laethem
160d532498
Fix init functions
This was broken in commit 574c7ec047 and
broke the nrf port.
2018-08-23 21:59:09 +02:00
Ayke van Laethem
ea6355b39e
Make parseConvert not require frame parameter 2018-08-22 23:42:40 +02:00
Ayke van Laethem
d5c7c28135
Simplify some code 2018-08-22 05:14:15 +02:00
Ayke van Laethem
3a6ef38041
Preliminary implementation of a hashmap, unfinished
Missing features:
  * keys other than strings
  * more than 8 values in the hashmap
  * growing a map when needed
  * initial size hint
  * delete(m, key)
  * iterators (for range)
  * initializing global maps
  * ...more?
2018-08-22 04:50:24 +02:00
Ayke van Laethem
8fb9cd4e23
Implement shifting with a differently-sized integer 2018-08-22 04:35:25 +02:00
Ayke van Laethem
337e48270b
Implement comparing a pointer to nil 2018-08-22 04:33:09 +02:00
Ayke van Laethem
c3cb22030f
Implement == and != for strings 2018-08-22 00:56:11 +02:00
Ayke van Laethem
2777f8464e
Implement printing of booleans 2018-08-22 00:54:39 +02:00
Ayke van Laethem
a30ffa5c1e
Revert "Move coroutine passes from Makefile to compiler itself"
This reverts commit d9ca5f97fb.

There is a problem with coroutines that I haven't solved yet. Reverting
makes it work, for now.

Also, use a better coroutines flag for the LLVM opt tool.
2018-08-20 20:24:54 +02:00
Ayke van Laethem
df4ee6e733
passes: Fix bug in SimpleDCE
Main was included twice, leading to problems with coroutines.
2018-08-20 20:08:11 +02:00
Ayke van Laethem
6739ad07b2
Update nrfx submodule 2018-08-20 05:21:48 +02:00
Ayke van Laethem
d9ca5f97fb
Move coroutine passes from Makefile to compiler itself
This is much more convenient.
2018-08-20 04:31:01 +02:00
Ayke van Laethem
03c8a8bd3a
README: Add build guide 2018-08-20 04:19:54 +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
fae4c7f555
Better error messages 2018-08-19 20:43:39 +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
e18fd6da16
Rename analysis.go -> passes.go 2018-08-19 17:07:48 +02:00
Ayke van Laethem
29d601883b
Implement dummy GOMAXPROCS
This compiler targets single-core machines, GOMAXPROCS is thus fixed to
1.
2018-08-18 20:06:59 +02:00
Ayke van Laethem
8b6cb204cd
Basic support for slices 2018-08-18 20:06:35 +02:00
Ayke van Laethem
86a3aea868
Add a LICENSE file 2018-08-18 19:04:14 +02:00
Ayke van Laethem
9aaac8e17b
README: Describe supported targets 2018-08-18 15:59:12 +02:00
Ayke van Laethem
bfe9b52661
README: Mark a few features as supported 2018-08-18 15:58:22 +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
cad3e03f94
Allow imports from GOROOT 2018-08-18 01:11:50 +02:00
Ayke van Laethem
4af2bcb6a9
Split up tgo.go 2018-08-18 01:11:25 +02:00
Ayke van Laethem
0b98ec83ba
Remove unnecessary check for nil in parseExpr 2018-08-18 00:19:56 +02:00