]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: refactor maplit
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 29 Mar 2017 16:08:39 +0000 (09:08 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 3 Apr 2017 20:10:17 +0000 (20:10 +0000)
commit095a62c3494e5ca6290357d1b4d307f502257578
treee1001946be1f359a9a4cf21c9621f20365ccd6a1
parent1d6a499cc02012275b3c172dc98a143e49fb8ddc
cmd/compile: refactor maplit

Instead of walking the list of nodes twice,
once to find static entries to add to an array
and once to find dynamic entries to generate code for,
do the split once up front, into two slices.
Then process each slice individually.
This makes the code easier to read
and more importantly, easier to modify.

While we're here, add a TODO to avoid
using temporaries for mapassign_fast calls.
It's not an important TODO;
the generated code would be basically identical.
It would just avoid a minor amount of
pointless SSA optimization work.

Passes toolstash-check.
No measureable compiler performance impact.

Updates #19751

Change-Id: I84a8f2c22f9025c718ef34639059d7bd02a3c406
Reviewed-on: https://go-review.googlesource.com/39351
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/sinit.go