1. 05 Sep, 2017 2 commits
    • Matthew Dempsky's avatar
      cmd/compile: fix evaluation order for OASOP · 34db5f0c
      Matthew Dempsky authored
      Currently, we handle "x op= y" by rewriting as "x = x op y", while
      ensuring that any calls or receive operations in 'x' are only
      evaluated once. Notably, pointer indirection, indexing operations,
      etc. are left alone as it's typically safe to re-evaluate those.
      
      However, those operations were interleaved with evaluating 'y', which
      could include function calls that might cause re-evaluation to yield
      different memory addresses.
      
      As a fix, simply ensure that we order side-effecting operations in 'y'
      before either evaluation of 'x'.
      
      Fixes #21687.
      
      Change-Id: Ib14e77760fda9c828e394e8e362dc9e5319a84b2
      Reviewed-on: https://go-review.googlesource.com/60091
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      34db5f0c
    • Matthew Dempsky's avatar
      cmd/compile: fix and improve struct field reflect information · d349fa25
      Matthew Dempsky authored
      The previous logic was overly complicated, generated suboptimally
      encoded struct type descriptors, and mishandled embeddings of
      predeclared universal types.
      
      Fixes #21122.
      Fixes #21353.
      Fixes #21696.
      Fixes #21702.
      Updates #21357.
      
      Change-Id: If34761fa6dbe4af2af59dee501e7f30845320376
      Reviewed-on: https://go-review.googlesource.com/60410
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      d349fa25
  2. 04 Sep, 2017 1 commit
  3. 03 Sep, 2017 4 commits
  4. 02 Sep, 2017 2 commits
    • Mark Pulford's avatar
      math: Add Round function (ties away from zero) · 03c3bb5f
      Mark Pulford authored
      This function avoids subtle faults found in many ad-hoc implementations,
      and is simple enough to be inlined by the compiler.
      
      Fixes #20100
      
      Change-Id: Ib320254e9b1f1f798c6ef906b116f63bc29e8d08
      Reviewed-on: https://go-review.googlesource.com/43652Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      03c3bb5f
    • Keith Randall's avatar
      runtime: fix hashmap load factor computation · dbe3522c
      Keith Randall authored
      overLoadFactor wasn't really doing what it says it does.
      It was reporting overOrEqualToLoadFactor.  That's actually what we
      want when adding an entry to a map, but it isn't what we want when
      constructing a map in the first place.
      
      The impetus for this change is that if you make a map with a hint
      of exactly 8 (which happens, for example, with the unitMap in
      time/format.go), we allocate 2 buckets for it instead of 1.
      
      Instead, make overLoadFactor really report when it is > the max
      allowed load factor, not >=.  Adjust the callers who want to ensure
      that the map is no more than the max load factor after an insertion
      by adding a +1 to the current (pre-addition) size.
      
      Change-Id: Ie8d85344800a9a870036b637b1031ddd9e4b93f9
      Reviewed-on: https://go-review.googlesource.com/61053
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMartin Möhrmann <moehrmann@google.com>
      dbe3522c
  5. 01 Sep, 2017 10 commits
  6. 31 Aug, 2017 14 commits
  7. 30 Aug, 2017 7 commits
    • Chris Ball's avatar
      runtime: add symbols for Linux syscall numbers on 386/amd64 · 4d269ad1
      Chris Ball authored
      Matches other architectures by using names for syscalls instead of
      numbers directly.
      
      Fixes #20499.
      
      Change-Id: I63d606b0b1fe6fb517fd994a7542a3f38d80dd54
      Reviewed-on: https://go-review.googlesource.com/44213
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      4d269ad1
    • Carlos Eduardo Seo's avatar
      runtime: fix regression in BenchmarkCompareBytes* for ppc64x · 4641d78a
      Carlos Eduardo Seo authored
      Between go1.7 and go1.8, a performance regression was introduced in some of the
      BenchmarkCompareBytes benchmarks.
      
      Go1.7 vs Go1.8:
      BenchmarkCompareBytesToNil-8               7.44          8.44          +13.44%
      BenchmarkCompareBytesIdentical-8           6.96          11.5          +65.23%
      BenchmarkCompareBytesBigIdentical-8        6.65          47112         +708351.13%
      
      This change fixes the problem by optimizing the case where the byte slices being
      compared are equal:
      
      Go1.9 vs current:
      BenchmarkCompareBytesToNil-8               7.35          7.00          -4.76%
      BenchmarkCompareBytesIdentical-8           11.4          6.81          -40.26%
      BenchmarkCompareBytesBigIdentical-8        48396         9.26          -99.98%
      
      runtime.cmpstring can benefit from the same approach and is also changed.
      
      Change-Id: I3cb25f59d8b940a83a2cf687eea764cfeff90688
      Reviewed-on: https://go-review.googlesource.com/59650
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarLynn Boger <laboger@linux.vnet.ibm.com>
      4641d78a
    • Hiroshi Ioka's avatar
      cmd/cgo: support niladic function-like macros · 03876af9
      Hiroshi Ioka authored
      Currently, cgo supports only macros which can be reduced to constants
      or variables. The CL addresses remaining parts, macros which can be
      represented as niladic functions.
      
      The basic idea is simple:
        1. make a thin wrapper function per macros.
        2. replace macro expansions with function calls.
      
      Fixes #10715
      Fixes #18720
      
      Change-Id: I150b4fb48e9dc4cc34466ef6417c04ac93d4bc1a
      Reviewed-on: https://go-review.googlesource.com/43970
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      03876af9
    • Joe Tsai's avatar
      archive/tar: minor doc fixes · c1679286
      Joe Tsai authored
      Use "file" consistently instead of "entry".
      
      Change-Id: Ia81c9665d0d956adb78f7fa49de40cdb87fba000
      Reviewed-on: https://go-review.googlesource.com/60150Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c1679286
    • Joe Tsai's avatar
      archive/tar: require opt-in to PAX or GNU format for time features · f85dc050
      Joe Tsai authored
      Nearly every Header obtained from FileInfoHeader via the FS has
      timestamps with sub-second resolution and the AccessTime
      and ChangeTime fields populated. This forces the PAX format
      to almost always be used, which has the following problems:
      * PAX is still not as widely supported compared to USTAR
      * The PAX headers will occupy at minimum 1KiB for every entry
      
      The old behavior of tar Writer had no support for sub-second resolution
      nor any support for AccessTime or ChangeTime, so had neither problem.
      Instead the Writer would just truncate sub-second information and
      ignore the AccessTime and ChangeTime fields.
      
      In this CL, we preserve the behavior such that the *default* behavior
      would output a USTAR header for most cases by truncating sub-second
      time measurements and ignoring AccessTime and ChangeTime.
      To use either of the features, users will need to explicitly specify
      that the format is PAX or GNU.
      
      The exact policy chosen is this:
      * USTAR and GNU may still be chosen even if sub-second measurements
      are present; they simply truncate the timestamp to the nearest second.
      As before, PAX uses sub-second resolutions.
      * If the Format is unspecified, then WriteHeader ignores AccessTime
      and ChangeTime when using the USTAR format.
      
      This ensures that USTAR may still be chosen for a vast majority of
      file entries obtained through FileInfoHeader.
      
      Updates #11171
      Updates #17876
      
      Change-Id: Icc5274d4245922924498fd79b8d3ae94d5717271
      Reviewed-on: https://go-review.googlesource.com/59230
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      f85dc050
    • Marvin Stenger's avatar
      runtime/internal/sys: use standard generated code header · 0592a1a3
      Marvin Stenger authored
      This change implements the convention for generated code header agreed upon in https://golang.org/s/generatedcode.
      Additionally run go generate.
      Also update some comments.
      
      Updates #13560
      
      Change-Id: If45f91b93aaa0d43280c2c4630823bc4d2dc7d3a
      Reviewed-on: https://go-review.googlesource.com/60250
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0592a1a3
    • Michael Stapelberg's avatar
      context: fix lint warning “drop = 0 from declaration” · 2915e44d
      Michael Stapelberg authored
      Previously, the suggested code would result in the following golint warning:
      “should drop = 0 from declaration of var errorsOnlyKey; it is the zero value”
      
      Change-Id: I1a302c1e40ca89acbc76897e39097ecd04865460
      Reviewed-on: https://go-review.googlesource.com/60290Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      2915e44d