1. 15 Apr, 2019 4 commits
    • Michael Munday's avatar
      runtime: fix GDB tests on s390x running Ubuntu 18.04 · d91f7e66
      Michael Munday authored
      On Ubuntu 18.04 I am seeing GDB fail to restore the stack pointer
      during this test because stack unwinding can't find the PC. This CL
      is essentially a partial revert of CL 23940 and fixes the issue on
      s390x.
      
      Change-Id: Ib4c41162dc85dc882eb6e248330f4082c3fa94c3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169857
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      d91f7e66
    • Michael Munday's avatar
      cmd/link, runtime: mark goexit as the top of the call stack · aafe2573
      Michael Munday authored
      This CL adds a new attribute, TOPFRAME, which can be used to mark
      functions that should be treated as being at the top of the call
      stack. The function `runtime.goexit` has been marked this way on
      architectures that use a link register.
      
      This will stop programs that use DWARF to unwind the call stack
      from unwinding past `runtime.goexit` on architectures that use a
      link register. For example, it eliminates "corrupt stack?"
      warnings when generating a backtrace that hits `runtime.goexit`
      in GDB on s390x.
      
      Similar code should be added for non-link-register architectures
      (i.e. amd64, 386). They mark the top of the call stack slightly
      differently to link register architectures so I haven't added
      that code (they need to mark "rip" as undefined).
      
      Fixes #24385.
      
      Change-Id: I15b4c69ac75b491daa0acf0d981cb80eb06488de
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169726
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      aafe2573
    • Yuval Pavel Zholkover's avatar
      cmd/dist: enable cgo for freebsd/arm · 0bd101ce
      Yuval Pavel Zholkover authored
      Change-Id: Icc1a54da848bf446919c0d5470d1e79fad339832
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171727Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0bd101ce
    • Daniel Martí's avatar
      go/token: add IsIdentifier, IsKeyword, and IsExported · 60a8dbf3
      Daniel Martí authored
      Telling whether a string is a valid Go identifier can seem like an easy
      task, but it's easy to forget about the edge cases. For example, some
      implementations out there forget that an empty string or keywords like
      "func" aren't valid identifiers.
      
      Add a simple implementation with proper Unicode support, and start using
      it in cmd/cover and cmd/doc. Other pieces of the standard library
      reimplement part of this logic, but don't use a "func(string) bool"
      signature, so we're leaving them untouched for now.
      
      Add some tests too, to ensure that we actually got these edge cases
      correctly.
      
      Since telling whether a string is a valid identifier requires knowing
      that it's not a valid keyword, add IsKeyword too. The internal map was
      already accessible via Lookup, but "Lookup(str) != IDENT" isn't as easy
      to understand as IsKeyword(str). And, as per Josh's suggestion, we could
      have IsKeyword (and probably Lookup too) use a perfect hash function
      instead of a global map.
      
      Finally, for consistency with these new functions, add IsExported. That
      makes go/ast.IsExported a bit redundant, so perhaps it can be deprecated
      in favor of go/token.IsExported in the future. Clarify that
      token.IsExported doesn't imply token.IsIdentifier, to avoid ambiguity.
      
      Fixes #30064.
      
      Change-Id: I0e0e49215fd7e47b603ebc2b5a44086c51ba57f7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169018
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      60a8dbf3
  2. 14 Apr, 2019 2 commits
  3. 13 Apr, 2019 5 commits
  4. 12 Apr, 2019 11 commits
  5. 11 Apr, 2019 11 commits
  6. 10 Apr, 2019 7 commits
    • Michael Anthony Knyszek's avatar
      runtime: introduce treapForSpan to reduce code duplication · 7b33b627
      Michael Anthony Knyszek authored
      Currently which treap a span should be inserted into/removed from is
      checked by looking at the span's properties. This logic is repeated in
      four places. As this logic gets more complex, it makes sense to
      de-duplicate this, so introduce treapForSpan instead which captures this
      logic by returning the appropriate treap for the span.
      
      For #30333.
      
      Change-Id: I4bd933d93dc50c5fc7c7c7f56ceb95194dcbfbcc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170857
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      7b33b627
    • Michael Anthony Knyszek's avatar
      runtime: add tests for runtime mTreap · d13a9312
      Michael Anthony Knyszek authored
      This change exports the runtime mTreap in export_test.go and then adds a
      series of tests which check that the invariants of the treap are
      maintained under different operations. These tests also include tests
      for the treap iterator type.
      
      Also, we note that the find() operation on the treap never actually was
      best-fit, so the tests just ensure that it returns an appropriately
      sized span.
      
      For #30333.
      
      Change-Id: If81f7c746dda6677ebca925cb0a940134701b894
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164100
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      d13a9312
    • Michael Anthony Knyszek's avatar
      runtime: throw if scavenge necessary during coalescing · 2ab6d017
      Michael Anthony Knyszek authored
      Currently when coalescing if two adjacent spans are scavenged, we
      subtract their sizes from memstats and re-scavenge the new combined
      span. This is wasteful however, since the realignment semantics make
      this case of having to re-scavenge impossible.
      
      In realign() inside of coalesce(), there was also a bug: on systems
      where physPageSize > pageSize, we wouldn't realign because a condition
      had the wrong sign. This wasteful re-scavenging has been masking this
      bug this whole time. So, this change fixes that first.
      
      Then this change gets rid of the needsScavenge logic and instead checks
      explicitly for the possibility of unscavenged pages near the physical
      page boundary. If the possibility exists, it throws. The intent of
      throwing here is to catch changes to the runtime which cause this
      invariant to no longer hold, at which point it would likely be
      appropriate to scavenge the additional pages (and only the additional
      pages) at that point.
      
      Change-Id: I185e3d7b53e36e90cf9ace5fa297a9e8008d75f3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/158377
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      2ab6d017
    • Mihai Moldovan's avatar
      cmd/dist: add BOOT_GO_LDFLAGS - counterpart of BOOT_GO_GCFLAGS · 512b3c63
      Mihai Moldovan authored
      This allows passing custom LDFLAGS while building the bootstrapping
      tool.
      
      Afterwards, GO_LDFLAGS will be used as usual.
      
      Change-Id: I1e224e3ce8bf7b2ce1ef8fec1894720338f04396
      GitHub-Last-Rev: 17d40dc2dd2f0815331cb2f8de3445f86687cc45
      GitHub-Pull-Request: golang/go#31298
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171037
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      512b3c63
    • LE Manh Cuong's avatar
      os: fix RemoveAll hangs on large directory · c3495058
      LE Manh Cuong authored
      golang.org/cl/121255 added close and re-open the directory when looping, prevent
      us from missing some if previous iteration deleted files.
      
      The CL introdued a bug. If we can not delete all entries in one request,
      the looping never exits, causing RemoveAll hangs.
      
      To fix that, simply discard the entries if we can not delete all of them
      in one iteration, then continue reading entries and delete them.
      
      Also make sure removeall_at return first error it encounters.
      
      Fixes #29921
      
      Change-Id: I8ec3a4c822d8d2d95d9f1ab71547879da395bc4a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171099
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c3495058
    • Keith Randall's avatar
      syscall: store skip count in file descriptor offset · a6af1041
      Keith Randall authored
      Multiple calls to ReadDirent expect to return subsequent
      portions of the directory listing. There's no place to store
      our progress other than the file descriptor offset.
      
      Fortunately, the file descriptor offset doesn't need to be
      a real offset. We can store any int64 we want there.
      
      Fixes #31368
      
      Change-Id: I49e4e0e7ff707d3e96aa5d43e3b0199531013cde
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171477
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a6af1041
    • Ahsun Ahmed's avatar
      errors: return false if nil error is passed to As · fda5e6d6
      Ahsun Ahmed authored
      Fixes #30970
      
      Change-Id: I333676b55a2364e329fffeafca8fc57d45a0b84b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168598Reviewed-by: default avatarMarcel van Lohuizen <mpvl@golang.org>
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fda5e6d6