1. 17 Mar, 2016 22 commits
  2. 16 Mar, 2016 18 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: further sinit.go cleanup · d33e37a7
      Josh Bleecher Snyder authored
      Follow-up to CL 20674.
      
      Passes toolstash -cmp.
      
      Change-Id: I065fd4cd80d996c1e6566773189401ca4630c1ca
      Reviewed-on: https://go-review.googlesource.com/20692
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      d33e37a7
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj/x86: estimate text size · 82625649
      Josh Bleecher Snyder authored
      We can’t perfectly predict how large the function
      will be, but we can make a safe overestimate.
      No significant CPU time changes.
      
      name       old alloc/op    new alloc/op    delta
      Template      67.7MB ± 0%     67.5MB ± 0%   -0.24%          (p=0.029 n=4+4)
      Unicode       43.9MB ± 0%     43.8MB ± 0%   -0.13%          (p=0.029 n=4+4)
      GoTypes        244MB ± 0%      244MB ± 0%   -0.28%          (p=0.029 n=4+4)
      Compiler      1.05GB ± 0%     1.05GB ± 0%   -0.38%          (p=0.029 n=4+4)
      
      name       old allocs/op   new allocs/op   delta
      Template        795k ± 0%       794k ± 0%   -0.14%          (p=0.029 n=4+4)
      Unicode         569k ± 0%       569k ± 0%     ~             (p=0.114 n=4+4)
      GoTypes        2.59M ± 0%      2.58M ± 0%   -0.11%          (p=0.029 n=4+4)
      Compiler       11.0M ± 0%      11.0M ± 0%   -0.09%          (p=0.029 n=4+4)
      
      Passes toolstash -cmp.
      
      Change-Id: I0a92ab04cba7520540ec58fe7189666d0e771454
      Reviewed-on: https://go-review.googlesource.com/20771Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      82625649
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: convert Symgrow to a method · fb950cd7
      Josh Bleecher Snyder authored
      Passes toolstash -cmp.
      
      Change-Id: I77a415a4e5d8de7eb902fb0866aaf8783259485a
      Reviewed-on: https://go-review.googlesource.com/20770Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fb950cd7
    • James Bardin's avatar
      cmd/cgo: add C.CBytes · 5a34472d
      James Bardin authored
      Add a C.CBytes function to copy a Go byte slice into C memory. This
      returns an unsafe.Pointer, since that is what needs to be passed to
      C.free, and the data is often opaque bytes anyway.
      
      Fixes #14838
      
      Change-Id: Ic7bc29637eb6f1f5ee409b3898c702a59833a85a
      Reviewed-on: https://go-review.googlesource.com/20762Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      5a34472d
    • Austin Clements's avatar
      cmd/compile: omit write barrier when assigning global function · 3e54ca9a
      Austin Clements authored
      Currently we generate write barriers when the right side of an
      assignment is a global function. This doesn't fall into the existing
      case of storing an address of a global because we haven't lowered the
      function to a pointer yet.
      
      This write barrier is unnecessary, so eliminate it.
      
      Fixes #13901.
      
      Change-Id: Ibc10e00a8803db0fd75224b66ab94c3737842a79
      Reviewed-on: https://go-review.googlesource.com/20772
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      3e54ca9a
    • Josh Bleecher Snyder's avatar
      cmd/compile: make sinit consts Go-ish · 4e75932c
      Josh Bleecher Snyder authored
      Passes toolstash -cmp.
      
      Change-Id: Ie11912a16d2cd54500e2f6e84316519b80e7c304
      Reviewed-on: https://go-review.googlesource.com/20672Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4e75932c
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj/x86: clean up asm buffer · e6ed3e8a
      Josh Bleecher Snyder authored
      c2go translated writing and advancing a pointer using slices.
      Switch to something more idiomatic.
      It is also more efficient, but not enough to matter.
      
      Change-Id: I67709632ac53253615a35365824ae97bbe5458d5
      Reviewed-on: https://go-review.googlesource.com/20767
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e6ed3e8a
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj/x86: clean up part of span6 · e248b96d
      Josh Bleecher Snyder authored
      Passes toolstash -cmp.
      
      Change-Id: I38eb507de2e9dc2cf01822e420bf31a91fb1b720
      Reviewed-on: https://go-review.googlesource.com/20766
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e248b96d
    • Robert Griesemer's avatar
      cmd/compile: remove dead code handling '~' operator · c1a4fe8d
      Robert Griesemer authored
      The parser code was not reachable ever since some of the lexer cleanups.
      We could recognize '~' in the lexer, complain, and return a '^' instead,
      but it's been a few years since Go was new and this may have been a use-
      ful error. The lexer complains with "illegal character U+007E '~'" which
      is good enough.
      
      For #13244.
      
      Change-Id: Ie3283738486eb6f8462d594f2728ac98333c0520
      Reviewed-on: https://go-review.googlesource.com/20768Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      c1a4fe8d
    • Brad Fitzpatrick's avatar
      net/http: remove init func reference to ServeMux · 8540a1c4
      Brad Fitzpatrick authored
      Shrinks cmd/go by 30KB.
      
      Change-Id: Ied31192e85af76ebac743f8cc12bd9ef6ec5048f
      Reviewed-on: https://go-review.googlesource.com/20765Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      8540a1c4
    • Josh Bleecher Snyder's avatar
      cmd/compile: move LSym.RefIdx for better packing · 826831ac
      Josh Bleecher Snyder authored
      Change-Id: I0516d49ee8381c5e022d77c2fb41515c01c8a631
      Reviewed-on: https://go-review.googlesource.com/20764Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      826831ac
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove LSym.Etext · 31a9e505
      Josh Bleecher Snyder authored
      Use a local variable instead.
      
      Passes toolstash -cmp.
      
      Change-Id: I9623a40ff0d568f11afd1279b6aaa1c33eda644c
      Reviewed-on: https://go-review.googlesource.com/20730Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      31a9e505
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove LSym.Next · dd2ba0c7
      Josh Bleecher Snyder authored
      Instead, use a slice.
      
      Passes toolstash -cmp.
      
      Change-Id: I889fdb4ae997416f907522f549b96506be13bec7
      Reviewed-on: https://go-review.googlesource.com/20699Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dd2ba0c7
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove LSym.Value · 61b9315d
      Josh Bleecher Snyder authored
      It is unused.
      
      Passes toolstash -cmp.
      
      Change-Id: I22ae2bb432ce6be377dea43cf018ffccb6e95f37
      Reviewed-on: https://go-review.googlesource.com/20698Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      61b9315d
    • Austin Clements's avatar
      runtime: shrink stacks during concurrent mark · f11e4eb5
      Austin Clements authored
      Currently we shrink stacks during STW mark termination because it used
      to be unsafe to shrink them concurrently. For some programs, this
      significantly increases pause time: stack shrinking costs ~5ms/MB
      copied plus 2µs/shrink.
      
      Now that we've made it safe to shrink a stack without the world being
      stopped, shrink them during the concurrent mark phase.
      
      This reduces the STW time in the program from issue #12967 by an order
      of magnitude and brings it from over the 10ms goal to well under:
      
      name           old 95%ile-markTerm-time  new 95%ile-markTerm-time  delta
      Stackshrink-4               23.8ms ±60%               1.80ms ±39%  -92.44%  (p=0.008 n=5+5)
      
      Fixes #12967.
      
      This slows down the go1 and garbage benchmarks overall by < 0.5%.
      
      name              old time/op  new time/op  delta
      XBenchGarbage-12  2.48ms ± 1%  2.49ms ± 1%  +0.45%  (p=0.005 n=25+21)
      
      name                      old time/op    new time/op    delta
      BinaryTree17-12              2.93s ± 2%     2.97s ± 2%  +1.34%  (p=0.002 n=19+20)
      Fannkuch11-12                2.51s ± 1%     2.59s ± 0%  +3.09%  (p=0.000 n=18+18)
      FmtFprintfEmpty-12          51.1ns ± 2%    51.5ns ± 1%    ~     (p=0.280 n=20+17)
      FmtFprintfString-12          175ns ± 1%     169ns ± 1%  -3.01%  (p=0.000 n=20+20)
      FmtFprintfInt-12             160ns ± 1%     160ns ± 0%  +0.53%  (p=0.000 n=20+20)
      FmtFprintfIntInt-12          265ns ± 0%     266ns ± 1%  +0.59%  (p=0.000 n=20+20)
      FmtFprintfPrefixedInt-12     237ns ± 1%     238ns ± 1%  +0.44%  (p=0.000 n=20+20)
      FmtFprintfFloat-12           326ns ± 1%     341ns ± 1%  +4.55%  (p=0.000 n=20+19)
      FmtManyArgs-12              1.01µs ± 0%    1.02µs ± 0%  +0.43%  (p=0.000 n=20+19)
      GobDecode-12                8.41ms ± 1%    8.30ms ± 2%  -1.22%  (p=0.000 n=20+19)
      GobEncode-12                6.66ms ± 1%    6.68ms ± 0%  +0.30%  (p=0.000 n=18+19)
      Gzip-12                      322ms ± 1%     322ms ± 1%    ~     (p=1.000 n=20+20)
      Gunzip-12                   42.8ms ± 0%    42.9ms ± 0%    ~     (p=0.174 n=20+20)
      HTTPClientServer-12         69.7µs ± 1%    70.6µs ± 1%  +1.20%  (p=0.000 n=20+20)
      JSONEncode-12               16.8ms ± 0%    16.8ms ± 1%    ~     (p=0.154 n=19+19)
      JSONDecode-12               65.1ms ± 0%    65.3ms ± 1%  +0.34%  (p=0.003 n=20+20)
      Mandelbrot200-12            3.93ms ± 0%    3.92ms ± 0%    ~     (p=0.396 n=19+20)
      GoParse-12                  3.66ms ± 1%    3.65ms ± 1%    ~     (p=0.117 n=16+18)
      RegexpMatchEasy0_32-12      85.0ns ± 2%    85.5ns ± 2%    ~     (p=0.143 n=20+20)
      RegexpMatchEasy0_1K-12       267ns ± 1%     267ns ± 1%    ~     (p=0.867 n=20+17)
      RegexpMatchEasy1_32-12      83.3ns ± 2%    83.8ns ± 1%    ~     (p=0.068 n=20+20)
      RegexpMatchEasy1_1K-12       432ns ± 1%     432ns ± 1%    ~     (p=0.804 n=20+19)
      RegexpMatchMedium_32-12      133ns ± 0%     133ns ± 0%    ~     (p=1.000 n=20+20)
      RegexpMatchMedium_1K-12     40.3µs ± 1%    40.4µs ± 1%    ~     (p=0.319 n=20+19)
      RegexpMatchHard_32-12       2.10µs ± 1%    2.10µs ± 1%    ~     (p=0.723 n=20+18)
      RegexpMatchHard_1K-12       63.0µs ± 0%    63.0µs ± 0%    ~     (p=0.158 n=19+17)
      Revcomp-12                   461ms ± 1%     476ms ± 8%  +3.29%  (p=0.002 n=20+20)
      Template-12                 80.1ms ± 1%    79.3ms ± 1%  -1.00%  (p=0.000 n=20+20)
      TimeParse-12                 360ns ± 0%     360ns ± 0%    ~     (p=0.802 n=18+19)
      TimeFormat-12                374ns ± 1%     372ns ± 0%  -0.77%  (p=0.000 n=20+19)
      [Geo mean]                  61.8µs         62.0µs       +0.40%
      
      Change-Id: Ib60cd46b7a4987e07670eb271d22f6cee5802842
      Reviewed-on: https://go-review.googlesource.com/20044Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f11e4eb5
    • Austin Clements's avatar
      runtime: generalize work.finalizersDone to work.markrootDone · c14d25c6
      Austin Clements authored
      We're about to add another root marking job that needs to happen only
      during the first markroot pass (whether that's concurrent or STW),
      just like finalizer scanning. Rather than introducing another flag
      that has the same value as finalizersDone, just rename finalizersDone
      to markrootDone.
      
      Change-Id: I535356c6ea1f3734cb5b6add264cb7bf48de95e8
      Reviewed-on: https://go-review.googlesource.com/20043Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c14d25c6
    • Austin Clements's avatar
      runtime: make shrinkstack concurrent-safe · 276b1777
      Austin Clements authored
      Currently shinkstack is only safe during STW because it adjusts
      channel-related stack pointers and moves send/receive stack slots
      without synchronizing with the channel code. Make it safe to use when
      the world isn't stopped by:
      
      1) Locking all channels the G is blocked on while adjusting the sudogs
         and copying the area of the stack that may contain send/receive
         slots.
      
      2) For any stack frames that may contain send/receive slot, using an
         atomic CAS to adjust pointers to prevent races between adjusting a
         pointer in a receive slot and a concurrent send writing to that
         receive slot.
      
      In principle, the synchronization could be finer-grained. For example,
      we considered synchronizing around the sudogs, which would allow
      channel operations involving other Gs to continue if the G being
      shrunk was far enough down the send/receive queue. However, using the
      channel lock means no additional locks are necessary in the channel
      code. Furthermore, the stack shrinking code holds the channel lock for
      a very short time (much less than the time required to shrink the
      stack).
      
      This does not yet make stack shrinking concurrent; it merely makes
      doing so safe.
      
      This has negligible effect on the go1 and garbage benchmarks.
      
      For #12967.
      
      Change-Id: Ia49df3a8a7be4b36e365aac4155a2416b94b988c
      Reviewed-on: https://go-review.googlesource.com/20042Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      276b1777
    • Austin Clements's avatar
      runtime: define lock order between G status and channel lock · d45bf722
      Austin Clements authored
      Currently, locking a G's stack by setting its status to _Gcopystack or
      _Gscan is unordered with respect to channel locks. However, when we
      make stack shrinking concurrent, stack shrinking will need to lock the
      G and then acquire channel locks, which imposes an order on these.
      
      Document this lock ordering and fix closechan to respect it.
      Everything else already happens to respect it.
      
      For #12967.
      
      Change-Id: I4dd02675efffb3e7daa5285cf75bf24f987d90d4
      Reviewed-on: https://go-review.googlesource.com/20041Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d45bf722