An error occurred fetching the project authors.
  1. 29 Oct, 2017 2 commits
    • Austin Clements's avatar
      cmd/compile: elide write barriers for copy of notinheap pointers · b78b54ff
      Austin Clements authored
      Currently copy and append for types containing only scalars and
      notinheap pointers still get compiled to have write barriers, even
      though those write barriers are unnecessary. Fix these to use
      HasHeapPointer instead of just Haspointer so that they elide write
      barriers when possible.
      
      This fixes the unnecessary write barrier in runtime.recordspan when it
      grows the h.allspans slice. This is important because recordspan gets
      called (*very* indirectly) from (*gcWork).tryGet, which is
      go:nowritebarrierrec. Unfortunately, the compiler's analysis has no
      hope of seeing this because it goes through the indirect call
      fixalloc.first, but I saw it happen.
      
      Change-Id: Ieba3abc555a45f573705eab780debcfe5c4f5dd1
      Reviewed-on: https://go-review.googlesource.com/73413
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      b78b54ff
    • Austin Clements's avatar
      cmd/compile: make HasHeapPointer recursive · 316e3036
      Austin Clements authored
      Currently (*Type).HasHeapPointer only ignores pointers go:notinheap
      types if the type itself is a pointer to a go:notinheap type. However,
      if it's some other type that contains pointers where all of those
      pointers are go:notinheap, it will conservatively return true. As a
      result, we'll use write barriers where they aren't needed, for example
      calling typedmemmove instead of just memmove on structs that contain
      only go:notinheap pointers.
      
      Fix this by making HasHeapPointer walk the whole type looking for
      pointers that aren't marked go:notinheap.
      
      Change-Id: Ib8c6abf6f7a20f34969d1d402c5498e0b990be59
      Reviewed-on: https://go-review.googlesource.com/73412
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      316e3036