1. 24 Aug, 2018 11 commits
    • Alberto Donizetti's avatar
      time: allow +00 as numeric timezone name and GMT offset · 38143bad
      Alberto Donizetti authored
      A timezone with a zero offset from UTC and without a three-letter
      abbreviation will have a numeric name in timestamps: "+00".
      
      There are currently two of them:
      
        $ zdump Atlantic/Azores America/Scoresbysund
        Atlantic/Azores       Wed Aug 22 09:01:05 2018 +00
        America/Scoresbysund  Wed Aug 22 09:01:05 2018 +00
      
      These two timestamp are rejected by Parse, since it doesn't allow for
      zero offsets:
      
        parsing time "Wed Aug 22 09:01:05 2018 +00": extra text: +00
      
      This change modifies Parse to accept a +00 offset in numeric timezone
      names.
      
      As side effect of this change, Parse also now accepts "GMT+00". It was
      explicitely disallowed (with a unit test ensuring it got rejected),
      but the restriction seems incorrect.
      
      DATE(1), for example, allows it:
      
        $ date --debug --date="2009-01-02 03:04:05 GMT+00"
      
        date: parsed date part: (Y-M-D) 2009-01-02
        date: parsed time part: 03:04:05
        date: parsed zone part: UTC+00
        date: input timezone: parsed date/time string (+00)
        date: using specified time as starting value: '03:04:05'
        date: starting date/time: '(Y-M-D) 2009-01-02 03:04:05 TZ=+00'
        date: '(Y-M-D) 2009-01-02 03:04:05 TZ=+00' = 1230865445 epoch-seconds
        date: timezone: system default
        date: final: 1230865445.000000000 (epoch-seconds)
        date: final: (Y-M-D) 2009-01-02 03:04:05 (UTC)
        date: final: (Y-M-D) 2009-01-02 04:04:05 (UTC+01)
        Fri  2 Jan 04:04:05 CET 2009
      
      This fixes 2 of 17 time.Parse() failures listed in Issue #26032.
      
      Updates #26032
      
      Change-Id: I01cd067044371322b7bb1dae452fb3c758ed3cc2
      Reviewed-on: https://go-review.googlesource.com/130696
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      38143bad
    • Tobias Klauser's avatar
      syscall, os: use pipe2 syscall on DragonflyBSD instead of pipe · e6c15945
      Tobias Klauser authored
      Follow the implementation used by the other BSDs ith os.Pipe and
      syscall.forkExecPipe consisting of a single syscall instead of three.
      
      Change-Id: I602187672f244cbd8faaa3397904d71d15452d9f
      Reviewed-on: https://go-review.googlesource.com/130996
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      e6c15945
    • Martin Möhrmann's avatar
      runtime: move arm hardware division support detection to internal/cpu · 2e8c31b3
      Martin Möhrmann authored
      Assumes mandatory VFP and VFPv3 support to be present by default
      but not IDIVA if AT_HWCAP is not available.
      
      Adds GODEBUGCPU options to disable the use of code paths in the runtime
      that use hardware support for division.
      
      Change-Id: Ida02311bd9b9701de3fc120697e69445bf6c0853
      Reviewed-on: https://go-review.googlesource.com/114826
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      2e8c31b3
    • Martin Möhrmann's avatar
      runtime: do not execute write barrier on newly allocated slice in growslice · 4363c98f
      Martin Möhrmann authored
      The new slice created in growslice is cleared during malloc for
      element types containing pointers and therefore can only contain
      nil pointers. This change avoids executing write barriers for these
      nil pointers by adding and using a special bulkBarrierPreWriteSrcOnly
      function that does not enqueue pointers to slots in dst to the write
      barrier buffer.
      
      Change-Id: If9b18248bfeeb6a874b0132d19520adea593bfc4
      Reviewed-on: https://go-review.googlesource.com/115996
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      4363c98f
    • Martin Möhrmann's avatar
      runtime: replace typedmemmmove with bulkBarrierPreWrite and memmove in growslice · 96dcc445
      Martin Möhrmann authored
      A bulkBarrierPreWrite together with a memmove as used in typedslicecopy
      is faster than a typedmemmove for each element of the old slice that
      needs to be copied to the new slice.
      
      typedslicecopy is not used here as runtime functions should not call
      other instrumented runtime functions and some conditions like dst == src
      or the destination slice not being large enought that are checked for
      in typedslicecopy can not happen in growslice.
      
      Append                         13.5ns ± 6%  13.3ns ± 3%     ~     (p=0.304 n=10+10)
      AppendGrowByte                 1.18ms ± 2%  1.19ms ± 1%     ~     (p=0.113 n=10+9)
      AppendGrowString                123ms ± 1%    73ms ± 1%  -40.39%  (p=0.000 n=9+8)
      AppendSlice/1Bytes             3.81ns ± 1%  3.78ns ± 1%     ~     (p=0.116 n=10+10)
      AppendSlice/4Bytes             3.71ns ± 1%  3.70ns ± 0%     ~     (p=0.095 n=10+9)
      AppendSlice/7Bytes             3.73ns ± 0%  3.75ns ± 1%     ~     (p=0.442 n=10+10)
      AppendSlice/8Bytes             4.00ns ± 1%  4.01ns ± 1%     ~     (p=0.330 n=10+10)
      AppendSlice/15Bytes            4.29ns ± 1%  4.28ns ± 1%     ~     (p=0.536 n=10+10)
      AppendSlice/16Bytes            4.28ns ± 1%  4.31ns ± 1%   +0.75%  (p=0.019 n=10+10)
      AppendSlice/32Bytes            4.57ns ± 2%  4.58ns ± 2%     ~     (p=0.236 n=10+10)
      AppendSliceLarge/1024Bytes      305ns ± 2%   306ns ± 1%     ~     (p=0.236 n=10+10)
      AppendSliceLarge/4096Bytes     1.06µs ± 1%  1.06µs ± 0%     ~     (p=1.000 n=9+10)
      AppendSliceLarge/16384Bytes    3.12µs ± 2%  3.11µs ± 1%     ~     (p=0.493 n=10+10)
      AppendSliceLarge/65536Bytes    5.61µs ± 5%  5.36µs ± 2%   -4.58%  (p=0.003 n=10+8)
      AppendSliceLarge/262144Bytes   21.0µs ± 1%  19.5µs ± 1%   -7.09%  (p=0.000 n=8+10)
      AppendSliceLarge/1048576Bytes  78.4µs ± 1%  78.7µs ± 2%     ~     (p=0.315 n=8+10)
      AppendStr/1Bytes               3.96ns ± 6%  3.99ns ± 9%     ~     (p=0.591 n=10+10)
      AppendStr/4Bytes               3.98ns ± 1%  3.99ns ± 1%     ~     (p=0.515 n=9+9)
      AppendStr/8Bytes               4.27ns ± 1%  4.27ns ± 1%     ~     (p=0.633 n=10+10)
      AppendStr/16Bytes              4.56ns ± 2%  4.55ns ± 1%     ~     (p=0.869 n=10+10)
      AppendStr/32Bytes              4.85ns ± 1%  4.89ns ± 1%   +0.71%  (p=0.003 n=10+8)
      AppendSpecialCase              18.7ns ± 1%  18.7ns ± 1%     ~     (p=0.144 n=10+10)
      AppendInPlace/NoGrow/Byte       438ns ± 1%   439ns ± 1%     ~     (p=0.135 n=10+8)
      AppendInPlace/NoGrow/1Ptr      1.05µs ± 2%  1.05µs ± 1%     ~     (p=0.469 n=10+10)
      AppendInPlace/NoGrow/2Ptr      1.77µs ± 1%  1.78µs ± 2%     ~     (p=0.469 n=10+10)
      AppendInPlace/NoGrow/3Ptr      1.94µs ± 1%  1.93µs ± 2%     ~     (p=0.517 n=10+10)
      AppendInPlace/NoGrow/4Ptr      3.18µs ± 1%  3.17µs ± 0%     ~     (p=0.483 n=10+9)
      AppendInPlace/Grow/Byte         382ns ± 2%   383ns ± 2%     ~     (p=0.705 n=9+10)
      AppendInPlace/Grow/1Ptr         383ns ± 1%   384ns ± 1%     ~     (p=0.844 n=10+10)
      AppendInPlace/Grow/2Ptr         459ns ± 2%   467ns ± 2%   +1.74%  (p=0.001 n=10+10)
      AppendInPlace/Grow/3Ptr         593ns ± 1%   597ns ± 2%     ~     (p=0.195 n=10+10)
      AppendInPlace/Grow/4Ptr         583ns ± 2%   589ns ± 2%     ~     (p=0.084 n=10+10)
      
      Change-Id: I629872f065a22b29267c1adbfc578aaedd36d365
      Reviewed-on: https://go-review.googlesource.com/115755
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      96dcc445
    • Martin Möhrmann's avatar
      runtime: use internal/cpu variables in assembler code · c15c04d9
      Martin Möhrmann authored
      Using internal/cpu variables has the benefit of avoiding false sharing
      (as those are padded) and allows memory and cache usage for these variables
      to be shared by multiple packages.
      
      Change-Id: I2bf68d03091bf52b466cf689230d5d25d5950037
      Reviewed-on: https://go-review.googlesource.com/126599
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c15c04d9
    • Tobias Klauser's avatar
      internal/syscall/unix: don't use linkname to refer to syscall.fcntl · d8cf1514
      Tobias Klauser authored
      Just open-code the fcntl syscall instead of relying on the obscurity of
      go:linkname.
      
      Change-Id: I3e4ec9db6539e016f56667d7b8b87aa37671d0e7
      Reviewed-on: https://go-review.googlesource.com/130736
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      d8cf1514
    • Seebs's avatar
      os: use Println instead of Printf in example · 9cfa41c8
      Seebs authored
      This message has no format specifiers and no trailing newline.
      It should use Println for consistency with other examples.
      
      Change-Id: I49bd1652f9449fcbdd79c6b689c123090972aab3
      Reviewed-on: https://go-review.googlesource.com/127836Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarTobias Klauser <tobias.klauser@gmail.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9cfa41c8
    • Martin Möhrmann's avatar
      cmd/compile: refactor appendslice to use newer gc code style · c907a754
      Martin Möhrmann authored
      - add comments with builtin function signatures that are instantiated
      - use Nodes type from the beginning instead of
        []*Node with a later conversion to Nodes
      - use conv(x, y) helper function instead of nod(OCONV, x, y)
      - factor out repeated calls to Type.Elem()
      
      This makes the function style similar to newer functions like extendslice.
      
      passes toolstash -cmp
      
      Change-Id: Iedab191af9e0884fb6762c9c168430c1d2246979
      Reviewed-on: https://go-review.googlesource.com/112598
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      c907a754
    • Martin Möhrmann's avatar
      cmd/compile: remove superfluous signed right shift used for signed division by 2 · 379d2dea
      Martin Möhrmann authored
      A signed right shift before an unsigned right shift by register width-1
      (extracts the sign bit) is superflous.
      
      trigger counts during ./make.bash
       0   (Rsh8U  (Rsh8  x _) 7  ) -> (Rsh8U  x 7 )
       0   (Rsh16U (Rsh16 x _) 15 ) -> (Rsh16U x 15)
       2   (Rsh32U (Rsh32 x _) 31 ) -> (Rsh32U x 31)
       251 (Rsh64U (Rsh64 x _) 63 ) -> (Rsh64U x 63)
      
      Changes the instructions generated on AMD64 for x / 2 where
      x is a signed integer from:
      
       MOVQ    AX, CX
       SARQ    $63, AX
       SHRQ    $63, AX
       ADDQ    CX, AX
       SARQ    $1, AX
      
      to:
      
       MOVQ    AX, CX
       SHRQ    $63, AX
       ADDQ    CX, AX
       SARQ    $1, AX
      
      Change-Id: I86321ae8fc9dc24b8fa9eb80aa5c7299eff8c9dc
      Reviewed-on: https://go-review.googlesource.com/115956
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      379d2dea
    • Ben Shi's avatar
      cmd/internal/obj: support more arm64 FP instructions · 84374d4d
      Ben Shi authored
      ARM64 also supports float point LDP(load pair) & STP (store pair).
      The CL adds implementation and corresponding test cases for
      FLDPD/FLDPS/FSTPD/FSTPS.
      
      Change-Id: I45f112012a4e097bfaf023d029b36e6cbc7a5859
      Reviewed-on: https://go-review.googlesource.com/125438
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      84374d4d
  2. 23 Aug, 2018 11 commits
    • Dmitri Shuralyov's avatar
      doc/go1.11: add link to new WebAssembly wiki page · 6e76aeba
      Dmitri Shuralyov authored
      The wiki page has recently been created, and at this time it's
      just a stub. It's expected that support for WebAssembly will be
      evolving over time, and the wiki page can be kept updated with
      helpful information, how to get started, tips and tricks, etc.
      
      Use present tense because it's expected that there will be more
      general information added by the time Go 1.11 release happens.
      
      Also add link to https://webassembly.org/ in first paragraph.
      
      Change-Id: I139c2dcec8f0d7fd89401df38a3e12960946693f
      Reviewed-on: https://go-review.googlesource.com/131078Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      6e76aeba
    • Heschi Kreinick's avatar
      runtime: handle morestack system stack transition in gentraceback · ae6361e4
      Heschi Kreinick authored
      gentraceback handles system stack transitions, but only when they're
      done by systemstack(). Handle morestack() too.
      
      I tried to do this generically but systemstack and morestack are
      actually *very* different functions. Most notably, systemstack returns
      "normally", just messes with $sp along the way. morestack never
      returns at all -- it calls newstack, and newstack then jumps both
      stacks and functions back to whoever called morestack. I couldn't
      think of a way to handle both of them generically. So don't.
      
      The current implementation does not include systemstack on the generated
      traceback. That's partly because I don't know how to find its stack frame
      reliably, and partly because the current structure of the code wants to
      do the transition before the call, not after. If we're willing to
      assume that morestack's stack frame is 0 size, this could probably be
      fixed.
      
      For posterity's sake, alternatives tried:
      
      - Have morestack put a dummy function into schedbuf, like systemstack
      does. This actually worked (see patchset 1) but more by a series of
      coincidences than by deliberate design. The biggest coincidence was that
      because morestack_switch was a RET and its stack was 0 size, it actually
      worked to jump back to it at the end of newstack -- it would just return
      to the caller of morestack. Way too subtle for me, and also a little
      slower than just jumping directly.
      
      - Put morestack's PC and SP into schedbuf, so that gentraceback could
      treat it like a normal function except for the changing SP. This was a
      terrible idea and caused newstack to reenter morestack in a completely
      unreasonable state.
      
      To make testing possible I did a small redesign of testCPUProfile to
      take a callback that defines how to check if the conditions pass to it
      are satisfied. This seemed better than making the syntax of the "need"
      strings even more complicated.
      
      Updates #25943
      
      Change-Id: I9271a30a976f80a093a3d4d1c7e9ec226faf74b4
      Reviewed-on: https://go-review.googlesource.com/126795
      Run-TryBot: Heschi Kreinick <heschi@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      ae6361e4
    • Heschi Kreinick's avatar
      runtime: fix use of wrong g in gentraceback · c9986d14
      Heschi Kreinick authored
      gentraceback gets the currently running g to do some sanity checks, but
      should use gp everywhere to do its actual work. Some noncritical checks
      later accidentally used g instead of gp. This seems like it could be a
      problem in many different contexts, but I noticed in Windows profiling,
      where profilem calls gentraceback on a goroutine from a different
      thread.
      
      Change-Id: I3da27a43e833b257f6411ee6893bdece45a9323f
      Reviewed-on: https://go-review.googlesource.com/128895
      Run-TryBot: Heschi Kreinick <heschi@google.com>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      c9986d14
    • Michal Bohuslávek's avatar
      text/template: Put bad function name in quotes in panic from (*Template).Funcs · b15a1e3c
      Michal Bohuslávek authored
      This turns
      
      	panic: function name  is not a valid identifier
      
      into
      	panic: function name "" is not a valid identifier
      
      and also makes it consistent with the func signature check.
      
      This CL also makes the testBadFuncName func a test helper.
      
      Change-Id: Id967cb61ac28228de81e1cd76a39f5195a5ebd11
      Reviewed-on: https://go-review.googlesource.com/130998Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b15a1e3c
    • Daniel Martí's avatar
      cmd/vet: check embedded field tags too · 4b439e41
      Daniel Martí authored
      We can no longer use the field's position for the duplicate field tag
      warning - since we now check embedded tags, the positions may belong to
      copmletely different packages.
      
      Instead, keep track of the lowest field that's still part of the
      top-level struct type that we are checking.
      
      Finally, be careful to not repeat the independent struct field warnings
      when checking fields again because they are embedded into another
      struct. To do this, separate the duplicate tag value logic into a func
      that recurses into embedded fields on a per-encoding basis.
      
      Fixes #25593.
      
      Change-Id: I3bd6e01306d8ec63c0314d25e3136d5e067a9517
      Reviewed-on: https://go-review.googlesource.com/115677
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAlan Donovan <adonovan@google.com>
      4b439e41
    • Andrew Bonventre's avatar
      doc/go1.11: remove draft status · e897d43c
      Andrew Bonventre authored
      Change-Id: I3f99083b7d8ab06482c2c22eafda8b0141a872bd
      Reviewed-on: https://go-review.googlesource.com/131076Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      e897d43c
    • Kazuhiro Sera's avatar
      all: fix typos detected by github.com/client9/misspell · ad644d2e
      Kazuhiro Sera authored
      Change-Id: Iadb3c5de8ae9ea45855013997ed70f7929a88661
      GitHub-Last-Rev: ae85bcf82be8fee533e2b9901c6133921382c70a
      GitHub-Pull-Request: golang/go#26920
      Reviewed-on: https://go-review.googlesource.com/128955Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ad644d2e
    • Martin Möhrmann's avatar
      cmd/compile: add convnop helper function · c5d38b89
      Martin Möhrmann authored
      Like the conv helper function but for creating OCONVNOP nodes
      instead of OCONV nodes.
      
      passes toolstash -cmp
      
      Change-Id: Ib93ffe66590ebaa2b4fa552c81f1a2902e789d8e
      Reviewed-on: https://go-review.googlesource.com/112597
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      c5d38b89
    • Yury Smolsky's avatar
      cmd/compile: add sources for inlined functions to ssa.html · 9e2a04d5
      Yury Smolsky authored
      This CL adds the source code of all inlined functions
      into the function specified in $GOSSAFUNC.
      The code is appended to the sources column of ssa.html.
      
      ssaDumpInlined is populated with references to inlined functions.
      Then it is used for dumping the sources in buildssa.
      
      The source columns contains code in following order:
      target function, inlined functions sorted by filename, lineno.
      
      Fixes #25904
      
      Change-Id: I4f6d4834376f1efdfda1f968a5335c0543ed36bc
      Reviewed-on: https://go-review.googlesource.com/126606
      Run-TryBot: Yury Smolsky <yury@smolsky.by>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      9e2a04d5
    • Yury Smolsky's avatar
      cmd/compile: export the Func.Endlineno field · c374984e
      Yury Smolsky authored
      This CL exports the Func.Endlineno value for inlineable functions.
      It is needed to grab the source code of an imported function
      inlined into the function specified in $GOSSAFUNC.
      
      See CL 126606 for details.
      
      Updates #25904
      
      Change-Id: I1e259e20445e4109b4621a95abb5bde1be457af1
      Reviewed-on: https://go-review.googlesource.com/126605
      Run-TryBot: Yury Smolsky <yury@smolsky.by>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c374984e
    • Yury Smolsky's avatar
      cmd/compile: clean the output of GOSSAFUNC · c35069d6
      Yury Smolsky authored
      Since we print almost everything to ssa.html in the GOSSAFUNC mode,
      there is a need to stop spamming stdout when user just wants to see
      ssa.html.
      
      This changes cleans output of the GOSSAFUNC debug mode.
      To enable the dump of the debug data to stdout, one must
      put suffix + after the function name like that:
      
      GOSSAFUNC=Foo+
      
      Otherwise gc will not print the IR and ASM to stdout after each phase.
      AST IR is still sent to stdout because it is not included
      into ssa.html. It will be fixed in a separate change.
      
      The change adds printing out the full path to the ssa.html file.
      
      Updates #25942
      
      Change-Id: I711e145e05f0443c7df5459ca528dced273a62ee
      Reviewed-on: https://go-review.googlesource.com/126603
      Run-TryBot: Yury Smolsky <yury@smolsky.by>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c35069d6
  3. 22 Aug, 2018 18 commits