1. 10 Apr, 2015 18 commits
    • Dmitry Vyukov's avatar
      cmd/gc: fix handling of OGETG in race mode · 08c43488
      Dmitry Vyukov authored
      Now that getg is an intrinsic, more runtime functions
      gets inlined (in particular, LockOSThread).
      Runtime code gets race instrumented after inlining into
      other packages. This can lead to false positives,
      as race detector ignores all internal synchronization in runtime.
      Inling of LockOSThread lead to false race reports on m contents.
      See the issue for an example.
      
      Fixes #10380
      
      Change-Id: Ic9b760b53c28c2350bc54a5d4677fcd1c1f86e5f
      Reviewed-on: https://go-review.googlesource.com/8690Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      08c43488
    • Austin Clements's avatar
      runtime: start concurrent GC promptly when we reach its trigger · 4b956ae3
      Austin Clements authored
      Currently, when allocation reaches the concurrent GC trigger size, we
      start the concurrent collector by ready'ing its G. This simply puts it
      on the end of the P's run queue, which means we may not actually start
      GC for some time as the current G continues to run and then the P
      drains other Gs already on its run queue. Since the mutator can
      continue to allocate, the heap can potentially be much larger than we
      intended by the time GC actually starts. Furthermore, how much larger
      is difficult to predict since it depends on the scheduler.
      
      Fix this by preempting the current G and switching directly to the
      concurrent GC G as soon as we reach the trigger heap size.
      
      On the garbage benchmark from the benchmarks subrepo with
      GOMAXPROCS=4, this reduces the time from triggering the GC to the
      beginning of sweep termination by 10 to 30 milliseconds, which reduces
      allocation after the trigger by up to 10MB (a large fraction of the
      64MB live heap the benchmark tries to maintain).
      
      One other known source of delay before we "really" start GC is the
      sweep finalization performed before sweep termination. This has
      similar negative effects on heap size and predictability, but is an
      orthogonal problem. This change adds a TODO for this.
      
      Change-Id: I8bae98cb43685c1bf353ff55868e4647e3743c47
      Reviewed-on: https://go-review.googlesource.com/8513Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      4b956ae3
    • Austin Clements's avatar
      runtime: remove GoSched/GoStart trace events around GC · 6afb5fa4
      Austin Clements authored
      These were appropriate for STW GC, since it interrupted the allocating
      Goroutine, but don't apply to concurrent GC, which runs on its own
      Goroutine. Forced GC is still STW, but it makes sense to attribute the
      GC to the goroutine that called runtime.GC().
      
      Change-Id: If12418ca66dc7e53b8b16025af4e03adb5d9577e
      Reviewed-on: https://go-review.googlesource.com/8715Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      6afb5fa4
    • Austin Clements's avatar
      internal/trace: don't assume GC will start and end on same P · eec6fdc9
      Austin Clements authored
      Currently, GC disables preemption between the traceGCStart and
      traceGCDone, so it never moves Ps. Consequently, the trace verifier
      attaches information about GC to its per-P state and will fail if GC
      starts on one P and ends on another.
      
      GC will soon be preemptible and may end on a different P than it
      began. Hence, this change lifts this per-P verifier state to global
      state.
      
      Change-Id: I82256e2baab1ff3c4453fec312079018423b4b51
      Reviewed-on: https://go-review.googlesource.com/8714Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      eec6fdc9
    • Austin Clements's avatar
      runtime: make test for freezetheworld more precise · 7c372496
      Austin Clements authored
      exitsyscallfast checks for freezetheworld, but does so only by
      checking if stopwait is positive. This can also happen during
      stoptheworld, which is harmless, but confusing. Shortly, it will be
      important that we get to the p.status cas even if stopwait is set.
      
      Hence, make this test more specific so it only triggers with
      freezetheworld and not other uses of stopwait.
      
      Change-Id: Ibb722cd8360c3ed5a9654482519e3ceb87a8274d
      Reviewed-on: https://go-review.googlesource.com/8205Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      7c372496
    • Austin Clements's avatar
      debug/dwarf: document DWARF class -> Go type mapping · 253ad67b
      Austin Clements authored
      Currently, the only way to know the Go type of an attribute of some
      DWARF attribute class was to read the dwarf package code (or
      experiment).  This makes it hard to go from the DWARF specification to
      writing code that uses the dwarf package.
      
      Fix this by adding a table to the documentation comment of the Field
      type that gives the correspondence between DWARF attribute classes and
      Go types.
      
      Change-Id: I57c678a551fa1eb46f8207085d5a53d44985e3e7
      Reviewed-on: https://go-review.googlesource.com/7280Reviewed-by: 's avatarRob Pike <r@golang.org>
      Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
      253ad67b
    • Robert Griesemer's avatar
      strconv: use 64bit uint for decimal conversion if available · faa9d1ec
      Robert Griesemer authored
      The existing code used ints for the (slow) decimal conversion and
      assumed that they were 32bit wide.
      
      This change uses uints and the appropriate width (32 or 64bit)
      depending on platform.
      
      The performance difference is in the noise for the usual (optimized)
      case which does not use the slow path conversion:
      
      benchmark                               old ns/op     new ns/op     delta
      BenchmarkFormatFloatDecimal             298           299           +0.34%
      BenchmarkFormatFloat                    388           392           +1.03%
      BenchmarkFormatFloatExp                 365           364           -0.27%
      BenchmarkFormatFloatNegExp              364           362           -0.55%
      BenchmarkFormatFloatBig                 482           476           -1.24%
      BenchmarkAppendFloatDecimal             100           102           +2.00%
      BenchmarkAppendFloat                    199           201           +1.01%
      BenchmarkAppendFloatExp                 174           175           +0.57%
      BenchmarkAppendFloatNegExp              169           174           +2.96%
      BenchmarkAppendFloatBig                 286           286           +0.00%
      BenchmarkAppendFloat32Integer           99.9          102           +2.10%
      BenchmarkAppendFloat32ExactFraction     161           164           +1.86%
      BenchmarkAppendFloat32Point             199           201           +1.01%
      BenchmarkAppendFloat32Exp               167           168           +0.60%
      BenchmarkAppendFloat32NegExp            163           169           +3.68%
      BenchmarkAppendFloat64Fixed1            137           134           -2.19%
      BenchmarkAppendFloat64Fixed2            144           146           +1.39%
      BenchmarkAppendFloat64Fixed3            138           140           +1.45%
      BenchmarkAppendFloat64Fixed4            144           145           +0.69%
      
      The performance difference is significant if the fast path conversion is
      explicitly turned off (ftoa.go:101):
      
      benchmark                               old ns/op     new ns/op     delta
      BenchmarkFormatFloatDecimal             459           427           -6.97%
      BenchmarkFormatFloat                    1560          1180          -24.36%
      BenchmarkFormatFloatExp                 5501          3128          -43.14%
      BenchmarkFormatFloatNegExp              24085         14360         -40.38%
      BenchmarkFormatFloatBig                 1409          1081          -23.28%
      BenchmarkAppendFloatDecimal             248           226           -8.87%
      BenchmarkAppendFloat                    1315          982           -25.32%
      BenchmarkAppendFloatExp                 5274          2869          -45.60%
      BenchmarkAppendFloatNegExp              23905         14054         -41.21%
      BenchmarkAppendFloatBig                 1194          860           -27.97%
      BenchmarkAppendFloat32Integer           167           175           +4.79%
      BenchmarkAppendFloat32ExactFraction     182           184           +1.10%
      BenchmarkAppendFloat32Point             556           564           +1.44%
      BenchmarkAppendFloat32Exp               1134          918           -19.05%
      BenchmarkAppendFloat32NegExp            2679          1801          -32.77%
      BenchmarkAppendFloat64Fixed1            274           238           -13.14%
      BenchmarkAppendFloat64Fixed2            494           368           -25.51%
      BenchmarkAppendFloat64Fixed3            1833          1008          -45.01%
      BenchmarkAppendFloat64Fixed4            6133          3596          -41.37%
      
      Change-Id: I829b8abcca882b1c10d8ae421d3249597c31f3c9
      Reviewed-on: https://go-review.googlesource.com/3811Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      faa9d1ec
    • Dmitry Vyukov's avatar
      runtime: fix tracing of syscall exit · 089d363a
      Dmitry Vyukov authored
      Fix tracing of syscall exit after:
      https://go-review.googlesource.com/#/c/7504/
      
      Change-Id: Idcde2aa826d2b9a05d0a90a80242b6bfa78846ab
      Reviewed-on: https://go-review.googlesource.com/8728Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      089d363a
    • Dmitry Vyukov's avatar
      syscall: correct code for cover cmd · 53a8ee50
      Dmitry Vyukov authored
      Fixes #10378
      
      This is clumsy, but currently cover tool fails as:
      
      $ go test -run=none -cover syscall
      syscall_linux_amd64.go:15: can only use //go:noescape with external func implementations
      FAIL	syscall [build failed]
      
      This happens because cover tool mishandles //go: comments.
      r and gri said that fixing cover is infeasible due to go/ast limitations.
      
      So at least fix the offending code so that coverage works.
      This come up in context of coverage-guided fuzzing which works best
      with program-wide coverage.
      
      Change-Id: I142e5774c9f326ed38cb202693bd4edae93879ba
      Reviewed-on: https://go-review.googlesource.com/8723Reviewed-by: 's avatarRob Pike <r@golang.org>
      53a8ee50
    • Dmitry Vyukov's avatar
      test: add -update_errors flag to run script · 76477412
      Dmitry Vyukov authored
      The flag updates error annotations in test files from actual compiler output.
      This is useful when doing compiler changes that add/remove/change lots of errors,
      or when adding lots of new tests.
      Also I noticed at least 2 cases where annotation were sub-optimal:
      1. The annotation was "leaking param p" when the actual error is
      "leaking param p to result ~r1".
      2. The annotation was "leaking param m" when the actual errors
      are "leaking param m" and "leaking param mv1".
      
      For now it works only for errorcheck mode.
      
      Also, apply the update to escape and liveness tests.
      Some files have gccgo-specific errors of the form "gc error|gccgo error",
      so it is risky to run update on all files. Gccgo-specific error
      does not necessary contain '|', it can be just truncated.
      
      Change-Id: Iaaae767f859dcb8321a8cb4970b2b70969e8a345
      Reviewed-on: https://go-review.googlesource.com/5310
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      76477412
    • Paul Marks's avatar
      net: make multi-IP resolution more flexible. · a5dec385
      Paul Marks authored
      Remove the "netaddr" type, which ambiguously represented either one
      address, or a list of addresses. Instead, use "addrList" wherever
      multiple addresses are supported.
      
      The "first" method returns the first address matching some condition
      (e.g. "is it IPv4?"), primarily to support legacy code that can't handle
      multiple addresses.
      
      The "partition" method splits an addrList into two categories, as
      defined by some strategy function. This is useful for implementing
      Happy Eyeballs, and similar two-channel algorithms.
      
      Finally, internetAddrList (formerly resolveInternetAddr) no longer
      mangles the ordering defined by getaddrinfo. In the future, this may
      be used by a sequential Dial implementation.
      
      Updates #8453, #8455.
      
      Change-Id: I7375f4c34481580ab40e31d33002a4073a0474f3
      Reviewed-on: https://go-review.googlesource.com/8360Reviewed-by: 's avatarMikio Hara <mikioh.mikioh@gmail.com>
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a5dec385
    • Dave Cheney's avatar
      cmd/internal/gc: clean up Componentgen · 4b21be46
      Dave Cheney authored
      Update #9855
      
      In preparation for introducing direct use of a zero register on
      platforms that support it, take the opportunity to clean up
      Componentgen a bit.
      
      Change-Id: I120ce1ffcca8c4f7603bfe76bfa1aedd27ebb4d2
      Reviewed-on: https://go-review.googlesource.com/8691
      Run-TryBot: Dave Cheney <dave@cheney.net>
      Reviewed-by: 's avatarMinux Ma <minux@golang.org>
      4b21be46
    • Michael Hudson-Doyle's avatar
      runtime, cmd/internal/ld: rename themoduledata to firstmoduledata · a1f57598
      Michael Hudson-Doyle authored
      'themoduledata' doesn't really make sense now we support multiple moduledata
      objects.
      
      Change-Id: I8263045d8f62a42cb523502b37289b0fba054f62
      Reviewed-on: https://go-review.googlesource.com/8521Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a1f57598
    • Daniel Theophanes's avatar
      cmd/internal/obj/x86: look for go cmd in GOBIN if present. · a2a8a046
      Daniel Theophanes authored
      If GOBIN is not empty the build moves the go executable
      to a new path. When this test runs it fails to find the
      go cmd in the GOROOT.
      
      Change-Id: I100def0fbcb9691b13776f795b1d1725e36d8102
      Reviewed-on: https://go-review.googlesource.com/8735Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a2a8a046
    • Michael Hudson-Doyle's avatar
      runtime, reflect: support multiple moduledata objects · fae4a128
      Michael Hudson-Doyle authored
      This changes all the places that consult themoduledata to consult a
      linked list of moduledata objects, as will be necessary for
      -linkshared to work.
      
      Obviously, as there is as yet no way of adding moduledata objects to
      this list, all this change achieves right now is wasting a few
      instructions here and there.
      
      Change-Id: I397af7f60d0849b76aaccedf72238fe664867051
      Reviewed-on: https://go-review.googlesource.com/8231Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fae4a128
    • Michael Hudson-Doyle's avatar
      cmd/go: support -buildmode=default,archive,exe,c-shared · cb6e9ec0
      Michael Hudson-Doyle authored
      Modelled somewhat on the -race support.
      
      Change-Id: I137037addfc76341f7deb216776fdd18e9af9fe5
      Reviewed-on: https://go-review.googlesource.com/8680Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      cb6e9ec0
    • Michael Hudson-Doyle's avatar
      84207a25
    • Josh Bleecher Snyder's avatar
      runtime: fix arm64 build · 969f1014
      Josh Bleecher Snyder authored
      Broken by CL 8541.
      
      Change-Id: Ie2e89a22b91748e82f7bc4723660a24ed4135687
      Reviewed-on: https://go-review.googlesource.com/8734Reviewed-by: 's avatarMinux Ma <minux@golang.org>
      969f1014
  2. 09 Apr, 2015 20 commits
  3. 08 Apr, 2015 2 commits