A little bit of guesswork, again (I'm not working on the compiler)
https://github.com/golang/go/blob/75e16f5127eb6affb4b473c93565a8d29a802e51/src/cmd/compile/internal/gc/walk.go#L1094

`mapaccess1` is obviously for map index expressions of the form `m[key]`,
while `mapaccess2` is for assignments like `a, ok := m[key]`.

And AIUI the non-`_fat` versions are used if the value-type of the map is
too large to fit into a pre-allocated array of zero-bytes. In that case,
the runtime gets passed a separate pointer to a zero-value of that type to
use as the default - I assume, in that case the compiler emits code to
allocate (on the stack or the heap) zeroed memory of the appropriate size
and passes that to `mapaccess1_fat`.

Hope that helps, even though I'm guessing :)

On Wed, Dec 16, 2020 at 7:40 AM xie cui <cuiwei...@gmail.com> wrote:

> https://github.com/golang/go/blob/master/src/runtime/map.go#L554
> https://github.com/golang/go/blob/master/src/runtime/map.go#L562
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/9ef8570c-42b1-441f-bd57-64b6da3cba0bn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/9ef8570c-42b1-441f-bd57-64b6da3cba0bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfFQE6%2BvSDziZFV%3DVHJAu6%2BmP4-Js-%3DRsU9L-aGZ-L6k0g%40mail.gmail.com.

Reply via email to