]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: in wasm, allocate approximately right number of locals for functions
authorDenys Smirnov <denis.smirnov.91@gmail.com>
Fri, 19 Oct 2018 19:04:29 +0000 (19:04 +0000)
committerRichard Musiol <neelance@gmail.com>
Fri, 19 Oct 2018 21:05:33 +0000 (21:05 +0000)
commit6c631ae227cb6f15d5b0b8cc39c1715b8f4e9187
treebf39ab50c425a946fe777009b492ad3aa0417520
parentf5636523998594af75ec87d3c2a2070dc1cb65f4
cmd/compile: in wasm, allocate approximately right number of locals for functions

Currently, WASM binary writer requests 16 int registers (locals) and
16 float registers for every function regardless of how many locals the
function uses.

This change counts the number of used registers and requests a number
of locals matching the highest register index. The change has no effect
on performance and neglectable binary size improvement, but it makes
WASM code more readable and easy to analyze.

Change-Id: Ic1079623c0d632b215c68482db909fa440892700
GitHub-Last-Rev: 184634fa918aff74e280904dc2efafcc80735a8b
GitHub-Pull-Request: golang/go#28116
Reviewed-on: https://go-review.googlesource.com/c/140999
Reviewed-by: Richard Musiol <neelance@gmail.com>
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/internal/obj/wasm/wasmobj.go