1. 04 Apr, 2016 13 commits
    • Shahar Kohanim's avatar
      cmd/link: grow rdBuf lazily · bc942823
      Shahar Kohanim authored
      Counting the final buffer size usually doesn't result in the buffer growing,
      so assume that it doesn't need to grow and only grow if necessary.
      
      name       old secs    new secs    delta
      LinkCmdGo   0.49 ± 4%   0.48 ± 3%  -1.31%   (p=0.000 n=95+95)
      
      name       old MaxRSS  new MaxRSS  delta
      LinkCmdGo   122k ± 4%   121k ± 5%    ~     (p=0.065 n=96+100)
      
      Change-Id: I85e7f5688a61ef5ef2b1b7afe56507e71c5bd5b1
      Reviewed-on: https://go-review.googlesource.com/21509Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Shahar Kohanim <skohanim@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      bc942823
    • Robert Griesemer's avatar
      cmd/compile: export inlined function bodies · a9ea36af
      Robert Griesemer authored
      Completed implementation for exporting inlined functions
      using the new binary export format. This change passes
      (export GO_GCFLAGS=-newexport; make all.bash) but for
      gc's builtin_test.go which we need to adjust before enabling
      this code by default.
      
      For a high-level description of the export format see the
      comment at the top of bexport.go.
      
      Major changes:
      
      1) The export format for the platform independent export data
         changed: When we export inlined function bodies, additional
         objects (other functions, types, etc.) that are referred to
         by the function bodies will need to be exported. While this
         doesn't affect the platform-independent portion directly, it
         adds more objects to the exportlist while we are exporting.
         Instead of trying to sort the objects into groups, just export
         objects as they appear in the export list. This is slightly
         less compact (one extra byte per object), but it is simpler
         and much more flexible.
      
      2) The export format contains now three sections: 1) The plat-
         form independent objects, 2) the objects pulled in for export
         via inlined function bodies, and 3) the inlined function bodies.
      
      3) Completed the exporting and importing code for inlined function
         bodies. The format is completely compiler-specific and easily
         changeable w/o affecting other tools. There is still quite a
         bit of room for denser encoding. This can happen at any time
         in the future.
      
      This change contains also the adjustments for go/internal/gcimporter,
      necessary because of the export format change 1) mentioned above.
      
      For #13241.
      
      Change-Id: I86bca0bd984b12ccf13d0d30892e6e25f6d04ed5
      Reviewed-on: https://go-review.googlesource.com/21172
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a9ea36af
    • Matthew Dempsky's avatar
      cmd/compile: use *byte for pointer to string memory · 38e11d05
      Matthew Dempsky authored
      Change-Id: I14cff013ef4920d33b5ead0c75d51681bb4f635a
      Reviewed-on: https://go-review.googlesource.com/21337
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      38e11d05
    • Marcel van Lohuizen's avatar
      testing: unflake TestBRun · 8bc9c57b
      Marcel van Lohuizen authored
      by only testing the lower bound of memalloc
      
      Fixes #15063
      
      Change-Id: Iab2fdd75e9ce98c641bfbce57f142fa47176772d
      Reviewed-on: https://go-review.googlesource.com/21507Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      8bc9c57b
    • Alexandru Moșoi's avatar
      cmd/compile: constant fold modulo · 060501dc
      Alexandru Moșoi authored
      Fixes #15079
      
      Change-Id: Ib4dd9eab322da39234008e040100e75cb58761b3
      Reviewed-on: https://go-review.googlesource.com/21501Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      060501dc
    • Alexandru Moșoi's avatar
      cmd/compile: fold IsInBounds of modulo. · 68325b56
      Alexandru Moșoi authored
      In b we only need the division by 0 check.
      
      func b(i uint, v []byte) byte {
          return v[i%uint(len(v))]
      }
      
      Updates #15079.
      
      Change-Id: Ic7491e677dd57cd6ba577efbce576dbb6e023cbd
      Reviewed-on: https://go-review.googlesource.com/21502
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Reviewed-by: default avatarAhmed Waheed <oneofone@gmail.com>
      68325b56
    • Austin Clements's avatar
      runtime: fix pagesInUse accounting · 61f56e92
      Austin Clements authored
      When we grow the heap, we create a temporary "in use" span for the
      memory acquired from the OS and then free that span to link it into
      the heap. Hence, we (1) increase pagesInUse when we make the temporary
      span so that (2) freeing the span will correctly decrease it.
      
      However, currently step (1) increases pagesInUse by the number of
      pages requested from the heap, while step (2) decreases it by the
      number of pages requested from the OS (the size of the temporary
      span). These aren't necessarily the same, since we round up the number
      of pages we request from the OS, so steps 1 and 2 don't necessarily
      cancel out like they're supposed to. Over time, this can add up and
      cause pagesInUse to underflow and wrap around to 2^64. The garbage
      collector computes the sweep ratio from this, so if this happens, the
      sweep ratio becomes effectively infinite, causing the first allocation
      on each P in a sweep cycle to sweep the entire heap. This makes
      sweeping effectively STW.
      
      Fix this by increasing pagesInUse in step 1 by the number of pages
      requested from the OS, so that the two steps correctly cancel out. We
      add a test that checks that the running total matches the actual state
      of the heap.
      
      Fixes #15022. For 1.6.x.
      
      Change-Id: Iefd9d6abe37d0d447cbdbdf9941662e4f18eeffc
      Reviewed-on: https://go-review.googlesource.com/21280
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      61f56e92
    • David Crawshaw's avatar
      cmd/link: keep types together when dynamic linking · 2d568895
      David Crawshaw authored
      To refer to types and names by offsets, we want to keep the symbols in
      the same sections. Do this by making all types .relro for now.
      
      Once name offsets are further along, name data can move out of relro.
      
      Change-Id: I1cbd2e914bd180cdf25c4aeb13d9c1c734febe69
      Reviewed-on: https://go-review.googlesource.com/21394Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      2d568895
    • Caio Marcelo de Oliveira Filho's avatar
      go/types: better error when assigning to struct field in map · 74c0fea9
      Caio Marcelo de Oliveira Filho authored
      Identify this assignment case and instead of the more general error
      
          prog.go:6: cannot assign to students["sally"].age (value of type int)
      
      produce
      
          prog.go:6: cannot directly assign to struct field students["sally"].age in map
      
      that explains why the assignment is not possible. Used ExprString
      instead of String of operand since the type of the field is not relevant
      to the error.
      
      Updates #13779.
      
      Change-Id: I581251145ae6336ddd181b9ddd77f657c51b5aff
      Reviewed-on: https://go-review.googlesource.com/21463Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      74c0fea9
    • Caio Marcelo de Oliveira Filho's avatar
      cmd/compile: better error when assigning to struct field in map · f229e467
      Caio Marcelo de Oliveira Filho authored
      Identify this assignment case and instead of the more general error
      
          prog.go:6: cannot assign to students["sally"].age
      
      produce
      
          prog.go:6: cannot directly assign to struct field students["sally"].age in map
      
      that explains why the assignment is not possible.
      
      Fixes #13779.
      
      Change-Id: I90c10b445f907834fc1735aa66e44a0f447aa74f
      Reviewed-on: https://go-review.googlesource.com/21462Reviewed-by: default avatarDavid Chase <drchase@google.com>
      f229e467
    • Alex Brainman's avatar
      runtime: change osyield to use Windows SwitchToThread · 1f5b1b2b
      Alex Brainman authored
      It appears that windows osyield is just 15ms sleep on my computer
      (see benchmarks below). Replace NtWaitForSingleObject in osyield
      with SwitchToThread (as suggested by Dmitry).
      
      Also add issue #14790 related benchmarks, so we can track perfomance
      changes in CL 20834 and CL 20835 and beyond.
      
      Update #14790
      
      benchmark                             old ns/op     new ns/op     delta
      BenchmarkChanToSyscallPing1ms         1953200       1953000       -0.01%
      BenchmarkChanToSyscallPing15ms        31562904      31248400      -1.00%
      BenchmarkSyscallToSyscallPing1ms      5247          4202          -19.92%
      BenchmarkSyscallToSyscallPing15ms     5260          4374          -16.84%
      BenchmarkChanToChanPing1ms            474           494           +4.22%
      BenchmarkChanToChanPing15ms           468           489           +4.49%
      BenchmarkOsYield1ms                   980018        75.5          -99.99%
      BenchmarkOsYield15ms                  15625200      75.8          -100.00%
      
      Change-Id: I1b4cc7caca784e2548ee3c846ca07ef152ebedce
      Reviewed-on: https://go-review.googlesource.com/21294
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1f5b1b2b
    • Rob Pike's avatar
      html/template: prefix the internally-used FuncMap values with an underscore · 02adfa0b
      Rob Pike authored
      This makes these names even less likely to collide with a real user-defined function.
      
      Fixes #13852.
      
      Change-Id: If5a8562c6797ced19c355c7ab2c86fc4401a8674
      Reviewed-on: https://go-review.googlesource.com/21490
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      02adfa0b
    • Christopher Nelson's avatar
      cmd/go: fix -buildmode=c-archive should work on windows · ed8f0e5c
      Christopher Nelson authored
      Add supporting code for runtime initialization, including both
      32- and 64-bit x86 architectures.
      
      Add .ctors section on Windows to PE .o files, and INITENTRY to .ctors
      section to plug in to the GCC C/C++ startup initialization mechanism.
      This allows the Go runtime to initialize itself. Add .text section
      symbol for .ctor relocations. Note: This is unlikely to be useful for
      MSVC-based toolchains.
      
      Fixes #13494
      
      Change-Id: I4286a96f70e5f5228acae88eef46e2bed95813f3
      Reviewed-on: https://go-review.googlesource.com/18057Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      ed8f0e5c
  2. 03 Apr, 2016 12 commits
  3. 02 Apr, 2016 7 commits
  4. 01 Apr, 2016 8 commits