• Josh Bleecher Snyder's avatar
    cmd/compile: refactor maplit · 095a62c3
    Josh Bleecher Snyder authored
    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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    095a62c3
sinit.go 29.4 KB