1. 08 Apr, 2014 6 commits
    • Russ Cox's avatar
      reflect, runtime: fix crash in GC due to reflect.call + precise GC · 72c5d5e7
      Russ Cox authored
      Given
              type Outer struct {
                      *Inner
                      ...
              }
      the compiler generates the implementation of (*Outer).M dispatching to
      the embedded Inner. The implementation is logically:
              func (p *Outer) M() {
                      (p.Inner).M()
              }
      but since the only change here is the replacement of one pointer
      receiver with another, the actual generated code overwrites the
      original receiver with the p.Inner pointer and then jumps to the M
      method expecting the *Inner receiver.
      
      During reflect.Value.Call, we create an argument frame and the
      associated data structures to describe it to the garbage collector,
      populate the frame, call reflect.call to run a function call using
      that frame, and then copy the results back out of the frame. The
      reflect.call function does a memmove of the frame structure onto the
      stack (to set up the inputs), runs the call, and the memmoves the
      stack back to the frame structure (to preserve the outputs).
      
      Originally reflect.call did not distinguish inputs from outputs: both
      memmoves were for the full stack frame. However, in the case where the
      called function was one of these wrappers, the rewritten receiver is
      almost certainly a different type than the original receiver. This is
      not a problem on the stack, where we use the program counter to
      determine the type information and understand that during (*Outer).M
      the receiver is an *Outer while during (*Inner).M the receiver in the
      same memory word is now an *Inner. But in the statically typed
      argument frame created by reflect, the receiver is always an *Outer.
      Copying the modified receiver pointer off the stack into the frame
      will store an *Inner there, and then if a garbage collection happens
      to scan that argument frame before it is discarded, it will scan the
      *Inner memory as if it were an *Outer. If the two have different
      memory layouts, the collection will intepret the memory incorrectly.
      
      Fix by only copying back the results.
      
      Fixes #7725.
      
      LGTM=khr
      R=khr
      CC=dave, golang-codereviews
      https://golang.org/cl/85180043
      72c5d5e7
    • Dmitriy Vyukov's avatar
      runtime/race: more precise handling of channel synchronization · 9e1cadad
      Dmitriy Vyukov authored
      It turns out there is a relatively common pattern that relies on
      inverted channel semaphore:
      
      gate := make(chan bool, N)
      for ... {
              // limit concurrency
              gate <- true
              go func() {
                      foo(...)
                      <-gate
              }()
      }
      // join all goroutines
      for i := 0; i < N; i++ {
              gate <- true
      }
      
      So handle synchronization on inverted semaphores with cap>1.
      Fixes #7718.
      
      LGTM=rsc
      R=rsc
      CC=golang-codereviews
      https://golang.org/cl/84880046
      9e1cadad
    • Ian Lance Taylor's avatar
      liblink: remove code that is never executed · f4ecfaa4
      Ian Lance Taylor authored
      This code tests linkmode == LinkExternal but is only invoked
      by the compiler/assembler, not the linker.
      
      Update #7164
      
      LGTM=rsc
      R=rsc, dave
      CC=golang-codereviews
      https://golang.org/cl/85080043
      f4ecfaa4
    • Rob Pike's avatar
      doc/go1.3.html: drop support for windows 2000 · 78025fb2
      Rob Pike authored
      LGTM=bradfitz, alex.brainman
      R=golang-codereviews, bradfitz, alex.brainman
      CC=golang-codereviews
      https://golang.org/cl/85190043
      78025fb2
    • Keith Randall's avatar
      runtime: make sure associated defers are copyable before trying to copy a stack. · fc6753c7
      Keith Randall authored
      Defers generated from cgo lie to us about their argument layout.
      Mark those defers as not copyable.
      
      CL 83820043 contains an additional test for this code and should be
      checked in (and enabled) after this change is in.
      
      Fixes bug 7695.
      
      LGTM=rsc
      R=golang-codereviews, rsc
      CC=golang-codereviews
      https://golang.org/cl/84740043
      fc6753c7
    • Keith Randall's avatar
      runtime: fix heapdump bugs. · af923df8
      Keith Randall authored
      Iterate the right number of times in arrays and channels.
      Handle channels with zero-sized objects in them.
      Output longer type names if we have them.
      Compute argument offset correctly.
      
      LGTM=rsc
      R=golang-codereviews, rsc
      CC=golang-codereviews
      https://golang.org/cl/82980043
      af923df8
  2. 07 Apr, 2014 8 commits
  3. 06 Apr, 2014 2 commits
  4. 04 Apr, 2014 10 commits
  5. 03 Apr, 2014 14 commits