1. 11 Oct, 2017 36 commits
    • Cherry Zhang's avatar
      test: skip issue22200b.go on mipsle · 70576947
      Cherry Zhang authored
      It should be skipped on 32-bit architectures.
      
      Change-Id: If7a64b9e90e47c3e8734dd62729bfd2944ae926c
      Reviewed-on: https://go-review.googlesource.com/70071Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      70576947
    • Russ Cox's avatar
      cmd/dist: refresh deps.go after recent package io changes · d19ced04
      Russ Cox authored
      Change-Id: Iaa960c85011289e047c64b53cf610838eb50332d
      Reviewed-on: https://go-review.googlesource.com/70073
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      d19ced04
    • Ian Lance Taylor's avatar
      runtime: unify amd64 -buildmode=exe entry point code · cf3f7712
      Ian Lance Taylor authored
      All of the amd64 entry point code is the same except for Plan 9.
      Unify it all into asm_amd64.s.
      
      Change-Id: Id47ce3a7bb2bb0fd48f326a2d88ed18b17dee456
      Reviewed-on: https://go-review.googlesource.com/69292
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      cf3f7712
    • Austin Clements's avatar
      cmd/link: fix some unintentional symbol creation · e29efbcb
      Austin Clements authored
      There are two places in DWARF generation that create symbols when they
      really just want to get the symbol if it exists. writeranges, in
      particular, will create a DWARF range symbol for every single textp
      symbol (though they won't get linked into any list, so they don't
      affect the binary).
      
      Fix these to use ROLookup instead of Lookup.
      
      Change-Id: I401eadf22890e296bd08bccaa6ba2fd8fac800cd
      Reviewed-on: https://go-review.googlesource.com/69971
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
      Reviewed-by: 's avatarThan McIntosh <thanm@google.com>
      e29efbcb
    • Joe Tsai's avatar
      io: simplify pipe implementation · 371eda45
      Joe Tsai authored
      In the distant past, Pipe was implemented with channels and a
      long running pipe.run goroutine (see CL 994043).
      This approach of having all communication serialized through the
      run method was error prone giving Pipe a history of deadlocks
      and race conditions.
      
      After the introduction of sync.Cond, the implementation was rewritten
      (see CL 4252057) to use condition variables and avoid the
      long running pipe.run goroutine. While this implementation is superior
      to the previous one, this implementation is strange in that the
      p.data field is always set immediately prior to signaling the other
      goroutine with Cond.Signal, effectively making the combination of the
      two a channel-like operation. Inferior to a channel, however, this still
      requires explicit locking around the p.data field.
      
      The data+rwait can be effectively be replaced by a "chan []byte" to
      inform a reader that there is data available.
      The data+wwait can be effectively be replaced by a "chan int" to
      inform a writer of how many bytes were read.
      
      This implementation is a simplified from net.Pipe in CL 37402.
      
      Change-Id: Ia5b26320b0525934fd87a3b69a091c787167f5aa
      Reviewed-on: https://go-review.googlesource.com/65330
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBryan Mills <bcmills@google.com>
      371eda45
    • Joe Tsai's avatar
      net: implement deadline functionality on Pipe · e2dd8ca9
      Joe Tsai authored
      Implement deadline functionality on Pipe so that it properly implements
      the semantics of the Conn interface. This aids usages of Pipe (often in
      unit tests) with a more realistic and complete implementation.
      
      The new implementation avoids a dependency on a io.Pipe since it is
      impossible to keep the prior semantics of synchronous reads and writes
      while also trying to implement cancelation over an io.{Reader,Writer}
      that fundamentally has no cancelation support.
      
      The fact that net.Pipe is synchronous (and documented as such)
      is unfortunate because no realistic network connection is synchronous.
      Instead real networks introduces a read and write buffer of some sort.
      However, we do not change the semantics for backwards compatibility.
      
      The approach taken does not leave any long-running goroutines,
      meaning that tests that never call Close will not cause a resource leak.
      
      Fixes #18170
      
      Change-Id: I5140b1f289a0a49fb2d485f031b5aa0ee99ecc30
      Reviewed-on: https://go-review.googlesource.com/37402
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      e2dd8ca9
    • Russ Cox's avatar
      cmd/internal/buildid: add missing f.Close in ReadFile · 7dcd3330
      Russ Cox authored
      On Windows, not closing f keeps us from being able to remove it.
      
      Change-Id: Id4cb709b6ce0b30485b87364a9f0e6e71d2782bd
      Reviewed-on: https://go-review.googlesource.com/70070
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7dcd3330
    • Russ Cox's avatar
      cmd/dist: reenable TestDeps · 31896332
      Russ Cox authored
      It looks like I forgot to reenable this test when I fixed #21522.
      Update deps.go and reenable.
      
      Change-Id: I68a45df09b418f48d93d2e7ab1d274e056c192e6
      Reviewed-on: https://go-review.googlesource.com/70050
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      31896332
    • Russ Cox's avatar
      cmd/go: record both build ID and content ID in archives and binaries · cdbc363c
      Russ Cox authored
      The content ID will be needed for content-based staleness
      determination. It is defined as the SHA256 hash of the file
      in which it appears, with occurrences of the build+content IDs
      changed to zeros during the hashing operation.
      
      Storing the content ID in the archives is a little tricky
      but it means that later builds need not rehash the archives
      each time they are referenced, so under the assumption
      that each package is imported at least once after being
      compiled, hashing at build time is a win. (Also the whole
      file is more likely to be in cache at build time,
      since we just wrote it.)
      
      In my unscientific tests, the time for "go build -a std cmd"
      rises from about 14.3s to 14.5s on my laptop, or under 2%.
      
      Change-Id: Ia3d4dc657d003e8295631f73363868bd92ebf96a
      Reviewed-on: https://go-review.googlesource.com/69054Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      cdbc363c
    • Austin Clements's avatar
      cmd/compile: fix some plive comments · 85f93c88
      Austin Clements authored
      The liveness analysis no longer directly emits PCDATA. Fix stale
      comments that say so.
      
      Change-Id: Id26b112ddf4c13a12ebf766f64bf57c68fbfe3ef
      Reviewed-on: https://go-review.googlesource.com/67691
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      85f93c88
    • Keith Randall's avatar
      cmd/compile: abort earlier if stack frame too large · e130dcf0
      Keith Randall authored
      If the stack frame is too large, abort immediately.
      We used to generate code first, then abort.
      In issue 22200, generating code raised a panic
      so we got an ICE instead of an error message.
      
      Change the max frame size to 1GB (from 2GB).
      Stack frames between 1.1GB and 2GB didn't used to work anyway,
      the pcln table generation would have failed and generated an ICE.
      
      Fixes #22200
      
      Change-Id: I1d918ab27ba6ebf5c87ec65d1bccf973f8c8541e
      Reviewed-on: https://go-review.googlesource.com/69810
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      e130dcf0
    • Keith Randall's avatar
      cmd/compile: fold constant comparisions into SETxxmem ops. · 624630b8
      Keith Randall authored
      Fixes #22198
      
      Change-Id: I5cb91c73069af8b16a2580d28756efd58c84b690
      Reviewed-on: https://go-review.googlesource.com/69990
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      624630b8
    • Russ Cox's avatar
      cmd/buildid: add new tool factoring out code needed by go command · 9ad2319b
      Russ Cox authored
      This CL does a few things.
      
      1. It moves the existing "read a build ID" code out of the go command
      and into cmd/internal/buildid.
      
      2. It adds new code there to "write a build ID".
      
      3. It adds better tests.
      
      4. It encapsulates cmd/internal/buildid into a new standalone program
      "go tool buildid".
      
      The go command is going to use the new "write a build ID" functionality
      in a future CL. Adding the separate "go tool buildid" gives "go build -x"
      a printable command to explain what it is doing in that new step.
      (This is similar to the go command printing "go tool pack" commands
      equivalent to the actions it is taking, even though it's not invoking pack
      directly.) Keeping go build -x honest means that other build systems can
      potentially keep up with the go command.
      
      Change-Id: I01c0a66e30a80fa7254e3f2879283d3cd7aa03b4
      Reviewed-on: https://go-review.googlesource.com/69053Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      9ad2319b
    • Austin Clements's avatar
      cmd/compile: split TestNexting into subtests · 0bede7f3
      Austin Clements authored
      This makes it more obvious which of the two builds is failing by
      putting "dbg" or "opt" directly in the test name. It also makes it
      possible for them to fail independently, so a failure in "dbg" doesn't
      mask a failure in "opt", and to visibly skip the opt test when run
      with an unoptimized runtime.
      
      Change-Id: I3403a7fd3c1a13ad51a938bb95dfe54c320bb58e
      Reviewed-on: https://go-review.googlesource.com/69970
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
      0bede7f3
    • Austin Clements's avatar
      runtime: make (Un)LockOSThread doc more prescriptive · 0aef82aa
      Austin Clements authored
      Right now users have to infer why they would want LockOSThread and
      when it may or may not be appropriate to call UnlockOSThread. This
      requires some understanding of Go's internal thread pool
      implementation, which is unfortunate.
      
      Improve the situation by making the documentation on these functions
      more prescriptive so users can figure out when to use them even if
      they don't know about the scheduler.
      
      Change-Id: Ide221791e37cb5106dd8a172f89fbc5b3b98fe32
      Reviewed-on: https://go-review.googlesource.com/52871
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      0aef82aa
    • Austin Clements's avatar
      runtime: terminate locked OS thread if its goroutine exits · 4f34a529
      Austin Clements authored
      runtime.LockOSThread is sometimes used when the caller intends to put
      the OS thread into an unusual state. In this case, we never want to
      return this thread to the runtime thread pool. However, currently
      exiting the goroutine implicitly unlocks its OS thread.
      
      Fix this by terminating the locked OS thread when its goroutine exits,
      rather than simply returning it to the pool.
      
      Fixes #20395.
      
      Change-Id: I3dcec63b200957709965f7240dc216fa84b62ad9
      Reviewed-on: https://go-review.googlesource.com/46038
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      4f34a529
    • Austin Clements's avatar
      runtime: make it possible to exit Go-created threads · eff2b262
      Austin Clements authored
      Currently, threads created by the runtime exist until the whole
      program exits. For #14592 and #20395, we want to be able to exit and
      clean up threads created by the runtime. This commit implements that
      mechanism.
      
      The main difficulty is how to clean up the g0 stack. In cgo mode and
      on Solaris and Windows where the OS manages thread stacks, we simply
      arrange to return from mstart and let the system clean up the thread.
      If the runtime allocated the g0 stack, then we use a new exitThread
      syscall wrapper that arranges to clear a flag in the M once the stack
      can safely be reaped and call the thread termination syscall.
      
      exitThread is based on the existing exit1 wrapper, which was always
      meant to terminate the calling thread. However, exit1 has never been
      used since it was introduced 9 years ago, so it was broken on several
      platforms. exitThread also has the additional complication of having
      to flag that the stack is unused, which requires some tricks on
      platforms that use the stack for syscalls.
      
      This still leaves the problem of how to reap the unused g0 stacks. For
      this, we move the M from allm to a new freem list as part of the M
      exiting. Later, allocm scans the freem list, finds Ms that are marked
      as done with their stack, removes these from the list and frees their
      g0 stacks. This also allows these Ms to be garbage collected.
      
      This CL does not yet use any of this functionality. Follow-up CLs
      will. Likewise, there are no new tests in this CL because we'll need
      follow-up functionality to test it.
      
      Change-Id: Ic851ee74227b6d39c6fc1219fc71b45d3004bc63
      Reviewed-on: https://go-review.googlesource.com/46037
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      eff2b262
    • Russ Cox's avatar
      cmd/go: make cmd/* default to go tool installation · a9c3d09d
      Russ Cox authored
      Every cmd/thing is 'go tool thing' except for go and gofmt.
      But the table in cmd/go enumerates all the things instead of
      saying that go and gofmt are the exceptions.
      Change that, so that when adding new tools it's not
      necessary to update this table.
      
      Change-Id: Ia6fef41b4d967249b19971a0d03e5acb0317ea82
      Reviewed-on: https://go-review.googlesource.com/69052
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      a9c3d09d
    • Austin Clements's avatar
      runtime: replace sched.mcount int32 with sched.mnext int64 · 6c7bea63
      Austin Clements authored
      Currently, since Ms never exit, the number of Ms, the number of Ms
      ever created, and the ID of the next M are all the same and must be
      small. That's about to change, so rename sched.mcount to sched.mnext
      to make it clear it's the number of Ms ever created (and the ID of the
      next M), change its type to int64, and use mcount() for the number of
      Ms. In the next commit, mcount() will become slightly less trivial.
      
      For #20395.
      
      Change-Id: I9af34d36bd72416b5656555d16e8085076f1b196
      Reviewed-on: https://go-review.googlesource.com/68750
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      6c7bea63
    • Russ Cox's avatar
      cmd/go: hoist C++, Objective-C, and Fortran checks earlier · d7ac5ce8
      Russ Cox authored
      Today they happen during the build phase; they should happen
      during the load phase instead, along with the C check.
      
      Change-Id: I6074a995b8e29275549aafa574511b735642d85b
      Reviewed-on: https://go-review.googlesource.com/69051
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      d7ac5ce8
    • Austin Clements's avatar
      runtime: mark mstart as nowritebarrierrec · a212083e
      Austin Clements authored
      mstart is the entry point for new threads, so it certainly can't
      interact with GC enough to have write barriers. We move the one small
      piece that is allowed to have write barriers out into its own
      function.
      
      Change-Id: Id9c31d6ffac31d0051fab7db15eb428c11cadbad
      Reviewed-on: https://go-review.googlesource.com/46035
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      a212083e
    • Russ Cox's avatar
      cmd/go: replace a.Package.Internal.Pkgfile with a.built · 8f7f46f5
      Russ Cox authored
      Logically the build needs to start treating a.Package as immutable,
      since we might want to build a.Package multiple ways.
      Record the built target in a.built instead.
      
      Right now a.built is predictable ahead of time, but we want to
      move toward satisfying some builds from a cache directory,
      in which case a.built will point into the cache directory
      and not be determined until action execution time.
      
      There is probably more to do with shared libraries, but this
      does not break what's there.
      
      Change-Id: I941988b520bee2f664fd8cabccf389e1dc29628b
      Reviewed-on: https://go-review.googlesource.com/69050
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      8f7f46f5
    • Austin Clements's avatar
      runtime: make m.nextwaitm an muintptr · 12ec5472
      Austin Clements authored
      This field is really a *m (modulo its bottom bit). Change it from
      uintptr to muintptr to document this fact.
      
      Change-Id: I2d181a955ef1d2c1a268edf20091b440d85726c9
      Reviewed-on: https://go-review.googlesource.com/46034
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      12ec5472
    • Russ Cox's avatar
      cmd/go: clean up compile vs link vs shared library actions · 4e8be995
      Russ Cox authored
      Everything got a bit tangled together in b.action1.
      Try to tease things apart again.
      
      In general this is a refactoring of the existing code, with limited
      changes to the effect of the code.
      
      The main additional change is to complete a.Deps for link actions.
      That list now directly contains all the inputs the linker will attempt
      to read, eliminating the need for a transitive traversal of the entire
      action graph to find those. The comepleteness of a.Deps will be
      important when we eventually use it to decide whether an cached
      action output can be reused.
      
      all.bash passes, but it's possible I've broken some subtety of
      buildmode=shared again. Certainly that code took the longest
      to get working.
      
      Change-Id: I34e849eda446dca45a9cfce02b07bec6edb6d0d4
      Reviewed-on: https://go-review.googlesource.com/69831
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      4e8be995
    • Austin Clements's avatar
      runtime: don't start new threads from locked threads · 2595fe7f
      Austin Clements authored
      Applications that need to manipulate kernel thread state are currently
      on thin ice in Go: they can use LockOSThread to prevent other
      goroutines from running on the manipulated thread, but Go may clone
      this manipulated state into a new thread that's put into the runtime's
      thread pool along with other threads.
      
      Fix this by never starting a new thread from a locked thread or a
      thread that may have been started by C. Instead, the runtime starts a
      "template thread" with a known-good state. If it then needs to start a
      new thread but doesn't know that the current thread is in a good
      state, it forwards the thread creation to the template thread.
      
      Fixes #20676.
      
      Change-Id: I798137a56e04b7723d55997e9c5c085d1d910643
      Reviewed-on: https://go-review.googlesource.com/46033
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      2595fe7f
    • Russ Cox's avatar
      cmd/go: separate compile and link steps in action graph · 9a9780a2
      Russ Cox authored
      To the extent that invoking the compiler and invoking the linker
      have different dependency requirements, representing both steps
      by a single action node leads to confusion.
      
      If we move to having separate .a and .x (import metadata) files
      in the standard builds, then the .a is a link dependency but not
      a compile dependency, and vice versa for .x.
      Today, in shared library builds, the .a is a compile dependency
      and a link dependency, while the .so is only a link dependency.
      
      Also in this CL: change the gccgo link step to extract _cgo_flags
      into root.Objdir, which is private to the link step, instead of into
      b.WorkDir, which is shared by all the link steps that could possibly
      be running in parallel. And attempt to handle the -n and -x flags
      when loading _cgo_flags, instead of dying attempting to read
      an archive that wasn't written.
      
      Also in this CL: create a.Objdir before running a.Func, to avoid
      duplicating the Mkdir(a.Objdir) in every a.Func.
      
      A future CL will update the link action's Deps to be accurate.
      (Right now the link steps search out the true Deps by walking
      the entire action graph.)
      
      Change-Id: I15128ce2bd064887f98abc3a4cf204241f518631
      Reviewed-on: https://go-review.googlesource.com/69830
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      9a9780a2
    • David Crawshaw's avatar
      debug/elf: add relocation constants · 0c6fc0d7
      David Crawshaw authored
      Compiled from various tables found around the internet.
      
      Some of these are used by cmd/link.
      
      Change-Id: I258b25e694dbe91a61d675763f2c47ccc928fd70
      Reviewed-on: https://go-review.googlesource.com/69012
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      0c6fc0d7
    • Ian Lance Taylor's avatar
      cmd/go: correct directory used in checkNestedVCS test · 862b78e1
      Ian Lance Taylor authored
      This error was not used when using git because nested git is permitted.
      Add test using Mercurial, so that at least we have a test, even though
      the test is not run by default.
      
      Fixes #22157
      Fixes #22201
      
      Change-Id: If521f3c09b0754e00e56fa3cd0364764a57a43ad
      Reviewed-on: https://go-review.googlesource.com/69670
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      862b78e1
    • Ben Shi's avatar
      cmd/compile: optimize ARM code with CMN/TST/TEQ · 1ec78d1d
      Ben Shi authored
      CMN/TST/TEQ were supported since ARMv4, which can be used to
      simplify comparisons.
      
      This patch implements the optimization and here are the benchmark
      results.
      
      1. A special test case got 18.21% improvement.
      name                     old time/op    new time/op    delta
      TSTTEQ-4                    806µs ± 1%     659µs ± 0%  -18.21%  (p=0.000 n=20+18)
      (https://github.com/benshi001/ugo1/blob/master/tstteq_test.go)
      
      2. There is no regression in the compilecmp benchmark.
      name        old time/op       new time/op       delta
      Template          2.31s ± 1%        2.30s ± 1%    ~     (p=0.661 n=10+9)
      Unicode           1.32s ± 3%        1.32s ± 5%    ~     (p=0.280 n=10+10)
      GoTypes           7.69s ± 1%        7.65s ± 0%  -0.52%  (p=0.027 n=10+8)
      Compiler          36.5s ± 1%        36.4s ± 1%    ~     (p=0.546 n=9+9)
      SSA               85.1s ± 2%        84.9s ± 1%    ~     (p=0.529 n=10+10)
      Flate             1.43s ± 2%        1.43s ± 2%    ~     (p=0.661 n=10+9)
      GoParser          1.81s ± 2%        1.81s ± 1%    ~     (p=0.796 n=10+10)
      Reflect           5.10s ± 2%        5.09s ± 1%    ~     (p=0.853 n=10+10)
      Tar               2.47s ± 1%        2.48s ± 1%    ~     (p=0.123 n=10+10)
      XML               2.59s ± 1%        2.58s ± 1%    ~     (p=0.853 n=10+10)
      [Geo mean]        4.78s             4.77s       -0.17%
      
      name        old user-time/op  new user-time/op  delta
      Template          2.72s ± 3%        2.73s ± 2%    ~     (p=0.928 n=10+10)
      Unicode           1.58s ± 4%        1.60s ± 1%    ~     (p=0.087 n=10+9)
      GoTypes           9.41s ± 2%        9.36s ± 1%    ~     (p=0.060 n=10+10)
      Compiler          44.4s ± 2%        44.2s ± 2%    ~     (p=0.289 n=10+10)
      SSA                110s ± 2%         110s ± 1%    ~     (p=0.739 n=10+10)
      Flate             1.67s ± 2%        1.63s ± 3%    ~     (p=0.063 n=10+10)
      GoParser          2.12s ± 1%        2.12s ± 2%    ~     (p=0.840 n=10+10)
      Reflect           5.94s ± 1%        5.98s ± 1%    ~     (p=0.063 n=9+10)
      Tar               3.01s ± 2%        3.02s ± 2%    ~     (p=0.584 n=10+10)
      XML               3.04s ± 3%        3.02s ± 2%    ~     (p=0.696 n=10+10)
      [Geo mean]        5.73s             5.72s       -0.20%
      
      name        old text-bytes    new text-bytes    delta
      HelloSize         579kB ± 0%        579kB ± 0%    ~     (all equal)
      
      name        old data-bytes    new data-bytes    delta
      HelloSize        5.46kB ± 0%       5.46kB ± 0%    ~     (all equal)
      
      name        old bss-bytes     new bss-bytes     delta
      HelloSize        72.8kB ± 0%       72.8kB ± 0%    ~     (all equal)
      
      name        old exe-bytes     new exe-bytes     delta
      HelloSize        1.03MB ± 0%       1.03MB ± 0%    ~     (all equal)
      
      3. There is little change in the go1 benchmark (excluding the noise).
      name                     old time/op    new time/op     delta
      BinaryTree17-4              40.3s ± 1%      40.6s ± 1%  +0.80%  (p=0.000 n=30+30)
      Fannkuch11-4                24.2s ± 1%      24.1s ± 0%    ~     (p=0.093 n=30+30)
      FmtFprintfEmpty-4           834ns ± 0%      826ns ± 0%  -0.93%  (p=0.000 n=29+24)
      FmtFprintfString-4         1.39µs ± 1%     1.36µs ± 0%  -2.02%  (p=0.000 n=30+30)
      FmtFprintfInt-4            1.43µs ± 1%     1.44µs ± 1%    ~     (p=0.155 n=30+29)
      FmtFprintfIntInt-4         2.09µs ± 0%     2.11µs ± 0%  +1.16%  (p=0.000 n=28+30)
      FmtFprintfPrefixedInt-4    2.33µs ± 1%     2.36µs ± 0%  +1.25%  (p=0.000 n=30+30)
      FmtFprintfFloat-4          4.27µs ± 1%     4.32µs ± 1%  +1.27%  (p=0.000 n=30+30)
      FmtManyArgs-4              8.18µs ± 0%     8.14µs ± 0%  -0.46%  (p=0.000 n=25+27)
      GobDecode-4                 101ms ± 1%      101ms ± 1%    ~     (p=0.182 n=29+29)
      GobEncode-4                89.6ms ± 1%     87.8ms ± 2%  -2.02%  (p=0.000 n=30+29)
      Gzip-4                      4.07s ± 1%      4.08s ± 1%    ~     (p=0.173 n=30+27)
      Gunzip-4                    602ms ± 1%      600ms ± 1%  -0.29%  (p=0.000 n=29+28)
      HTTPClientServer-4          679µs ± 4%      683µs ± 3%    ~     (p=0.197 n=30+30)
      JSONEncode-4                241ms ± 1%      239ms ± 1%  -0.84%  (p=0.000 n=30+30)
      JSONDecode-4                903ms ± 1%      882ms ± 1%  -2.33%  (p=0.000 n=30+30)
      Mandelbrot200-4            41.8ms ± 0%     41.8ms ± 0%    ~     (p=0.719 n=30+30)
      GoParse-4                  45.5ms ± 1%     45.8ms ± 1%  +0.52%  (p=0.000 n=30+30)
      RegexpMatchEasy0_32-4      1.27µs ± 1%     1.27µs ± 0%  -0.60%  (p=0.000 n=30+30)
      RegexpMatchEasy0_1K-4      7.77µs ± 6%     7.69µs ± 4%  -0.96%  (p=0.040 n=30+30)
      RegexpMatchEasy1_32-4      1.29µs ± 1%     1.28µs ± 1%  -0.54%  (p=0.000 n=30+30)
      RegexpMatchEasy1_1K-4      10.3µs ± 6%     10.2µs ± 3%    ~     (p=0.453 n=30+27)
      RegexpMatchMedium_32-4     1.98µs ± 1%     2.00µs ± 1%  +0.85%  (p=0.000 n=30+29)
      RegexpMatchMedium_1K-4      503µs ± 0%      503µs ± 1%    ~     (p=0.752 n=30+30)
      RegexpMatchHard_32-4       27.1µs ± 1%     26.5µs ± 0%  -1.96%  (p=0.000 n=30+24)
      RegexpMatchHard_1K-4        809µs ± 1%      799µs ± 1%  -1.29%  (p=0.000 n=29+30)
      Revcomp-4                  67.3ms ± 2%     67.2ms ± 1%    ~     (p=0.265 n=29+29)
      Template-4                  1.08s ± 1%      1.07s ± 0%  -1.39%  (p=0.000 n=30+22)
      TimeParse-4                6.93µs ± 1%     6.96µs ± 1%  +0.40%  (p=0.005 n=30+30)
      TimeFormat-4               13.3µs ± 0%     13.3µs ± 1%    ~     (p=0.734 n=30+30)
      [Geo mean]                  709µs           707µs       -0.32%
      
      name                     old speed      new speed       delta
      GobDecode-4              7.59MB/s ± 1%   7.57MB/s ± 1%    ~     (p=0.145 n=29+29)
      GobEncode-4              8.56MB/s ± 1%   8.74MB/s ± 1%  +2.07%  (p=0.000 n=30+29)
      Gzip-4                   4.76MB/s ± 1%   4.75MB/s ± 1%  -0.25%  (p=0.037 n=30+30)
      Gunzip-4                 32.2MB/s ± 1%   32.3MB/s ± 1%  +0.29%  (p=0.000 n=29+28)
      JSONEncode-4             8.04MB/s ± 1%   8.11MB/s ± 1%  +0.85%  (p=0.000 n=30+30)
      JSONDecode-4             2.15MB/s ± 1%   2.20MB/s ± 1%  +2.29%  (p=0.000 n=30+30)
      GoParse-4                1.27MB/s ± 1%   1.26MB/s ± 1%  -0.73%  (p=0.000 n=30+30)
      RegexpMatchEasy0_32-4    25.1MB/s ± 1%   25.3MB/s ± 0%  +0.61%  (p=0.000 n=30+30)
      RegexpMatchEasy0_1K-4     131MB/s ± 6%    133MB/s ± 4%  +1.35%  (p=0.009 n=28+30)
      RegexpMatchEasy1_32-4    24.9MB/s ± 1%   25.0MB/s ± 1%  +0.54%  (p=0.000 n=30+30)
      RegexpMatchEasy1_1K-4    99.2MB/s ± 6%  100.2MB/s ± 3%    ~     (p=0.448 n=30+27)
      RegexpMatchMedium_32-4    503kB/s ± 1%    500kB/s ± 0%  -0.66%  (p=0.002 n=30+24)
      RegexpMatchMedium_1K-4   2.04MB/s ± 0%   2.04MB/s ± 1%    ~     (p=0.358 n=30+30)
      RegexpMatchHard_32-4     1.18MB/s ± 1%   1.20MB/s ± 1%  +1.75%  (p=0.000 n=30+30)
      RegexpMatchHard_1K-4     1.26MB/s ± 1%   1.28MB/s ± 1%  +1.42%  (p=0.000 n=30+30)
      Revcomp-4                37.8MB/s ± 2%   37.8MB/s ± 1%    ~     (p=0.266 n=29+29)
      Template-4               1.80MB/s ± 1%   1.82MB/s ± 1%  +1.46%  (p=0.000 n=30+30)
      [Geo mean]               6.91MB/s        6.96MB/s       +0.70%
      
      fixes #21583
      
      Change-Id: I24065a80588ccae7de3ad732a3cfb0026cf7e214
      Reviewed-on: https://go-review.googlesource.com/67490Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1ec78d1d
    • Frank Somers's avatar
      runtime: move vdso_linux_amd64.go to vdso_linux.go · 4477107b
      Frank Somers authored
      This is a preparation step for adding vDSO support on linux/386.
      
      In a follow-on change, the vDSO ELF symbol lookup code in this
      file will be refactored so it can be used on multiple architectures.
      
      First, move the file to an architecture-neutral file name so that
      the change history is preserved. Build tags are added so that the
      build behaves as it did before.
      
      vdso_linux_amd64.go will be recreated later, just containing the
      amd64 specifics.
      
      If the move and refactor were combined in a single change, then the
      history to date would be lost because git would see the existing code
      as a new file.
      
      Change-Id: Iddb5da0d7faf141fd7cc835fe6a80c80153897e9
      Reviewed-on: https://go-review.googlesource.com/69710
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      4477107b
    • Daniel Martí's avatar
      cmd/compile: eliminate some lineno uses · 6013052e
      Daniel Martí authored
      Focused on ranges, selects and switches for this one.
      
      While at it, simplify some vars in typecheckselect.
      
      Updates #19683.
      
      Change-Id: Ib6aabe0f6826cb1930483aeb4bb2de1ff8052d9e
      Reviewed-on: https://go-review.googlesource.com/69690
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6013052e
    • Alberto Donizetti's avatar
      cmd/compile: fix OTYPESW Op comment · 07f7db3e
      Alberto Donizetti authored
      OTYPESW Op comment says
      
        // List = Left.(type)
      
      this seems to be wrong. Adding
      
        fmt.Printf("n: %v\n", cond)
        fmt.Printf("  n.List: %v\n", cond.List)
        fmt.Printf("  n.Left: %v\n", cond.Left)
        fmt.Printf("  n.Right: %v\n", cond.Right)
      
      to (s *typeSwitch) walk(sw *Node), and compiling the following code
      snippet
      
        var y interface{}
        switch x := y.(type) {
        default:
          println(x)
        }
      
      prints
      
        n: <node TYPESW>
          n.List:
          n.Left: x
          n.Right: y
      
      The correct OTYPESW Node field positions are
      
        // Left = Right.(type)
      
      This is confirmed by the fact that, further in the code,
      typeSwitch.walk() checks that Right (and not Left) is of type
      interface:
      
        cond.Right = walkexpr(cond.Right, &sw.Ninit)
        if !cond.Right.Type.IsInterface() {
          yyerror("type switch must be on an interface")
          return
        }
      
      This patch fixes the OTYPESW comment.
      
      Change-Id: Ief1e409cfabb7640d7f7b0d4faabbcffaf605450
      Reviewed-on: https://go-review.googlesource.com/69112Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      07f7db3e
    • Ian Lance Taylor's avatar
      cmd/compile: disable TestNexting in short mode · 0c53b4ec
      Ian Lance Taylor authored
      Updates #22206
      
      Change-Id: If75feddc01f8f86f294929fa7081c70eb15e581d
      Reviewed-on: https://go-review.googlesource.com/69790
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      0c53b4ec
    • griesemer's avatar
      cmd/compile/internal/syntax: consider function nesting for error recovery · 68e39030
      griesemer authored
      This re-enables functionality that inadvertently was disabled in the
      (long) past.
      
      Also, don't perform branch checks if we had errors in a function
      to avoid spurious errors or (worst-case) crashes.
      
      Slightly modified test/fixedbugs/issue14006.go to make sure the
      test still reports invalid label errors (the surrounding function
      must be syntactically correct).
      
      Change-Id: Id5642930877d7cf3400649094ec75c753b5084b7
      Reviewed-on: https://go-review.googlesource.com/69770
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      68e39030
    • griesemer's avatar
      cmd/compile/internal/syntax: factor out parsing of func bodies (cleanup) · 39edffb6
      griesemer authored
      Change-Id: If6481a5401940a923fc9a104981dfb90eed0d1ac
      Reviewed-on: https://go-review.googlesource.com/69750
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      39edffb6
    • griesemer's avatar
      cmd/compile/internal/syntax: remove some outdated comments (cleanup) · c87fb208
      griesemer authored
      Change-Id: If242bb99d501420827b764c908580f2363e01ac4
      Reviewed-on: https://go-review.googlesource.com/69730Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      c87fb208
  2. 10 Oct, 2017 4 commits
    • Carlos Eduardo Seo's avatar
      cmd/asm, cmd/internal/obj/ppc64: Fix Data Cache instructions for ppc64x · 3a165bba
      Carlos Eduardo Seo authored
      This change fixes the implementation of Data Cache instructions for
      ppc64x, allowing non-zero hint field values.
      
      Change-Id: I454aac9293d069a4817ee574d5809fa1799b3216
      Reviewed-on: https://go-review.googlesource.com/68670
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      Reviewed-by: 's avatarLynn Boger <laboger@linux.vnet.ibm.com>
      3a165bba
    • Joe Tsai's avatar
      archive/tar: ignore ChangeTime and AccessTime unless Format is specified · 577aab0c
      Joe Tsai authored
      CL 59230 changed Writer.WriteHeader to ignore the ChangeTime and AccessTime
      fields when considering using the USTAR format when the format is unspecified.
      This policy is confusing and leads to unexpected behavior where some files
      have ModTime only, while others have ModTime+AccessTime+ChangeTime if the
      format became PAX for some unrelated reason (e.g., long pathname).
      
      Change the policy to simply always ignore ChangeTime, AccessTime, and
      sub-second time resolutions unless the user explicitly specifies a format.
      This is a safe policy change since WriteHeader had no support for the
      above features in any Go release.
      
      Support for ChangeTime and AccessTime was added in CL 55570.
      Support for sub-second times was added in CL 55552.
      Both CLs landed after the latest Go release (i.e., Go1.9), which was
      cut from the master branch around August 6th, 2017.
      
      Change-Id: Ib82baa1bf9dd4573ed4f674b7d55d15f733a4843
      Reviewed-on: https://go-review.googlesource.com/69296Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      577aab0c
    • Joe Tsai's avatar
      archive/tar: improve handling of directory paths · 4cd58c2f
      Joe Tsai authored
      The USTAR format says:
      <<<
      Implementors should be aware that the previous file format did not include
      a mechanism to archive directory type files.
      For this reason, the convention of using a filename ending with
      <slash> was adopted to specify a directory on the archive.
      >>>
      
      In light of this suggestion, make the following changes:
      * Writer.WriteHeader refuses to encode a header where a file that
      is obviously a file-type has a trailing slash in the name.
      * formatter.formatString avoids encoding a trailing slash in the event
      that the string is truncated (the full string will be encoded elsewhere,
      so stripping the slash is safe).
      * Reader.Next treats a TypeRegA (which is the zero value of Typeflag)
      as a TypeDir if the name has a trailing slash.
      
      Change-Id: Ibf27aa8234cce2032d92e5e5b28546c2f2ae5ef6
      Reviewed-on: https://go-review.googlesource.com/69293Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4cd58c2f
    • Cherry Zhang's avatar
      cmd/compile: intrinsify atomics on MIPS64 · d63de287
      Cherry Zhang authored
      Change-Id: Ica65b7a52af9558a05d0a0e1dff0f9ec838f4117
      Reviewed-on: https://go-review.googlesource.com/68830
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      d63de287