1. 14 Apr, 2015 1 commit
  2. 13 Apr, 2015 32 commits
  3. 12 Apr, 2015 7 commits
    • Matt T. Proud's avatar
      expvar: swap Float sync. from mutex to atomic. · 926616da
      Matt T. Proud authored
      Float type from a mutex to atomic bit array in a manner akin to
      Google Guava's AtomicDouble[0], including adding a benchmark for the
      type (benchcmp included below) along with some expvar_test.go cruft
      being fixed.
      
      benchmark             old ns/op     new ns/op     delta
      BenchmarkFloatSet     115           9.37          -91.85%
      BenchmarkFloatAdd     114           17.1          -85.00%
      
      benchmark             old allocs     new allocs     delta
      BenchmarkFloatSet     0              0              +0.00%
      BenchmarkFloatAdd     0              0              +0.00%
      
      benchmark             old bytes     new bytes     delta
      BenchmarkFloatSet     0             0             +0.00%
      BenchmarkFloatAdd     0             0             +0.00%
      
      [0] - http://goo.gl/m4dtlI
      
      Change-Id: I4ce6a913734ec692e3ed243f6e6f7c11da4c6036
      Reviewed-on: https://go-review.googlesource.com/3687Reviewed-by: 's avatarRob Pike <r@golang.org>
      926616da
    • David du Colombier's avatar
      os: add TestProgWideChdir · ae740a45
      David du Colombier authored
      This test checks the working directory is
      always consistent after Chdir in a Go program.
      
      Fixes #10035.
      
      Change-Id: I6abf0e4fcd40680ee572c6b40fc52ab17ef38d54
      Reviewed-on: https://go-review.googlesource.com/6382Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: David du Colombier <0intro@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ae740a45
    • David du Colombier's avatar
      syscall: ignore getwd errors when fixing working directory on Plan 9 · 7d3f81a9
      David du Colombier authored
      In Plan 9, goroutines can run in different processes,
      which don't share their working directory. However,
      Go expects the working directory to be program-wide.
      
      We use a Fixwd function to fix the working directory
      before calling system calls which depend on the
      working directory.
      
      In fixwdLocked, the working directory is not fixed
      when getwd returns an error. However, an error can
      happen is some cases, notably when the directory
      has been previously removed in another process.
      
      Fixes #10422.
      
      Change-Id: Ie0c36f97c4b5ebe27ff0ead360987c5b35f825e4
      Reviewed-on: https://go-review.googlesource.com/8800Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      7d3f81a9
    • Hyang-Ah (Hana) Kim's avatar
      cmd/go: fix a typo. · 63c16b18
      Hyang-Ah (Hana) Kim authored
      Change-Id: Ic453da17817f66e1073f6ba740b830b8daf2fc38
      Reviewed-on: https://go-review.googlesource.com/8829Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      63c16b18
    • Austin Clements's avatar
      debug/dwarf: add Entry.AttrField method to get *Field by Attr · 947b6a7e
      Austin Clements authored
      Currently, Entry has a Val method that looks up an attribute and
      returns its value. Now that Field has more fields than the attribute
      and its value, it's useful to return the whole Field and let the
      caller retrieve the parts it needs.
      
      This change adds an AttrField method to Entry that does the same
      lookup at Val, but returns the whole *Field rather than just the
      value.
      
      Change-Id: Ic629744c14c0e09d7528fa1026b0e1857789948c
      Reviewed-on: https://go-review.googlesource.com/8503Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      947b6a7e
    • Austin Clements's avatar
      debug/dwarf: add DWARF attribute value class to Field · d7d13373
      Austin Clements authored
      To return DWARF attribute values, debug/dwarf maps the DWARF attribute
      value classes to Go types. Unfortunately, this mapping is ambiguous in
      a way that makes it impossible to correctly interpret some DWARF
      attributes as of DWARF 4. For example, AttrStartScope can be either a
      constant or a rangelistptr. The attribute is interpreted differently
      depending on its class, but debug/dwarf maps both classes to int64, so
      the caller can't distinguish them from the Go type.
      AttrDataMemberLocation is similar.
      
      To address this, this change adds a field to type Field that indicates
      the exact DWARF attribute value class of that field's value. This
      makes it possible to distinguish value classes that can't be
      distinguished by their Go type alone.
      
      The root of this type ambiguity was DWARF itself. For example, DWARF 2
      made no distinction between constants that were just constants and
      constants that were section offsets because no attribute could have
      both meanings. Hence, the single int64 type was sufficient. To avoid
      introducing just another layer of ambiguity, this change takes pains
      to canonicalize ambiguous classes in DWARF 2 and 3 files into the
      unambiguous classes of DWARF 4.
      
      Of course, there's no guarantee that future DWARF versions won't do
      the same thing again and further subdivide the DWARF 4 classes. This
      change gets ahead of this somewhat by distinguishing the various *ptr
      classes even though the encoding does not. If there's some other form
      of split, we can handle this in a backwards-compatible way by
      introducing, for example, a Class5 field and type.
      
      Change-Id: I4ef96d1223b0fd7f96ecf44fcc0e704a36af02b4
      Reviewed-on: https://go-review.googlesource.com/8502Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      d7d13373
    • David Crawshaw's avatar
      cmd/interal/ld: darwin c-archive buildmode support · ced7ffe9
      David Crawshaw authored
      Uses ar to create an archive when -buildmode=c-archive.
      
      A small example (that I hope to turn into a test in a later CL):
      
      goarchive.go:
      	package main
      
      	import "fmt"
      
      	import "C"
      
      	func init() {
      		fmt.Println("ran go init")
      	}
      
      	//export FuncInGo
      	func FuncInGo() {
      		fmt.Println("called a go function")
      	}
      
      	func main() {
      		fmt.Println("in main")
      	}
      
      This can be compiled with:
      
      	go build -ldflags=-buildmode=c-archive -o=libgo.a goarchive.go
      
      main.c:
      
      	#include <stdio.h>
      
      	extern void FuncInGo();
      
      	int main(void) {
      		printf("c hello\n");
      		FuncInGo();
      		printf("c goodbye\n");
      		return 0;
      	}
      
      Can be compiled with:
      
      	cc main.c libgo.a
      
      Apple provide a warning about the lack of PIE, but still produce a
      binary which runs and outputs (on darwin/amd64):
      
      	c hello
      	ran go init
      	called a go function
      	c goodbye
      
      Change-Id: I7611925f210a83afa6bd1e66a5601dd636a428c8
      Reviewed-on: https://go-review.googlesource.com/8711Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      ced7ffe9