1. 08 Mar, 2018 2 commits
  2. 07 Mar, 2018 22 commits
    • Ian Lance Taylor's avatar
      cmd/cover: don't crash on non-gofmt'ed input · 8b8625a3
      Ian Lance Taylor authored
      Without the change to cover.go, the new test fails with
      
      panic: overlapping edits: [4946,4950)->"", [4947,4947)->"thisNameMustBeVeryLongToCauseOverflowOfCounterIncrementStatementOntoNextLineForTest.Count[112]++;"
      
      The original code inserts "else{", deletes "else", and then positions
      a new block just after the "}" that must come before the "else".
      That works on gofmt'ed code, but fails if the code looks like "}else".
      When there is no space between the "{" and the "else", the new block
      is inserted into a location that we are deleting, leading to the
      "overlapping edits" mentioned above.
      
      This CL fixes this case by not deleting the "else" but just using the
      one that is already there. That requires adjust the block offset to
      come after the "{" that we insert.
      
      Fixes #23927
      
      Change-Id: I40ef592490878765bbce6550ddb439e43ac525b2
      Reviewed-on: https://go-review.googlesource.com/98935
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      8b8625a3
    • Ian Lance Taylor's avatar
      runtime: get traceback from VDSO code · 419c0645
      Ian Lance Taylor authored
      Currently if a profiling signal arrives while executing within a VDSO
      the profiler will report _ExternalCode, which is needlessly confusing
      for a pure Go program. Change the VDSO calling code to record the
      caller's PC/SP, so that we can do a traceback from that point. If that
      fails for some reason, report _VDSO rather than _ExternalCode, which
      should at least point in the right direction.
      
      This adds some instructions to the code that calls the VDSO, but the
      slowdown is reasonably negligible:
      
      name                                  old time/op  new time/op  delta
      ClockVDSOAndFallbackPaths/vDSO-8      40.5ns ± 2%  41.3ns ± 1%  +1.85%  (p=0.002 n=10+10)
      ClockVDSOAndFallbackPaths/Fallback-8  41.9ns ± 1%  43.5ns ± 1%  +3.84%  (p=0.000 n=9+9)
      TimeNow-8                             41.5ns ± 3%  41.5ns ± 2%    ~     (p=0.723 n=10+10)
      
      Fixes #24142
      
      Change-Id: Iacd935db3c4c782150b3809aaa675a71799b1c9c
      Reviewed-on: https://go-review.googlesource.com/97315
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      419c0645
    • Ian Lance Taylor's avatar
      runtime: change from rt_sigaction to sigaction · c2f28de7
      Ian Lance Taylor authored
      This normalizes the Linux code to act like other targets. The size
      argument to the rt_sigaction system call is pushed to a single
      function, sysSigaction.
      
      This is intended as a simplification step for CL 93875 for #14327.
      
      Change-Id: I594788e235f0da20e16e8a028e27ac8c883907c4
      Reviewed-on: https://go-review.googlesource.com/99077
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      c2f28de7
    • Brad Fitzpatrick's avatar
      cmd/dist: skip rebuild before running tests when on the build systems · d8c9ef9e
      Brad Fitzpatrick authored
      Updates #24300
      
      Change-Id: I7752dab67e15a6dfe5fffe5b5ccbf3373bbc2c13
      Reviewed-on: https://go-review.googlesource.com/99296Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d8c9ef9e
    • Vlad Krasnov's avatar
      math/big: implement addMulVVW on arm64 · fd3d2793
      Vlad Krasnov authored
      The lack of proper addMulVVW implementation for arm64 hurts RSA performance.
      
      This assembly implementation is optimized for arm64 based servers.
      
      name                  old time/op    new time/op     delta
      pkg:math/big goos:linux goarch:arm64
      AddMulVVW/1             55.2ns ± 0%     11.9ns ± 1%    -78.37%  (p=0.000 n=8+10)
      AddMulVVW/2             67.0ns ± 0%     11.2ns ± 0%    -83.28%  (p=0.000 n=7+10)
      AddMulVVW/3             93.2ns ± 0%     13.2ns ± 0%    -85.84%  (p=0.000 n=10+10)
      AddMulVVW/4              126ns ± 0%       13ns ± 1%    -89.82%  (p=0.000 n=10+10)
      AddMulVVW/5              151ns ± 0%       17ns ± 0%    -88.87%  (p=0.000 n=10+9)
      AddMulVVW/10             323ns ± 0%       25ns ± 0%    -92.20%  (p=0.000 n=10+10)
      AddMulVVW/100           3.28µs ± 0%     0.14µs ± 0%    -95.82%  (p=0.000 n=10+10)
      AddMulVVW/1000          31.7µs ± 0%      1.3µs ± 0%    -96.00%  (p=0.000 n=10+8)
      AddMulVVW/10000          313µs ± 0%       13µs ± 0%    -95.98%  (p=0.000 n=10+10)
      AddMulVVW/100000        3.24ms ± 0%     0.13ms ± 1%    -96.13%  (p=0.000 n=9+9)
      pkg:crypto/rsa goos:linux goarch:arm64
      RSA2048Decrypt          44.7ms ± 0%      4.0ms ± 6%    -91.08%  (p=0.000 n=8+10)
      RSA2048Sign             46.3ms ± 0%      5.0ms ± 0%    -89.29%  (p=0.000 n=9+10)
      3PrimeRSA2048Decrypt    22.3ms ± 0%      2.4ms ± 0%    -89.26%  (p=0.000 n=10+10)
      
      Change-Id: I295f0bd5c51a4442d02c44ece1f6026d30dff0bc
      Reviewed-on: https://go-review.googlesource.com/76270Reviewed-by: 's avatarVlad Krasnov <vlad@cloudflare.com>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Vlad Krasnov <vlad@cloudflare.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fd3d2793
    • David du Colombier's avatar
      cmd/go: skip TestVetWithOnlyCgoFiles when cgo is disabled · b1335037
      David du Colombier authored
      CL 99175 added TestVetWithOnlyCgoFiles. However, this
      test is failing on platforms where cgo is disabled,
      because no file can be built.
      
      This change fixes TestVetWithOnlyCgoFiles by skipping
      this test when cgo is disabled.
      
      Fixes #24304.
      
      Change-Id: Ibb38fcd3e0ed1a791782145d3f2866f12117c6fe
      Reviewed-on: https://go-review.googlesource.com/99275Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      b1335037
    • Elias Naur's avatar
      runtime/cgo: make sure nil is undefined before defining it · 7a2a96d6
      Elias Naur authored
      While working on standalone builds of gomobile bindings, I ran into
      errors on the form:
      
      gcc_darwin_arm.c:30:31: error: ambiguous expansion of macro 'nil' [-Werror,-Wambiguous-macro]
      /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/usr/include/MacTypes.h:94:15: note: expanding this definition of 'nil'
      
      Fix it by undefining nil before defining it in libcgo.h.
      
      Change-Id: I8e9660a68c6c351e592684d03d529f0d182c0493
      Reviewed-on: https://go-review.googlesource.com/99215
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      7a2a96d6
    • Ian Lance Taylor's avatar
      cmd/go: run vet on packages with only cgo files · 709da955
      Ian Lance Taylor authored
      CgoFiles is not included in GoFiles, so we need to check both.
      
      Fixes #24193
      
      Change-Id: I6a67bd912e3d9a4be0eae8fa8db6fa8a07fb5df3
      Reviewed-on: https://go-review.googlesource.com/99175
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      709da955
    • Matthew Dempsky's avatar
      cmd/compile: prevent untyped types from reaching walk · a3b3284d
      Matthew Dempsky authored
      We already require expressions to have already been typechecked before
      reaching walk. Moreover, all untyped expressions should have been
      converted to their default type by walk.
      
      However, in practice, we've been somewhat sloppy and inconsistent
      about ensuring this. In particular, a lot of AST rewrites ended up
      leaving untyped bool expressions scattered around. These likely aren't
      harmful in practice, but it seems worth cleaning up.
      
      The two most common cases addressed by this CL are:
      
      1) When generating OIF and OFOR nodes, we would often typecheck the
      conditional expression, but not apply defaultlit to force it to the
      expression's default type.
      
      2) When rewriting string comparisons into more fundamental primitives,
      we were simply overwriting r.Type with the desired type, which didn't
      propagate the type to nested subexpressions. These are fixed by
      utilizing finishcompare, which correctly handles this (and is already
      used by other comparison lowering rewrites).
      
      Lastly, walkexpr is extended to assert that it's not called on untyped
      expressions.
      
      Fixes #23834.
      
      Change-Id: Icbd29648a293555e4015d3b06a95a24ccbd3f790
      Reviewed-on: https://go-review.googlesource.com/98337Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      a3b3284d
    • Kunpei Sakai's avatar
      cmd/compile: go fmt · ed8b7a77
      Kunpei Sakai authored
      Change-Id: I2eae33928641c6ed74badfe44d079ae90e5cc8c8
      Reviewed-on: https://go-review.googlesource.com/99195Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      ed8b7a77
    • Alberto Donizetti's avatar
      test/codegen: fix issue with arm64 memmove codegen test · c0289583
      Alberto Donizetti authored
      This recently added arm64 memmove codegen check:
      
        func movesmall() {
          // arm64:-"memmove"
          x := [...]byte{1, 2, 3, 4, 5, 6, 7}
          copy(x[1:], x[:])
        }
      
      is not correct, for two reasons:
      
      1. regexps are matched from the start of the disasm line (excluding
         line information). This mean that a negative -"memmove" check will
         pass against a 'CALL runtime.memmove' line because the line does
         not start with 'memmove' (its starts with CALL...).
         The way to specify no 'memmove' match whatsoever on the line is
         -".*memmove"
      
      2. AFAIK comments on their own line are matched against the first
         subsequent non-comment line. So the code above only verifies that
         the x := ... line does not generate a memmove. The comment should
         be moved near the copy() line, if it's that one we want to not
         generate a memmove call.
      
      The fact that the test above is not effective can be checked by
      running `go run run.go -v codegen` in the toplevel test directory with
      a go1.10 toolchain (that does not have the memmove-elision
      optimization). The test will still pass (it shouldn't).
      
      This change changes the regexp to -".*memmove" and moves it near the
      line it needs to (not)match.
      
      Change-Id: Ie01ef4d775e77d92dc8d8b7856b89b200f5e5ef2
      Reviewed-on: https://go-review.googlesource.com/98977
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      c0289583
    • Tobias Klauser's avatar
      debug/pe: use bytes.IndexByte instead of a loop · aa00d974
      Tobias Klauser authored
      Follow CL 98759
      
      Change-Id: I58c8b769741b395e5bf4e723505b149d063d492a
      Reviewed-on: https://go-review.googlesource.com/99095
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      aa00d974
    • Tobias Klauser's avatar
      database/sql: fix typo in comment · 06572356
      Tobias Klauser authored
      Change-Id: Ie2966bae1dc2e542c42fb32d8059a4b2d4690014
      Reviewed-on: https://go-review.googlesource.com/99115Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      06572356
    • Hana Kim's avatar
      cmd/trace: force GC occassionally · 93b0261d
      Hana Kim authored
      to return memory to the OS after completing potentially
      large operations.
      
      Update #21870
      
      Sys went down to 3.7G
      
      $ DEBUG_MEMORY_USAGE=1 go tool trace trace.out
      
      2018/03/07 09:35:52 Parsing trace...
      after parsing trace
       Alloc:	3385754360 Bytes
       Sys:	3662047864 Bytes
       HeapReleased:	0 Bytes
       HeapSys:	3488907264 Bytes
       HeapInUse:	3426549760 Bytes
       HeapAlloc:	3385754360 Bytes
      Enter to continue...
      2018/03/07 09:36:09 Splitting trace...
      after spliting trace
       Alloc:	3238309424 Bytes
       Sys:	3684410168 Bytes
       HeapReleased:	0 Bytes
       HeapSys:	3488874496 Bytes
       HeapInUse:	3266461696 Bytes
       HeapAlloc:	3238309424 Bytes
      Enter to continue...
      2018/03/07 09:36:39 Opening browser. Trace viewer is listening on http://100.101.224.241:12345
      
      after httpJsonTrace
       Alloc:	3000633872 Bytes
       Sys:	3693978424 Bytes
       HeapReleased:	0 Bytes
       HeapSys:	3488743424 Bytes
       HeapInUse:	3030966272 Bytes
       HeapAlloc:	3000633872 Bytes
      Enter to continue...
      
      Change-Id: I56f64cae66c809cbfbad03fba7bd0d35494c1d04
      Reviewed-on: https://go-review.googlesource.com/92376Reviewed-by: 's avatarPeter Weinberger <pjw@google.com>
      93b0261d
    • jimmyfrasche's avatar
      go/build: correct value of .Doc field · 20b14b71
      jimmyfrasche authored
      Build could use the package comment from test files to populate the .Doc
      field on *Package.
      
      As go list uses this data and several packages in the standard library
      have tests with package comments, this lead to:
      
      $ go list -f '{{.Doc}}' flag container/heap image
      These examples demonstrate more intricate uses of the flag package.
      This example demonstrates an integer heap built using the heap interface.
      This example demonstrates decoding a JPEG image and examining its pixels.
      
      This change now only examines non-test files when attempting to populate
      .Doc, resulting in the expected behavior:
      
      $ gotip list -f '{{.Doc}}' flag container/heap image
      Package flag implements command-line flag parsing.
      Package heap provides heap operations for any type that implements heap.Interface.
      Package image implements a basic 2-D image library.
      
      Fixes #23594
      
      Change-Id: I37171c26ec5cc573efd273556a05223c6f675968
      Reviewed-on: https://go-review.googlesource.com/96976
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      20b14b71
    • Hana Kim's avatar
      cmd/trace: generate jsontrace data in a streaming fashion · ee465831
      Hana Kim authored
      Update #21870
      
      The Sys went down to 4.25G from 6.2G.
      
      $ DEBUG_MEMORY_USAGE=1 go tool trace trace.out
      2018/03/07 08:49:01 Parsing trace...
      after parsing trace
       Alloc:	3385757184 Bytes
       Sys:	3661195896 Bytes
       HeapReleased:	0 Bytes
       HeapSys:	3488841728 Bytes
       HeapInUse:	3426516992 Bytes
       HeapAlloc:	3385757184 Bytes
      Enter to continue...
      2018/03/07 08:49:18 Splitting trace...
      after spliting trace
       Alloc:	2352071904 Bytes
       Sys:	4243825464 Bytes
       HeapReleased:	0 Bytes
       HeapSys:	4025712640 Bytes
       HeapInUse:	2377703424 Bytes
       HeapAlloc:	2352071904 Bytes
      Enter to continue...
      after httpJsonTrace
       Alloc:	3228697832 Bytes
       Sys:	4250379064 Bytes
       HeapReleased:	0 Bytes
       HeapSys:	4025647104 Bytes
       HeapInUse:	3260014592 Bytes
       HeapAlloc:	3228697832 Bytes
      
      Change-Id: I546f26bdbc68b1e58f1af1235a0e299dc0ff115e
      Reviewed-on: https://go-review.googlesource.com/92375
      Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
      Reviewed-by: 's avatarPeter Weinberger <pjw@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ee465831
    • Yuval Pavel Zholkover's avatar
      runtime: add missing build constraints to os_linux_{be64,noauxv,novdso,ppc64x}.go files · 083f3957
      Yuval Pavel Zholkover authored
      They do not match the file name patterns of
        *_GOOS
        *_GOARCH
        *_GOOS_GOARCH
      therefore the implicit linux constraint was not being added.
      
      Change-Id: Ie506c51cee6818db445516f96fffaa351df62cf5
      Reviewed-on: https://go-review.googlesource.com/99116Reviewed-by: 's avatarTobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      083f3957
    • Elias Naur's avatar
      androidtest.bash: don't require GOARCH set · 9094946f
      Elias Naur authored
      The host GOARCH is most likely supported (386, amd64, arm, arm64).
      
      Change-Id: I86324b9c00f22c592ba54bda7d2ae97c86bda904
      Reviewed-on: https://go-review.googlesource.com/99155
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      9094946f
    • Alex Brainman's avatar
      os: use WIN32_FIND_DATA.Reserved0 to identify symlinks · e83601b4
      Alex Brainman authored
      os.Stat implementation uses instructions described at
      https://blogs.msdn.microsoft.com/oldnewthing/20100212-00/?p=14963/
      to distinguish symlinks. In particular, it calls
      GetFileAttributesEx or FindFirstFile and checks
      either WIN32_FILE_ATTRIBUTE_DATA.dwFileAttributes
      or WIN32_FIND_DATA.dwFileAttributes to see if
      FILE_ATTRIBUTES_REPARSE_POINT flag is set.
      And that seems to worked fine so far.
      
      But now we discovered that OneDrive root folder
      is determined as directory:
      
      c:\>dir C:\Users\Alex | grep OneDrive
      30/11/2017  07:25 PM    <DIR>          OneDrive
      c:\>
      
      while Go identified it as symlink.
      
      But we did not follow Microsoft's advice to the letter - we never
      checked WIN32_FIND_DATA.Reserved0. And adding that extra check
      makes Go treat OneDrive as symlink. So use FindFirstFile and
      WIN32_FIND_DATA.Reserved0 to determine symlinks.
      
      Fixes #22579
      
      Change-Id: I0cb88929eb8b47b1d24efaf1907ad5a0e20de83f
      Reviewed-on: https://go-review.googlesource.com/86556Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e83601b4
    • Matthew Dempsky's avatar
      cmd/compile: remove funcdepth variables · d7eb4901
      Matthew Dempsky authored
      There were only two large classes of use for these variables:
      
      1) Testing "funcdepth != 0" or "funcdepth > 0", which is equivalent to
      checking "Curfn != nil".
      
      2) In oldname, detecting whether a closure variable has been created
      for the current function, which can be handled by instead testing
      "n.Name.Curfn != Curfn".
      
      Lastly, merge funcstart into funchdr, since it's only called once, and
      it better matches up with funcbody now.
      
      Passes toolstash-check.
      
      Change-Id: I8fe159a9d37ef7debc4cd310354cea22a8b23394
      Reviewed-on: https://go-review.googlesource.com/99076
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      d7eb4901
    • Matthew Dempsky's avatar
      cmd/compile: cleanup funccompile and compile · aa00ca12
      Matthew Dempsky authored
      Bring these functions next to each other, and clean them up a little
      bit. Also, change emitptrargsmap to take Curfn as a parameter instead
      of a global.
      
      Passes toolstash-check.
      
      Change-Id: Ib9c94fda3b2cb6f0dcec1585622b33b4f311b5e9
      Reviewed-on: https://go-review.googlesource.com/99075
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      aa00ca12
    • Kunpei Sakai's avatar
      cmd/compile: prevent detection of wrong duplicates · b75e8a2a
      Kunpei Sakai authored
      by including *types.Type in typeVal.
      
      Updates #21866
      Fixes #24159
      
      Change-Id: I2f8cac252d88d43e723124f2867b1410b7abab7b
      Reviewed-on: https://go-review.googlesource.com/98476
      Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      b75e8a2a
  3. 06 Mar, 2018 16 commits