1. 29 Mar, 2019 10 commits
    • David Chase's avatar
      cmd/compile: enhance induction variable detection for unrolled loops · d8f60eea
      David Chase authored
      Would suggest extending capabilities (32-bit, unsigned, etc)
      in separate CLs because prove bugs are so mystifying.
      
      This implements the suggestion in this comment
      https://go-review.googlesource.com/c/go/+/104041/10/src/cmd/compile/internal/ssa/loopbce.go#164
      for inferring properly bounded iteration for loops of the form
      
      for i := K0; i < KNN-(K-1); i += K
      for i := K0; i <= KNN-K;    i += K
      
      Where KNN is "known non negative" (i.e., len or cap) and K
      is also not negative.  Because i <= KNN-K, i+K <= KNN and
      no overflow occurs.
      
      Also handles decreasing case (K1 > 0)
      for i := KNN; i >= K0; i -= K1
      which works when MININT+K1 < K0
      (i.e. MININT < K0-K1, no overflow)
      
      Signed only, also only 64 bit for now.
      
      Change-Id: I5da6015aba2f781ec76c4ad59c9c48d952325fdc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/136375
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlexandru Moșoi <alexandru@mosoi.ro>
      d8f60eea
    • Joel Sing's avatar
      cmd/link: permit duplicate weak symbols · c90f6dd4
      Joel Sing authored
      Permit weak symbols to be duplicates - most external linkers allow
      this and there are various situations where they can occur (including
      retpoline and retguard).
      
      Fixes #29563
      
      Change-Id: I355493c847fbc8f670a85a643db65a4cf8f9883d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169658
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c90f6dd4
    • Michael Munday's avatar
      cmd/asm: add 'insert program mask' instruction for s390x · 6966b675
      Michael Munday authored
      This CL adds the 'insert program mask' (IPM) instruction to s390x.
      IPM stores the current program mask (which contains the condition
      code) into a general purpose register.
      
      This instruction will be useful when implementing intrinsics for
      the arithmetic functions in the math/bits package. We can also
      potentially use it to convert some condition codes into bool
      values.
      
      The condition code can be saved and restored using an instruction
      sequence such as:
      
        IPM  R4          // save condition code to R4
        ...
        TMLH R4, $0x3000 // restore condition code from R4
      
      We can also use IPM to save the carry bit to a register using an
      instruction sequence such as:
      
        IPM     R4                   // save condition code to R4
        RISBLGZ $31, $31, $3, R4, R4 // isolate carry bit in R4
      
      Change-Id: I169d450b6ea1a7ff8c0286115ddc42618da8a2f4
      Reviewed-on: https://go-review.googlesource.com/c/go/+/165997
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      6966b675
    • Elias Naur's avatar
      runtime/cgo: use free TLS slot on Android Q · 95f18757
      Elias Naur authored
      Android assumes pthread tls keys correspond to some offset from the
      TLS base. This is about to change in a future version of Android.
      Fortunately, Android Q leaves a slot open for use to use, TLS_SLOT_APP.
      
      Fixes #29674
      
      Change-Id: Id6ba19afacdfed9b262453714715435e2544185f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170117
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      95f18757
    • Elias Naur's avatar
      cmd/link/ld,cmd/internal/obj,runtime: make the Android TLS offset dynamic · 1d10b175
      Elias Naur authored
      We're going to need a different TLS offset for Android Q, so the static
      offsets used for 386 and amd64 are no longer viable on Android.
      
      Introduce runtime·tls_g and use that for indexing into TLS storage. As
      an added benefit, we can then merge the TLS setup code for all android
      GOARCHs.
      
      While we're at it, remove a bunch of android special cases no longer
      needed.
      
      Updates #29674
      Updates #29249 (perhaps fixes it)
      
      Change-Id: I77c7385aec7de8f1f6a4da7c9c79999157e39572
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169817
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      1d10b175
    • Jordan Liggitt's avatar
      net/http/httputil: make ReverseProxy flush headers on FlushInterval · 2cc34738
      Jordan Liggitt authored
      A regression was introduced in CL 137335 (5440bfc2) that caused FlushInterval
      to not be honored until the first Write() call was encountered. This change
      starts the flush timer as part of setting up the maxLatencyWriter.
      
      Fixes #31125
      Fixes #31126
      
      Change-Id: I75325bd926652922219bd1457b2b00ac6d0d41b0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170066Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      2cc34738
    • Ian Lance Taylor's avatar
      runtime: rename p racectx field to raceprocctx · 70ea70ec
      Ian Lance Taylor authored
      Both g and p had a racectx field, but they held different kinds of values.
      The g field held ThreadState values while the p field held Processor values
      (to use the names used in the C++ code in the compiler_rt support library).
      Rename the p field to raceprocctx to reduce potential confusion.
      
      Change-Id: Iefba0e259d240171e973054c452c3c15bf3f8f8f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169960Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      70ea70ec
    • Ben Hoyt's avatar
      bytes, strings: add tests for TrimLeftFunc and TrimRightFunc · 154e5abf
      Ben Hoyt authored
      When I was working on the fix for #31038 (make TrimSpace return nil on
      all-space input) I noticed that there were no tests for TrimLeftFunc
      and TrimRightFunc, including the funky nil behavior. So add some!
      
      I've just reused the existing TrimFunc test cases for TrimLeftFunc and
      TrimRightFunc, as well as adding new tests for the empty string and
      all-trimmed cases (which test the nil-returning behavior of TrimFunc and
      TrimLeftFunc).
      
      Change-Id: Ib580d4364e9b3c91350305f9d9873080d7862904
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170061
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      154e5abf
    • zdjones's avatar
      cmd/compile: make prove use poset to check non-negatives · ddef1578
      zdjones authored
      Prove currently fails to remove bounds checks of the form:
      
      if i >= 0 {              // hint that i is non-negative
          for i < len(data) {  // i becomes Phi in the loop SSA
              _ = data[i]      // data[Phi]; bounds check!!
      	i++
          }
      }
      
      addIndVarRestrictions fails to identify that the loop induction
      variable, (Phi), is non-negative. As a result, the restrictions,
      i <= Phi < len(data), are only added for the signed domain. When
      testing the bounds check, addBranchRestrictions is similarly unable
      to infer that Phi is non-negative. As a result, the restriction,
      Phi >= len(data), is only added/tested for the unsigned domain.
      
      This CL changes the isNonNegative method to utilise the factTable's
      partially ordered set (poset). It also adds field factTable.zero to
      allow isNonNegative to query the poset using the zero(0) constant
      found or created early in prove.
      
      Fixes #28956
      
      Change-Id: I792f886c652eeaa339b0d57d5faefbf5922fe44f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/161437
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarGiovanni Bajo <rasky@develer.com>
      ddef1578
    • Agniva De Sarker's avatar
      internal/bytealg: simplify memchr for wasm · 4a7cd9d9
      Agniva De Sarker authored
      Get rid of an extra register R5 which just recalculated the value of R4.
      Reuse R4 instead.
      
      We also remove the casting of c to an unsigned char because the initial
      load of R0 is done with I32Load8U anyways.
      
      Also indent the code to make it more readable.
      
      name                           old time/op  new time/op  delta
      IndexRune                       597ns ± 3%   580ns ± 3%  -2.93%  (p=0.002 n=10+10)
      IndexRuneLongString             634ns ± 4%   654ns ± 3%  +3.07%  (p=0.004 n=10+10)
      IndexRuneFastPath              57.6ns ± 3%  56.9ns ± 4%    ~     (p=0.210 n=10+10)
      Index                           104ns ± 3%   104ns ± 4%    ~     (p=0.639 n=10+10)
      LastIndex                      87.1ns ± 5%  85.7ns ± 3%    ~     (p=0.171 n=10+10)
      IndexByte                      34.4ns ± 4%  32.9ns ± 5%  -4.28%  (p=0.002 n=10+10)
      IndexHard1                     21.6ms ± 1%  21.8ms ± 3%    ~     (p=0.460 n=8+10)
      IndexHard2                     21.6ms ± 2%  21.9ms ± 5%    ~     (p=0.133 n=9+10)
      IndexHard3                     21.8ms ± 3%  21.7ms ± 1%    ~     (p=0.579 n=10+10)
      IndexHard4                     21.6ms ± 1%  21.9ms ± 4%    ~     (p=0.360 n=8+10)
      LastIndexHard1                 25.1ms ± 2%  25.4ms ± 5%    ~     (p=0.853 n=10+10)
      LastIndexHard2                 25.3ms ± 6%  25.2ms ± 5%    ~     (p=0.796 n=10+10)
      LastIndexHard3                 25.3ms ± 4%  25.2ms ± 3%    ~     (p=0.739 n=10+10)
      IndexTorture                    130µs ± 3%   133µs ± 5%    ~     (p=0.218 n=10+10)
      IndexAnyASCII/1:1              98.4ns ± 5%  96.6ns ± 5%    ~     (p=0.054 n=10+10)
      IndexAnyASCII/1:2               109ns ± 4%   110ns ± 3%    ~     (p=0.232 n=10+10)
      IndexAnyASCII/1:4               135ns ± 4%   134ns ± 3%    ~     (p=0.671 n=10+10)
      IndexAnyASCII/1:8               184ns ± 4%   184ns ± 3%    ~     (p=0.749 n=10+10)
      IndexAnyASCII/1:16              289ns ± 3%   281ns ± 3%  -2.73%  (p=0.001 n=9+10)
      IndexAnyASCII/16:1              322ns ± 3%   307ns ± 3%  -4.71%  (p=0.000 n=10+10)
      IndexAnyASCII/16:2              329ns ± 3%   320ns ± 3%  -2.89%  (p=0.008 n=10+10)
      IndexAnyASCII/16:4              353ns ± 3%   339ns ± 3%  -3.91%  (p=0.001 n=10+10)
      IndexAnyASCII/16:8              390ns ± 3%   374ns ± 3%  -4.06%  (p=0.000 n=10+10)
      IndexAnyASCII/16:16             471ns ± 4%   452ns ± 2%  -4.22%  (p=0.000 n=10+10)
      IndexAnyASCII/256:1            2.94µs ± 4%  2.91µs ± 2%    ~     (p=0.424 n=10+10)
      IndexAnyASCII/256:2            2.92µs ± 3%  2.90µs ± 2%    ~     (p=0.388 n=9+10)
      IndexAnyASCII/256:4            2.93µs ± 1%  2.90µs ± 1%  -0.98%  (p=0.036 n=8+9)
      IndexAnyASCII/256:8            3.03µs ± 5%  2.97µs ± 3%    ~     (p=0.085 n=10+10)
      IndexAnyASCII/256:16           3.07µs ± 4%  3.01µs ± 1%  -2.03%  (p=0.003 n=10+9)
      IndexAnyASCII/4096:1           45.8µs ± 3%  45.9µs ± 2%    ~     (p=0.905 n=10+9)
      IndexAnyASCII/4096:2           46.7µs ± 3%  46.2µs ± 3%    ~     (p=0.190 n=10+10)
      IndexAnyASCII/4096:4           45.7µs ± 2%  46.4µs ± 3%  +1.37%  (p=0.022 n=9+10)
      IndexAnyASCII/4096:8           46.4µs ± 3%  46.0µs ± 2%    ~     (p=0.436 n=10+10)
      IndexAnyASCII/4096:16          46.6µs ± 3%  46.7µs ± 2%    ~     (p=0.971 n=10+10)
      IndexPeriodic/IndexPeriodic2   1.40ms ± 3%  1.40ms ± 2%    ~     (p=0.853 n=10+10)
      IndexPeriodic/IndexPeriodic4   1.40ms ± 3%  1.40ms ± 3%    ~     (p=0.579 n=10+10)
      IndexPeriodic/IndexPeriodic8   1.42ms ± 3%  1.39ms ± 2%  -1.60%  (p=0.029 n=10+10)
      IndexPeriodic/IndexPeriodic16   616µs ± 5%   583µs ± 5%  -5.32%  (p=0.001 n=10+10)
      IndexPeriodic/IndexPeriodic32   313µs ± 5%   301µs ± 2%  -3.67%  (p=0.002 n=10+10)
      IndexPeriodic/IndexPeriodic64   169µs ± 5%   164µs ± 5%  -3.17%  (p=0.023 n=10+10)
      
      NodeJS version - 10.2.1
      
      Change-Id: I9a8268314b5652c4aeffc4c5c72d2fd1a384aa9e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169777
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      4a7cd9d9
  2. 28 Mar, 2019 20 commits
  3. 27 Mar, 2019 10 commits