1. 16 Nov, 2015 7 commits
    • Ian Lance Taylor's avatar
      cmd/compile: add special case for testing first field of struct variable · 9aed0b7e
      Ian Lance Taylor authored
      The change to the write barrier in https://golang.org/cl/16899 means
      that the compiler now emits tests of the first field of a struct.  That
      was using a register that was not used before.  This change fixes that
      for amd64 by adding a special case for the first field of a struct.
      
      Update #12416.
      
      Change-Id: Ia57baa62cd741592fbeb9be82f1e846be73d6edd
      Reviewed-on: https://go-review.googlesource.com/16933
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      9aed0b7e
    • Ian Lance Taylor's avatar
      runtime: add optional expensive check for invalid cgo pointer passing · be1ef467
      Ian Lance Taylor authored
      If you set GODEBUG=cgocheck=2 the runtime package will use the write
      barrier to detect cases where a Go program writes a Go pointer into
      non-Go memory.  In conjunction with the existing cgo checks, and the
      not-yet-implemented cgo check for exported functions, this should
      reliably detect all cases (that do not import the unsafe package) in
      which a Go pointer is incorrectly shared with C code.  This check is
      optional because it turns on the write barrier at all times, which is
      known to be expensive.
      
      Update #12416.
      
      Change-Id: I549d8b2956daa76eac853928e9280e615d6365f4
      Reviewed-on: https://go-review.googlesource.com/16899Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      be1ef467
    • Ian Lance Taylor's avatar
      cmd/dist: check more GOOS/GOARCH combinations in mkdeps.bash · 1860a0fa
      Ian Lance Taylor authored
      The current mkdeps.bash just checks for dependencies for GOOS=windows
      with the current GOARCH.  This is not always accurate as some package
      imports only happen on specific GOOS/GOARCH combinations.  Check a
      selected, easily changed, combination of GOOS/GOARCH values.
      
      This generates a deps.go identical to the one in the repository today.
      
      Fixes #13221.
      
      Change-Id: I96d67d49c8c63641d578acedbb28be807607db65
      Reviewed-on: https://go-review.googlesource.com/16882Reviewed-by: 's avatarMichael Matloob <matloob@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1860a0fa
    • Rahul Chaudhry's avatar
      cmd/go: set buildmode=pie default for android/arm64. · f7c7ed7c
      Rahul Chaudhry authored
      Just like android/arm, android/arm64 refuses to execute non-PIE
      binaries. In addition, starting from the M release (Marshmallow),
      Android refuses to execute binaries with any text relocations
      (this was just a warning in the L release). This makes "-shared"
      necessary as well when building executables for Android.
      
      Change-Id: Id8802de5be98ff472fc370f8d22ffbde316aaf1e
      Reviewed-on: https://go-review.googlesource.com/16744Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      f7c7ed7c
    • Austin Clements's avatar
      runtime: handle sysReserve returning a pointer below the arena · 0de59c27
      Austin Clements authored
      In mheap.sysAlloc, if an allocation at arena_used would exceed
      arena_end (but wouldn't yet push us past arena_start+_MaxArean32), it
      trie to extend the arena reservation by another 256 MB. It extends the
      arena by calling sysReserve, which, on 32-bit, calls mmap without
      MAP_FIXED, which means the address is just a hint and the kernel can
      put the mapping wherever it wants. In particular, mmap may choose an
      address below arena_start (the kernel also chose arena_start, so there
      could be lots of space below it). Currently, we don't detect this case
      and, if it happens, mheap.sysAlloc will corrupt arena_end and
      arena_used then return the low pointer to mheap.grow, which will crash
      when it attempts to index in to h_spans with an underflowed index.
      
      Fix this by checking not only that that p+p_size isn't too high, but
      that p isn't too low.
      
      Fixes #13143.
      
      Change-Id: I8d0f42bd1484460282a83c6f1a6f8f0df7fb2048
      Reviewed-on: https://go-review.googlesource.com/16927
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      0de59c27
    • Austin Clements's avatar
      runtime: avoid stat underflow crash · 97dc5915
      Austin Clements authored
      If the area returned by sysReserve in mheap.sysAlloc is outside the
      usable arena, we sysFree it. We pass a fake stat pointer to sysFree
      because we haven't added the allocation to any stat at that point.
      However, we pass a 0 stat, so sysFree panics when it decrements the
      stat because the fake stat underflows.
      
      Fix this by setting the fake stat to the allocation size.
      
      Updates #13143 (this is a prerequisite to fixing that bug).
      
      Change-Id: I61a6c9be19ac1c95863cf6a8435e19790c8bfc9a
      Reviewed-on: https://go-review.googlesource.com/16926Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      97dc5915
    • Marcel van Lohuizen's avatar
      unicode/utf8: removed uses of ranging over string · 9b299c1e
      Marcel van Lohuizen authored
      Ranging over string is much slower than using DecodeRuneInString.
      See golang.org/issue/13162.
      
      Replacing ranging over a string with the implementation of the Bytes
      counterpart results in the following performance improvements:
      
      RuneCountInStringTenASCIIChars-8     43.0ns ± 1%  16.4ns ± 2%  -61.80%  (p=0.000 n=7+8)
      RuneCountInStringTenJapaneseChars-8   161ns ± 2%   154ns ± 2%   -4.58%  (p=0.000 n=8+8)
      ValidStringTenASCIIChars-8           52.2ns ± 1%  13.2ns ± 1%  -74.62%  (p=0.001 n=7+7)
      ValidStringTenJapaneseChars-8         173ns ± 2%   153ns ± 2%  -11.78%  (p=0.000 n=7+8)
      
      Update golang/go#13162
      
      Change-Id: Ifc40a6a94bb3317f1f2d929d310bd2694645e9f6
      Reviewed-on: https://go-review.googlesource.com/16695Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      9b299c1e
  2. 15 Nov, 2015 7 commits
  3. 14 Nov, 2015 12 commits
  4. 13 Nov, 2015 14 commits