1. 07 May, 2017 1 commit
    • Alex Brainman's avatar
      os: reimplement windows os.Stat · 53003621
      Alex Brainman authored
      Currently windows Stat uses combination of Lstat and Readlink to
      walk symlinks until it reaches file or directory. Windows Readlink
      is implemented via Windows DeviceIoControl(FSCTL_GET_REPARSE_POINT, ...)
      call, but that call does not work on network shares or inside of
      Docker container (see issues #18555 ad #19922 for details).
      
      But Raymond Chen suggests different approach:
      https://blogs.msdn.microsoft.com/oldnewthing/20100212-00/?p=14963/
      - he suggests to use Windows I/O manager to dereferences the
      symbolic link.
      
      This appears to work for all normal symlinks, but also for network
      shares and inside of Docker container.
      
      This CL implements described procedure.
      
      I also had to adjust TestStatSymlinkLoop, because the test is
      expecting Stat to return syscall.ELOOP for symlink with a loop.
      But new Stat returns Windows error of ERROR_CANT_RESOLVE_FILENAME
      = 1921 instead. I could map ERROR_CANT_RESOLVE_FILENAME into
      syscall.ELOOP, but I suspect the former is broader than later.
      And ERROR_CANT_RESOLVE_FILENAME message text of "The name of
      the file cannot be resolved by the system." sounds fine to me.
      
      Fixes #10935
      Fixes #18555
      Fixes #19922
      
      Change-Id: I979636064cdbdb9c7c840cf8ae73fe2c24499879
      Reviewed-on: https://go-review.googlesource.com/41834Reviewed-by: default avatarHarshavardhana <hrshvardhana@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      53003621
  2. 06 May, 2017 3 commits
  3. 05 May, 2017 8 commits
    • Robert Griesemer's avatar
      go/types: remove invalid documentation and assertion on package names · 2eeaba41
      Robert Griesemer authored
      NewPackage required through documentation that the package name not
      be blank (which wasn't true since each time we check a new package
      we create one with a blank name (api.go:350). NewPackage also asserted
      that a package name not be "_". While it is invalid for a package name
      to be "_", one could conceivably create a package named "_" through
      export data manipulation. Furthermore, it is ok to import a package
      with package path "_" as long as the package itself is not named "_".
      
      - removed misleading documentation
      - removed unnecessary assertion
      - added safety checks when we actually do the import
      
      Fixes #20231.
      
      Change-Id: I1eb1ab7b5e3130283db715374770cf05d749d159
      Reviewed-on: https://go-review.googlesource.com/42852
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      2eeaba41
    • Robert Griesemer's avatar
      go/importer: report import path if package is not found · 0e751829
      Robert Griesemer authored
      Fixes #20230.
      
      Change-Id: I2e9b9e9d2540eb66c8411ac7910962933bc2c0e9
      Reviewed-on: https://go-review.googlesource.com/42870
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      0e751829
    • Josh Bleecher Snyder's avatar
      cmd/compile: add Func.SetNilCheckDisabled · 53e62aba
      Josh Bleecher Snyder authored
      Generated hash and eq routines don't need nil checks.
      Prior to this CL, this was accomplished by
      temporarily incrementing the global variable disable_checknil.
      However, that increment lasted only the lifetime of the
      call to funccompile. After CL 41503, funccompile may
      do nothing but enqueue the function for compilation,
      resulting in nil checks being generated.
      
      Fix this by adding an explicit flag to a function
      indicating whether nil checks should be disabled
      for that function.
      
      While we're here, allow concurrent compilation
      with the -w and -W flags, since that was needed
      to investigate this issue.
      
      Fixes #20242
      
      Change-Id: Ib9140c22c49e9a09e62fa3cf350f5d3eff18e2bd
      Reviewed-on: https://go-review.googlesource.com/42591
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMarvin Stenger <marvin.stenger94@gmail.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      53e62aba
    • Carlos Eduardo Seo's avatar
      cmd/internal/obj/ppc64, cmd/link/internal/ppc64: Change function alignment to 16 · 09b71d56
      Carlos Eduardo Seo authored
      The Power processor manual states that "Branches not from the last instruction
      of an aligned quadword and not to the first instruction of an aligned quadword
      cause inefficiencies in the IBuffer". This changes the function alignment from 8
      to 16 bytes to comply with that.
      
      Fixes #18963
      
      Change-Id: Ibce9bf8302110a86c6ab05948569af9ffdfcf4bb
      Reviewed-on: https://go-review.googlesource.com/36390
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      09b71d56
    • Samuel Tan's avatar
      html/template: allow safe usage of predefined escapers in pipelines · 3a2fee03
      Samuel Tan authored
      Allow the predefined escapers "html", "urlquery", and "js" to be used
      in pipelines when they have no potential to affect the correctness or
      safety of the escaped pipeline output. Specifically:
      - "urlquery" may be used if it is the last command in the pipeline.
      - "html" may be used if it is the last command in the pipeline, and
        the pipeline does not occur in an unquoted HTML attribute value
        context.
      - "js" may be used in any pipeline, since it does not affect the
        merging of contextual escapers.
      
      This change will loosens the restrictions on predefined escapers
      introduced in golang.org/cl/37880, which will hopefully ease the
      upgrade path for existing template users.
      
      This change brings back the escaper-merging logic, and associated
      unit tests, that were removed in golang.org/cl/37880. However, a
      few notable changes have been made:
      - "_html_template_nospaceescaper" is no longer considered
        equivalent to "html", since the former escapes spaces, while
        the latter does not (see #19345). This change should not silently
        break any templates, since pipelines where this substituion will
        happen will already trigger an explicit error.
      - An "_eval_args_" internal directive has been added to
        handle pipelines containing a single explicit call to a
        predefined escaper, e.g. {{html .X}} (see #19353).
      
      Also, the HTMLEscape function called by the predefined
      text/template "html" function now escapes the NULL character as
      well. This effectively makes it as secure as the internal
      html/template HTML escapers (see #19345). While this change is
      backward-incompatible, it will only affect illegitimate uses
      of this escaper, since the NULL character is always illegal in
      valid HTML.
      
      Fixes #19952
      
      Change-Id: I9b5570a80a3ea284b53901e6a1f842fc59b33d3a
      Reviewed-on: https://go-review.googlesource.com/40936Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3a2fee03
    • Dieter Plaetinck's avatar
      template: warn about interleaved nature of writes · 1acff5fe
      Dieter Plaetinck authored
      Execute incurs separate writes for each "step", e.g. each
      variable that needs to be printed, and the final newline.
      While it is correct to state that templates can be executed
      concurrently, there is a more subtle nuance that is easily missed:
      when writing to the same writer, the writes from concurrent execute
      calls can be interleaved, leading to unexpected output.
      
      Change-Id: I0abbd7960d8a8d15e109a8a3eeff3b43b852bbbf
      Reviewed-on: https://go-review.googlesource.com/37444Reviewed-by: default avatarRob Pike <r@golang.org>
      1acff5fe
    • David Crawshaw's avatar
      cmd/link: stop passing unused read_only_relocs · 27a10f7d
      David Crawshaw authored
      The external darwin linker has been printing:
      
      	ld: warning: -read_only_relocs cannot be used with x86_64
      
      for a long time. Now that it is printed by CL 33301, we may as
      well get rid of it.
      
      Fixes #20246
      
      Change-Id: I1147cf1ff197fdfda228a1349f13627bcf9fc72f
      Reviewed-on: https://go-review.googlesource.com/42730
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarTodd Neal <todd@tneal.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      27a10f7d
    • Alex Brainman's avatar
      cmd/link: do not read .bss sections in ldpe · 507f4d5f
      Alex Brainman authored
      For .bss section symbol ldelf does not set P (raw symbol data).
      Make ldpe do the same.
      
      Change-Id: Ib3d558456f505ee568d0972465fa9b08b5794a87
      Reviewed-on: https://go-review.googlesource.com/42631Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      507f4d5f
  4. 04 May, 2017 10 commits
  5. 03 May, 2017 8 commits
  6. 02 May, 2017 8 commits
    • Filip Gruszczynski's avatar
      runtime: don't panic for bad size hint in hashmap · f9531448
      Filip Gruszczynski authored
      Because the hint parameter is supposed to be treated
      purely as a hint, if it doesn't meet the requirements
      we disregard it and continue as if there was no hint
      at all.
      
      Fixes #19926
      
      Change-Id: I86e7f99472fad6b99ba4e2fd33e4a9e55d55115e
      Reviewed-on: https://go-review.googlesource.com/40854
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f9531448
    • Alberto Donizetti's avatar
      doc/contribute: directly link to the Agreements page · 9f6fde3a
      Alberto Donizetti authored
      There's no Settings->Agreement path for PolyGerrit users, but if we
      link directly to the page in the instructions, Gerrit will inform them
      that they can access the page by switching to the old UI.
      
      Fixes #20207
      
      Change-Id: I0887ee854e4ac5975b5f305adb6259b81b41618f
      Reviewed-on: https://go-review.googlesource.com/42412Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9f6fde3a
    • Brad Fitzpatrick's avatar
      api: update next.txt · b2c60b2b
      Brad Fitzpatrick authored
      Change-Id: Ifbfd71a9c0d447e22c369c9d1209063b2a5c657b
      Reviewed-on: https://go-review.googlesource.com/42490
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b2c60b2b
    • Michael Munday's avatar
      cmd/{asm,compile}: avoid zeroAuto clobbering flags on s390x · 35cf3843
      Michael Munday authored
      This CL modifies how MOV[DWHB] instructions that store a constant to
      memory are assembled to avoid them clobbering the condition code
      (flags). It also modifies zeroAuto to use MOVD instructions instead of
      CLEAR (which is assembled as XC).
      
      MOV[DWHB]storeconst ops also no longer clobbers flags.
      
      Note: this CL modifies the assembler so that it can no longer handle
      immediates outside the range of an int16 or offsets from SB, which
      reflects what the machine instructions support. The compiler doesn't
      need this capability any more and I don't think this affects any existing
      assembly, but it is easy to workaround if it does.
      
      Fixes #20187.
      
      Change-Id: Ie54947ff38367bd6a19962bf1a6d0296a4accffb
      Reviewed-on: https://go-review.googlesource.com/42179Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      35cf3843
    • Bryan C. Mills's avatar
      expvar: reduce sync.Map overhead for (*Map).Set · e9702c0c
      Bryan C. Mills authored
      Use Load instead of LoadOrStore in the fast path to save 1 alloc/op
      for existing keys.
      
      name                          old time/op    new time/op    delta
      IntAdd                          6.39ns ± 7%    6.97ns ±19%     ~     (p=0.105 n=8+8)
      IntAdd-6                        12.3ns ± 1%    12.2ns ± 1%     ~     (p=0.396 n=7+7)
      IntSet                          6.41ns ± 6%    6.94ns ±21%     ~     (p=0.168 n=8+8)
      IntSet-6                        12.1ns ± 3%    11.7ns ± 9%     ~     (p=0.496 n=7+8)
      FloatAdd                        14.3ns ± 9%    14.7ns ± 4%     ~     (p=0.088 n=8+8)
      FloatAdd-6                      36.5ns ± 1%    36.6ns ± 0%     ~     (p=0.709 n=7+6)
      FloatSet                        6.59ns ± 7%    6.47ns ± 7%     ~     (p=0.397 n=8+7)
      FloatSet-6                      12.2ns ± 1%    12.2ns ± 2%     ~     (p=0.748 n=7+7)
      StringSet                       67.8ns ± 6%    68.7ns ± 6%     ~     (p=0.342 n=8+8)
      StringSet-6                     41.8ns ± 5%    41.7ns ± 5%     ~     (p=0.979 n=8+8)
      MapSet                           294ns ± 6%     234ns ± 4%  -20.35%  (p=0.000 n=8+8)
      MapSet-6                        95.8ns ± 2%    89.4ns ± 3%   -6.73%  (p=0.000 n=8+8)
      MapSetDifferent                 1.31µs ± 5%    1.07µs ± 4%  -18.21%  (p=0.000 n=8+8)
      MapSetDifferent-6                260ns ± 8%     210ns ± 9%  -19.44%  (p=0.000 n=8+8)
      MapSetString                     294ns ± 6%     236ns ± 4%  -19.92%  (p=0.000 n=8+8)
      MapSetString-6                  95.6ns ± 2%    89.9ns ± 2%   -5.97%  (p=0.000 n=7+8)
      MapAddSame                      1.46µs ± 3%    1.46µs ± 5%     ~     (p=0.721 n=8+8)
      MapAddSame-6                     328ns ± 6%     330ns ± 4%     ~     (p=0.776 n=8+8)
      MapAddDifferent                 4.89µs ± 7%    4.98µs ± 6%     ~     (p=0.505 n=8+8)
      MapAddDifferent-6               1.02µs ± 3%    1.01µs ± 4%     ~     (p=0.352 n=7+8)
      MapAddSameSteadyState           62.1ns ± 7%    60.8ns ± 4%     ~     (p=0.521 n=8+8)
      MapAddSameSteadyState-6         38.1ns ± 3%    37.7ns ± 0%     ~     (p=0.185 n=7+6)
      MapAddDifferentSteadyState       290ns ± 5%     293ns ± 4%     ~     (p=0.515 n=8+8)
      MapAddDifferentSteadyState-6    63.0ns ± 7%    63.7ns ±11%     ~     (p=0.482 n=7+8)
      RealworldExpvarUsage            7.39µs ± 5%    7.51µs ± 5%     ~     (p=0.382 n=8+8)
      RealworldExpvarUsage-6          3.07µs ±28%    3.04µs ±43%     ~     (p=0.798 n=8+8)
      
      name                          old alloc/op   new alloc/op   delta
      IntAdd                           0.00B          0.00B          ~     (all equal)
      IntAdd-6                         0.00B          0.00B          ~     (all equal)
      IntSet                           0.00B          0.00B          ~     (all equal)
      IntSet-6                         0.00B          0.00B          ~     (all equal)
      FloatAdd                         0.00B          0.00B          ~     (all equal)
      FloatAdd-6                       0.00B          0.00B          ~     (all equal)
      FloatSet                         0.00B          0.00B          ~     (all equal)
      FloatSet-6                       0.00B          0.00B          ~     (all equal)
      StringSet                        16.0B ± 0%     16.0B ± 0%     ~     (all equal)
      StringSet-6                      16.0B ± 0%     16.0B ± 0%     ~     (all equal)
      MapSet                           48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSet-6                         48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent                   192B ± 0%      128B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent-6                 192B ± 0%      128B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString                     48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString-6                   48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapAddSame                        480B ± 0%      480B ± 0%     ~     (all equal)
      MapAddSame-6                      480B ± 0%      480B ± 0%     ~     (all equal)
      MapAddDifferent                 1.09kB ± 0%    1.09kB ± 0%     ~     (all equal)
      MapAddDifferent-6               1.09kB ± 0%    1.09kB ± 0%     ~     (all equal)
      MapAddSameSteadyState            0.00B          0.00B          ~     (all equal)
      MapAddSameSteadyState-6          0.00B          0.00B          ~     (all equal)
      MapAddDifferentSteadyState       0.00B          0.00B          ~     (all equal)
      MapAddDifferentSteadyState-6     0.00B          0.00B          ~     (all equal)
      RealworldExpvarUsage             0.00B          0.00B          ~     (all equal)
      RealworldExpvarUsage-6           0.00B          0.00B          ~     (all equal)
      
      name                          old allocs/op  new allocs/op  delta
      IntAdd                            0.00           0.00          ~     (all equal)
      IntAdd-6                          0.00           0.00          ~     (all equal)
      IntSet                            0.00           0.00          ~     (all equal)
      IntSet-6                          0.00           0.00          ~     (all equal)
      FloatAdd                          0.00           0.00          ~     (all equal)
      FloatAdd-6                        0.00           0.00          ~     (all equal)
      FloatSet                          0.00           0.00          ~     (all equal)
      FloatSet-6                        0.00           0.00          ~     (all equal)
      StringSet                         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      StringSet-6                       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      MapSet                            3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSet-6                          3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent                   12.0 ± 0%       8.0 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent-6                 12.0 ± 0%       8.0 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString                      3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString-6                    3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapAddSame                        11.0 ± 0%      11.0 ± 0%     ~     (all equal)
      MapAddSame-6                      11.0 ± 0%      11.0 ± 0%     ~     (all equal)
      MapAddDifferent                   31.0 ± 0%      31.0 ± 0%     ~     (all equal)
      MapAddDifferent-6                 31.0 ± 0%      31.0 ± 0%     ~     (all equal)
      MapAddSameSteadyState             0.00           0.00          ~     (all equal)
      MapAddSameSteadyState-6           0.00           0.00          ~     (all equal)
      MapAddDifferentSteadyState        0.00           0.00          ~     (all equal)
      MapAddDifferentSteadyState-6      0.00           0.00          ~     (all equal)
      RealworldExpvarUsage              0.00           0.00          ~     (all equal)
      RealworldExpvarUsage-6            0.00           0.00          ~     (all equal)
      
      https://perf.golang.org/search?q=upload:20170501.1
      
      Change-Id: I28fc3906473f2b7307f6d1ae05a8d9b01ef8a6f8
      Reviewed-on: https://go-review.googlesource.com/42211
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e9702c0c
    • Chris Manghane's avatar
      net/http: bgErr is unused; remove it · 48def43f
      Chris Manghane authored
      Fixes #20196.
      
      Change-Id: Ib87f6e9e27a38f21f860b7150c818d77be653dd3
      Reviewed-on: https://go-review.googlesource.com/42370Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      48def43f
    • Josh Bleecher Snyder's avatar
      cmd/dist: spin up fewer test dir runners · a93e9f0f
      Josh Bleecher Snyder authored
      5 shards, each of which spins up NumCPU processes,
      each of which is running at GOMAXPROCS=NumCPU,
      is too much for one machine. It makes my laptop unusable.
      
      It might also be in part responsible for test flakes
      that require a moderately responsive system,
      like #18589 (backedge scheduling) and #19276 (locklinear).
      
      It's possible that Go should be a better neighbor in general;
      that's #17969. In the meantime, fix this corner of the world.
      
      Builders snapshot the world and run shards on different
      machines, so keeping sharding high for them is good.
      
      This is a partial reversion of CL 18199.
      
      Fixes #20141.
      
      Change-Id: I123cf9436f4f4da3550372896265c38117b78071
      Reviewed-on: https://go-review.googlesource.com/42431Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      a93e9f0f
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: fix LSym.Type during compilation, not linking · 18fb670e
      Josh Bleecher Snyder authored
      Prior to this CL, the compiler and assembler
      were sloppy about the LSym.Type for LSyms
      containing static data.
      
      The linker then fixed this up, converting
      Sxxx and SBSS to SDATA, and SNOPTRBSS to SNOPTRDATA
      if it noticed that the symbol had associated data.
      
      It is preferable to just get this right in cmd/compile
      and cmd/asm, because it removes an unnecessary traversal
      of the symbol table from the linker (see #14624).
      Do this by touching up the LSym.Type fixes in
      LSym.prepwrite and Link.Globl.
      
      I have confirmed by instrumenting the linker
      that the now-eliminated code paths were unreached.
      And an additional check in the object file writing code
      will help preserve that invariant.
      
      There was a case in the Windows linker,
      with internal linking and cgo,
      where we were generating SNOPTRBSS symbols with data.
      For now, convert those at the site at which they occur
      into SNOPTRDATA, just like they were.
      
      Does not pass toolstash-check,
      but does generate identical linked binaries.
      
      No compiler performance changes.
      
      Change-Id: I77b071ab103685ff8e042cee9abb864385488872
      Reviewed-on: https://go-review.googlesource.com/40864
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      18fb670e
  7. 01 May, 2017 2 commits
    • Elias Naur's avatar
      misc/android: don't let the Android exec wrapper hang indefinitely · 00f82778
      Elias Naur authored
      On Android, the exec wrapper passes on output from adb to its parent
      process by passing on os.Stderr and os.Stdout to adb. If the adb
      process somehow hangs, it will keep stderr and stdout will open, in turn
      blocking go test from ever returning from its cmd.Wait() even though
      it has killed the exec wrapper process.
      
      Break the short circuit by introducing a wrapper between adb and the
      exec wrapper, preventing os/exec.Run from passing along the raw
      file descriptors for os.Stdout and os.Stderr.
      
      (Hopefully) fixes occasional indefinite hangs on the Android builder.
      
      Change-Id: I1188211fbde79b4a66bf93ff8e9d0091abf34560
      Reviewed-on: https://go-review.googlesource.com/42271
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      00f82778
    • Martin Möhrmann's avatar
      cmd/compile: use MOVL instead of MOVQ for small constants on amd64 · f9bec9eb
      Martin Möhrmann authored
      The encoding of MOVL to a register is 2 bytes shorter than for MOVQ.
      The upper 32bit are automatically zeroed when MOVL to a register is used.
      
      Replaces 1657 MOVQ by MOVL in the go binary.
      Reduces go binary size by 4 kilobyte.
      
      name                   old time/op    new time/op    delta
      BinaryTree17              1.93s ± 0%     1.93s ± 0%  -0.32%  (p=0.000 n=9+9)
      Fannkuch11                2.66s ± 0%     2.48s ± 0%  -6.60%  (p=0.000 n=9+9)
      FmtFprintfEmpty          31.8ns ± 0%    31.6ns ± 0%  -0.63%  (p=0.000 n=10+10)
      FmtFprintfString         52.0ns ± 0%    51.9ns ± 0%  -0.19%  (p=0.000 n=10+10)
      FmtFprintfInt            55.6ns ± 0%    54.6ns ± 0%  -1.80%  (p=0.002 n=8+10)
      FmtFprintfIntInt         87.7ns ± 0%    84.8ns ± 0%  -3.31%  (p=0.000 n=9+9)
      FmtFprintfPrefixedInt    98.9ns ± 0%   102.0ns ± 0%  +3.10%  (p=0.000 n=10+10)
      FmtFprintfFloat           165ns ± 0%     164ns ± 0%  -0.61%  (p=0.000 n=10+10)
      FmtManyArgs               368ns ± 0%     361ns ± 0%  -1.98%  (p=0.000 n=8+10)
      GobDecode                4.53ms ± 0%    4.58ms ± 0%  +1.08%  (p=0.000 n=9+10)
      GobEncode                3.74ms ± 0%    3.73ms ± 0%  -0.27%  (p=0.000 n=10+10)
      Gzip                      164ms ± 0%     163ms ± 0%  -0.48%  (p=0.000 n=10+10)
      Gunzip                   26.7ms ± 0%    26.6ms ± 0%  -0.13%  (p=0.000 n=9+10)
      HTTPClientServer         30.4µs ± 1%    30.3µs ± 1%  -0.41%  (p=0.016 n=10+10)
      JSONEncode               10.9ms ± 0%    11.0ms ± 0%  +0.70%  (p=0.000 n=10+10)
      JSONDecode               36.8ms ± 0%    37.0ms ± 0%  +0.59%  (p=0.000 n=9+10)
      Mandelbrot200            3.20ms ± 0%    3.21ms ± 0%  +0.44%  (p=0.000 n=9+10)
      GoParse                  2.35ms ± 0%    2.35ms ± 0%  +0.26%  (p=0.000 n=10+9)
      RegexpMatchEasy0_32      58.3ns ± 0%    58.4ns ± 0%  +0.17%  (p=0.000 n=10+10)
      RegexpMatchEasy0_1K       138ns ± 0%     142ns ± 0%  +2.68%  (p=0.000 n=10+10)
      RegexpMatchEasy1_32      55.1ns ± 0%    55.6ns ± 1%    ~     (p=0.104 n=10+10)
      RegexpMatchEasy1_1K       242ns ± 0%     243ns ± 0%  +0.41%  (p=0.000 n=10+10)
      RegexpMatchMedium_32     87.4ns ± 0%    89.9ns ± 0%  +2.86%  (p=0.000 n=10+10)
      RegexpMatchMedium_1K     27.4µs ± 0%    27.4µs ± 0%  +0.15%  (p=0.000 n=10+10)
      RegexpMatchHard_32       1.30µs ± 0%    1.32µs ± 1%  +1.91%  (p=0.000 n=10+10)
      RegexpMatchHard_1K       39.0µs ± 0%    39.5µs ± 0%  +1.38%  (p=0.000 n=10+10)
      Revcomp                   316ms ± 0%     319ms ± 0%  +1.13%  (p=0.000 n=9+8)
      Template                 40.6ms ± 0%    40.6ms ± 0%    ~     (p=0.123 n=10+10)
      TimeParse                 224ns ± 0%     224ns ± 0%    ~     (all equal)
      TimeFormat                230ns ± 0%     225ns ± 0%  -2.17%  (p=0.000 n=10+10)
      
      Change-Id: I32a099b65f9e6d4ad7288ed48546655c534757d8
      Reviewed-on: https://go-review.googlesource.com/38630
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f9bec9eb