1. 11 Oct, 2018 3 commits
    • Rob Pike's avatar
      text/template: explain that integer constants can overflow · 9a9dc36f
      Rob Pike authored
      This behavior is the same as in Go: constants can be coerced to int
      and whether overflow occurs depends on how big an int is, but
      this surprises people sometimes, so document it again here.
      
      Fixes #25833.
      
      Change-Id: I557995f1a1e8e871b21004953923d16f36cb9037
      Reviewed-on: https://go-review.googlesource.com/c/141378Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9a9dc36f
    • Rob Pike's avatar
      unsafe: document that Alignof, Offsetof, and Sizeof return a constant · daf6f254
      Rob Pike authored
      Nothing is changing but the documentation, which did not mention
      this property of these functions.
      
      Fixes #27587.
      
      Change-Id: I75bcee4a1dd9ec8cd82826c9a6e02ba7d599f719
      Reviewed-on: https://go-review.googlesource.com/c/141377Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      daf6f254
    • Ben Shi's avatar
      cmd/compile: optimize 386's ADDLconstmodifyidx4 · 27965c14
      Ben Shi authored
      This CL optimize ADDLconstmodifyidx4 to INCL/DECL, when the
      constant is +1/-1.
      
      1. The total size of pkg/linux_386/ decreases 28 bytes, excluding
      cmd/compile.
      
      2. There is no regression in the go1 benchmark test, excluding noise.
      name                     old time/op    new time/op    delta
      BinaryTree17-4              3.25s ± 2%     3.23s ± 3%  -0.70%  (p=0.040 n=30+30)
      Fannkuch11-4                3.50s ± 1%     3.47s ± 1%  -0.68%  (p=0.000 n=30+30)
      FmtFprintfEmpty-4          44.6ns ± 3%    44.8ns ± 3%  +0.46%  (p=0.029 n=30+30)
      FmtFprintfString-4         79.0ns ± 3%    78.7ns ± 3%    ~     (p=0.053 n=30+30)
      FmtFprintfInt-4            89.2ns ± 2%    89.4ns ± 3%    ~     (p=0.665 n=30+29)
      FmtFprintfIntInt-4          142ns ± 3%     142ns ± 3%    ~     (p=0.435 n=30+30)
      FmtFprintfPrefixedInt-4     182ns ± 2%     182ns ± 2%    ~     (p=0.964 n=30+30)
      FmtFprintfFloat-4           407ns ± 3%     411ns ± 4%    ~     (p=0.080 n=30+30)
      FmtManyArgs-4               597ns ± 3%     593ns ± 4%    ~     (p=0.222 n=30+30)
      GobDecode-4                7.09ms ± 6%    7.07ms ± 7%    ~     (p=0.633 n=30+30)
      GobEncode-4                6.81ms ± 9%    6.81ms ± 8%    ~     (p=0.982 n=30+30)
      Gzip-4                      398ms ± 4%     400ms ± 6%    ~     (p=0.177 n=30+30)
      Gunzip-4                   41.3ms ± 3%    40.6ms ± 4%  -1.71%  (p=0.005 n=30+30)
      HTTPClientServer-4         63.4µs ± 3%    63.4µs ± 4%    ~     (p=0.646 n=30+28)
      JSONEncode-4               16.0ms ± 3%    16.1ms ± 3%    ~     (p=0.057 n=30+30)
      JSONDecode-4               63.3ms ± 8%    63.1ms ± 7%    ~     (p=0.786 n=30+30)
      Mandelbrot200-4            5.17ms ± 3%    5.15ms ± 8%    ~     (p=0.654 n=30+30)
      GoParse-4                  3.24ms ± 3%    3.23ms ± 2%    ~     (p=0.091 n=30+30)
      RegexpMatchEasy0_32-4       103ns ± 4%     103ns ± 4%    ~     (p=0.575 n=30+30)
      RegexpMatchEasy0_1K-4       823ns ± 2%     821ns ± 3%    ~     (p=0.827 n=30+30)
      RegexpMatchEasy1_32-4       113ns ± 3%     112ns ± 3%    ~     (p=0.076 n=30+30)
      RegexpMatchEasy1_1K-4      1.02µs ± 4%    1.01µs ± 5%    ~     (p=0.087 n=30+30)
      RegexpMatchMedium_32-4      129ns ± 3%     127ns ± 4%  -1.55%  (p=0.009 n=30+30)
      RegexpMatchMedium_1K-4     39.3µs ± 4%    39.7µs ± 3%    ~     (p=0.054 n=30+30)
      RegexpMatchHard_32-4       2.15µs ± 4%    2.15µs ± 4%    ~     (p=0.712 n=30+30)
      RegexpMatchHard_1K-4       66.0µs ± 3%    65.1µs ± 3%  -1.32%  (p=0.002 n=30+30)
      Revcomp-4                   1.85s ± 2%     1.85s ± 3%    ~     (p=0.168 n=30+30)
      Template-4                 69.5ms ± 7%    68.9ms ± 6%    ~     (p=0.250 n=28+28)
      TimeParse-4                 434ns ± 3%     432ns ± 4%    ~     (p=0.629 n=30+30)
      TimeFormat-4                403ns ± 4%     408ns ± 3%  +1.23%  (p=0.019 n=30+29)
      [Geo mean]                 65.5µs         65.3µs       -0.20%
      
      name                     old speed      new speed      delta
      GobDecode-4               108MB/s ± 6%   109MB/s ± 6%    ~     (p=0.636 n=30+30)
      GobEncode-4               113MB/s ±10%   113MB/s ± 9%    ~     (p=0.982 n=30+30)
      Gzip-4                   48.8MB/s ± 4%  48.6MB/s ± 5%    ~     (p=0.178 n=30+30)
      Gunzip-4                  470MB/s ± 3%   479MB/s ± 4%  +1.72%  (p=0.006 n=30+30)
      JSONEncode-4              121MB/s ± 3%   120MB/s ± 3%    ~     (p=0.057 n=30+30)
      JSONDecode-4             30.7MB/s ± 8%  30.8MB/s ± 8%    ~     (p=0.784 n=30+30)
      GoParse-4                17.9MB/s ± 3%  17.9MB/s ± 2%    ~     (p=0.090 n=30+30)
      RegexpMatchEasy0_32-4     309MB/s ± 4%   309MB/s ± 3%    ~     (p=0.530 n=30+30)
      RegexpMatchEasy0_1K-4    1.24GB/s ± 2%  1.25GB/s ± 3%    ~     (p=0.976 n=30+30)
      RegexpMatchEasy1_32-4     282MB/s ± 3%   284MB/s ± 3%  +0.81%  (p=0.041 n=30+30)
      RegexpMatchEasy1_1K-4    1.00GB/s ± 3%  1.01GB/s ± 4%    ~     (p=0.091 n=30+30)
      RegexpMatchMedium_32-4   7.71MB/s ± 3%  7.84MB/s ± 4%  +1.71%  (p=0.000 n=30+30)
      RegexpMatchMedium_1K-4   26.1MB/s ± 4%  25.8MB/s ± 3%    ~     (p=0.051 n=30+30)
      RegexpMatchHard_32-4     14.9MB/s ± 4%  14.9MB/s ± 4%    ~     (p=0.712 n=30+30)
      RegexpMatchHard_1K-4     15.5MB/s ± 3%  15.7MB/s ± 3%  +1.34%  (p=0.003 n=30+30)
      Revcomp-4                 138MB/s ± 2%   137MB/s ± 3%    ~     (p=0.174 n=30+30)
      Template-4               28.0MB/s ± 6%  28.2MB/s ± 6%    ~     (p=0.251 n=28+28)
      [Geo mean]               82.3MB/s       82.6MB/s       +0.36%
      
      Change-Id: I389829699ffe9500a013fcf31be58a97e98043e1
      Reviewed-on: https://go-review.googlesource.com/c/140701
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      27965c14
  2. 10 Oct, 2018 16 commits
    • Matthew Dempsky's avatar
      cmd/compile/internal/types: regen stringer file · 5b2030cb
      Matthew Dempsky authored
      Forgot to do this for golang.org/cl/76312.
      
      Change-Id: Ic20fef3eeff14a805f608221aff1fa03934be3ca
      Reviewed-on: https://go-review.googlesource.com/c/141357
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5b2030cb
    • Rob Pike's avatar
      cmd/doc: add a -src flag to show original source · 294d16c9
      Rob Pike authored
      It's long-desired but was blocked by #26835. That is now fixed, so
      it's easy. When -src is off, we behave as before. But with -src
      set, initialize the go/doc package to preserve the original AST and
      things flow very easily.
      
      With -src, since you're seeing inside the package source anyway it
      shows unexported fields and constants: you see the original source.
      But you still need -u to ask about them.
      
      Fixes #18807
      
      Change-Id: I473e90323b4eff0735360274dc0d2d9dba16ff8b
      Reviewed-on: https://go-review.googlesource.com/c/140959Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      Run-TryBot: Andrew Gerrand <adg@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      294d16c9
    • Rob Pike's avatar
      go/doc: add new mode bit PreserveAST to control clearing of data in AST · d5e72203
      Rob Pike authored
      To save memory in godoc, this package routinely clears fields of
      the AST to avoid keeping data that godoc no longer needs. For other
      programs, such as cmd/doc, this behavior is unfortunate. Also, one
      should be able to tell any package like this, "don't change my
      data".
      
      Add a Mode bit, defaulting to off to preserve existing behavior,
      that allows a client to specify that the AST is inviolate.
      
      This is necessary to address some of the outstanding issues
      in cmd/doc that require, for example, looking at function bodies.
      
      Fixes #26835
      
      Change-Id: I01cc97c6addc5ab6abff885fff4bd53454a03bbc
      Reviewed-on: https://go-review.googlesource.com/c/140958Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      d5e72203
    • Josh Bleecher Snyder's avatar
      cmd/compile: remove some inl budget hacks · 555d8c45
      Josh Bleecher Snyder authored
      Prior to stack tracing, inlining could cause
      dead pointers to be kept alive in some loops.
      See #18336 and CL 31674.
      
      The adjustment removed by this change preserved the inlining status quo
      in the face of Node structure changes, to avoid creating new problems.
      Now that stack tracing provides precision, these hacks can be removed.
      
      Of course, our inlining code model is already hacky (#17566),
      but at least now there will be fewer epicyclical hacks.
      
      Newly inline-able functions in std cmd as a result of this change:
      
      hash/adler32/adler32.go:65:6: can inline (*digest).UnmarshalBinary
      hash/fnv/fnv.go:281:6: can inline (*sum32).UnmarshalBinary
      hash/fnv/fnv.go:292:6: can inline (*sum32a).UnmarshalBinary
      reflect/value.go:1298:6: can inline Value.OverflowComplex
      compress/bzip2/bit_reader.go:25:6: can inline newBitReader
      encoding/xml/xml.go:365:6: can inline (*Decoder).switchToReader
      vendor/golang_org/x/crypto/cryptobyte/builder.go:77:6: can inline (*Builder).AddUint16
      crypto/x509/x509.go:1851:58: can inline buildExtensions.func2.1.1
      crypto/x509/x509.go:1871:58: can inline buildExtensions.func2.3.1
      crypto/x509/x509.go:1883:58: can inline buildExtensions.func2.4.1
      cmd/vet/internal/cfg/builder.go:463:6: can inline (*builder).labeledBlock
      crypto/tls/handshake_messages.go:1450:6: can inline (*newSessionTicketMsg).marshal
      crypto/tls/handshake_server.go:769:6: can inline (*serverHandshakeState).clientHelloInfo
      crypto/tls/handshake_messages.go:1171:6: can inline (*nextProtoMsg).unmarshal
      cmd/link/internal/amd64/obj.go:40:6: can inline Init
      cmd/link/internal/ppc64/obj.go:40:6: can inline Init
      net/http/httputil/persist.go:54:6: can inline NewServerConn
      net/http/fcgi/child.go:83:6: can inline newResponse
      cmd/compile/internal/ssa/poset.go:245:6: can inline (*poset).newnode
      
      Change-Id: I19e8e383a6273849673d35189a9358870665f82f
      Reviewed-on: https://go-review.googlesource.com/c/141117
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIlya Tocar <ilya.tocar@intel.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      555d8c45
    • Tobias Klauser's avatar
      syscall: add marker comments to zsyscall_{aix,solaris}_*.go · fa0c15ea
      Tobias Klauser authored
      These marker comments are in every other zsyscall_*.go file generated by
      mksyscall.pl. Also add them to the files generated by mksyscall_libc.pl
      used for aix and solaris.
      
      Change-Id: I7fd125df3549d83c658bbe7424861c76c024f2e5
      Reviewed-on: https://go-review.googlesource.com/c/141037
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      fa0c15ea
    • Clément Chigot's avatar
      net: add AIX operating system · 9ff11b02
      Clément Chigot authored
      This commit adds AIX operating system to net package for ppc64
      architecture.
      
      Updates: #25893
      
      Change-Id: I46bbc7b03931019beb969443cb3f9a756956c66c
      Reviewed-on: https://go-review.googlesource.com/c/138724
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      9ff11b02
    • Keith Randall's avatar
      cmd/compile: make []byte("...") more efficient · ceb0c371
      Keith Randall authored
      Do []byte(string) conversions more efficiently when the string
      is a constant. Instead of calling stringtobyteslice, allocate
      just the space we need and encode the initialization directly.
      
      []byte("foo") rewrites to the following pseudocode:
      
      var s [3]byte // on heap or stack, depending on whether b escapes
      s = *(*[3]byte)(&"foo"[0]) // initialize s from the string
      b = s[:]
      
      which generates this assembly:
      
      	0x001d 00029 (tmp1.go:9)	LEAQ	type.[3]uint8(SB), AX
      	0x0024 00036 (tmp1.go:9)	MOVQ	AX, (SP)
      	0x0028 00040 (tmp1.go:9)	CALL	runtime.newobject(SB)
      	0x002d 00045 (tmp1.go:9)	MOVQ	8(SP), AX
      	0x0032 00050 (tmp1.go:9)	MOVBLZX	go.string."foo"+2(SB), CX
      	0x0039 00057 (tmp1.go:9)	MOVWLZX	go.string."foo"(SB), DX
      	0x0040 00064 (tmp1.go:9)	MOVW	DX, (AX)
      	0x0043 00067 (tmp1.go:9)	MOVB	CL, 2(AX)
      // Then the slice is b = {AX, 3, 3}
      
      The generated code is still not optimal, as it still does load/store
      from read-only memory instead of constant stores.  Next CL...
      
      Update #26498
      Fixes #10170
      
      Change-Id: I4b990b19f9a308f60c8f4f148934acffefe0a5bd
      Reviewed-on: https://go-review.googlesource.com/c/140698
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      ceb0c371
    • Clément Chigot's avatar
      mime: add AIX operating system · 05581fcc
      Clément Chigot authored
      This commit adds AIX operating system to mime package for ppc64
      architecture.
      
      Updates: #25893
      
      Change-Id: I1b81a9204446c8c76ae24ea5c6fd33077c373ae4
      Reviewed-on: https://go-review.googlesource.com/c/138723
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      05581fcc
    • Clément Chigot's avatar
      crypto: add AIX operating system · 29907b13
      Clément Chigot authored
      This commit adds AIX operating system to crypto package for ppc64
      architecture.
      
      Updates: #25893
      
      Change-Id: I20047ff2fef0051b8b235ec15b064c4a95c2b9c3
      Reviewed-on: https://go-review.googlesource.com/c/138722
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      29907b13
    • Clément Chigot's avatar
      time: add AIX operating system · 1c88ce5f
      Clément Chigot authored
      This commit adds AIX operating system to time package for ppc64
      architecture.
      
      Updates: #25893
      
      Change-Id: I4fb6fb47eae7671bf4e22729d6d160f557083c44
      Reviewed-on: https://go-review.googlesource.com/c/138721
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      1c88ce5f
    • Lynn Boger's avatar
      cmd/internal/obj/ppc64: generate float 0 more efficiently on ppc64x · f776d51b
      Lynn Boger authored
      This change makes use of a VSX instruction to generate the
      float 0 value instead of generating a constant in memory and
      loading it from there.
      
      This uses 1 instruction instead of 2 and avoids a memory reference.
      in the +0 case, uses 2 instructions in the -0 case but avoids
      the memory reference.
      
      Since this is done in the assembler for ppc64x, an update has
      been made to the assembler test.
      
      Change-Id: Ief7dddcb057bfb602f78215f6947664e8c841464
      Reviewed-on: https://go-review.googlesource.com/c/139420Reviewed-by: default avatarMichael Munday <mike.munday@ibm.com>
      f776d51b
    • Clément Chigot's avatar
      syscall: add AIX operating system · 8f9902da
      Clément Chigot authored
      This commit adds AIX operating system to syscall package for ppc64
      architecture.
      It also adds the file syscall_aix.go in the runtime package for
      syscalls needed during fork and exec.
      
      Updates: #25893
      
      Change-Id: I301b1051b178a3efb7bbc39cdbd8e00b594d65ef
      Reviewed-on: https://go-review.googlesource.com/c/138720
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      8f9902da
    • Brad Fitzpatrick's avatar
      net/http/httputil: fix race/crash in previous ReverseProxy change · c870d56f
      Brad Fitzpatrick authored
      The previous ReverseProxy change, CL 137335, introduced a bug which could cause
      a race and/or a crash.
      
      This reliably crashed before:
      
      $ go test -short -race -v -run=TestReverseProxyFlushInterval -count=20 net/http/httputil
      
      The problem was a goroutine was running http.ResponseWriter.Flush
      after the http.Handler's ServeHTTP completed. There was code to
      prevent that (a deferred stop call) but the stop call didn't consider
      the case where time.AfterFunc had already fired off a new goroutine
      but that goroutine hadn't yet scheduled.
      
      Change-Id: I06357908465a3b953efc33e63c70dec19a501adf
      Reviewed-on: https://go-review.googlesource.com/c/140977
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
      c870d56f
    • Wil Selwood's avatar
      testing: try to Log through parent if test has completed · 95d06ab6
      Wil Selwood authored
      If the test has already completed when a go routine with a panic
      handler reports an error the location of the error call is lost.
      
      Added logDepth to be able to log location of failure at different
      depths down the stack.
      
      Fixes #26720
      
      Change-Id: I8b7789ddae757ef6f4bd315cb20356709f4fadec
      Reviewed-on: https://go-review.googlesource.com/c/127596
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      95d06ab6
    • Clément Chigot's avatar
      syscall: change solaris files to libc files · 49be65ee
      Clément Chigot authored
      AIX and Solaris both requires libc to make any syscalls and their
      implementation is really similar.
      Therefore, Solaris files reused by AIX have their name changed to *_libc.
      
      exec_libc.go is also adapted to AIX.
      
      Updates: #25893
      
      Change-Id: I50d1d7b964831637013d5e64799187cd9565c42b
      Reviewed-on: https://go-review.googlesource.com/c/138719
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      49be65ee
    • Muhammad Falak R Wani's avatar
      runtime/cgo: annotate unused variable with __attribute__((unused)) · dc2ae288
      Muhammad Falak R Wani authored
      Fixes #28095
      
      Change-Id: Id8668d52986c9805213e8847f49fe42dfde2e01a
      Reviewed-on: https://go-review.googlesource.com/c/140797
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      dc2ae288
  3. 09 Oct, 2018 16 commits
    • Bryan C. Mills's avatar
      cmd/go: remove extraneous 'file' from usage message in script_test · 45e66887
      Bryan C. Mills authored
      Previously, erroneous usage would produce error messages like:
      
      	FAIL: testdata/script/mod_tidy_replace.txt:4: usage: stdout [-count=N] 'pattern' file
      
      where the “file” argument is not actually valid for the stdout command.
      
      Change-Id: I74100960f4d25da122faa6c82620995a3fbfc75f
      Reviewed-on: https://go-review.googlesource.com/c/140858
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      45e66887
    • Bryan C. Mills's avatar
      cmd/go: check that package paths are invariantly non-empty · 6c85693b
      Bryan C. Mills authored
      The empty string is never a valid package path.
      Passing an empty string to a function that expects a package path
      indicates some missing validation step further up the call chain —
      typically (and most easily) a missed error check.
      
      Change-Id: I78a2403d95b473bacb0d40814cd9d477ecfd5351
      Reviewed-on: https://go-review.googlesource.com/c/140857
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      6c85693b
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: major evconst cleanup · 48dc42b6
      Matthew Dempsky authored
      Major cleanup to structure the code more similarly to go/constant.
      
      Passes "toolstash -cmp" on std cmd.
      
      Change-Id: I3ec7a7a24e313f119b0da4095001aad02e317894
      Reviewed-on: https://go-review.googlesource.com/c/139901
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      48dc42b6
    • Muhammad Falak R Wani's avatar
      go/doc: skip examples with no body · d30d5a6b
      Muhammad Falak R Wani authored
      Fixes #28044
      
      Change-Id: I0052e078dd34dc3546204416bcc5a99e3146c535
      Reviewed-on: https://go-review.googlesource.com/c/140317
      Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      d30d5a6b
    • Austin Clements's avatar
      runtime: rename gosweepdone to isSweepDone and document better · 007e8a2f
      Austin Clements authored
      gosweepdone is another anachronism from the time when the sweeper was
      implemented in C. Rename it to "isSweepDone" for the modern era.
      
      Change-Id: I8472aa6f52478459c3f2edc8a4b2761e73c4c2dd
      Reviewed-on: https://go-review.googlesource.com/c/138658
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      007e8a2f
    • Austin Clements's avatar
      runtime: eliminate gosweepone · f3bb4cbf
      Austin Clements authored
      gosweepone just switches to the system stack and calls sweepone.
      sweepone doesn't need to run on the system stack, so this is pretty
      pointless.
      
      Historically, this was necessary because the sweeper was written in C
      and hence needed to run on the system stack. gosweepone was the
      function that Go code (specifically, bgsweep) used to call into the C
      sweeper implementation. This probably became unnecessary in 2014 with
      CL golang.org/cl/167540043, which ported the sweeper to Go.
      
      This CL changes all callers of gosweepone to call sweepone and
      eliminates gosweepone.
      
      Change-Id: I26b8ef0c7d060b4c0c5dedbb25ecfc936acc7269
      Reviewed-on: https://go-review.googlesource.com/c/138657
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f3bb4cbf
    • Austin Clements's avatar
      runtime: simplify free count calculation in (un)cacheSpan · 416804f3
      Austin Clements authored
      For unclear reasons, cacheSpan and uncacheSpan compute the number of
      elements in a span by dividing its size by the element size. This
      number is simply available in the mspan structure, so just use it.
      
      Change-Id: If2e5de6ecec39befd3324bf1da4a275ad000932f
      Reviewed-on: https://go-review.googlesource.com/c/138656
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      416804f3
    • Austin Clements's avatar
      runtime: avoid tracking spans with no objects with mcentral · 70d7e96c
      Austin Clements authored
      Lazy mcache flushing (golang.org/cl/134783) made it so that moving a
      span from an mcache to an mcentral was sometimes responsible for
      sweeping the span. However, it did a "preserving" sweep, which meant
      it retained ownership, even if the sweeper swept all objects in the
      span. As a result, we could put a completely unused span back in the
      mcentral.
      
      Fix this by first taking back ownership of the span into the mcentral
      and moving it to the right mcentral list, and then doing a
      non-preserving sweep. The non-preserving sweep will move the span to
      the heap if it sweeps all objects.
      
      Change-Id: I244b1893b44b8c00264f0928ac9239449775f617
      Reviewed-on: https://go-review.googlesource.com/c/140597
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMichael Knyszek <mknyszek@google.com>
      70d7e96c
    • Austin Clements's avatar
      runtime: fix non-in-use span check · 7d2f46da
      Austin Clements authored
      Lazy mcache flushing (golang.org/cl/134783) introduced a second value
      for sweepgen that indicates a span has been swept. I missed adding
      this case to a sanity check in sweepone, so it can now panic if it
      finds a non-in-use spans that's been swept *and* put in an mcache.
      
      Fix this by adding the second sweepgen case to this check.
      
      Fixes #27997.
      
      Change-Id: I568d9f2cc8923396ca897a37d154cd2c859c7bef
      Reviewed-on: https://go-review.googlesource.com/c/140697
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7d2f46da
    • Austin Clements's avatar
      runtime: undo manual inlining of mbits.setMarked · 1d09433e
      Austin Clements authored
      Since atomic.Or8 is now an intrinsic (and has been for some time),
      markBits.setMarked is inlinable. Undo the manual inlining of it.
      
      Change-Id: I8e37ccf0851ad1d3088d9c8ae0f6f0c439d7eb2d
      Reviewed-on: https://go-review.googlesource.com/c/138659
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      1d09433e
    • Austin Clements's avatar
      runtime: tidy mheap.freeSpan · 3f86d7cc
      Austin Clements authored
      freeSpan currently takes a mysterious "acct int32" argument. This is
      really just a boolean and actually just needs to match the "large"
      argument to alloc in order to balance out accounting.
      
      To make this clearer, replace acct with a "large bool" argument that
      must match the call to mheap.alloc.
      
      Change-Id: Ibc81faefdf9f0583114e1953fcfb362e9c3c76de
      Reviewed-on: https://go-review.googlesource.com/c/138655
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      3f86d7cc
    • Brad Fitzpatrick's avatar
      net/http/httputil: rewrite flushing code, disable on Server-Sent Events · 5440bfc2
      Brad Fitzpatrick authored
      * Rewrite the flushing code to not use a persistent goroutine, which
        also simplifies testing.
      * Define the meaning of a negative flush interval. Its meaning doesn't
        change, but now it's locked in, and then we can use it to optimize
        the performance of the non-buffered case to avoid use of an AfterFunc.
      * Support (internal-only) special casing of FlushInterval values per
        request/response.
      * For now, treat Server-Sent Event responses as unbuffered. (or rather,
        immediately flushed from the buffer per-write)
      
      Fixes #27816
      
      Change-Id: Ie0f975c997daa3db539504137c741a96d7022665
      Reviewed-on: https://go-review.googlesource.com/c/137335
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
      5440bfc2
    • Qais Patankar's avatar
      cmd/compile: fix Compiler Directives typo · ffc7bc55
      Qais Patankar authored
      Change-Id: I098b3c627c2142affd4e800a2c1f37e00f3775c5
      Reviewed-on: https://go-review.googlesource.com/c/140777Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      ffc7bc55
    • Marten Seemann's avatar
      crypto/tls: fix ServerHello SCT test · 465d1c61
      Marten Seemann authored
      According to https://tools.ietf.org/html/rfc6962#section-3.3, the SCT
      must be at least one byte long. The parsing code correctly checks for
      this condition, but rarely the test does generate an empty SCT.
      
      Change-Id: If36a34985b4470a5a9f96affc159195c04f6bfad
      Reviewed-on: https://go-review.googlesource.com/c/129755Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      465d1c61
    • Ben Shi's avatar
      cmd/compile: combine similar code in amd64's assembly generator · ccc337d8
      Ben Shi authored
      BSFQ/BSRQ/BSFL/BSRL/SQRTSD have similar logic in amd64's assembly
      generator. This CL combines them together while does not impact
      generated amd64 code. The total size of
      pkg/linux_amd64/cmd/compile/internal decreases about 1.8KB.
      
      Change-Id: I5f3210c5178c20ac9108877c69f17234baf5b6b7
      Reviewed-on: https://go-review.googlesource.com/c/140438
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      ccc337d8
    • Ben Shi's avatar
      cmd/compile: add indexed form for several 386 instructions · 39333025
      Ben Shi authored
      This CL implements indexed memory operands for the following instructions.
      (ADD|SUB|MUL|AND|OR|XOR)Lload -> (ADD|SUB|MUL|AND|OR|XOR)Lloadidx4
      (ADD|SUB|AND|OR|XOR)Lmodify -> (ADD|SUB|AND|OR|XOR)Lmodifyidx4
      (ADD|AND|OR|XOR)Lconstmodify -> (ADD|AND|OR|XOR)Lconstmodifyidx4
      
      1. The total size of pkg/linux_386/ decreases about 2.5KB, excluding
      cmd/compile/ .
      
      2. There is little regression in the go1 benchmark test, excluding noise.
      name                     old time/op    new time/op    delta
      BinaryTree17-4              3.25s ± 3%     3.25s ± 3%    ~     (p=0.218 n=40+40)
      Fannkuch11-4                3.53s ± 1%     3.53s ± 1%    ~     (p=0.303 n=40+40)
      FmtFprintfEmpty-4          44.9ns ± 3%    45.6ns ± 3%  +1.48%  (p=0.030 n=40+36)
      FmtFprintfString-4         78.7ns ± 5%    80.1ns ± 7%    ~     (p=0.217 n=36+40)
      FmtFprintfInt-4            90.2ns ± 6%    89.8ns ± 5%    ~     (p=0.659 n=40+38)
      FmtFprintfIntInt-4          140ns ± 5%     141ns ± 5%  +1.00%  (p=0.027 n=40+40)
      FmtFprintfPrefixedInt-4     185ns ± 3%     183ns ± 3%    ~     (p=0.104 n=40+40)
      FmtFprintfFloat-4           411ns ± 4%     406ns ± 3%  -1.37%  (p=0.005 n=40+40)
      FmtManyArgs-4               590ns ± 4%     598ns ± 4%  +1.35%  (p=0.008 n=40+40)
      GobDecode-4                7.16ms ± 5%    7.10ms ± 5%    ~     (p=0.335 n=40+40)
      GobEncode-4                6.85ms ± 7%    6.74ms ± 9%    ~     (p=0.058 n=38+40)
      Gzip-4                      400ms ± 4%     399ms ± 2%  -0.34%  (p=0.003 n=40+33)
      Gunzip-4                   41.4ms ± 3%    41.4ms ± 4%  -0.12%  (p=0.020 n=40+40)
      HTTPClientServer-4         64.1µs ± 4%    63.5µs ± 2%  -1.07%  (p=0.000 n=39+37)
      JSONEncode-4               15.9ms ± 2%    15.9ms ± 3%    ~     (p=0.103 n=40+40)
      JSONDecode-4               62.2ms ± 4%    61.6ms ± 3%  -0.98%  (p=0.006 n=39+40)
      Mandelbrot200-4            5.18ms ± 3%    5.14ms ± 4%    ~     (p=0.125 n=40+40)
      GoParse-4                  3.29ms ± 2%    3.27ms ± 2%  -0.66%  (p=0.006 n=40+40)
      RegexpMatchEasy0_32-4       103ns ± 4%     103ns ± 4%    ~     (p=0.632 n=40+40)
      RegexpMatchEasy0_1K-4       830ns ± 3%     828ns ± 3%    ~     (p=0.563 n=40+40)
      RegexpMatchEasy1_32-4       113ns ± 4%     113ns ± 4%    ~     (p=0.494 n=40+40)
      RegexpMatchEasy1_1K-4      1.03µs ± 4%    1.03µs ± 4%    ~     (p=0.665 n=40+40)
      RegexpMatchMedium_32-4      130ns ± 4%     129ns ± 3%    ~     (p=0.458 n=40+40)
      RegexpMatchMedium_1K-4     39.4µs ± 3%    39.7µs ± 3%    ~     (p=0.825 n=40+40)
      RegexpMatchHard_32-4       2.16µs ± 4%    2.15µs ± 4%    ~     (p=0.137 n=40+40)
      RegexpMatchHard_1K-4       65.2µs ± 3%    65.4µs ± 4%    ~     (p=0.160 n=40+40)
      Revcomp-4                   1.87s ± 2%     1.87s ± 1%  +0.17%  (p=0.019 n=33+33)
      Template-4                 69.4ms ± 3%    69.8ms ± 3%  +0.60%  (p=0.009 n=40+40)
      TimeParse-4                 437ns ± 4%     438ns ± 4%    ~     (p=0.234 n=40+40)
      TimeFormat-4                408ns ± 3%     408ns ± 3%    ~     (p=0.904 n=40+40)
      [Geo mean]                 65.7µs         65.6µs       -0.08%
      
      name                     old speed      new speed      delta
      GobDecode-4               107MB/s ± 5%   108MB/s ± 5%    ~     (p=0.336 n=40+40)
      GobEncode-4               112MB/s ± 6%   114MB/s ± 9%  +1.95%  (p=0.036 n=37+40)
      Gzip-4                   48.5MB/s ± 4%  48.6MB/s ± 2%  +0.28%  (p=0.003 n=40+33)
      Gunzip-4                  469MB/s ± 4%   469MB/s ± 4%  +0.11%  (p=0.021 n=40+40)
      JSONEncode-4              122MB/s ± 2%   122MB/s ± 3%    ~     (p=0.105 n=40+40)
      JSONDecode-4             31.2MB/s ± 4%  31.5MB/s ± 4%  +0.99%  (p=0.007 n=39+40)
      GoParse-4                17.6MB/s ± 2%  17.7MB/s ± 2%  +0.66%  (p=0.007 n=40+40)
      RegexpMatchEasy0_32-4     310MB/s ± 4%   310MB/s ± 4%    ~     (p=0.384 n=40+40)
      RegexpMatchEasy0_1K-4    1.23GB/s ± 3%  1.24GB/s ± 3%    ~     (p=0.186 n=40+40)
      RegexpMatchEasy1_32-4     283MB/s ± 3%   281MB/s ± 4%    ~     (p=0.855 n=40+40)
      RegexpMatchEasy1_1K-4    1.00GB/s ± 4%  1.00GB/s ± 4%    ~     (p=0.665 n=40+40)
      RegexpMatchMedium_32-4   7.68MB/s ± 4%  7.73MB/s ± 3%    ~     (p=0.359 n=40+40)
      RegexpMatchMedium_1K-4   26.0MB/s ± 3%  25.8MB/s ± 3%    ~     (p=0.825 n=40+40)
      RegexpMatchHard_32-4     14.8MB/s ± 3%  14.9MB/s ± 4%    ~     (p=0.136 n=40+40)
      RegexpMatchHard_1K-4     15.7MB/s ± 3%  15.7MB/s ± 4%    ~     (p=0.150 n=40+40)
      Revcomp-4                 136MB/s ± 1%   136MB/s ± 1%  -0.09%  (p=0.028 n=32+33)
      Template-4               28.0MB/s ± 3%  27.8MB/s ± 3%  -0.59%  (p=0.010 n=40+40)
      [Geo mean]               82.1MB/s       82.3MB/s       +0.25%
      
      Change-Id: Ifa387a251056678326d3508aa02753b70bf7e5d0
      Reviewed-on: https://go-review.googlesource.com/c/140303
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      39333025
  4. 08 Oct, 2018 5 commits