diff options
author | Ayke van Laethem <[email protected]> | 2020-07-10 17:05:09 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-07-11 14:47:43 +0200 |
commit | d60631551540799f4431b56d35d6e586c488c834 (patch) | |
tree | 96f93c630ed3285dbf1c78cfb6c6565b851e12e4 /tools | |
parent | 60fdf812093eb70ffe2f55d3ed52f14a81ec69fe (diff) | |
download | tinygo-d60631551540799f4431b56d35d6e586c488c834.tar.gz tinygo-d60631551540799f4431b56d35d6e586c488c834.zip |
builder: try to determine stack size information at compile time
For now, this is just an extra flag that can be used to print stack
frame information, but this is intended to provide a way to determine
stack sizes for goroutines at compile time in many cases.
Stack sizes are often somewhere around 350 bytes so are in fact not all
that big usually. Once this can be determined at compile time in many
cases, it is possible to use this information when available and as a
result increase the fallback stack size if the size cannot be determined
at compile time. This should reduce stack overflows while at the same
time reducing RAM consumption in many cases.
Interesting output for testdata/channel.go:
function stack usage (in bytes)
Reset_Handler 332
.Lcommand-line-arguments.fastreceiver 220
.Lcommand-line-arguments.fastsender 192
.Lcommand-line-arguments.iterator 192
.Lcommand-line-arguments.main$1 184
.Lcommand-line-arguments.main$2 200
.Lcommand-line-arguments.main$3 200
.Lcommand-line-arguments.main$4 328
.Lcommand-line-arguments.receive 176
.Lcommand-line-arguments.selectDeadlock 72
.Lcommand-line-arguments.selectNoOp 72
.Lcommand-line-arguments.send 184
.Lcommand-line-arguments.sendComplex 192
.Lcommand-line-arguments.sender 192
.Lruntime.run$1 548
This shows that the stack size (if these numbers are correct) can in
fact be determined automatically in many cases, especially for small
goroutines. One of the great things about Go is lightweight goroutines,
and reducing stack sizes is very important to make goroutines
lightweight on microcontrollers.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/gen-device-svd/gen-device-svd.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/gen-device-svd/gen-device-svd.go b/tools/gen-device-svd/gen-device-svd.go index ee1a86bbb..2e417b3ea 100755 --- a/tools/gen-device-svd/gen-device-svd.go +++ b/tools/gen-device-svd/gen-device-svd.go @@ -916,6 +916,7 @@ func writeAsm(outdir string, device *Device) error { Default_Handler: wfe b Default_Handler +.size Default_Handler, .-Default_Handler // Avoid the need for repeated .weak and .set instructions. .macro IRQ handler |