1. 16 Aug, 2016 6 commits
    • Robert Griesemer's avatar
      go/types: minor cleanups · 3dc082f8
      Robert Griesemer authored
      1) Removed mark field from declInfo struct. Instead use a visited map
         in ordering.go which was the only use place for the mark field.
      
      2) Introduced objSet type for the common map[Object]bool type.
      
      3) Improved comments.
      
      Change-Id: I7544e7458d844b0ca08193f11de6238d317eaf2d
      Reviewed-on: https://go-review.googlesource.com/24153Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      3dc082f8
    • Robert Griesemer's avatar
      go/types: fix computation of initialization order · 5c84441d
      Robert Griesemer authored
      The old algorithm operated on a dependency graph that included
      all objects (including functions) for simplicity: it was based
      directly on the dependencies collected for each object during
      type checking an object's initialization expression. It also
      used that graph to compute the objects involved in an erroneous
      initialization cycle.
      
      Cycles that consist only of (mutually recursive) functions are
      permitted in initialization code; so those cycles were silently
      ignored if encountered. However, such cycles still inflated the
      number of dependencies a variable might have (due to the cycle),
      which in some cases lead to the wrong variable being scheduled
      for initialization before the one with the inflated dependency
      count.
      
      Correcting for the cycle when it is found is too late since at
      that point another variable may have already been scheduled.
      
      The new algorithm computes the initialization dependency graph as
      before but adds an extra pass during which functions are eliminated
      from the graph (and their dependencies are "back-propagated").
      This eliminates the problem of cycles only involving functions
      (there are no functions).
      
      When a cycle is found, the new code computes the cycle path from
      the original object dependencies so it can still include functions
      on the path as before, for the same detailed error message.
      
      The new code also more clearly distinguishes between objects that
      can be in the dependency graph (constants, variables, functions),
      and objects that cannot, by introducing the dependency type, a new
      subtype of Object. As a consequence, the dependency graph is smaller.
      
      Fixes #10709.
      
      Change-Id: Ib58d6ea65cfb279041a0286a2c8e865f11d244eb
      Reviewed-on: https://go-review.googlesource.com/24131Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      5c84441d
    • Brad Fitzpatrick's avatar
      syscall: test Gettimeofday everywhere, not just on Darwin · 66da8855
      Brad Fitzpatrick authored
      The Darwin-only restriction was because we were late in the Go 1.7
      cycle when the test was added.
      
      In the process, I noticed Gettimeofday wasn't in the "unimplemented
      midden heap" section of syscall_nacl.go, despite this line in the
      original go1.txt:
      
      pkg syscall, func Gettimeofday(*Timeval) error
      
      So, add it, returning ENOSYS like the others.
      
      Change-Id: Id7e02e857b753f8d079bee335c22368734e92254
      Reviewed-on: https://go-review.googlesource.com/26772
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
      66da8855
    • Hiroshi Ioka's avatar
      os: consolidate files · 664c4a1f
      Hiroshi Ioka authored
      Code movement only.
      
      If someone finds function 'foo' in "foo_linux.go",
      they will expect that the Window version of 'foo' exists in "foo_windows.go".
      
      Current code doesn't follow this manner.
      
      For example, 'sameFile' exists in "file_unix.go",
      "stat_plan9.go" and "types_windows.go".
      
      The CL address that problem by following rules:
      
      * readdir family => dir.go, dir_$GOOS.go
      * stat family => stat.go, stat_$GOOS.go
      * path-functions => path_$GOOS.go
      * sameFile => types.go, types_$GOOS.go
      * process-functions => exec.go, exec_$GOOS.go
      * hostname => sys.go, sys_$GOOS.go
      
      Change-Id: Ic3c64663ce0b2a364d7a414351cd3c772e70187b
      Reviewed-on: https://go-review.googlesource.com/27035
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      664c4a1f
    • Gerrit Code Review's avatar
    • Keith Randall's avatar
      Merge remote-tracking branch 'origin/dev.ssa' into merge · 88c8b7c7
      Keith Randall authored
      Merging from dev.ssa back into master.
      
      Contains complete SSA backends for arm, arm64, 386, amd64p32.
      Work in progress for PPC64.
      
      Change-Id: Ifd7075e3ec6f88f776e29f8c7fd55830328897fd
      88c8b7c7
  2. 15 Aug, 2016 5 commits
  3. 11 Aug, 2016 3 commits
  4. 10 Aug, 2016 4 commits
    • Cherry Zhang's avatar
      [dev.ssa] cmd/internal/obj/arm64: fix encoding constant into some instructions · 748aa844
      Cherry Zhang authored
      When a constant can be encoded in a logical instruction (BITCON), do
      it this way instead of using the constant pool. The BITCON testing
      code runs faster than table lookup (using map):
      
      (on AMD64 machine, with pseudo random input)
      BenchmarkIsBitcon-4   	300000000	         4.04 ns/op
      BenchmarkTable-4      	50000000	        27.3 ns/op
      
      The equivalent C code of BITCON testing is formally verified with
      model checker CBMC against linear search of the lookup table.
      
      Also handle cases when a constant can be encoded in a MOV instruction.
      In this case, materializa the constant into REGTMP without using the
      constant pool.
      
      When constants need to be added to the constant pool, make sure to
      check whether it fits in 32-bit. If not, store 64-bit.
      
      Both legacy and SSA compiler backends are happy with this.
      
      Fixes #16226.
      
      Change-Id: I883e3069dee093a1cdc40853c42221a198a152b0
      Reviewed-on: https://go-review.googlesource.com/26631
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      748aa844
    • Josh Bleecher Snyder's avatar
      testing: respect benchtime on very fast benchmarks · 31ad583a
      Josh Bleecher Snyder authored
      When ns/op dropped below 1, the old code
      ignored benchtime and reverted to 1s.
      
      Change-Id: I59752cef88d8d73bfd5b085f5400ae657f78504e
      Reviewed-on: https://go-review.googlesource.com/26664
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMarcel van Lohuizen <mpvl@golang.org>
      31ad583a
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: implement GO386=387 · c069bc49
      Keith Randall authored
      Last part of the 386 SSA port.
      
      Modify the x86 backend to simulate SSE registers and
      instructions with 387 registers and instructions.
      The simulation isn't terribly performant, but it works,
      and the old implementation wasn't very performant either.
      Leaving to people who care about 387 to optimize if they want.
      
      Turn on SSA backend for 386 by default.
      
      Fixes #16358
      
      Change-Id: I678fb59132620b2c47e993c1c10c4c21135f70c0
      Reviewed-on: https://go-review.googlesource.com/25271
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      c069bc49
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: more fixes for 386 shared libraries · 77ef597f
      Keith Randall authored
      Use the destination register for materializing the pc
      for GOT references also. See https://go-review.googlesource.com/c/25442/
      The SSA backend assumes CX does not get clobbered for these instructions.
      
      Mark duffzero as clobbering CX. The linker needs to clobber CX
      to materialize the address to call. (This affects the non-shared-library
      duffzero also, but hopefully forbidding one register across duffzero
      won't be a big deal.)
      
      Hopefully this is all the cases where the linker is clobbering CX
      under the hood and SSA assumes it isn't.
      
      Change-Id: I080c938170193df57cd5ce1f2a956b68a34cc886
      Reviewed-on: https://go-review.googlesource.com/26611
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      77ef597f
  5. 09 Aug, 2016 4 commits
    • David Chase's avatar
      [dev.ssa] cmd/compile: PPC: FP load/store/const/cmp/neg; div/mod · ff37d0e6
      David Chase authored
      FP<->int conversions remain.
      
      Updates #16010.
      
      Change-Id: I38d7a4923e34d0a489935fffc4c96c020cafdba2
      Reviewed-on: https://go-review.googlesource.com/25589
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      ff37d0e6
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: fix PIC for SSA-generated code · 2cbdd55d
      Keith Randall authored
      Access to globals requires a 2-instruction sequence on PIC 386.
      
          MOVL foo(SB), AX
      
      is translated by the obj package into:
      
          CALL getPCofNextInstructionInTempRegister(SB)
          MOVL (&foo-&thisInstruction)(tmpReg), AX
      
      The call returns the PC of the next instruction in a register.
      The next instruction then offsets from that register to get the
      address required.  The tricky part is the allocation of the
      temp register.  The legacy compiler always used CX, and forbid
      the register allocator from allocating CX when in PIC mode.
      We can't easily do that in SSA because CX is actually a required
      register for shift instructions. (I think the old backend got away
      with this because the register allocator never uses CX, only
      codegen knows that shifts must use CX.)
      
      Instead, we allow the temp register to be anything.  When the
      destination of the MOV (or LEA) is an integer register, we can
      use that register.  Otherwise, we make sure to compile the
      operation using an LEA to reference the global.  So
      
          MOVL AX, foo(SB)
      
      is never generated directly.  Instead, SSA generates:
      
          LEAL foo(SB), DX
          MOVL AX, (DX)
      
      which is then rewritten by the obj package to:
      
          CALL getPcInDX(SB)
          LEAL (&foo-&thisInstruction)(DX), AX
          MOVL AX, (DX)
      
      So this CL modifies the obj package to use different thunks
      to materialize the pc into different registers.  We use the
      registers that regalloc chose so that SSA can still allocate
      the full set of registers.
      
      Change-Id: Ie095644f7164a026c62e95baf9d18a8bcaed0bba
      Reviewed-on: https://go-review.googlesource.com/25442
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      2cbdd55d
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: port SSA backend to amd64p32 · 69a755b6
      Keith Randall authored
      It's not a new backend, just a PtrSize==4 modification
      of the existing AMD64 backend.
      
      Change-Id: Icc63521a5cf4ebb379f7430ef3f070894c09afda
      Reviewed-on: https://go-review.googlesource.com/25586
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      69a755b6
    • Chris Broadfoot's avatar
      doc/go1.7.html: update compress/flate section · 392bf3a9
      Chris Broadfoot authored
      Updates #15810.
      
      Change-Id: Ifa7d2fd7fbfe58dff8541b18a11f007a5ff5818a
      Reviewed-on: https://go-review.googlesource.com/25591Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      392bf3a9
  6. 08 Aug, 2016 2 commits
    • Gerrit Code Review's avatar
      Merge "[dev.ssa] Merge commit 'f135c326' into... · f3b4e785
      Gerrit Code Review authored
      Merge "[dev.ssa] Merge commit 'f135c326' into mergebranch" into dev.ssa
      f3b4e785
    • Brad Fitzpatrick's avatar
      net/http: make Transport use new connection if over HTTP/2 concurrency limit · 7a622740
      Brad Fitzpatrick authored
      The Go HTTP/1 client will make as many new TCP connections as the user requests.
      
      The HTTP/2 client tried to have that behavior, but the policy of
      whether a connection is re-usable didn't take into account the extra 1
      stream counting against SETTINGS_MAX_CONCURRENT_STREAMS so in practice
      users were getting errors.
      
      For example, if the server's advertised max concurrent streams is 100
      and 200 concurrrent Go HTTP requests ask for a connection at once, all
      200 will think they can reuse that TCP connection, but then 100 will
      fail later when the number of concurrent streams exceeds 100.
      
      Instead, recognize the "no cached connections" error value in the
      shouldRetryRequest method, so those 100 will retry a new connection.
      
      This is the conservative fix for Go 1.7 so users don't get errors, and
      to match the HTTP/1 behavior. Issues #13957 and #13774 are the more
      involved bugs for Go 1.8.
      
      Updates #16582
      Updates #13957
      
      Change-Id: I1f15a7ce60c07a4baebca87675836d6fe03993e8
      Reviewed-on: https://go-review.googlesource.com/25580
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarChris Broadfoot <cbro@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      7a622740
  7. 07 Aug, 2016 1 commit
  8. 06 Aug, 2016 2 commits
  9. 05 Aug, 2016 4 commits
  10. 04 Aug, 2016 5 commits
  11. 03 Aug, 2016 1 commit
    • Josh Bleecher Snyder's avatar
      [dev.ssa] cmd/compile: refactor out rulegen value parsing · 6a1153ac
      Josh Bleecher Snyder authored
      Previously, genMatch0 and genResult0 contained
      lots of duplication: locating the op, parsing
      the value, validation, etc.
      Parsing and validation was mixed in with code gen.
      
      Extract a helper, parseValue. It is responsible
      for parsing the value, locating the op, and doing
      shared validation.
      
      As a bonus (and possibly as my original motivation),
      make op selection pay attention to the number
      of args present.
      This allows arch-specific ops to share a name
      with generic ops as long as there is no ambiguity.
      It also detects and reports unresolved ambiguity,
      unlike before, where it would simply always
      pick the generic op, with no warning.
      
      Also use parseValue when generating the top-level
      op dispatch, to ensure its opinion about ops
      matches genMatch0 and genResult0.
      
      The order of statements in the generated code used
      to depend on the exact rule. It is now somewhat
      independent of the rule. That is the source
      of some of the generated code changes in this CL.
      See rewritedec64 and rewritegeneric for examples.
      It is a one-time change.
      
      The op dispatch switch and functions used to be
      sorted by opname without architecture. The sort
      now includes the architecture, leading to further
      generated code changes.
      See rewriteARM and rewriteAMD64 for examples.
      Again, it is a one-time change.
      
      There are no functional changes.
      
      Change-Id: I22c989183ad5651741ebdc0566349c5fd6c6b23c
      Reviewed-on: https://go-review.googlesource.com/24649
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      6a1153ac
  12. 02 Aug, 2016 3 commits