1. 12 Apr, 2017 25 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: move Text.From.Sym initialization earlier · 3692925c
      Josh Bleecher Snyder authored
      The initialization of an ATEXT Prog's From.Sym
      can race with the assemblers in a concurrent compiler.
      CL 40254 contains an initial, failed attempt to
      fix that race.
      
      This CL takes a different approach: Rather than
      expose an API to initialize the Prog,
      expose an API to initialize the Sym.
      
      The initialization of the Sym can then be
      moved earlier in the compiler, avoiding the race.
      
      The growth of gc.Func has negligible
      performance impact; see below.
      
      Passes toolstash -cmp.
      
      Updates #15756
      
      name       old alloc/op      new alloc/op      delta
      Template        38.8MB ± 0%       38.8MB ± 0%    ~     (p=0.968 n=9+10)
      Unicode         29.8MB ± 0%       29.8MB ± 0%    ~     (p=0.684 n=10+10)
      GoTypes          113MB ± 0%        113MB ± 0%    ~     (p=0.912 n=10+10)
      SSA             1.25GB ± 0%       1.25GB ± 0%    ~     (p=0.481 n=10+10)
      Flate           25.3MB ± 0%       25.3MB ± 0%    ~     (p=0.105 n=10+10)
      GoParser        31.7MB ± 0%       31.8MB ± 0%  +0.09%  (p=0.016 n=8+10)
      Reflect         78.3MB ± 0%       78.2MB ± 0%    ~     (p=0.190 n=10+10)
      Tar             26.5MB ± 0%       26.6MB ± 0%  +0.13%  (p=0.011 n=10+10)
      XML             42.4MB ± 0%       42.4MB ± 0%    ~     (p=0.971 n=10+10)
      
      name       old allocs/op     new allocs/op     delta
      Template          378k ± 1%         378k ± 0%    ~     (p=0.315 n=10+9)
      Unicode           321k ± 1%         321k ± 0%    ~     (p=0.436 n=10+10)
      GoTypes          1.14M ± 0%        1.14M ± 0%    ~     (p=0.079 n=10+9)
      SSA              9.70M ± 0%        9.70M ± 0%  -0.04%  (p=0.035 n=10+10)
      Flate             233k ± 1%         234k ± 1%    ~     (p=0.529 n=10+10)
      GoParser          315k ± 0%         316k ± 0%    ~     (p=0.095 n=9+10)
      Reflect           980k ± 0%         980k ± 0%    ~     (p=0.436 n=10+10)
      Tar               249k ± 1%         250k ± 0%    ~     (p=0.280 n=10+10)
      XML               391k ± 1%         391k ± 1%    ~     (p=0.481 n=10+10)
      
      Change-Id: I3c93033dddd2e1df8cc54a106a6e615d27859e71
      Reviewed-on: https://go-review.googlesource.com/40496
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      3692925c
    • Brad Fitzpatrick's avatar
      net: delete TestDialTimeoutFDLeak · 7faf3024
      Brad Fitzpatrick authored
      It's flaky and distracting.
      
      I'm not sure what it's testing, either. It hasn't saved us before.
      
      Somebody can resurrect it if they have time.
      
      Updates #15157
      
      Change-Id: I27bbfe51e09b6259bba0f73d60d03a4d38711951
      Reviewed-on: https://go-review.googlesource.com/40498Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      7faf3024
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: stop storing Text flags in From3 · ce3ee7cd
      Josh Bleecher Snyder authored
      Prior to this CL, flags such as NOSPLIT
      on ATEXT Progs were stored in From3.Offset.
      Some but not all of those flags were also
      duplicated into From.Sym.Attribute.
      
      This CL migrates all of those flags into
      From.Sym.Attribute and stops creating a From3.
      
      A side-effect of this is that printing an
      ATEXT Prog can no longer simply dump From3.Offset.
      That's kind of good, since the raw flag value
      wasn't very informative anyway, but it did
      necessitate a bunch of updates to the cmd/asm tests.
      
      The reason I'm doing this work now is that
      avoiding storing flags in both From.Sym and From3.Offset
      simplifies some other changes to fix the data
      race first described in CL 40254.
      
      This CL almost passes toolstash-check -all.
      The only changes are in cases where the assembler
      has decided that a function's flags may be altered,
      e.g. to make a function with no calls in it NOSPLIT.
      Prior to this CL, that information was not printed.
      
      Sample before:
      
      "".Ctz64 t=1 size=63 args=0x10 locals=0x0
      	0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35)	TEXT	"".Ctz64(SB), $0-16
      	0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35)	FUNCDATA	$0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB)
      
      Sample after:
      
      "".Ctz64 t=1 nosplit size=63 args=0x10 locals=0x0
      	0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35)	TEXT	"".Ctz64(SB), NOSPLIT, $0-16
      	0x0000 00000 (/Users/josh/go/tip/src/runtime/internal/sys/intrinsics.go:35)	FUNCDATA	$0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB)
      
      Observe the additional "nosplit" in the first line
      and the additional "NOSPLIT" in the second line.
      
      Updates #15756
      
      Change-Id: I5c59bd8f3bdc7c780361f801d94a261f0aef3d13
      Reviewed-on: https://go-review.googlesource.com/40495
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ce3ee7cd
    • Matthew Dempsky's avatar
      cmd/compile/internal/ssa: refactor ARM64 address folding · 4eb48a33
      Matthew Dempsky authored
      These patterns are the only uses of isArg and isAuto, and they all
      follow a common pattern too. Extract out so that we can more easily
      tweak the interface for isArg/isAuto.
      
      Passes toolstash -cmp for linux/arm64.
      
      Change-Id: I9c509dabdc123c93cb1ad2f34fe8c12a9f313f6d
      Reviewed-on: https://go-review.googlesource.com/40490
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      4eb48a33
    • Alberto Donizetti's avatar
      cmd/compile: do not print duplicate error on ideal->float{32,64} overflow · 2e60882f
      Alberto Donizetti authored
      Also adjust truncfltlit to make it more similar to trunccmplxlit, and
      make it report an error for bad Etypes.
      
      Fixes #19947
      
      Change-Id: I6684523e989c2293b8a8e85bd2bfb9c399c5ea36
      Reviewed-on: https://go-review.googlesource.com/40453Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      2e60882f
    • Austin Clements's avatar
      cmd/dist: require _ before GOOS and GOARCH when building bootstrap · c253ea47
      Austin Clements authored
      Currently, dist allows GOOS and GOARCH to appear as *any* substring in
      a file name when selecting source files to go into go_bootstrap. This
      was necessary prior to Go 1.4, where it needed to match names like
      "windows.c", but now it's gratuitously different from go/build. This
      led to a bug chase to figure out why "stubs_nonlinux.go" was not being
      built on non-Linux OSes.
      
      Change shouldbuild to require an "_" before the GOOS and GOARCH in a
      file name. This is still less strict than go/build, but the behavior
      is much closer.
      
      Change-Id: I580e9344a3c40d57c0721d345e911e8b4f141f5d
      Reviewed-on: https://go-review.googlesource.com/40435
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      c253ea47
    • Austin Clements's avatar
      runtime: expand inlining iteratively in CallersFrames · 7f32d41e
      Austin Clements authored
      Currently CallersFrames expands each PC to a slice of Frames and then
      iteratively returns those Frames. However, this makes it very
      difficult to avoid heap allocation: either the Frames slice will be
      heap allocated, or, if it uses internal scratch space for small slices
      (as it currently does), the Frames object itself has to be heap
      allocated.
      
      Fix this, at least in the common case, by expanding each PC
      iteratively. We introduce a new pcExpander type that's responsible for
      expanding a single PC. This maintains state from one Frame to the next
      in the same PC. Frames then becomes a wrapper around this responsible
      for feeding it the next PC when the pcExpander runs out of frames for
      the current PC.
      
      This makes it possible to stack-allocate a Frames object, which will
      make it possible to use this API for PC expansion from within the
      runtime itself.
      
      Change-Id: I993463945ab574557cf1d6bedbe79ce7e9cbbdcd
      Reviewed-on: https://go-review.googlesource.com/40434
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Lazar <lazard@golang.org>
      7f32d41e
    • David du Colombier's avatar
      cmd/link: skip TestRuntimeTypeDIEs on Plan 9 · 746441f9
      David du Colombier authored
      TestRuntimeTypeDIEs has been added in CL 38350. This
      test is failing on Plan 9 because executables don't
      have a DWARF symbol table.
      
      Fixes #19944.
      
      Change-Id: I121875bfd5f9f02ed668f8fb0686a0edffa2a99d
      Reviewed-on: https://go-review.googlesource.com/40452
      Run-TryBot: David du Colombier <0intro@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      746441f9
    • Matthew Dempsky's avatar
      cmd/compile/internal/ssa: ExternSymbol's Typ field is unused too · 700574e7
      Matthew Dempsky authored
      Change-Id: I5b692eb0586c40f3735a6b9c928e97ffa00a70e6
      Reviewed-on: https://go-review.googlesource.com/40471
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      700574e7
    • Daniel Theophanes's avatar
      database/sql: correctly guard the query Row preventing early release · dec95d8f
      Daniel Theophanes authored
      When a Tx starts a query, prevent returning the connection to the pool
      until after the query finishes.
      
      Fixes #19058
      
      Change-Id: I2c0480d9cca9eeb173b5b3441a5aeed6f527e0ac
      Reviewed-on: https://go-review.googlesource.com/40400Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dec95d8f
    • Alberto Donizetti's avatar
      cmd/compile: diagnose constant division by complex zero · 10a200e5
      Alberto Donizetti authored
      When casting an ideal to complex{64,128}, for example during the
      evaluation of
      
        var a = complex64(0) / 1e-50
      
      we want the compiler to report a division-by-zero error if a divisor
      would be zero after the cast.
      
      We already do this for floats; for example
      
        var b = float32(0) / 1e-50
      
      generates a 'division by zero' error at compile time (because
      float32(1e-50) is zero, and the cast is done before performing the
      division).
      
      There's no such check in the path for complex{64,128} expressions, and
      no cast is performed before the division in the evaluation of
      
        var a = complex64(0) / 1e-50
      
      which compiles just fine.
      
      This patch changes the convlit1 function so that complex ideals
      components (real and imag) are correctly truncated to float{32,64}
      when doing an ideal -> complex{64, 128} cast.
      
      Fixes #11674
      
      Change-Id: Ic5f8ee3c8cfe4c3bb0621481792c96511723d151
      Reviewed-on: https://go-review.googlesource.com/37891
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      10a200e5
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove Link.Plan9privates · 49f4b5a4
      Josh Bleecher Snyder authored
      Move it to the x86 package, matching our handling
      of deferreturn in x86 and arm.
      While we're here, improve the concurrency safety
      of both Plan9privates and deferreturn
      by eagerly initializing them in instinit.
      
      Updates #15756
      
      Change-Id: If3b1995c1e4ec816a5443a18f8d715631967a8b1
      Reviewed-on: https://go-review.googlesource.com/40408
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      49f4b5a4
    • Lynn Boger's avatar
      cmd/compile: fix PPC64.rules for LoweredMove · b8d327a4
      Lynn Boger authored
      A recent performance improvement for PPC64.rules introduced a
      regression for the case where the size of a move is <= 8 bytes
      and the value used in the offset field of the instruction is not
      aligned correctly for the instruction. In the cases where this happened,
      the assembler was not detecting the incorrect offset and still generated
      the instruction even though it was invalid.
      
      This fix changes the PPC64.rules for the moves that are now failing
      to include the correct alignment checks, along some additional testcases
      for gc/ssa for the failing alignments.
      
      I will add a fix to the assembler to detect incorrect offsets in
      another CL.
      
      This fixes #19907
      
      Change-Id: I3d327ce0ea6afed884725b1824f9217cef2fe6bf
      Reviewed-on: https://go-review.googlesource.com/40290Reviewed-by: default avatarCarlos Eduardo Seo <cseo@linux.vnet.ibm.com>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      b8d327a4
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove Link.Version · f30de83d
      Josh Bleecher Snyder authored
      It is zeroed pointlessly and never read.
      
      Change-Id: I65390501a878f545122ec558cb621b91e394a538
      Reviewed-on: https://go-review.googlesource.com/40406
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      f30de83d
    • Lynn Boger's avatar
      cmd/go: generate correct vendor paths with -compiler gccgo option · 9191c0b3
      Lynn Boger authored
      Curently the vendor paths are not always searched for imports if
      the compiler is gccgo.  This change generates the vendor paths
      and adds them with -I as arguments to the gccgo compile.
      
      Fixes #15628
      
      Change-Id: I318accbbbd8e6af45475eda399377455a3565880
      Reviewed-on: https://go-review.googlesource.com/40432
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      9191c0b3
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove Link.Debugdivmod · 30ddffad
      Josh Bleecher Snyder authored
      It is only used once and never written to.
      Switch to a local constant instead.
      
      Change-Id: Icdd84e47b81f0de44ad9ed56ab5f4f91df22e6b6
      Reviewed-on: https://go-review.googlesource.com/40405
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      30ddffad
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove dead Link fields · eacfa592
      Josh Bleecher Snyder authored
      These are unused after CLs 39922, 40252, 40370, 40371, and 40372.
      
      Change-Id: I76f9276c581067a8cb555de761550d960f6e39b8
      Reviewed-on: https://go-review.googlesource.com/40404
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      eacfa592
    • Daniel Martí's avatar
      cmd/compile/internal/gc: don't panic on continue in switch · 2923b14a
      Daniel Martí authored
      Continues outside of a loop are not allowed. Most of these possibilities
      were tested in label1.go, but one was missing - a plain continue in a
      switch/select but no enclosing loop.
      
      This used to error with a "continue not in loop" in 1.8, but recently
      was broken by c03e75e5. In particular, innerloop does not only account
      for loops, but also for switches and selects. Swap it by bools that
      track whether breaks and continues should be allowed.
      
      While at it, improve the wording of errors for breaks that are not where
      they should be. Change "loop" by "loop, switch, or select" since they
      can be used in any of those.
      
      And add tests to make sure this isn't broken again. Use a separate func
      since I couldn't get the compiler to crash on f() itself, possibly due
      to the recursive call on itself.
      
      Fixes #19934.
      
      Change-Id: I8f09c6c2107fd95cac50efc2a8cb03cbc128c35e
      Reviewed-on: https://go-review.googlesource.com/40357
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      2923b14a
    • Hiroshi Ioka's avatar
      cmd/cgo: remove unused enums · d4a623f9
      Hiroshi Ioka authored
      Previously, int values of #define macro are retrieved from DWARF via enums.
      Currently, those values are retrieved from symbol tables.
      It seems that previous code is unused.
      
      Change-Id: Id76c54baa46d6196738ea35aebd5de99b05b9bf8
      Reviewed-on: https://go-review.googlesource.com/40072Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d4a623f9
    • Alessandro Arzilli's avatar
      cmd/link: export specialized variants of runtime._type to debug_info · 073247f1
      Alessandro Arzilli authored
      The reflect package can be used to create new types at runtime, these
      types will have runtime._type entries describing them but no entry in
      debug_info (obviously).
      
      A debugger that wanted to print the value of variables with such types
      will have to read the runtime._type directly, however the
      "specializations" of runtime._type (runtime.slicetype, runtime.maptype,
      etc) are not exported to debug_info, besides runtime.interfacetype.
      
      All those types (i.e. runtime.slicetype, runtime.maptype, etc) should
      be exported to debug_info so that debuggers don't have to hard-code
      their description.
      
      Fixes #19602
      
      Change-Id: I086d523a4421a4ed964e16bc3c2274319a98b45b
      Reviewed-on: https://go-review.googlesource.com/38350Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      073247f1
    • Todd Neal's avatar
      plugin: properly handle recursively defined types · e49627d3
      Todd Neal authored
      Prevent a crash if the same type in two plugins had a recursive
      definition, either by referring to a pointer to itself or a map existing
      with the type as a value type (which creates a recursive definition
      through the overflow bucket type).
      
      Fixes #19258
      
      Change-Id: Iac1cbda4c5b6e8edd5e6859a4d5da3bad539a9c6
      Reviewed-on: https://go-review.googlesource.com/40292
      Run-TryBot: Todd Neal <todd@tneal.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      e49627d3
    • Todd Neal's avatar
      plugin: resolve random crash when calling exported functions · 758d078f
      Todd Neal authored
      open modified the plugin symbols map while ranging over it. This is
      normally harmless, except that the operations performed were not
      idempotent leading to function pointers being corrupted.
      
      Fixes #19269
      
      Change-Id: I4b6eb1d45567161412e4a34b41f1ebf647bcc942
      Reviewed-on: https://go-review.googlesource.com/40431
      Run-TryBot: Todd Neal <todd@tneal.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      758d078f
    • Joel Sing's avatar
      runtime/cgo: actually remove gcc_libinit_openbsd.c · 092405a9
      Joel Sing authored
      This was unintentionally emptied rather than removed in 9417c022.
      
      Change-Id: Ie6fdcf7ef55e58f12e2a2750ab448aa2d9f94d15
      Reviewed-on: https://go-review.googlesource.com/40413Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      092405a9
    • Alexander Menzhinsky's avatar
      cmd/go: add better error message when gccgo is missing · 20edbda5
      Alexander Menzhinsky authored
      Fixes #19628
      
      Change-Id: I19baf694c66aaca8e0d95297c97aacb40db24c47
      Reviewed-on: https://go-review.googlesource.com/40250Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      20edbda5
    • Daniel Theophanes's avatar
      database/sql: de-duplicate various methods · ab0e9019
      Daniel Theophanes authored
      Form a new method pattern where *driverConn and
      release functions are passed into the method.
      They are named DB.execDC, DB.queryDC, DB.beginDC. This
      allows more code to be de-duplicated when starting
      queries.
      
      The Stmt creation and management code are untouched.
      
      Change-Id: I24c853531e511d8a4bc1f53dd4dbdf968763b4e7
      Reviewed-on: https://go-review.googlesource.com/39630
      Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      ab0e9019
  2. 11 Apr, 2017 15 commits