1. 27 May, 2015 8 commits
  2. 26 May, 2015 8 commits
  3. 25 May, 2015 2 commits
  4. 23 May, 2015 3 commits
  5. 22 May, 2015 16 commits
  6. 21 May, 2015 3 commits
    • Russ Cox's avatar
      runtime: fix callwritebarrier · 001438bd
      Russ Cox authored
      Given a call frame F of size N where the return values start at offset R,
      callwritebarrier was instructing heapBitsBulkBarrier to scan the block
      of memory [F+R, F+R+N). It should only scan [F+R, F+N). The extra N-R
      bytes scanned might lead into the next allocated block in memory.
      Because the scan was consulting the heap bitmap for type information,
      scanning into the next block normally "just worked" in the sense of
      not crashing.
      
      Scanning the extra N-R bytes of memory is a problem mainly because
      it causes the GC to consider pointers that might otherwise not be
      considered, leading it to retain objects that should actually be freed.
      This is very difficult to detect.
      
      Luckily, juju turned up a case where the heap bitmap and the memory
      were out of sync for the block immediately after the call frame, so that
      heapBitsBulkBarrier saw an obvious non-pointer where it expected a
      pointer, causing a loud crash.
      
      Why is there a non-pointer in memory that the heap bitmap records as
      a pointer? That is more difficult to answer. At least one way that it
      could happen is that allocations containing no pointers at all do not
      update the heap bitmap. So if heapBitsBulkBarrier walked out of the
      current object and into a no-pointer object and consulted those bitmap
      bits, it would be misled. This doesn't happen in general because all
      the paths to heapBitsBulkBarrier first check for the no-pointer case.
      This may or may not be what happened, but it's the only scenario
      I've been able to construct.
      
      I tried for quite a while to write a simple test for this and could not.
      It does fix the juju crash, and it is clearly an improvement over the
      old code.
      
      Fixes #10844.
      
      Change-Id: I53982c93ef23ef93155c4086bbd95a4c4fdaac9a
      Reviewed-on: https://go-review.googlesource.com/10317Reviewed-by: 's avatarAustin Clements <austin@google.com>
      001438bd
    • Austin Clements's avatar
      runtime: eliminate write barrier from adjustpointers · a5c3bbe0
      Austin Clements authored
      Currently adjustpointers invokes a write barrier for every stack slot
      it updates. This is safe---the write barrier always does nothing
      because the new value is never a heap pointer---but it's unnecessary
      overhead in performance and complexity.
      
      Fix this by rewriting adjustpointers to work with *uintptrs instead of
      *unsafe.Pointers. As an added bonus, this makes the code cleaner.
      
      name                   old mean              new mean              delta
      BinaryTree17            3.35s × (0.98,1.01)   3.33s × (0.99,1.02)    ~    (p=0.095 n=20+19)
      Fannkuch11              2.49s × (1.00,1.01)   2.52s × (0.99,1.01)  +1.23% (p=0.000 n=19+20)
      FmtFprintfEmpty        52.2ns × (0.99,1.02)  52.2ns × (0.99,1.02)    ~    (p=0.766 n=19+19)
      FmtFprintfString        181ns × (0.99,1.02)   179ns × (0.99,1.01)  -1.06% (p=0.000 n=20+19)
      FmtFprintfInt           177ns × (0.99,1.01)   173ns × (0.99,1.02)  -2.26% (p=0.000 n=17+20)
      FmtFprintfIntInt        300ns × (0.99,1.01)   302ns × (0.99,1.01)  +0.76% (p=0.000 n=19+20)
      FmtFprintfPrefixedInt   253ns × (0.99,1.02)   256ns × (0.99,1.01)  +0.96% (p=0.000 n=20+19)
      FmtFprintfFloat         334ns × (0.99,1.02)   334ns × (1.00,1.01)    ~    (p=0.243 n=20+19)
      FmtManyArgs            1.16µs × (0.99,1.01)  1.17µs × (0.99,1.02)  +0.88% (p=0.000 n=20+20)
      GobDecode              9.16ms × (0.99,1.02)  9.18ms × (1.00,1.00)  +0.21% (p=0.048 n=20+17)
      GobEncode              7.03ms × (0.99,1.01)  7.05ms × (0.99,1.01)    ~    (p=0.091 n=19+19)
      Gzip                    374ms × (0.99,1.01)   372ms × (0.99,1.02)  -0.50% (p=0.008 n=18+20)
      Gunzip                 92.9ms × (0.99,1.01)  92.5ms × (1.00,1.01)  -0.47% (p=0.002 n=19+19)
      HTTPClientServer       53.1µs × (0.98,1.01)  52.5µs × (0.99,1.01)  -0.98% (p=0.000 n=20+19)
      JSONEncode             17.4ms × (0.99,1.02)  17.5ms × (0.99,1.01)    ~    (p=0.061 n=19+20)
      JSONDecode             66.0ms × (0.99,1.02)  64.7ms × (0.99,1.01)  -1.87% (p=0.000 n=20+20)
      Mandelbrot200          3.94ms × (1.00,1.01)  3.95ms × (1.00,1.01)    ~    (p=0.799 n=18+19)
      GoParse                3.89ms × (0.99,1.02)  3.86ms × (0.99,1.01)  -0.70% (p=0.016 n=20+19)
      RegexpMatchEasy0_32     102ns × (0.99,1.02)   102ns × (1.00,1.01)    ~    (p=0.557 n=20+18)
      RegexpMatchEasy0_1K     353ns × (0.99,1.02)   341ns × (0.99,1.01)  -3.38% (p=0.000 n=20+20)
      RegexpMatchEasy1_32    85.0ns × (0.99,1.02)  85.0ns × (0.99,1.01)    ~    (p=0.851 n=19+20)
      RegexpMatchEasy1_1K     521ns × (0.99,1.02)   506ns × (1.00,1.01)  -2.85% (p=0.000 n=20+18)
      RegexpMatchMedium_32    142ns × (0.99,1.02)   141ns × (1.00,1.01)  -1.17% (p=0.000 n=20+19)
      RegexpMatchMedium_1K   42.8µs × (0.99,1.01)  42.3µs × (0.99,1.01)  -1.07% (p=0.000 n=20+19)
      RegexpMatchHard_32     2.17µs × (0.99,1.01)  2.16µs × (1.00,1.01)  -0.51% (p=0.042 n=20+18)
      RegexpMatchHard_1K     65.6µs × (0.99,1.01)  64.8µs × (1.00,1.00)  -1.21% (p=0.000 n=20+17)
      Revcomp                 581ms × (0.99,1.04)   536ms × (1.00,1.01)  -7.71% (p=0.000 n=20+18)
      Template               77.2ms × (0.99,1.01)  76.8ms × (0.99,1.01)    ~    (p=0.426 n=20+18)
      TimeParse               369ns × (0.99,1.02)   371ns × (1.00,1.01)    ~    (p=0.117 n=20+19)
      TimeFormat              371ns × (0.99,1.02)   391ns × (0.99,1.01)  +5.33% (p=0.000 n=20+19)
      
      Change-Id: I5b952ba577ac4365c8c87db837c5804a1e30b7be
      Reviewed-on: https://go-review.googlesource.com/10293Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      a5c3bbe0
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: remove F3t field from Prog · 13781737
      Josh Bleecher Snyder authored
      F3t was effectively a local variable.
      Remove it.
      
      This shrinks obj.Prog from 456 to 448 bytes,
      which places it in a smaller malloc class.
      
      This reduces the memory usage of the compiler
      while compiling the rotate tests by ~2.75%.
      
      Change-Id: I31cc9dd67269851a430b56bcc7d255c9349eb522
      Reviewed-on: https://go-review.googlesource.com/10255Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      13781737