1. 15 Feb, 2018 33 commits
    • Austin Clements's avatar
      runtime: use spanOf* more widely · 4de46862
      Austin Clements authored
      The logic in the spanOf* functions is open-coded in a lot of places
      right now. Replace these with calls to the spanOf* functions.
      
      Change-Id: I3cc996aceb9a529b60fea7ec6fef22008c012978
      Reviewed-on: https://go-review.googlesource.com/85880
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      4de46862
    • Austin Clements's avatar
      runtime: consolidate mheap.lookup* and spanOf* · a90f9a00
      Austin Clements authored
      I think we'd forgotten about the mheap.lookup APIs when we introduced
      spanOf*, but, at any rate, the spanOf* functions are used far more
      widely at this point, so this CL eliminates the mheap.lookup*
      functions in favor of spanOf*.
      
      Change-Id: I15facd0856e238bb75d990e838a092b5bef5bdfc
      Reviewed-on: https://go-review.googlesource.com/85879
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      a90f9a00
    • Austin Clements's avatar
      runtime: split object finding out of heapBitsForObject · 058bb7ea
      Austin Clements authored
      heapBitsForObject does two things: it finds the base of the object and
      it creates the heapBits for the base of the object. There are several
      places where we just care about the base of the object. Furthermore,
      greyobject only needs the heapBits in the checkmark path and can
      easily compute them only when needed. Once we eliminate passing the
      heap bits to grayobject, almost all uses of heapBitsForObject don't
      need the heap bits.
      
      Hence, this splits heapBitsForObject into findObject and
      heapBitsForAddr (the latter already exists), removes the hbits
      argument to grayobject, and replaces all heapBitsForObject calls with
      calls to findObject.
      
      In addition to making things cleaner overall, heapBitsForAddr is going
      to get more expensive shortly, so it's important that we don't do it
      needlessly.
      
      Note that there's an interesting performance pitfall here. I had
      originally moved findObject to mheap.go, since it made more sense
      there. However, that leads to a ~2% slow down and a whopping 11%
      increase in L1 icache misses on both the x/garbage and compilebench
      benchmarks. This suggests we may want to be more principled about
      this, but, for now, let's just leave findObject in mbitmap.go.
      
      (I tried to make findObject small enough to inline by splitting out
      the error case, but, sadly, wasn't quite able to get it under the
      inlining budget.)
      
      Change-Id: I7bcb92f383ade565d22a9f2494e4c66fd513fb10
      Reviewed-on: https://go-review.googlesource.com/85878
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      058bb7ea
    • Austin Clements's avatar
      runtime: replace mlookup and findObject with heapBitsForObject · 41e6abdc
      Austin Clements authored
      These functions all serve essentially the same purpose. mlookup is
      used in only one place and findObject in only three. Use
      heapBitsForObject instead, which is the most optimized implementation.
      
      (This may seem slightly silly because none of these uses care about
      the heap bits, but we're about to split up the functionality of
      heapBitsForObject anyway. At that point, findObject will rise from the
      ashes.)
      
      Change-Id: I906468c972be095dd23cf2404a7d4434e802f250
      Reviewed-on: https://go-review.googlesource.com/85877
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      41e6abdc
    • Austin Clements's avatar
      runtime: validate lfnode addresses · b1d94c11
      Austin Clements authored
      Change-Id: Ic8c506289caaf6218494e5150d10002e0232feaa
      Reviewed-on: https://go-review.googlesource.com/85876
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      b1d94c11
    • Austin Clements's avatar
      runtime: expand/update lfstack address space assumptions · 981d0495
      Austin Clements authored
      I was spelunking Linux's address space code and found that some of the
      information about maximum virtual addresses in lfstack's comments was
      out of date. This expands and updates the comment.
      
      Change-Id: I9f54b23e6b266b3c5cc20259a849231fb751f6e7
      Reviewed-on: https://go-review.googlesource.com/85875
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      981d0495
    • Chad Rosier's avatar
      cmd/compile: improve absorb shifts optimization for arm64 · 51932c32
      Chad Rosier authored
      Current absorb shifts optimization can generate dead Value nodes which increase
      use count of other live nodes. It will impact other optimizations (such as
      combined loads) which are enabled based on specific use count. This patch fixes
      the issue by decreasing the use count of nodes referenced by dead Value nodes
      generated by absorb shifts optimization.
      
      Performance impacts on go1 benchmarks (data collected on A57@2GHzx8):
      
      name                     old time/op    new time/op    delta
      BinaryTree17-8              6.28s ± 2%     6.24s ± 1%     ~     (p=0.065 n=10+9)
      Fannkuch11-8                6.32s ± 0%     6.33s ± 0%   +0.17%  (p=0.000 n=10+10)
      FmtFprintfEmpty-8          98.9ns ± 0%    99.2ns ± 0%   +0.34%  (p=0.000 n=9+7)
      FmtFprintfString-8          183ns ± 1%     182ns ± 1%   -1.01%  (p=0.005 n=9+10)
      FmtFprintfInt-8             199ns ± 1%     202ns ± 1%   +1.41%  (p=0.000 n=10+9)
      FmtFprintfIntInt-8          272ns ± 1%     276ns ± 3%   +1.36%  (p=0.015 n=10+10)
      FmtFprintfPrefixedInt-8     367ns ± 1%     369ns ± 1%   +0.68%  (p=0.042 n=10+10)
      FmtFprintfFloat-8           491ns ± 1%     493ns ± 1%     ~     (p=0.064 n=10+10)
      FmtManyArgs-8              1.31µs ± 1%    1.32µs ± 1%   +0.39%  (p=0.042 n=8+9)
      GobDecode-8                17.0ms ± 2%    16.2ms ± 2%   -4.74%  (p=0.000 n=10+10)
      GobEncode-8                13.7ms ± 2%    13.4ms ± 1%   -2.40%  (p=0.000 n=10+9)
      Gzip-8                      844ms ± 0%     737ms ± 0%  -12.70%  (p=0.000 n=10+10)
      Gunzip-8                   84.4ms ± 1%    83.9ms ± 0%   -0.55%  (p=0.000 n=10+8)
      HTTPClientServer-8          122µs ± 1%     124µs ± 1%   +1.75%  (p=0.000 n=10+9)
      JSONEncode-8               34.9ms ± 1%    32.4ms ± 0%   -7.11%  (p=0.000 n=10+9)
      JSONDecode-8                150ms ± 0%     146ms ± 1%   -2.84%  (p=0.000 n=7+10)
      Mandelbrot200-8            10.0ms ± 0%    10.0ms ± 0%     ~     (p=0.529 n=10+10)
      GoParse-8                  8.18ms ± 1%    8.03ms ± 0%   -1.93%  (p=0.000 n=10+10)
      RegexpMatchEasy0_32-8       209ns ± 0%     209ns ± 0%     ~     (p=0.248 n=10+9)
      RegexpMatchEasy0_1K-8       789ns ± 1%     790ns ± 0%     ~     (p=0.361 n=10+10)
      RegexpMatchEasy1_32-8       202ns ± 0%     202ns ± 1%     ~     (p=0.137 n=8+10)
      RegexpMatchEasy1_1K-8      1.12µs ± 2%    1.12µs ± 1%     ~     (p=0.810 n=10+10)
      RegexpMatchMedium_32-8      298ns ± 0%     298ns ± 0%     ~     (p=0.443 n=10+9)
      RegexpMatchMedium_1K-8     83.0µs ± 5%    78.6µs ± 0%   -5.37%  (p=0.000 n=10+10)
      RegexpMatchHard_32-8       4.32µs ± 0%    4.26µs ± 0%   -1.47%  (p=0.000 n=10+10)
      RegexpMatchHard_1K-8        132µs ± 4%     126µs ± 0%   -4.41%  (p=0.000 n=10+9)
      Revcomp-8                   1.11s ± 0%     1.11s ± 0%   +0.14%  (p=0.017 n=10+9)
      Template-8                  155ms ± 1%     155ms ± 1%     ~     (p=0.796 n=10+10)
      TimeParse-8                 774ns ± 1%     785ns ± 1%   +1.41%  (p=0.001 n=10+10)
      TimeFormat-8                788ns ± 1%     806ns ± 1%   +2.24%  (p=0.000 n=10+9)
      
      name                     old speed      new speed      delta
      GobDecode-8              45.2MB/s ± 2%  47.5MB/s ± 2%   +4.96%  (p=0.000 n=10+10)
      GobEncode-8              56.0MB/s ± 2%  57.4MB/s ± 1%   +2.44%  (p=0.000 n=10+9)
      Gzip-8                   23.0MB/s ± 0%  26.3MB/s ± 0%  +14.55%  (p=0.000 n=10+10)
      Gunzip-8                  230MB/s ± 1%   231MB/s ± 0%   +0.55%  (p=0.000 n=10+8)
      JSONEncode-8             55.6MB/s ± 1%  59.9MB/s ± 0%   +7.65%  (p=0.000 n=10+9)
      JSONDecode-8             12.9MB/s ± 0%  13.3MB/s ± 1%   +2.94%  (p=0.000 n=7+10)
      GoParse-8                7.08MB/s ± 1%  7.22MB/s ± 0%   +1.95%  (p=0.000 n=10+10)
      RegexpMatchEasy0_32-8     153MB/s ± 0%   153MB/s ± 0%   -0.16%  (p=0.023 n=10+10)
      RegexpMatchEasy0_1K-8    1.30GB/s ± 1%  1.30GB/s ± 0%     ~     (p=0.393 n=10+10)
      RegexpMatchEasy1_32-8     158MB/s ± 0%   158MB/s ± 0%     ~     (p=0.684 n=10+10)
      RegexpMatchEasy1_1K-8     915MB/s ± 2%   918MB/s ± 1%     ~     (p=0.796 n=10+10)
      RegexpMatchMedium_32-8   3.35MB/s ± 0%  3.35MB/s ± 0%     ~     (p=1.000 n=10+9)
      RegexpMatchMedium_1K-8   12.3MB/s ± 5%  13.0MB/s ± 0%   +5.56%  (p=0.000 n=10+10)
      RegexpMatchHard_32-8     7.40MB/s ± 0%  7.51MB/s ± 0%   +1.50%  (p=0.000 n=10+10)
      RegexpMatchHard_1K-8     7.75MB/s ± 4%  8.10MB/s ± 0%   +4.52%  (p=0.000 n=10+8)
      Revcomp-8                 229MB/s ± 0%   228MB/s ± 0%   -0.14%  (p=0.017 n=10+9)
      Template-8               12.5MB/s ± 1%  12.5MB/s ± 1%     ~     (p=0.780 n=10+10)
      
      Change-Id: I103389f168eac79f6af44e8fef93acc2a7a4ac96
      Reviewed-on: https://go-review.googlesource.com/88415
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      51932c32
    • Than McIntosh's avatar
      compiler: honor //line directives in DWARF variable file/line attrs · b3cb740b
      Than McIntosh authored
      During DWARF debug generation, the DW_AT_decl_line / DW_AT_decl_file
      attributes for variable DIEs were being computed without taking into
      account the possibility of "//line" directives. Fix things up to use
      the correct src.Pos methods to pick up this info.
      
      Fixes #23704.
      
      Change-Id: I88c21a0e0a9602392be229252d856a6d665868e2
      Reviewed-on: https://go-review.googlesource.com/92255
      Run-TryBot: Than McIntosh <thanm@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
      b3cb740b
    • Hana Kim's avatar
      internal/trace: link user span start and end events · 1ae22d8c
      Hana Kim authored
      Also add testdata for version 1.11 including UserTaskSpan test trace.
      
      Change-Id: I673fb29bb3aee96a14fadc0ab860d4f5832143f5
      Reviewed-on: https://go-review.googlesource.com/93795Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
      1ae22d8c
    • zaq1tomo's avatar
      cmd/cgo: delete double space in comment · 864ac315
      zaq1tomo authored
      delete double space from comment
      
      Change-Id: I71af5c1149941575016f79a91269f128b1fc16af
      GitHub-Last-Rev: aba8874bd362d05d6c29c8647049369dfcd796f5
      GitHub-Pull-Request: golang/go#23851
      Reviewed-on: https://go-review.googlesource.com/94415Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      864ac315
    • Ian Lance Taylor's avatar
      debug/dwarf: formStrp uses a 64-bit value for 64-bit DWARF · ff3885dc
      Ian Lance Taylor authored
      No test as the only system I know that uses 64-bit DWARF is AIX.
      
      Change-Id: I24e225253075be188845656b6778993c2d24ebf5
      Reviewed-on: https://go-review.googlesource.com/84379
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      ff3885dc
    • Hana Kim's avatar
      runtime/trace: implement annotation API · 6977a3b2
      Hana Kim authored
      This implements the annotation API proposed in golang.org/cl/63274.
      
      traceString is updated to protect the string map with trace.stringsLock
      because the assumption that traceString is called by a single goroutine
      (either at the beginning of tracing and at the end of tracing when
      dumping all the symbols and function names) is no longer true.
      
      traceString is used by the annotation apis (NewContext, StartSpan, Log)
      to register frequently appearing strings (task and span names, and log
      keys) after this change.
      
      NewContext -> one or two records (EvString, EvUserTaskCreate)
      end function -> one record (EvUserTaskEnd)
      StartSpan -> one or two records (EvString, EvUserSpan)
      span end function -> one or two records (EvString, EvUserSpan)
      Log -> one or two records (EvString, EvUserLog)
      
      EvUserLog record is of the typical record format written by traceEvent
      except that it is followed by bytes that represents the value string.
      
      In addition to runtime/trace change, this change includes
      corresponding changes in internal/trace to parse the new record types.
      
      Future work to improve efficiency:
        More efficient unique task id generation instead of atomic. (per-P
        counter).
        Instead of a centralized trace.stringsLock, consider using per-P
        string cache or something more efficient.
      
      R=go1.11
      
      Change-Id: Iec9276c6c51e5be441ccd52dec270f1e3b153970
      Reviewed-on: https://go-review.googlesource.com/71690Reviewed-by: 's avatarAustin Clements <austin@google.com>
      6977a3b2
    • Hana Kim's avatar
      runtime/trace: user annotation API · 32d1cd33
      Hana Kim authored
      This CL presents the proposed user annotation API skeleton.
      This CL bumps up the trace version to 1.11.
      
      Design doc https://goo.gl/iqJfJ3
      
      Implementation CLs are followed.
      
      The API introduces three basic building blocks. Log, Span, and Task.
      
      Log is for basic logging. When called, the message will be recorded
      to the trace along with timestamp, goroutine id, and stack info.
      
         trace.Log(ctx, messageType message)
      
      Span can be thought as an extension of log to record interesting
      time interval during a goroutine's execution. A span is local to a
      goroutine by definition.
      
         trace.WithSpan(ctx, "doVeryExpensiveOp", func(ctx context) {
            /* do something very expensive */
         })
      
      Task is higher-level concept that aids tracing of complex operations
      that encompass multiple goroutines or are asynchronous.
      For example, an RPC request, a HTTP request, a file write, or a
      batch job can be traced with a Task.
      
      Note we chose to design the API around context.Context so it allows
      easier integration with other tracing tools, often designed around
      context.Context as well. Log and WithSpan APIs recognize the task
      information embedded in the context and record it in the trace as
      well. That allows the Go execution tracer to associate and group
      the spans and log messages based on the task information.
      
      In order to create a Task,
      
         ctx, end := trace.NewContext(ctx, "myTask")
         defer end()
      
      The Go execution tracer measures the time between the task created
      and the task ended for the task latency.
      
      More discussion history in golang.org/cl/59572.
      
      Update #16619
      
      R=go1.11
      
      Change-Id: I59a937048294dafd23a75cf1723c6db461b193cd
      Reviewed-on: https://go-review.googlesource.com/63274Reviewed-by: 's avatarAustin Clements <austin@google.com>
      32d1cd33
    • Michael Fraenkel's avatar
      cmd/compile: convert untyped bool for OIF and OFOR · e0576805
      Michael Fraenkel authored
      Updates #23834.
      
      Change-Id: I92aca9108590a0c7de774f4fad7ded97105e3cb8
      Reviewed-on: https://go-review.googlesource.com/94475Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      e0576805
    • Carlos Eduardo Seo's avatar
      cmd/asm, cmd/internal/obj/ppc64: add Immediate Shifted opcodes for ppc64x · 9a9a8c01
      Carlos Eduardo Seo authored
      This change adds ADD/AND/OR/XOR Immediate Shifted instructions for
      ppc64x so they are usable in Go asm code. These instructions were
      originally present in asm9.go, but they were only usable in that
      file (as -AADD, -AANDCC, -AOR, -AXOR). These old mnemonics are now
      removed.
      
      Updates #23845
      
      Change-Id: Ifa2fac685e8bc628cb241dd446adfc3068181826
      Reviewed-on: https://go-review.googlesource.com/94115Reviewed-by: 's avatarLynn Boger <laboger@linux.vnet.ibm.com>
      9a9a8c01
    • Mikio Hara's avatar
      all: drop support for Windows Vista or below (Windows XP) · d50bb8db
      Mikio Hara authored
      Per the notice in the Go 1.10 release notes, this change drops the
      support for Windows Vista or below (including Windows XP) and
      simplifies the code for the sake of maintenance.
      
      There is one exception to the above. The code related to DLL and
      system calls still remains in the runtime package. The remaining code
      will be refined and used for supporting upcoming Windows versions in
      future.
      
      Updates #17245
      Fixes #23072
      
      Change-Id: I9e2821721f25ef9b83dfbf85be2b7ee5d9023aa5
      Reviewed-on: https://go-review.googlesource.com/94255
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      d50bb8db
    • Tobias Klauser's avatar
      net, internal/poll, net/internal/socktest: set SOCK_{CLOEXEC,NONBLOCK} atomically on NetBSD · 9542ba67
      Tobias Klauser authored
      NetBSD supports the SOCK_CLOEXEC and SOCK_NONBLOCK flags to the socket
      syscall since version 6.0. The same version also introduced the paccept
      syscall which can be used to implement syscall.Accept4.
      
      Follows CL 40895
      
      Change-Id: I9e4e1829b0382744c7799f4e58929a53b4e193f7
      Reviewed-on: https://go-review.googlesource.com/94295
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBenny Siegert <bsiegert@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      9542ba67
    • Robert Griesemer's avatar
      cmd/compile/internal/syntax: don't assume (operator) ~ means operator ^ · 33eb0633
      Robert Griesemer authored
      The scanner assumed that ~ really meant ^, which may be helpful when
      coming from C. But ~ is not a valid Go token, and pretending that it
      should be ^ can lead to confusing error messages. Better to be upfront
      about it and complain about the invalid character in the first place.
      
      This was code "inherited" from the original yacc parser which was
      derived from a C compiler. It's 10 years later and we can probably
      assume that people are less confused about C and Go.
      
      Fixes #23587.
      
      Change-Id: I8d8f9b55b0dff009b75c1530d729bf9092c5aea6
      Reviewed-on: https://go-review.googlesource.com/94160Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      33eb0633
    • Daniel Martí's avatar
      cmd/vendor/github.com/google/pprof: refresh from upstream · e7cbbbe9
      Daniel Martí authored
      Updating to commit 0e0e5b7254e076a62326ab7305ba49e8515f0c91
      from github.com/google/pprof
      
      Recent modifications to the vendored pprof, such as skipping
      TestWebInterface to avoid starting a web browser, have all been fixed
      upstream.
      
      Change-Id: I72e11108c438e1573bf2f9216e76d157378e8d45
      Reviewed-on: https://go-review.googlesource.com/93375
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      e7cbbbe9
    • Tobias Klauser's avatar
      runtime: move ELF structure definitions into own files · afb9fc1d
      Tobias Klauser authored
      Move the ELF32 and ELF64 structure definitions into their own files so
      they can be reused when vDSO support is added for other architectures.
      
      Change-Id: Id0171b4e5cea4add8635743c881e3bf3469597af
      Reviewed-on: https://go-review.googlesource.com/93995
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      afb9fc1d
    • Josh Bleecher Snyder's avatar
      runtime: speed up stack copying a little · 605c9fee
      Josh Bleecher Snyder authored
      Remove a branch and a stack spill.
      
      name                old time/op  new time/op  delta
      StackCopy-8         79.2ms ± 1%  79.1ms ± 2%    ~     (p=0.063 n=96+95)
      StackCopyNoCache-8   121ms ± 1%   120ms ± 2%  -0.46%  (p=0.000 n=97+88)
      
      Change-Id: Ifcbbb05d773178fad84cb11a9a6768ace69fcf24
      Reviewed-on: https://go-review.googlesource.com/94029
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      605c9fee
    • Josh Bleecher Snyder's avatar
      runtime: simplify amd64 memmove of 3/4 bytes · 910d232a
      Josh Bleecher Snyder authored
      Change-Id: I132d3627ae301b68bf87eacb5bf41fd1ba2dcd91
      Reviewed-on: https://go-review.googlesource.com/94025
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      910d232a
    • Josh Bleecher Snyder's avatar
      runtime: fix minor doc typos in amd64 memmove · 8e0b814a
      Josh Bleecher Snyder authored
      Change-Id: Ic1ce2f93d6a225699e9ce5307d62cdda8f97630d
      Reviewed-on: https://go-review.googlesource.com/94024
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      8e0b814a
    • Josh Bleecher Snyder's avatar
      runtime: short-circuit typedslicecopy when dstp == srcp · 3658299f
      Josh Bleecher Snyder authored
      If copying from a slice to itself, skip the write barriers
      and actual memory copies.
      
      This happens in practice in code like this snippet from
      the trim pass in the compiler, when k ends up being 0:
      
      copy(s.Values[k:], s.Values[:m])
      
      Change-Id: Ie6924acfd56151f874d87f1d7f1f74320b4c4f10
      Reviewed-on: https://go-review.googlesource.com/94023
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      3658299f
    • Martin Möhrmann's avatar
      runtime: use new instead of newobject to create hmap in makemap · bf9f1c15
      Martin Möhrmann authored
      The runtime.hmap type is known at compile time.
      Using new(hmap) avoids loading the hmap type from the maptype
      supplied as an argument to makemap which is only known at runtime.
      
      This change makes makemap consistent with makemap_small
      by using new(hmap) instead of newobject in both functions.
      
      Change-Id: Ia47acfda527e8a71d15a1a7a4c2b54fb923515eb
      Reviewed-on: https://go-review.googlesource.com/91775
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      bf9f1c15
    • Martin Möhrmann's avatar
      runtime: improve test file naming · 530927e0
      Martin Möhrmann authored
      The runtime builtin functions that are tested in append_test.go
      are defined in slice.go. Renaming the test file to slice_test.go
      makes this relation explicit with a common file name prefix.
      
      Change-Id: I2f89ec23a6077fe6b80d2161efc760df828c8cd4
      Reviewed-on: https://go-review.googlesource.com/90655
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      530927e0
    • Ian Lance Taylor's avatar
      cmd/go: add options to security whitelist · f7c2a716
      Ian Lance Taylor authored
      Also permit passing flags to pkg-config, as we used to.
      
      Also change the error message to refer to https://golang.org/s/invalidflag.
      
      Fixes #23749
      
      Change-Id: I3fbeb4c346610e6fd55e8720e720b0a40e352ab5
      Reviewed-on: https://go-review.googlesource.com/93836
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      f7c2a716
    • Ian Lance Taylor's avatar
      doc: remove draft notice from Go 1.10 release notes · 229a8ce6
      Ian Lance Taylor authored
      Change-Id: I063b556b59ecb8a8f4a3f121c32982b90eee2d74
      Reviewed-on: https://go-review.googlesource.com/94159Reviewed-by: 's avatarAndrew Bonventre <andybons@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      229a8ce6
    • Ian Lance Taylor's avatar
      test: add new test that gccgo failed to compile · 0849dfd4
      Ian Lance Taylor authored
      Updates #22305
      
      Change-Id: I0e6bbd880599fc1b70d0378b746d162d4a846c65
      Reviewed-on: https://go-review.googlesource.com/91556
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      0849dfd4
    • Robert Griesemer's avatar
      cmd/compile/internal/syntax: fix syntax.Parse doc string, improved tests · eda39fe9
      Robert Griesemer authored
      1) Fix the doc string for syntax.Parse: The returned AST is
      always nil if there was an error and an error handler is missing.
      
      2) Adjust the syntax Print and Dump tests such that they print and
      dump the AST even in the presence of errors.
      
      Change-Id: If658eabdcc83f578d815070bc65d1a5f6cfaddfc
      Reviewed-on: https://go-review.googlesource.com/94157Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      eda39fe9
    • Robert Griesemer's avatar
      cmd/compile/internal/syntax: more tolerant handling of missing function invocation in go/defer · 1a227387
      Robert Griesemer authored
      Assume that an expression that is not a function call in a defer/go
      statement is indeed a function that is just missing its invocation.
      Report the error but continue with a sane syntax tree.
      
      Fixes #23586.
      
      Change-Id: Ib45ebac57c83b3e39ae4a1b137ffa291dec5b50d
      Reviewed-on: https://go-review.googlesource.com/94156Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      1a227387
    • Matthew Dempsky's avatar
      cmd/compile: fix typechecking of untyped boolean expressions · d3f6d11d
      Matthew Dempsky authored
      Previously, if we typechecked a statement like
      
          var x bool = p1.f == p2.f && p1.g == p2.g
      
      we would correctly update the '&&' node's type from 'untyped bool' to
      'bool', but the '==' nodes would stay 'untyped bool'. This is
      inconsistent, and caused consistency checks during walk to fail.
      
      This CL doesn't pass toolstash because it seems to slightly affect the
      register allocator's heuristics. (Presumably 'untyped bool's were
      previously making it all the way through SSA?)
      
      Fixes #23414.
      
      Change-Id: Ia85f8cfc69b5ba35dfeb157f4edf57612ecc3285
      Reviewed-on: https://go-review.googlesource.com/94022
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      d3f6d11d
    • Kunpei Sakai's avatar
      cmd/compile: allow converting defined string types to []rune · bcb563f4
      Kunpei Sakai authored
      Fixes #23298
      
      Change-Id: I107c6f3a80db83f063c0daf262c6e7f7492e4d4c
      Reviewed-on: https://go-review.googlesource.com/87695
      Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      bcb563f4
  2. 14 Feb, 2018 7 commits