1
0
mirror of https://github.com/golang/go synced 2024-10-03 13:21:22 -06:00
Commit Graph

3852 Commits

Author SHA1 Message Date
Jan Ziak
16bea49ede cmd/cc: map C int to int32 in Go defs
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6621052
2012-10-06 13:56:12 +08:00
Dave Cheney
ed0c5dd11f cmd/5g: avoid temporary during constant OINDEX
func addr(s[]int) *int {
	return &s[2]
}

--- prog list "addr" ---
0000 (/home/dfc/src/addr.go:5) TEXT     addr+0(SB),$0-16
0001 (/home/dfc/src/addr.go:6) MOVW     $s+0(FP),R0
0002 (/home/dfc/src/addr.go:6) MOVW     4(R0),R1
0003 (/home/dfc/src/addr.go:6) MOVW     $2,R2
0004 (/home/dfc/src/addr.go:6) CMP      R2,R1,
0005 (/home/dfc/src/addr.go:6) BHI      ,7(APC)
0006 (/home/dfc/src/addr.go:6) BL       ,runtime.panicindex+0(SB)
0007 (/home/dfc/src/addr.go:6) MOVW     0(R0),R0
0008 (/home/dfc/src/addr.go:6) MOVW     $8,R1
0009 (/home/dfc/src/addr.go:6) ADD      R1,R0
0010 (/home/dfc/src/addr.go:6) MOVW     R0,.noname+12(FP)
0011 (/home/dfc/src/addr.go:6) RET      ,

becomes

--- prog list "addr" ---
0000 (/home/dfc/src/addr.go:5) TEXT     addr+0(SB),$0-16
0001 (/home/dfc/src/addr.go:6) MOVW     $s+0(FP),R0
0002 (/home/dfc/src/addr.go:6) MOVW     4(R0),R1
0003 (/home/dfc/src/addr.go:6) MOVW     $2,R2
0004 (/home/dfc/src/addr.go:6) CMP      R2,R1,
0005 (/home/dfc/src/addr.go:6) BHI      ,7(APC)
0006 (/home/dfc/src/addr.go:6) BL       ,runtime.panicindex+0(SB)
0007 (/home/dfc/src/addr.go:6) MOVW     0(R0),R0
0008 (/home/dfc/src/addr.go:6) ADD      $8,R0
0009 (/home/dfc/src/addr.go:6) MOVW     R0,.noname+12(FP)
0010 (/home/dfc/src/addr.go:6) RET      ,

R=rsc, remyoudompheng, minux.ma
CC=golang-dev
https://golang.org/cl/6590056
2012-10-06 11:51:06 +10:00
Rémy Oudompheng
3a4e156ae1 cmd/5g: fix out of registers in nested calls, add compiler torture test.
R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev, remy
https://golang.org/cl/6586072
2012-10-05 23:30:49 +02:00
Andrew Gerrand
3fd5e0be9d godoc: make examples editable and runnable in playground
R=dsymonds
CC=golang-dev
https://golang.org/cl/6523045
2012-10-04 16:53:05 +10:00
Shenghou Ma
7e2e4a732d cmd/go: add support for -test.benchmem
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6587074
2012-10-04 13:20:18 +08:00
Rob Pike
d87d488953 cmd/api: add exception file
Fixes build.

R=golang-dev, adg, bradfitz, dsymonds, dave
CC=golang-dev
https://golang.org/cl/6586074
2012-10-04 11:35:17 +10:00
Rémy Oudompheng
2de064b63c cmd/8g: do not take the address of string/slice for &s[i]
A similar change was made in 6g recently.

LEALs in cmd/go: 31440 before, 27867 after.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    7065794000   6723617000   -4.84%
BenchmarkFannkuch11      7767395000   7477945000   -3.73%
BenchmarkGobDecode         34708140     34857820   +0.43%
BenchmarkGobEncode         10998780     10960060   -0.35%
BenchmarkGzip            1603630000   1471052000   -8.27%
BenchmarkGunzip           242573900    240650400   -0.79%
BenchmarkJSONEncode       120842200    117966100   -2.38%
BenchmarkJSONDecode       247254900    249103100   +0.75%
BenchmarkMandelbrot200     29237330     29241790   +0.02%
BenchmarkParse              8111320      8096865   -0.18%
BenchmarkRevcomp         2595780000   2694153000   +3.79%
BenchmarkTemplate         276679600    264497000   -4.40%

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloatDecimal                  429          416   -3.03%
BenchmarkAppendFloat                         780          740   -5.13%
BenchmarkAppendFloatExp                      746          700   -6.17%
BenchmarkAppendFloatNegExp                   752          694   -7.71%
BenchmarkAppendFloatBig                     1228         1108   -9.77%
BenchmarkAppendFloat32Integer                457          416   -8.97%
BenchmarkAppendFloat32ExactFraction          662          631   -4.68%
BenchmarkAppendFloat32Point                  771          735   -4.67%
BenchmarkAppendFloat32Exp                    722          672   -6.93%
BenchmarkAppendFloat32NegExp                 724          659   -8.98%
BenchmarkAppendFloat64Fixed1                 429          400   -6.76%
BenchmarkAppendFloat64Fixed2                 463          442   -4.54%

Update #1914.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6574043
2012-10-02 08:19:27 +02:00
Dmitriy Vyukov
041fc8bf96 race: gc changes
This is the first part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
This change makes gc compiler instrument memory accesses when supplied with -b flag.

R=rsc, nigeltao, lvd
CC=golang-dev
https://golang.org/cl/6497074
2012-10-02 10:05:46 +04:00
Dave Cheney
7b36acc4ac cmd/5g: avoid temporary during constant binary op
This CL is an attempt to backport the abop code generation from 6g. This improves the generation of the range offset if the increment can be encoded directly via Operand2 shift encoding.

0023 (/home/dfc/src/range.go:7) BGE     ,29(APC)
0024 (/home/dfc/src/range.go:7) MOVW    0(R3),R5
0025 (/home/dfc/src/range.go:7) MOVW    $4,R1
0026 (/home/dfc/src/range.go:7) ADD     R1,R3,R3
0027 (/home/dfc/src/range.go:8) ADD     R5,R4,R4
0028 (/home/dfc/src/range.go:7) B       ,17(APC)

becomes

0023 (/home/dfc/src/range.go:7) BGE     ,28(APC)
0024 (/home/dfc/src/range.go:7) MOVW    0(R3),R0
0025 (/home/dfc/src/range.go:7) ADD     $4,R3,R3
0026 (/home/dfc/src/range.go:8) ADD     R0,R4,R4
0027 (/home/dfc/src/range.go:7) B       ,17(APC)

Benchmarks are unimpressive

dfc@qnap:~/go/test/bench/go1$ ~/go/misc/benchcmp {old,new}.txt
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    2147483647   2147483647   +0.93%
BenchmarkFannkuch11      2147483647   2147483647   -2.52%
BenchmarkGobDecode        196135200    195842000   -0.15%
BenchmarkGobEncode         78581650     76734450   -2.35%
BenchmarkGzip            2147483647   2147483647   -0.47%
BenchmarkGunzip          1087243000   1070254000   -1.56%
BenchmarkJSONEncode      1107558000   1146077000   +3.48%
BenchmarkJSONDecode      2147483647   2147483647   -0.07%
BenchmarkMandelbrot200   2147483647   2147483647   -0.77%
BenchmarkParse             74328550     71653400   -3.60%
BenchmarkRevcomp          111123900    109325950   -1.62%
BenchmarkTemplate        2147483647   2147483647   -0.82%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode             3.91         3.92    1.00x
BenchmarkGobEncode             9.77        10.00    1.02x
BenchmarkGzip                  3.65         3.66    1.00x
BenchmarkGunzip               17.85        18.13    1.02x
BenchmarkJSONEncode            1.75         1.69    0.97x
BenchmarkJSONDecode            0.83         0.83    1.00x
BenchmarkParse                 0.78         0.81    1.04x
BenchmarkRevcomp              22.87        23.25    1.02x
BenchmarkTemplate              0.84         0.85    1.01x

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6564067
2012-10-02 08:12:39 +10:00
Robert Griesemer
5a03cd56a1 cmd/godoc: clearer comments in FormatSelections
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6561073
2012-10-01 14:17:25 -07:00
Akshat Kumar
48bd5c5010 cmd/go/build: Add magic data for Plan 9 binaries.
This change allows the Go build and install tools to
recognize Plan 9 i386 and amd64 binaries.

R=rsc, r, rminnich
CC=golang-dev
https://golang.org/cl/6575064
2012-10-01 15:04:52 -04:00
Luuk van Dijk
78ba449a3c cmd/gc: Missing break in esc switch.
R=rsc
CC=golang-dev
https://golang.org/cl/6594053
2012-10-01 16:33:06 +02:00
Shenghou Ma
9a3bc51c81 test/fixedbugs/bug454.go: add a test for CL 6564052
Also mention that ignoring second blank identifier of range is required by the spec in the code.

   Fixes #4173.

R=daniel.morsing, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6594043
2012-09-29 23:23:56 +08:00
Paul Chang
7c8e26ee2f cmd/godoc: fix minor bug in FormatSelections.
FormatSelections tries to call a nil function value if lw is nil
and the final entry in the selections array is non-nil. Luckily,
this doesn't actually happen in practice since godoc doesn't use
this combination (no line numbers, but with selections).

R=gri
CC=gobot, golang-dev
https://golang.org/cl/6488106
2012-09-28 14:19:43 -07:00
Rémy Oudompheng
617b7cf166 cmd/[568]g: header cleanup.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6573059
2012-09-27 08:34:00 +02:00
Rob Pike
b46dd48dd3 cmd/api: delete redundant text from deletion message
R=bradfitz, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6543064
2012-09-27 15:39:56 +10:00
Rémy Oudompheng
6feb61325a cmd/6g, cmd/8g: fix two "out of fixed registers" cases.
In two cases, registers were allocated too early resulting
in exhausting of available registers when nesting these
operations.

The case of method calls was due to missing cases in igen,
which only makes calls but doesn't allocate a register for
the result.

The case of 8-bit multiplication was due to a wrong order
in register allocation when Ullman numbers were bigger on the
RHS.

Fixes #3907.
Fixes #4156.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6560054
2012-09-26 21:17:11 +02:00
Daniel Morsing
7936ab58f7 cmd/gc: Don't calculate second value in range if it is blank.
Low hanging fruit optimization. Will remove an expensive copy if the range variable is an array.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6564052
2012-09-26 21:10:29 +02:00
Shenghou Ma
e039c405c8 cmd/6a, cmd/6l: add support for AES-NI instrutions and PSHUFD
This CL adds support for the these 7 new instructions to 6a/6l in
preparation of the upcoming CL for AES-NI accelerated crypto/aes:
AESENC, AESENCLAST, AESDEC, AESDECLAST, AESIMC, AESKEYGENASSIST,
and PSHUFD.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5970055
2012-09-27 01:53:08 +08:00
Shenghou Ma
5490814c30 cmd/go, cmd/ld: fix libgcc order and add __image_base__ symbol for windows
Fixes #4063.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/6543066
2012-09-26 22:34:25 +08:00
Joel Sing
e80fccb441 cmd/go: assume that code in $GOROOT is up to date
Do not check compiler/linker timestamps for packages that are in the
$GOROOT. Avoids trying to rebuild non-writable standard packages when
timestamps have not been retained on the Go binaries.

Fixes #4106.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6533053
2012-09-27 00:00:50 +10:00
Shenghou Ma
f2fadfefaf cmd/5c: fix dataflag annotation
file        old_size     new_size    base@c1ce95068533
bin/go      14717392     6287824     5918236

this huge size difference is due to GC data for runtime.mheap
(NOPTR dataflag is not obeyed).

R=rsc, dave
CC=golang-dev
https://golang.org/cl/6547051
2012-09-25 14:42:44 +08:00
Russ Cox
5c4e2570c1 cmd/dist: new version for string for development branch
Remove VERSION, which was forcing version to 'devel'.

Old:
$ go version
go version devel

New:
$ go version
go version devel +0a3866d6cc6b Mon Sep 24 20:08:05 2012 -0400

The date and time (and time zone) is that of the most recent commit,
not the time of the build itself. With some effort we could normalize
the zone, but I don't think it's worth the effort (more C coding,
since Mercurial is unhelpful).

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6569049
2012-09-24 21:35:20 -04:00
Russ Cox
10ea6519e4 build: make int 64 bits on amd64
The assembly offsets were converted mechanically using
code.google.com/p/rsc/cmd/asmlint. The instruction
changes were done by hand.

Fixes #2188.

R=iant, r, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/6550058
2012-09-24 20:57:01 -04:00
Rémy Oudompheng
33cceb09e2 cmd/{5g,6g,8g,6c}: remove unused macro, use %E to print etype.
R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/6569044
2012-09-24 23:44:00 +02:00
Rémy Oudompheng
f4e76d5e02 cmd/6g, cmd/8g: add OINDREG, ODOT, ODOTPTR cases to igen.
Apart from reducing the number of LEAL/LEAQ instructions by about
30%, it gives 8g easier registerization in several cases,
for example in strconv. Performance with 6g is not affected.

Before (386):
src/pkg/strconv/decimal.go:22   TEXT  (*decimal).String+0(SB),$240-12
src/pkg/strconv/extfloat.go:540 TEXT  (*extFloat).ShortestDecimal+0(SB),$584-20

After (386):
src/pkg/strconv/decimal.go:22   TEXT  (*decimal).String+0(SB),$196-12
src/pkg/strconv/extfloat.go:540 TEXT  (*extFloat).ShortestDecimal+0(SB),$420-20

Benchmarks with GOARCH=386 (on a Core 2).

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    7110191000   7079644000   -0.43%
BenchmarkFannkuch11      7769274000   7766514000   -0.04%
BenchmarkGobDecode         33454820     34755400   +3.89%
BenchmarkGobEncode         11675710     11007050   -5.73%
BenchmarkGzip            2013519000   1593855000  -20.84%
BenchmarkGunzip           253368200    242667600   -4.22%
BenchmarkJSONEncode       152443900    120763400  -20.78%
BenchmarkJSONDecode       304112800    247461800  -18.63%
BenchmarkMandelbrot200     29245520     29240490   -0.02%
BenchmarkParse              8484105      8088660   -4.66%
BenchmarkRevcomp         2695688000   2841263000   +5.40%
BenchmarkTemplate         363759800    277271200  -23.78%

benchmark                       old ns/op    new ns/op    delta
BenchmarkAtof64Decimal                127          129   +1.57%
BenchmarkAtof64Float                  166          164   -1.20%
BenchmarkAtof64FloatExp               308          300   -2.60%
BenchmarkAtof64Big                    584          571   -2.23%
BenchmarkAppendFloatDecimal           440          430   -2.27%
BenchmarkAppendFloat                  995          776  -22.01%
BenchmarkAppendFloatExp               897          746  -16.83%
BenchmarkAppendFloatNegExp            900          752  -16.44%
BenchmarkAppendFloatBig              1528         1228  -19.63%
BenchmarkAppendFloat32Integer         443          453   +2.26%
BenchmarkAppendFloat32ExactFraction   812          661  -18.60%
BenchmarkAppendFloat32Point          1002          773  -22.85%
BenchmarkAppendFloat32Exp             858          725  -15.50%
BenchmarkAppendFloat32NegExp          848          728  -14.15%
BenchmarkAppendFloat64Fixed1          447          431   -3.58%
BenchmarkAppendFloat64Fixed2          480          462   -3.75%
BenchmarkAppendFloat64Fixed3          461          457   -0.87%
BenchmarkAppendFloat64Fixed4          509          484   -4.91%

Update #1914.

R=rsc, nigeltao
CC=golang-dev, remy
https://golang.org/cl/6494107
2012-09-24 23:07:44 +02:00
Russ Cox
54af752865 cmd/gc: fix escape analysis bug
Was not handling &x.y[0] and &x.y.z correctly where
y is an array or struct-valued field (not a pointer).

R=ken2
CC=golang-dev
https://golang.org/cl/6551059
2012-09-24 15:53:12 -04:00
Rémy Oudompheng
14f3276c9d cmd/8g: don't create redundant temporaries in bgen.
Comparisons used to create temporaries for arguments
even if they were already variables or addressable.
Removing the extra ones reduces pressure on regopt.

benchmark                 old ns/op    new ns/op    delta
BenchmarkGobDecode         50787620     49908980   -1.73%
BenchmarkGobEncode         19870190     19473030   -2.00%
BenchmarkGzip            3214321000   3067929000   -4.55%
BenchmarkGunzip           496792800    465828600   -6.23%
BenchmarkJSONEncode       232524800    263864400  +13.48%
BenchmarkJSONDecode       622038400    506600600  -18.56%
BenchmarkMandelbrot200     23937310     45913060  +91.81%
BenchmarkParse             14364450     13997010   -2.56%
BenchmarkRevcomp         6919028000   6480009000   -6.35%
BenchmarkTemplate         594458800    539528200   -9.24%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            15.11        15.38    1.02x
BenchmarkGobEncode            38.63        39.42    1.02x
BenchmarkGzip                  6.04         6.33    1.05x
BenchmarkGunzip               39.06        41.66    1.07x
BenchmarkJSONEncode            8.35         7.35    0.88x
BenchmarkJSONDecode            3.12         3.83    1.23x
BenchmarkParse                 4.03         4.14    1.03x
BenchmarkRevcomp              36.73        39.22    1.07x
BenchmarkTemplate              3.26         3.60    1.10x

R=mtj, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6547064
2012-09-24 21:29:24 +02:00
Russ Cox
650160e36a cmd/gc: prepare for 64-bit ints
This CL makes the compiler understand that the type of
the len or cap of a map, slice, or string is 'int', not 'int32'.
It does not change the meaning of int, but it should make
the eventual change of the meaning of int in 6g a bit smoother.

Update #2188.

R=ken, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6542059
2012-09-24 14:59:44 -04:00
Russ Cox
0bf46d0cf3 cmd/ld: prepare for 64-bit ints
Use explicit IntSize constant instead of 4.

This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.

Update #2188.

R=ken, dave
CC=golang-dev
https://golang.org/cl/6554076
2012-09-24 14:59:09 -04:00
Russ Cox
5501a097a9 cmd/cgo: prepare for 64-bit ints
This CL makes the size of an int controlled by a variable
in cgo instead of hard-coding 4 (or 32 bits) in various places.

Update #2188.

R=iant, r, dave
CC=golang-dev
https://golang.org/cl/6548061
2012-09-24 14:58:57 -04:00
Russ Cox
0b08c9483f runtime: prepare for 64-bit ints
This CL makes the runtime understand that the type of
the len or cap of a map, slice, or string is 'int', not 'int32',
and it is also careful to distinguish between function arguments
and results of type 'int' vs type 'int32'.

In the runtime, the new typedefs 'intgo' and 'uintgo' refer
to Go int and uint. The C types int and uint continue to be
unavailable (cause intentional compile errors).

This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.

Update #2188.

R=iant, r, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6551067
2012-09-24 14:58:34 -04:00
Rémy Oudompheng
5e3fb887a3 cmd/[568]g: explain the purpose of various Reg fields.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6554062
2012-09-24 20:55:11 +02:00
Russ Cox
031b389ac1 cmd/gc: fix comment for caninl
Was describing an old implementation.

R=ken2
CC=golang-dev
https://golang.org/cl/6553066
2012-09-24 12:30:32 -04:00
Akshat Kumar
e42788628a cmd/dist, pkg/runtime: Plan 9, 64-bit: Get PID from TLS; remove use of `_tos'.
Using offsets from Tos is cumbersome and we've had problems
in the past. Since it's only being used to grab the PID, we'll just
get that from the default TLS instead.

R=rsc, rminnich, npe
CC=golang-dev
https://golang.org/cl/6543049
2012-09-24 12:24:45 -04:00
Rémy Oudompheng
36df358a30 cmd/6g: fix internal error with SSE registers.
Revision 63f7abcae015 introduced a bug caused by
code assuming registers started at X5, not X0.

Fixes #4138.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6558043
2012-09-23 18:22:03 +02:00
Shenghou Ma
ca5e9bfabc cmd/5g: fix build
R=rsc, r
CC=golang-dev
https://golang.org/cl/6552061
2012-09-23 15:05:44 +08:00
Russ Cox
05ac300830 cmd/gc: fix use of nil interface, slice
Fixes #3670.

R=ken2
CC=golang-dev
https://golang.org/cl/6542058
2012-09-22 20:42:11 -04:00
Russ Cox
658482d70f cmd/5g: fix register opt bug
The width was not being set on the address, which meant
that the optimizer could not find variables that overlapped
with it and mark them as having had their address taken.
This let to the compiler believing variables had been set
but never used and then optimizing away the set.

Fixes #4129.

R=ken2
CC=golang-dev
https://golang.org/cl/6552059
2012-09-22 10:01:35 -04:00
Joel Sing
49aa74ef7f cmd/cgo: use debug data for enums on windows
Use the debug data for enums on windows.

Fixes #4120.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/6545047
2012-09-22 17:57:54 +10:00
Russ Cox
c29f4e00a1 cmd/gc: fix a spurious -u compile error
Fixes #4082.

R=dsymonds
CC=golang-dev
https://golang.org/cl/6545055
2012-09-21 21:12:41 -04:00
Rob Pike
f934bb8eba cgo: set alignment to 1 for unions and classes; avoids crash from divide-by-zero
Fixes #4114.

R=golang-dev, iant, rsc, iant, devon.odell
CC=golang-dev
https://golang.org/cl/6553050
2012-09-22 07:25:41 +10:00
Rémy Oudompheng
413fbed341 cmd/6g: cosmetic improvements to regopt debugging.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6528044
2012-09-21 20:20:26 +02:00
Russ Cox
57ad05db15 cmd/6g: use all 16 float registers, optimize float moves
Fixes #2446.

R=ken2
CC=golang-dev
https://golang.org/cl/6557044
2012-09-21 13:39:09 -04:00
Joel Sing
31758b2c1a cmd/{ld,5l,6l,8l}: add support for OpenBSD ELF signatures
OpenBSD now requires ELF binaries to have a PT_NOTE that identifies
it as an OpenBSD binary. Refactor the existing NetBSD ELF signature
code and implement support for OpenBSD ELF signatures.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6489131
2012-09-21 12:51:39 +10:00
Lucio De Re
091388d8e9 cmd/ld: remove unused assignment
The calculation of datsize is redundant.

R=golang-dev, seed, rsc
CC=golang-dev
https://golang.org/cl/6503122
2012-09-20 14:58:33 -04:00
Joel Sing
9536480edc cgo: process DWARF info even when debug data is used for value
Always process the DWARF info, even when the const value is determined
using the debug data block. This ensures that the injected enum is
removed and future loads of the same constant do not trigger
inconsistent definitions.

Add tests for issues 2470 and 4054.
Fixes #4054.

R=golang-dev, fullung, dave, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6501101
2012-09-20 13:20:33 +10:00
David Symonds
5a93fea08e vet: fix rangeloop.
In a range loop, the presence of a value implies the presence of a key.
However, the presence of a value as an *ast.Ident does not imply that
the key is also an *ast.Ident, thus leading to a panic any time the
two argument form is used where the key is not an identifier.

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6540045
2012-09-20 08:12:47 +10:00
Robert Griesemer
83601807af gofmt: added testcase for files containing \r\n line endings
(see also issue 3961).

hexdump -c testdata/crlf.input
0000000   /   *  \r  \n  \t   S   o   u   r   c   e       c   o   n   t
0000010   a   i   n   i   n   g       C   R   /   L   F       l   i   n
0000020   e       e   n   d   i   n   g   s   .  \r  \n  \t   T   h   e
0000030       g   o   f   m   t   '   e   d       o   u   t   p   u   t
0000040       m   u   s   t       o   n   l   y       h   a   v   e
0000050   L   F  \r  \n  \t   l   i   n   e       e   n   d   i   n   g
0000060   s   .  \r  \n   *   /  \r  \n   p   a   c   k   a   g   e
0000070   m   a   i   n  \r  \n  \r  \n   f   u   n   c       m   a   i
0000080   n   (   )       {  \r  \n  \t   /   /       l   i   n   e
0000090   c   o   m   m   e   n   t  \r  \n  \t   p   r   i   n   t   l
00000a0   n   (   "   h   e   l   l   o   ,       w   o   r   l   d   !
00000b0   "   )       /   /       a   n   o   t   h   e   r       l   i
00000c0   n   e       c   o   m   m   e   n   t  \r  \n  \t   p   r   i
00000d0   n   t   l   n   (   )  \r  \n   }  \r  \n
00000db

hexdump -c testdata/crlf.golden
0000000   /   *  \n  \t   S   o   u   r   c   e       c   o   n   t   a
0000010   i   n   i   n   g       C   R   /   L   F       l   i   n   e
0000020       e   n   d   i   n   g   s   .  \n  \t   T   h   e       g
0000030   o   f   m   t   '   e   d       o   u   t   p   u   t       m
0000040   u   s   t       o   n   l   y       h   a   v   e       L   F
0000050  \n  \t   l   i   n   e       e   n   d   i   n   g   s   .  \n
0000060   *   /  \n   p   a   c   k   a   g   e       m   a   i   n  \n
0000070  \n   f   u   n   c       m   a   i   n   (   )       {  \n  \t
0000080   /   /       l   i   n   e       c   o   m   m   e   n   t  \n
0000090  \t   p   r   i   n   t   l   n   (   "   h   e   l   l   o   ,
00000a0       w   o   r   l   d   !   "   )       /   /       a   n   o
00000b0   t   h   e   r       l   i   n   e       c   o   m   m   e   n
00000c0   t  \n  \t   p   r   i   n   t   l   n   (   )  \n   }  \n
00000cf

R=rsc
CC=golang-dev
https://golang.org/cl/6526052
2012-09-19 14:14:21 -07:00
Shenghou Ma
4d7c81bc67 cmd/ld: consistent binary for cgo programs
We use pkg path instead of file name (which contains $WORK) in section symbols names.

R=golang-dev, fullung, rsc, iant
CC=golang-dev
https://golang.org/cl/6445085
2012-09-20 00:18:41 +08:00
Mikio Hara
1ad5f87635 cmd/api: fix signatures like func(x, y, z int)
Fixes writing of function parameter, result lists which
consist of multiple named or unnamed items with same type.

Fixes #4011.

R=golang-dev, bsiegert, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6475062
2012-09-19 07:04:12 +09:00
Andrew Gerrand
51e85612f9 vet: add range variable misuse detection
R=fullung, r, remyoudompheng, minux.ma, gri, rsc
CC=golang-dev
https://golang.org/cl/6494075
2012-09-18 14:19:31 -07:00
Dmitriy Vyukov
cc8cfefd8a race: linker changes
This is the second part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
This change makes the linker emit dependency on runtime/race package when supplied with -b flag.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6488074
2012-09-19 01:05:25 +04:00
Russ Cox
a29f3136b4 cmd/api: allow extension of interfaces with unexported methods
Fixes #4061.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6525047
2012-09-18 15:57:03 -04:00
Dmitriy Vyukov
8ed026e783 race: build system changes
This is the first part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
Adds -race flag to go command.
API change:
+pkg go/build, type Context struct, InstallTag string

R=rsc
CC=golang-dev
https://golang.org/cl/6488075
2012-09-18 23:47:15 +04:00
Dmitriy Vyukov
99b6e9f73b race: cmd/cgo changes
This is a part of a bigger change that adds data race detection feature:
https://golang.org/cl/6456044
This change breaks circular dependency between runtime/race and syscall packages.

R=rsc
CC=golang-dev
https://golang.org/cl/6498079
2012-09-18 23:42:18 +04:00
Daniel Morsing
804a43ca76 cmd/gc: fix double evaluation in interface comparison
During interface compare, the operands will be evaluated twice. The operands might include function calls for conversion, so make them cheap before comparing them.

R=rsc
CC=golang-dev
https://golang.org/cl/6498133
2012-09-18 17:40:53 +02:00
Dave Cheney
55ca5ab0be runtime: arm: abort if VFPv3 support missing
Fixes #3456.

This proposal is a reformulation of CL 5987063. This CL resets
the default GOARM value to 6 and allows the use of the VFPv3
optimisation if GOARM=7. Binaries built with this CL in place
will abort if GOARM=7 was used and the target host does not
support VFPv3.

R=minux.ma, rsc, ajstarks
CC=golang-dev
https://golang.org/cl/6501099
2012-09-18 09:55:07 +10:00
Lucio De Re
b29ed23ab5 build: fix various 'set and not used' for Plan 9
R=dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6501134
2012-09-17 17:25:26 -04:00
Francisco Souza
916ccbf165 cmd/go: reject relative values for GOPATH
Fixes #4062.

R=rsc, dave, r
CC=golang-dev, nicksaika
https://golang.org/cl/6488129
2012-09-17 13:44:55 -07:00
Daniel Morsing
551e263823 cmd/gc: add missing conversion from bool to interface in switches.
In switches without an expression, the compiler would not convert the implicit true to an interface, causing codegen errors.

Fixes #3980.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6497147
2012-09-17 21:29:10 +02:00
Russ Cox
ae42beafd3 cmd/go: fix build
TBR=r

TBR=r
CC=golang-dev
https://golang.org/cl/6496124
2012-09-14 12:21:57 -04:00
Russ Cox
ca75fdf972 cmd/go: treat all commands in exp/ as tools
Nothing in exp should get installed directly in bin,
at least not by default.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6497138
2012-09-14 12:06:21 -04:00
Rob Pike
f269f9a3c7 cmd/yacc: allow utf-8 token values
Also clean up the code and allow \U.
Fixes #3007.

R=golang-dev, rsc, 0xjnml
CC=golang-dev
https://golang.org/cl/6492105
2012-09-13 13:59:00 -07:00
Jan Ziak
032e5bfb30 ld: add .gcdata and .gcbss sections
R=rsc
CC=golang-dev
https://golang.org/cl/6281048
2012-09-13 15:59:34 -04:00
Daniel Morsing
d06dcd4595 cmd/gc: Specify which package import caused an redeclaration error.
Fixes #4012.

R=dave, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6490082
2012-09-13 18:40:50 +02:00
Russ Cox
6ee91ced92 cmd/pack: rename __.SYMDEF to __.GOSYMDEF
This fixes a problem with ELF tools thinking they know the
format of the symbol table, as we do not use any of the
standard formats for that table.

This change will probably annoy the Plan 9 users, but I
believe there are other incompatibilities already that mean
they have to use a Go-specific nm.

Fixes #3473.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6500117
2012-09-13 10:26:21 -04:00
Jan Ziak
d09afc2efb gc: generate garbage collection info for types
R=rsc, nigeltao, minux.ma
CC=golang-dev
https://golang.org/cl/6290043
2012-09-12 12:08:27 -04:00
Russ Cox
792518c656 cmd/dist: emit \r in env -w output
go tool dist env -w is supposed to print a Windows batch file.
Normally Windows will execute batch files without \r before \n,
but issue 3060 reports that if the file ends up containing paths
written in Chinese, Windows 7 cannot execute it without the \r.
So add the \r.

Fixes #3060.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6498120
2012-09-12 12:05:34 -04:00
Nigel Tao
a9a675ec35 cmd/6g, cmd/8g: clean up unnecessary switch code in componentgen.
Code higher up in the function already catches these cases.

R=remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6496106
2012-09-12 21:47:05 +10:00
Daniel Morsing
8fd65b0e1d cmd/gc: Inline pointer sized T2I interface conversions
This CL also adds support for marking the likelyness of IF nodes in the AST being true. This feature is being used here to mark the slow path as unlikely.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2IUintptr           16            1  -91.63%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5416917000   5461355000   +0.82%
BenchmarkFannkuch11      3810355000   3842609000   +0.85%
BenchmarkGobDecode         19950950     19855420   -0.48%
BenchmarkGobEncode         11301220     11308530   +0.06%
BenchmarkGzip             548119600    546869200   -0.23%
BenchmarkGunzip           176145400    180208300   +2.31%
BenchmarkJSONEncode        93117400     70163100  -24.65%
BenchmarkJSONDecode       406626800    409999200   +0.83%
BenchmarkMandelbrot200      6300992      6317866   +0.27%
BenchmarkParse              7664396      7451625   -2.78%
BenchmarkRevcomp         1189424000   1412332000  +18.74%
BenchmarkTemplate         491308400    458654200   -6.65%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            38.47        38.66    1.00x
BenchmarkGobEncode            67.92        67.87    1.00x
BenchmarkGzip                 35.40        35.48    1.00x
BenchmarkGunzip              110.16       107.68    0.98x
BenchmarkJSONEncode           20.84        27.66    1.33x
BenchmarkJSONDecode            4.77         4.73    0.99x
BenchmarkParse                 7.56         7.77    1.03x
BenchmarkRevcomp             213.69       179.96    0.84x
BenchmarkTemplate              3.95         4.23    1.07x

R=rsc, dave, nigeltao
CC=golang-dev
https://golang.org/cl/6351090
2012-09-11 21:42:30 +02:00
Nigel Tao
0184081eb9 cmd/gc: recognize small TPTR64 values as small integer constants.
Given the following Go program:

func sum(s []int) int {
        ret := 0
        for _, x := range s {
                ret += x
        }
        return ret
}

6g would previously generate:

--- prog list "sum" ---
0000 (main.go:3) TEXT    sum+0(SB),$0-24
0001 (main.go:5) MOVQ    s+0(FP),CX
0002 (main.go:5) MOVL    s+8(FP),DI
0003 (main.go:5) MOVL    s+12(FP),BX
0004 (main.go:4) MOVL    $0,SI
0005 (main.go:5) MOVL    $0,AX
0006 (main.go:5) JMP     ,8
0007 (main.go:5) INCL    ,AX
0008 (main.go:5) CMPL    AX,DI
0009 (main.go:5) JGE     $0,16
0010 (main.go:5) MOVL    (CX),DX
0011 (main.go:5) MOVQ    $4,BX
0012 (main.go:5) ADDQ    CX,BX
0013 (main.go:5) MOVQ    BX,CX
0014 (main.go:6) ADDL    DX,SI
0015 (main.go:5) JMP     ,7
0016 (main.go:8) MOVL    SI,.noname+16(FP)
0017 (main.go:8) RET     ,

and now generates:

--- prog list "sum" ---
0000 (main.go:3) TEXT    sum+0(SB),$0-24
0001 (main.go:5) MOVQ    s+0(FP),CX
0002 (main.go:5) MOVL    s+8(FP),DI
0003 (main.go:5) MOVL    s+12(FP),BX
0004 (main.go:4) MOVL    $0,SI
0005 (main.go:5) MOVL    $0,AX
0006 (main.go:5) JMP     ,8
0007 (main.go:5) INCL    ,AX
0008 (main.go:5) CMPL    AX,DI
0009 (main.go:5) JGE     $0,14
0010 (main.go:5) MOVL    (CX),BP
0011 (main.go:5) ADDQ    $4,CX
0012 (main.go:6) ADDL    BP,SI
0013 (main.go:5) JMP     ,7
0014 (main.go:8) MOVL    SI,.noname+16(FP)
0015 (main.go:8) RET     ,

The key difference is that
0011 (main.go:5) MOVQ    $4,BX
0012 (main.go:5) ADDQ    CX,BX
0013 (main.go:5) MOVQ    BX,CX
has changed to
0011 (main.go:5) ADDQ    $4,CX

R=rsc, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6506089
2012-09-11 19:45:28 +10:00
Rémy Oudompheng
b45b6fd1c7 cmd/6g, cmd/8g: do not LEA[LQ] interfaces when calling methods.
It is enough to load directly the data word and the itab word
from memory, so we save a LEA instruction for each method call,
and allow elimination of some extra temporaries.

Update #1914.

R=daniel.morsing, rsc
CC=golang-dev, remy
https://golang.org/cl/6501110
2012-09-11 08:45:23 +02:00
Rémy Oudompheng
ff642e290f cmd/6g, cmd/8g: eliminate extra agen for nil comparisons.
Removes an extra LEAL/LEAQ instructions there and usually saves
a useless temporary in the idiom
    if err := foo(); err != nil {...}

Generated code is also less involved:
    MOVQ err+n(SP), AX
    CMPQ AX, $0
(potentially CMPQ n(SP), $0) instead of
    LEAQ err+n(SP), AX
    CMPQ (AX), $0

Update #1914.

R=daniel.morsing, nigeltao, rsc
CC=golang-dev, remy
https://golang.org/cl/6493099
2012-09-11 08:08:40 +02:00
Rob Pike
6ce4930365 gc: initial BOM is legal.
Fixes #4040.

R=rsc
CC=golang-dev
https://golang.org/cl/6497098
2012-09-10 13:03:07 -07:00
Adam Langley
2c5b53866c undo CL 6498092 / 4ff71bc1a199
Broke tests on 386.

««« original CL description
6l/8l: emit correct opcodes to F(SUB|DIV)R?D.

When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6498092
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/6492100
2012-09-10 15:52:36 -04:00
Adam Langley
72fa142fc5 6l/8l: emit correct opcodes to F(SUB|DIV)R?D.
When the destination was not F0, 6l and 8l swapped FSUBD/FSUBRD and
FDIVD/FDIVRD.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6498092
2012-09-10 15:35:39 -04:00
Nigel Tao
5d7ece6f44 6g: delete unnecessary OXXX initialization.
No longer necessary after https://golang.org/cl/6497073/
removed the `if(n5.op != OXXX) { regfree(&n5); }`.

R=remy, r
CC=golang-dev, rsc
https://golang.org/cl/6498101
2012-09-10 11:24:34 +10:00
Rémy Oudompheng
ae0862c1ec cmd/8g: import componentgen from 6g.
This makes the compilers code more similar and improves
code generation a lot.

The number of LEAL instructions generated for cmd/go drops
by 60%.

% GOARCH=386 go build -gcflags -S -a cmd/go | grep LEAL | wc -l
Before:       89774
After:        47548

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloatDecimal                  540          444  -17.78%
BenchmarkAppendFloat                        1160         1035  -10.78%
BenchmarkAppendFloatExp                     1060          922  -13.02%
BenchmarkAppendFloatNegExp                  1053          920  -12.63%
BenchmarkAppendFloatBig                     1773         1558  -12.13%
BenchmarkFormatInt                         13065        12481   -4.47%
BenchmarkAppendInt                         10981         9900   -9.84%
BenchmarkFormatUint                         3804         3650   -4.05%
BenchmarkAppendUint                         3506         3303   -5.79%
BenchmarkUnquoteEasy                         714          683   -4.34%
BenchmarkUnquoteHard                        5117         2915  -43.03%

Update #1914.

R=nigeltao, rsc, golang-dev
CC=golang-dev, remy
https://golang.org/cl/6489067
2012-09-09 20:30:08 +02:00
Rob Pike
cbc9ab75cb cmd/yacc: allow leading underscore in token name
Fixes #4037.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6488093
2012-09-07 09:31:51 -07:00
Rémy Oudompheng
acbe6c94d7 cmd/6g: avoid taking the address of slices unnecessarily.
The main case where it happens is when evaluating &s[i] without
bounds checking, which usually happens during range loops (i=0).

This allows registerization of the corresponding variables,
saving 16 bytes of stack frame for each such range loop and a
LEAQ instruction.

R=golang-dev, rsc, dave
CC=golang-dev, remy
https://golang.org/cl/6497073
2012-09-07 06:54:42 +02:00
Joel Sing
4cfcb4a04b cgo: use debug data section for ELF
When generating enums use the debug data section instead of the
DWARF debug info, if it is available in the ELF file. This allows
mkerrors.sh to work correctly on OpenBSD/386 and NetBSD/386.

Fixes #2470.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6495090
2012-09-07 13:32:40 +10:00
Rob Pike
a225eaf9b7 cmd/yacc: always import fmt, safely
The parser depends on it but the client might not import it, so make sure it's there.
Fixes #4038.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6497094
2012-09-06 14:58:37 -07:00
Nigel Tao
481e5c6ad0 cmd/gc: re-order some OFOO constants. Rename ORRC to ORROTC to be
consistent with OLROT. Delete unused OBAD, OLRC.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/6489082
2012-09-06 10:47:25 +10:00
Nigel Tao
1c675ac89d cmd/gc: add commentary to the OXXX constants.
R=rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/6495074
2012-09-05 09:34:52 +10:00
Shenghou Ma
88ba4de152 cmd/5l: embed $GOARM value into binary as runtime.goarm
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6449127
2012-09-03 03:51:13 +08:00
Russ Cox
a96c2b8c1a cmd/gc: fix PkgPath of byte, rune types
Fixes #3853.

R=ken2
CC=golang-dev
https://golang.org/cl/6492071
2012-09-01 19:55:55 -04:00
Shenghou Ma
c5444a8937 cmd/ld: support zero-filled section for Mach-O files
R=golang-dev, r, dave, rsc
CC=golang-dev
https://golang.org/cl/6492069
2012-09-02 04:50:58 +08:00
Daniel Morsing
1c2021ca14 cmd/gc: Suggest *T in error for x.(T) if it would work.
Accomplished by synchronizing the formatting of conversion errors between typecheck.c and subr.c

Fixes #3984.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6500064
2012-09-01 13:52:55 -04:00
Rémy Oudompheng
8f3c2055bd cmd/6g, cmd/8g: eliminate short integer arithmetic when possible.
Fixes #3909.
Fixes #3910.

R=rsc, nigeltao
CC=golang-dev
https://golang.org/cl/6442114
2012-09-01 16:40:54 +02:00
Russ Cox
508bfda6d3 cmd/go: be clear that import loops are bad
There was mail on golang-nuts a few weeks ago
from someone who understood the message perfectly
and knew he had a cyclic dependency but assumed
that Go, like Python or Java, was supposed to handle it.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6488069
2012-09-01 10:34:58 -04:00
Rémy Oudompheng
ba97d52b85 cmd/gc: fix escape analysis bug with variable capture in loops.
Fixes #3975.

R=rsc, lvd
CC=golang-dev, remy
https://golang.org/cl/6475061
2012-08-31 22:23:37 +02:00
Akshat Kumar
a72bebf6e1 src: Add support for 64-bit version of Plan 9
This set of changes extends the Plan 9 support
to include the AMD64 architecture and should
work on all versions of Plan 9.

R=golang-dev, rminnich, noah.evans, rsc, minux.ma, npe
CC=akskuma, golang-dev, jfflore, noah.evans
https://golang.org/cl/6479052
2012-08-31 13:21:13 -04:00
Daniel Morsing
85ce3c7241 cmd/gc: mark broken type declarations as broken.
This fixes a spurious 'invalid recursive type' error, and stops the compiler from emitting errors on uses of the invalid type.

Fixes #3766.

R=golang-dev, dave, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6443100
2012-08-31 13:02:29 -04:00
Andrew Balholm
bdf6a43e23 cmd/yacc/units.txt: fix exchange rates
In the example "units" program for goyacc, the exchange rates were
        reciprocals of the correct amounts. Turn them right-side-up
        and update them to current figures.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6495053
2012-08-29 10:06:37 -07:00
Shenghou Ma
e607380ff6 cmd/ld: handle a special case of scattered relocation 2/1 on Darwin/386
Fixes #1635.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/6496043
2012-08-29 23:42:05 +08:00
Shenghou Ma
f653dfeb49 cmd/api: recognize version "devel" as dev. branch and apply -next
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6476066
2012-08-28 04:03:27 +08:00
Shenghou Ma
e80f6a4de1 cmd/6g: fix float32/64->uint64 conversion
CVTSS2SQ's rounding mode is controlled by the RC field of MXCSR;
as we specifically need truncate semantic, we should use CVTTSS2SQ.

    Fixes #3804.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6352079
2012-08-23 14:35:26 +08:00
Shenghou Ma
1cf27acfed cmd/ld: set ELF header flags for our Linux/ARM binary
To make it more compliant.
This won't affect the behavior of running on OABI-only kernels.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6475044
2012-08-23 14:33:41 +08:00
Nigel Tao
251199c430 cmd/8g: roll back the small integer constant optimizations introduced
in 13416:67c0b8c8fb29 "faster code, mainly for rotate" [1]. The codegen
can run out of registers if there are too many small-int arithmetic ops.

An alternative approach is to copy 6g's sbop/abop codegen to 8g, but
this change is less risky.

Fixes #3835.

[1] http://code.google.com/p/go/source/diff?spec=svn67c0b8c8fb29b1b7b6221977af6b89cae787b941&name=67c0b8c8fb29&r=67c0b8c8fb29b1b7b6221977af6b89cae787b941&format=side&path=/src/cmd/8g/cgen.c

R=rsc, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6450163
2012-08-23 16:17:22 +10:00
Joel Sing
2281c3294b cmd/go: fix cgo linking on netbsd
NetBSD's built-in linker script for 'ld -r' does not provide a
SEARCH_DIR. As a result libgcc.a is not found when -lgcc is used.

Work around this by determining the path to libgcc (by invoking
gcc with the -print-libgcc-file-name option) and explicitly
referencing the resulting library.

R=golang-dev, iant, aram, lucio.dere, minux.ma
CC=golang-dev
https://golang.org/cl/6470044
2012-08-22 22:23:56 +10:00
Shenghou Ma
b1532344ef cmd/ld: skip R_*_NONE relocations, fix Linux/386 build again
The last fix was wrong w.r.t C's operator precedence,
and it also failed to really skip the NONE relocation.

The offending R_386_NONE relocation is a absolute
relocation in section .eh_frame.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/6463058
2012-08-21 00:34:06 +08:00
Alex Brainman
58064a7cab pprof: make it work on windows again
- pprof is a perl script, so go command should invoke
  perl instead of trying to run pprof directly;
- pprof should use "go tool nm" unconditionally on windows,
  no one else can extract symbols from Go program;
- pprof should use "go tool nm" instead of "6nm".

Fixes #3879.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6445082
2012-08-18 17:03:32 +10:00
Shenghou Ma
93fac8859c cmd/ld: explicitly ignore R_*_NONE relocation to fix build
I don't know why this relocation is used.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6464070
2012-08-17 09:11:58 +08:00
Shenghou Ma
551d8b9ff5 cmd/go: new cgo build procedure
This CL adds a step to the build procedure for cgo programs. It uses 'ld -r'
to combine all gcc compiled object file and generate a relocatable object file
for our ld. Additionally, this linking step will combine some static linking
gcc library into the relocatable object file, so that we can use libgcc,
libmingwex and libmingw32 without problem.

   Fixes #3261.
   Fixes #1741.
   Added a testcase for linking in libgcc.

TODO:
1. still need to fix the INDIRECT_SYMBOL_LOCAL problem on Darwin/386.
2. still need to enable the libgcc test on Linux/ARM, because 5l can't deal
with thumb libgcc.

Tested on Darwin/amd64, Darwin/386, FreeBSD/amd64, FreeBSD/386, Linux/amd64,
Linux/386, Linux/ARM, Windows/amd64, Windows/386

R=iant, rsc, bradfitz, coldredlemur
CC=golang-dev
https://golang.org/cl/5822049
2012-08-17 03:42:34 +08:00
Daniel Morsing
b04c890a89 cmd/gc: Don't claim type assertion would help when it wont.
Fixes #3465.

R=golang-dev, rsc, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/6448097
2012-08-15 16:53:06 -07:00
Francisco Souza
34976b985a cmd/go: skipping relative paths on go test -i ./...
Fixes #3896.

R=rsc, rogpeppe, r
CC=golang-dev
https://golang.org/cl/6457075
2012-08-15 07:32:49 -07:00
Robert Hencke
16a82828a2 5l: trivial whitespace cleanup
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6446131
2012-08-15 10:32:44 +10:00
Robert Griesemer
f597fa67c1 godoc: report error for directories with multiple packages
Fixes #3922.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6453094
2012-08-09 16:10:46 -07:00
Shenghou Ma
af92b29fe6 cmd/5l: add PT_PAX_FLAGS ELF header
Although I don't use PAX enabled ARM kernels, PAX
does have support for ARM, so we're better off add
PT_PAX_FLAGS now in case people use PAX kernels.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6453092
2012-08-09 08:47:43 +08:00
Shenghou Ma
0cb04168d3 cmd/5l: dwarf line number support for Linux/ARM
Part of issue 3747.

R=dave, lvd, rsc
CC=golang-dev
https://golang.org/cl/6084044
2012-08-07 10:09:24 +08:00
Shenghou Ma
df623d03ab cmd/go: remove $WORK paths in generated binaries
Fixes #3748.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6357064
2012-08-07 10:00:58 +08:00
Rémy Oudompheng
77f3e189d2 runtime: faster string equality.
benchmark                                old ns/op    new ns/op    delta
BenchmarkCompareStringEqual                     51           35  -30.20%
BenchmarkCompareStringIdentical                 51            7  -85.71%
BenchmarkCompareStringSameLength                25           18  -28.29%
BenchmarkCompareStringDifferentLength            2            2   +1.46%

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6450092
2012-08-05 21:35:41 +02:00
Dmitriy Vyukov
2f2df2aceb cmd/go: allow to use syso files with cgo
I have C functions implemented in .syso file (rather than .so or inlined in .go file).
W/o this change the gcc invocation fails with undefined symbols.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6352076
2012-08-04 18:02:12 +03:00
Dmitriy Vyukov
8be5e8a419 cmd/cc: allow to call nested packages from within C code
E.g. sync/atomic.LoadInt32() can be called as sync»atomic·LoadInt32()

R=rsc
CC=golang-dev
https://golang.org/cl/6448057
2012-08-04 16:11:53 +04:00
Ian Lance Taylor
6fa38e5e0a cmd/go, go/build, misc/swig: add SWIG support to Go tool
R=adg, rsc, franciscossouza, seb.binet, gen.battle
CC=golang-dev
https://golang.org/cl/5845071
2012-08-03 18:08:43 -07:00
Michał Derkacz
dee5adcf74 5a, 5l, math: Add support for ABSD, ABSF floating point instructions.
R=golang-dev, dave, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6225051
2012-08-03 16:15:11 -04:00
Rémy Oudompheng
823962c521 cmd/8g: fix miscompilation due to BADWIDTH.
Fixes #3899.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6453084
2012-08-03 22:05:51 +02:00
Rémy Oudompheng
f4f1ba2b1e cmd/gc: accept switches on comparable arrays.
The compiler is incorrectly rejecting switches on arrays of
comparable types. It also doesn't catch incomparable structs
when typechecking the switch, leading to unreadable errors
during typechecking of the generated code.

Fixes #3894.

R=rsc
CC=gobot, golang-dev, r, remy
https://golang.org/cl/6442074
2012-08-03 21:47:26 +02:00
Russ Cox
3f34248a77 cmd/ld: add PT_PAX_FLAGS ELF header
PAX systems are Linux systems that are more paranoid about memory permissions.
These flags tell them to relax when running Go binaries.

Fixes #47.

R=iant
CC=golang-dev
https://golang.org/cl/6326054
2012-08-03 15:27:35 -04:00
Rémy Oudompheng
b6ea905ed9 cmd/gc: fix inlining bug with receive operator.
The receive operator was given incorrect precedence
resulting in incorrect deletion of parentheses.

Fixes #3843.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6442049
2012-08-01 00:45:26 +02:00
Shenghou Ma
9de61e7c8c cmd/5l, cmd/ld: add support for R_ARM_GOT_PREL
Android NDK's gcc 4.6 generates this relocation for runtime/cgo.

R=rsc
CC=golang-dev
https://golang.org/cl/6450056
2012-07-30 18:48:00 -04:00
Shenghou Ma
dd62bb4753 cmd/cgo: use 1 as last entry for __cgodebug_data
LLVM-based gcc will place all-zero data in a zero-filled
        section, but our debug/macho can't handle that.
        Fixes #3821.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6444049
2012-07-30 18:44:48 -04:00
Rémy Oudompheng
6cbf35c172 cmd/gc: fix initialization order involving method calls.
They were previously ignored when deciding order and
detecting dependency loops.
Fixes #3824.

R=rsc, golang-dev
CC=golang-dev, remy
https://golang.org/cl/6455055
2012-07-30 09:14:49 +02:00
Russ Cox
7711e61031 cmd/go: show $GOPATH in 'go env' output
Also, sort output.

R=golang-dev, patrick, dave, iant
CC=golang-dev, patrick
https://golang.org/cl/6446064
2012-07-30 00:22:42 -04:00
Daniel Morsing
dd166b9437 cmd/gc: point "no new variables" error at right line number.
Fixes #3856.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6455056
2012-07-29 22:24:19 -04:00
Ian Lance Taylor
24ae7e686d cgo: fix declarations in _cgo_export.c
Declare crosscall2.  Declare the functions passed to it as
returning void, rather than relying on implicit return type.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6432060
2012-07-25 14:14:37 -07:00
Dave Cheney
fba47dc3b1 cmd/godoc: delete -path flag
Fixes #3453.

R=golang-dev, gri, jeff, bradfitz
CC=golang-dev
https://golang.org/cl/6350086
2012-07-25 10:49:50 -07:00
Ian Lance Taylor
b575a98121 cgo: add -gccgopkgpath option to match gccgo -fgo-pkgpath
R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/6416056
2012-07-20 16:58:08 -07:00
Rob Pike
f49b7b0acf cmd/vet: provide flags to control which tests to run
By default, all are still run, but a particular test can be
selected with the new flags.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6395053
2012-07-16 14:03:11 -07:00
Rémy Oudompheng
656b192c16 cmd/gc: reject use of ... with multiple-valued expressions.
Fixes #3334.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6350103
2012-07-13 08:05:41 +02:00
Rémy Oudompheng
1ca7bc268b cmd/gc: avoid an internal error on invalid type switch.
The error was caused by a call to implements() even when
the type switch variable was not an interface.

Fixes #3786.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6354102
2012-07-12 23:31:36 +02:00
Rémy Oudompheng
bd0bb2bc39 cmd/gc: fix error message for type errors involving conversions.
Fixes #3818.

R=golang-dev, rsc, r
CC=golang-dev, remy
https://golang.org/cl/6352106
2012-07-12 23:26:52 +02:00
Dave Cheney
eb1c03eacb cmd/pack: remove unused paging logic
This is the remainder of https://golang.org/cl/4601051.

Partially addresses issue 2705.

R=golang-dev, r, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/6354066
2012-07-12 10:14:07 +10:00
Pieter Droogendijk
34b10d7482 cmd/dist: Make verbose messages print to stderr
Made the following changes:
 - Export errprintf() from all three OS-specific modules
 - Added errprintf() to a.h
 - Moved errprintf() in windows.c under xprintf(), since they are so similar
 - Replaced all instances of xprintf() with errprintf() where a vflag check is done
Fixes #3788.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6346056
2012-07-06 15:00:18 +10:00
Shenghou Ma
a49172663c cmd/cgo: make typedef map traversal order consistent
So that _cgo_gotypes.go will be the same for the same source
        code.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6357067
2012-07-05 15:24:33 -04:00
Nigel Tao
18e86644a3 cmd/gc: cache itab lookup in convT2I.
There may be further savings if convT2I can avoid the function call
if the cache is good and T is uintptr-shaped, a la convT2E, but that
will be a follow-up CL.

src/pkg/runtime:
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ISmall             43           15  -64.01%
BenchmarkConvT2IUintptr           45           14  -67.48%
BenchmarkConvT2ILarge            130          101  -22.31%

test/bench/go1:
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    8588997000   8499058000   -1.05%
BenchmarkFannkuch11      5300392000   5358093000   +1.09%
BenchmarkGobDecode         30295580     31040190   +2.46%
BenchmarkGobEncode         18102070     17675650   -2.36%
BenchmarkGzip             774191400    771591400   -0.34%
BenchmarkGunzip           245915100    247464100   +0.63%
BenchmarkJSONEncode       123577000    121423050   -1.74%
BenchmarkJSONDecode       451969800    596256200  +31.92%
BenchmarkMandelbrot200     10060050     10072880   +0.13%
BenchmarkParse             10989840     11037710   +0.44%
BenchmarkRevcomp         1782666000   1716864000   -3.69%
BenchmarkTemplate         798286600    723234400   -9.40%

R=rsc, bradfitz, go.peter.90, daniel.morsing, dave, uriel
CC=golang-dev
https://golang.org/cl/6337058
2012-07-03 09:09:05 +10:00
Shenghou Ma
a732cbb593 cmd/gc: add missing case for OCOM in defaultlit()
Fixes #3765.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6349064
2012-07-02 09:33:22 +08:00
Amir Mohammad Saied
35030a9966 cmd/go: httpGet function does not use global variable httpClient
No change, just for consistency.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6346048
2012-06-30 12:27:57 -07:00
Pieter Droogendijk
735780c27e cmd/dist: Make windows.c's fatal() print to stderr
Generating env.bat using dist env -wp > env.bat failed silently
if case of an error, because the message was redirected to env.bat.
Verbose messages still go to stdout, causing problems, but that's
a seperate change.
Made errprintf() identical to xprintf(), except for the output handle.
Yes, it's duplicate code, but most of the function is unpacking
the argument list and preparing it for WriteFile(), which has to be
done anyway.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6343047
2012-07-01 00:27:05 +10:00
Shenghou Ma
33d2b495c5 cmd/cgo: generate definitions for GoSlice
Fixes #3741.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6308076
2012-06-30 12:40:07 +08:00
Robert Griesemer
96a609c2d7 gofmt: handle comments correctly in rewrites
R=rsc
CC=golang-dev
https://golang.org/cl/6294076
2012-06-25 13:58:28 -07:00
Robert Griesemer
277e7e57ca go/ast: minor comment maps API change
This is a new, not yet committed API.

- Changed NewCommentMap to be independent of
  *File nodes and more symmetric with the
  Filter and Comments methods.

- Implemented Update method for use in
  AST modifications.

- Implemented String method for debugging

R=rsc
CC=golang-dev
https://golang.org/cl/6303086
2012-06-25 11:27:54 -07:00
Nigel Tao
8f84328fdc cmd/gc: inline convT2E when T is uintptr-shaped.
GOARCH=amd64 benchmarks

src/pkg/runtime
benchmark                  old ns/op    new ns/op    delta
BenchmarkConvT2ESmall             10           10   +1.00%
BenchmarkConvT2EUintptr            9            0  -92.07%
BenchmarkConvT2EBig               74           74   -0.27%
BenchmarkConvT2I                  27           26   -3.62%
BenchmarkConvI2E                   4            4   -7.05%
BenchmarkConvI2I                  20           19   -2.99%

test/bench/go1
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5930908000   5937260000   +0.11%
BenchmarkFannkuch11      3927057000   3933556000   +0.17%
BenchmarkGobDecode         21998090     21870620   -0.58%
BenchmarkGobEncode         12725310     12734480   +0.07%
BenchmarkGzip             567617600    567892800   +0.05%
BenchmarkGunzip           178284100    178706900   +0.24%
BenchmarkJSONEncode        87693550     86794300   -1.03%
BenchmarkJSONDecode       314212600    324115000   +3.15%
BenchmarkMandelbrot200      7016640      7073766   +0.81%
BenchmarkParse              7852100      7892085   +0.51%
BenchmarkRevcomp         1285663000   1286147000   +0.04%
BenchmarkTemplate         566823800    567606200   +0.14%

I'm not entirely sure why the JSON* numbers have changed, but
eyeballing the profile suggests that it could be spending less
and more time in runtime.{new,old}stack, so it could simply be
stack-split boundary noise.

R=rsc, dave, bsiegert, dsymonds
CC=golang-dev
https://golang.org/cl/6280049
2012-06-14 10:43:20 +10:00
Robert Griesemer
8140cd9149 godoc: show comments in various filtered views
Fixes #3454.

R=rsc
CC=golang-dev
https://golang.org/cl/6305069
2012-06-13 13:32:59 -07:00
Russ Cox
0c2f0cca7c cmd/api: handle empty API file, ignore -next in release
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6298063
2012-06-08 13:44:13 -04:00
Dave Cheney
072e36d5ef cmd/5c, cmd/5g, cmd/5l: fix cross compilation failure on darwin
Fixes #3708.

The fix to allow 5{c,g,l} to compile under clang 3.1 broke cross
compilation on darwin using the Apple default compiler on 10.7.3.

This failure was introduced in 9b455eb64690.

This has been tested by cross compiling on darwin/amd64 to linux/arm using

* gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
* clang version 3.1 (branches/release_31)

As well as on linux/arm using

* gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
* Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
* Debian clang version 3.1-4 (branches/release_31) (based on LLVM 3.1)

R=consalus, rsc
CC=golang-dev
https://golang.org/cl/6307058
2012-06-08 13:13:02 +10:00
Shenghou Ma
a0084b3494 cmd/5a, cmd/5l: add MULW{T,B} and MULAW{T,B} support for ARM
Supported in ARMv5TE and above.
        Also corrected MULA disassembly listing.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6265045
2012-06-08 02:42:28 +08:00
Russ Cox
f51390b23c cmd/cgo: make Go code order deterministic
The type declarations were being generated using
a range over a map, which meant that successive
runs produced different orders. This will make sure
successive runs produce the same files.

Fixes #3707.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6300062
2012-06-07 12:37:50 -04:00
Russ Cox
b185de82a4 cmd/gc: limit data disassembly to -SS
This makes -S useful again.

R=ken2
CC=golang-dev
https://golang.org/cl/6302054
2012-06-07 12:05:34 -04:00
Russ Cox
2a9410c19c cmd/gc: fix LEAQ $0, SI bug
Cannot take effective address of constant.

Fixes #3670.

R=ken2
CC=golang-dev
https://golang.org/cl/6299055
2012-06-07 11:59:18 -04:00
Russ Cox
9fe424737b cmd/gc: run escape analysis in call graph dependency order
If there are mutually recursive functions, there is a cycle in
the dependency graph, so the order is actually dependency order
among the strongly connected components: mutually recursive
functions get put into the same batch and analyzed together.
(Until now the entire package was put in one batch.)

The non-recursive case (single function, maybe with some
closures inside) will be able to be more precise about inputs
that escape only back to outputs, but that is not implemented yet.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6304050
2012-06-07 03:15:09 -04:00
Russ Cox
6363fc5aa6 cmd/gc: fix type checking loop
CL 4313064 fixed its test case but did not address a
general enough problem:

type T1 struct { F *T2 }
type T2 T1
type T3 T2

could still end up copying the definition of T1 for T2
before T1 was done being evaluated, or T3 before T2
was done.

In order to propagate the updates correctly,
record a copy of an incomplete type for re-execution
once the type is completed. Roll back CL 4313064.

Fixes #3709.

R=ken2
CC=golang-dev, lstoakes
https://golang.org/cl/6301059
2012-06-07 03:06:40 -04:00
Russ Cox
f18ced3fc9 cmd/gc: delete dead code
R=ken2
CC=golang-dev
https://golang.org/cl/6307050
2012-06-07 02:15:23 -04:00
Russ Cox
744b23fe48 cmd/gc: do not crash on struct with _ field
Fixes #3607.

R=ken2
CC=golang-dev
https://golang.org/cl/6296052
2012-06-07 02:05:08 -04:00
Russ Cox
ee5f59ab4f cmd/gc: preserve side effects during inlining of function with _ argument
Fixes #3593.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/6305061
2012-06-07 01:54:07 -04:00
Russ Cox
8022a1a588 cmd/gc: mark output of typename as type-checked
R=ken2
CC=golang-dev
https://golang.org/cl/6302051
2012-06-07 00:51:11 -04:00
Dave Cheney
d2d990cc0a cmd/5c, cmd/5g, cmd/5l: fix array indexing warning under Clang 3.1
This should be the last of them.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6297043
2012-06-06 08:18:55 +10:00
Rémy Oudompheng
a7059cc793 cmd/[568]g: correct freeing of allocated Regs.
R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/6281050
2012-06-05 06:43:15 +02:00
Nigel Tao
6763e5b6cd gc: fix typo.
There already is a "Phase 6" a few lines above.

R=rsc
CC=golang-dev
https://golang.org/cl/6270054
2012-06-05 11:56:32 +10:00
Russ Cox
25922c0658 cmd/gc: introduce hidden closure functions earlier
The original implementation of closures created the
underlying top-level function during walk, which is fairly
late in the compilation process and caused ordering-based
complications due to earlier stages that had to be repeated
any number of times.

Create the underlying function during typecheck, much
earlier, so that later stages can be run just once.

The result is a simpler compilation sequence.

R=ken2
CC=golang-dev
https://golang.org/cl/6279049
2012-06-04 17:07:59 -04:00
Nigel Tao
947a3ddf87 cmd/gc: recognize u<<1 op u>>31 as a rotate when op is ^, not just |.
R=rsc
CC=golang-dev
https://golang.org/cl/6249071
2012-06-04 20:53:32 +10:00
Shenghou Ma
5612fd770d api: add Linux/ARM to go1 API
It's very unfortunate that the type of Data field of struct
RawSockaddr is [14]uint8 on Linux/ARM instead of [14]int8
on all the others.
btw, it should be [14]int8 according to my header files.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6275050
2012-06-04 15:21:58 +08:00
Russ Cox
b1cb5f5dcb cmd/5g: fix typo
TBR=lvd
CC=golang-dev
https://golang.org/cl/6275048
2012-06-02 23:57:38 -04:00
Luuk van Dijk
40af78c19e cmd/gc: inline slice[arr,str] in the frontend (mostly).
R=rsc, ality, rogpeppe, minux.ma, dave
CC=golang-dev
https://golang.org/cl/5966075
2012-06-02 22:50:57 -04:00
Shenghou Ma
d186d07eda cmd/5a, cmd/5l, math: add CLZ instruction for ARM
Supported in ARMv5 and above.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6284043
2012-06-03 03:08:49 +08:00
Jan Ziak
65e61d5770 runtime: add (unused for now) gc field to type information
R=rsc
CC=golang-dev
https://golang.org/cl/6255074
2012-06-02 14:02:44 -04:00
Shenghou Ma
d87bc2f0c0 cmd/5c, cmd/5g, cmd/5l: enable use of R12, F8-F15
R=dave, rsc
CC=golang-dev
https://golang.org/cl/6248070
2012-06-02 12:54:28 -04:00
Brad Fitzpatrick
b7c2ade696 api: add FreeBSD to go1 API
Now that gri has made go/parser 15% faster, I offer this
change to slow back down cmd/api ~proportionately, adding
FreeBSD to the go1-checked set of platforms.

Really we should have done this earlier. This will prevent us
from breaking FreeBSD compatibility accidentally in the
future.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6279044
2012-06-01 18:42:36 -07:00
Russ Cox
c48ce6930f cmd/6l: loop alignment, disabled
Saving the code in case we improve things enough that
it matters later, but at least right now it is not worth doing.

R=ken2
CC=golang-dev
https://golang.org/cl/6248071
2012-06-01 10:23:15 -04:00
Russ Cox
96b0594833 cmd/5g, cmd/6g, cmd/8g: delete clearstk
Dreg from https://golang.org/cl/4629042

R=ken2
CC=golang-dev
https://golang.org/cl/6259057
2012-06-01 10:10:59 -04:00
Dave Cheney
5b2cd445fb cmd/go: add -ccflags
Add -ccflags to pass arguments to {5,6,8}c
similar to -gcflags for {5,6,8}g.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6260047
2012-05-31 09:10:03 +10:00
Russ Cox
001b75c942 cmd/gc: contiguous loop layout
Drop expecttaken function in favor of extra argument
to gbranch and bgen. Mark loop condition as likely to
be true, so that loops are generated inline.

The main benefit here is contiguous code when trying
to read the generated assembly. It has only minor effects
on the timing, and they mostly cancel the minor effects
that aligning function entry points had.  One exception:
both changes made Fannkuch faster.

Compared to before CL 6244066 (before aligned functions)
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4201958800   -0.48%
BenchmarkFannkuch11      3462631800   3215908600   -7.13%
BenchmarkGobDecode         20887622     20899164   +0.06%
BenchmarkGobEncode          9548772      9439083   -1.15%
BenchmarkGzip                151687       152060   +0.25%
BenchmarkGunzip                8742         8711   -0.35%
BenchmarkJSONEncode        62730560     62686700   -0.07%
BenchmarkJSONDecode       252569180    252368960   -0.08%
BenchmarkMandelbrot200      5267599      5252531   -0.29%
BenchmarkRevcomp25M       980813500    985248400   +0.45%
BenchmarkTemplate         361259100    357414680   -1.06%

Compared to tip (aligned functions):
benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4140739800   4201958800   +1.48%
BenchmarkFannkuch11      3259914400   3215908600   -1.35%
BenchmarkGobDecode         20620222     20899164   +1.35%
BenchmarkGobEncode          9384886      9439083   +0.58%
BenchmarkGzip                150333       152060   +1.15%
BenchmarkGunzip                8741         8711   -0.34%
BenchmarkJSONEncode        65210990     62686700   -3.87%
BenchmarkJSONDecode       249394860    252368960   +1.19%
BenchmarkMandelbrot200      5273394      5252531   -0.40%
BenchmarkRevcomp25M       996013800    985248400   -1.08%
BenchmarkTemplate         360620840    357414680   -0.89%

R=ken2
CC=golang-dev
https://golang.org/cl/6245069
2012-05-30 18:07:39 -04:00
Russ Cox
6a5660f160 cmd/5l: fix PLD
Was missing break.

R=ken2
CC=golang-dev
https://golang.org/cl/6250078
2012-05-30 17:01:25 -04:00
Russ Cox
f2bd3a977d cmd/6l, cmd/8l, cmd/5l: add AUNDEF instruction
On 6l and 8l, this is a real instruction, guaranteed to
cause an 'undefined instruction' exception.

On 5l, we simulate it as BL to address 0.

The plan is to use it as a signal to the linker that this
point in the instruction stream cannot be reached
(hence the changes to nofollow).  This will help the
compiler explain that panicindex and friends do not
return without having to put a list of these functions
in the linker.

R=ken2
CC=golang-dev
https://golang.org/cl/6255064
2012-05-30 16:47:56 -04:00
Russ Cox
8820ab5da9 cmd/ld: align function entry on arch-specific boundary
16 seems pretty standard on x86 for function entry.
I don't know if ARM would benefit, so I used just 4
(single instruction alignment).

This has a minor absolute effect on the current timings.
The main hope is that it will make them more consistent from
run to run.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4140739800   -1.93%
BenchmarkFannkuch11      3462631800   3259914400   -5.85%
BenchmarkGobDecode         20887622     20620222   -1.28%
BenchmarkGobEncode          9548772      9384886   -1.72%
BenchmarkGzip                151687       150333   -0.89%
BenchmarkGunzip                8742         8741   -0.01%
BenchmarkJSONEncode        62730560     65210990   +3.95%
BenchmarkJSONDecode       252569180    249394860   -1.26%
BenchmarkMandelbrot200      5267599      5273394   +0.11%
BenchmarkRevcomp25M       980813500    996013800   +1.55%
BenchmarkTemplate         361259100    360620840   -0.18%

R=ken2
CC=golang-dev
https://golang.org/cl/6244066
2012-05-30 16:26:38 -04:00
Russ Cox
b91cf50585 cmd/6l, cmd/8l: fix chaining bug in jump rewrite
The code was inconsistent about when it used
brchain(x) and when it used x directly, with the result
that you could end up emitting code for brchain(x) but
leave the jump pointing at an unemitted x.

R=ken2
CC=golang-dev
https://golang.org/cl/6250077
2012-05-30 16:10:53 -04:00
Russ Cox
a768de8347 cmd/6g: avoid MOVSD between registers
MOVSD only copies the low half of the packed register pair,
while MOVAPD copies both halves.  I assume the internal
register renaming works better with the latter, since it makes
our code run 25% faster.

Before:
mandelbrot 16000
        gcc -O2 mandelbrot.c	28.44u 0.00s 28.45r
        gc mandelbrot	44.12u 0.00s 44.13r
        gc_B mandelbrot	44.17u 0.01s 44.19r

After:
mandelbrot 16000
        gcc -O2 mandelbrot.c	28.22u 0.00s 28.23r
        gc mandelbrot	32.81u 0.00s 32.82r
        gc_B mandelbrot	32.82u 0.00s 32.83r

R=ken2
CC=golang-dev
https://golang.org/cl/6248068
2012-05-30 14:41:19 -04:00
Joel Sing
586b6dfa46 cmd/ld: increase number of ELF sections
On NetBSD a cgo enabled binary has more than 32 sections - bump NSECTS
so that we can actually link them successfully.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6261052
2012-05-31 03:06:38 +10:00
Russ Cox
de96df1b02 cmd/6g: change sbop swap logic
I added the nl->op == OLITERAL case during the recent
performance round, and while it helps for small integer constants,
it hurts for floating point constants.  In the Mandelbrot benchmark
it causes 2*Zr*Zi to compile like Zr*2*Zi:

        0x000000000042663d <+249>:	movsd  %xmm6,%xmm0
        0x0000000000426641 <+253>:	movsd  $2,%xmm1
        0x000000000042664a <+262>:	mulsd  %xmm1,%xmm0
        0x000000000042664e <+266>:	mulsd  %xmm5,%xmm0

instead of:

        0x0000000000426835 <+276>:	movsd  $2,%xmm0
        0x000000000042683e <+285>:	mulsd  %xmm6,%xmm0
        0x0000000000426842 <+289>:	mulsd  %xmm5,%xmm0

It is unclear why that has such a dramatic performance effect
in a tight loop, but it's obviously slightly better code, so go with it.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5957470000   5973924000   +0.28%
BenchmarkFannkuch11      3811295000   3869128000   +1.52%
BenchmarkGobDecode         26001900     25670500   -1.27%
BenchmarkGobEncode         12051430     11948590   -0.85%
BenchmarkGzip                177432       174821   -1.47%
BenchmarkGunzip               10967        10756   -1.92%
BenchmarkJSONEncode        78924750     79746900   +1.04%
BenchmarkJSONDecode       313606400    307081600   -2.08%
BenchmarkMandelbrot200     13670860      8200725  -40.01%  !!!
BenchmarkRevcomp25M      1179194000   1206539000   +2.32%
BenchmarkTemplate         447931200    443948200   -0.89%
BenchmarkMD5Hash1K             2856         2873   +0.60%
BenchmarkMD5Hash8K            22083        22029   -0.24%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            29.52        29.90    1.01x
BenchmarkGobEncode            63.69        64.24    1.01x
BenchmarkJSONEncode           24.59        24.33    0.99x
BenchmarkJSONDecode            6.19         6.32    1.02x
BenchmarkRevcomp25M          215.54       210.66    0.98x
BenchmarkTemplate              4.33         4.37    1.01x
BenchmarkMD5Hash1K           358.54       356.31    0.99x
BenchmarkMD5Hash8K           370.95       371.86    1.00x

R=ken2
CC=golang-dev
https://golang.org/cl/6261051
2012-05-30 10:22:33 -04:00
Alex Brainman
afe0e97aa6 runtime: handle windows exceptions, even in cgo programs
Fixes #3543.

R=golang-dev, kardianos, rsc
CC=golang-dev, hectorchu, vcc.163
https://golang.org/cl/6245063
2012-05-30 15:10:54 +10:00
Russ Cox
6dbaa206fb runtime: replace runtime·rnd function with ROUND macro
It's sad to introduce a new macro, but rnd shows up consistently
in profiles, and the function call overwhelms the two arithmetic
instructions it performs.

R=r
CC=golang-dev
https://golang.org/cl/6260051
2012-05-29 14:02:29 -04:00
Akshat Kumar
154c84cdac cmd/6l: Fixes for 64-bit Plan 9
Plan 9 versions for amd64 have 2 megabyte pages.
This also fixes the logic for 32-bit vs 64-bit Plan 9,
making 64-bit the default, and adds logic to generate
a symbols table.

R=golang-dev, rsc, rminnich, ality, 0intro
CC=golang-dev, john
https://golang.org/cl/6218046
2012-05-29 12:32:42 -04:00
Russ Cox
fefae6eed1 cmd/6g, cmd/8g: move panicindex calls out of line
The old code generated for a bounds check was
                CMP
                JLT ok
                CALL panicindex
        ok:
                ...

The new code is (once the linker finishes with it):
                CMP
                JGE panic
                ...
        panic:
                CALL panicindex

which moves the calls out of line, putting more useful
code in each cache line.  This matters especially in tight
loops, such as in Fannkuch.  The benefit is more modest
elsewhere, but real.

From test/bench/go1, amd64:

benchmark                old ns/op    new ns/op    delta
BenchmarkBinaryTree17   6096092000   6088808000   -0.12%
BenchmarkFannkuch11     6151404000   4020463000  -34.64%
BenchmarkGobDecode        28990050     28894630   -0.33%
BenchmarkGobEncode        12406310     12136730   -2.17%
BenchmarkGzip               179923       179903   -0.01%
BenchmarkGunzip              11219        11130   -0.79%
BenchmarkJSONEncode       86429350     86515900   +0.10%
BenchmarkJSONDecode      334593800    315728400   -5.64%
BenchmarkRevcomp25M     1219763000   1180767000   -3.20%
BenchmarkTemplate        492947600    483646800   -1.89%

And 386:

benchmark                old ns/op    new ns/op    delta
BenchmarkBinaryTree17   6354902000   6243000000   -1.76%
BenchmarkFannkuch11     8043769000   7326965000   -8.91%
BenchmarkGobDecode        19010800     18941230   -0.37%
BenchmarkGobEncode        14077500     13792460   -2.02%
BenchmarkGzip               194087       193619   -0.24%
BenchmarkGunzip              12495        12457   -0.30%
BenchmarkJSONEncode      125636400    125451400   -0.15%
BenchmarkJSONDecode      696648600    685032800   -1.67%
BenchmarkRevcomp25M     2058088000   2052545000   -0.27%
BenchmarkTemplate        602140000    589876800   -2.04%

To implement this, two new instruction forms:

        JLT target      // same as always
        JLT $0, target  // branch expected not taken
        JLT $1, target  // branch expected taken

The linker could also emit the prediction prefixes, but it
does not: expected taken branches are reversed so that the
expected case is not taken (as in example above), and
the default expectaton for such a jump is not taken
already.

R=golang-dev, gri, r, dave
CC=golang-dev
https://golang.org/cl/6248049
2012-05-29 12:09:27 -04:00
Russ Cox
97cbf47c78 cmd/8c: better fix for 64-bit register smash
Ken pointed out that CL 5998043 was ugly code.
This should be better.

Fixes #3501.

R=ken2
CC=golang-dev
https://golang.org/cl/6258049
2012-05-24 23:36:26 -04:00
Russ Cox
51072eb1fb cmd/gc: fix parallel assignment in range
for expr1, expr2 = range slice
was assigning to expr1 and expr2 in sequence
instead of in parallel.  Now it assigns in parallel,
as it should.  This matters for things like
for i, x[i] = range slice.

Fixes #3464.

R=ken2
CC=golang-dev
https://golang.org/cl/6252048
2012-05-24 23:05:36 -04:00
Russ Cox
c6ce44822c cmd/gc: faster code, mainly for rotate
* Eliminate bounds check on known small shifts.
* Rewrite x<<s | x>>(32-s) as a rotate (constant s).
* More aggressive (but still minimal) range analysis.

R=ken, dave, iant
CC=golang-dev
https://golang.org/cl/6209077
2012-05-24 17:20:07 -04:00
Russ Cox
c44768cb1c cmd/gc: fix small integer bounds check bug
R=ken2
CC=golang-dev
https://golang.org/cl/6254046
2012-05-24 14:01:39 -04:00
Robert Griesemer
016d0d0900 godoc: correctly categorize interface methods, performance tuning
- interface methods appeared under VarDecl in search results
  (long-standing TODO)

- don't walk parts of AST which contain no indexable material
  (minor performance tuning)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6228047
2012-05-24 10:56:35 -07:00
Russ Cox
3d3b4906f9 cmd/6g: peephole fixes/additions
* Shift/rotate by constant doesn't have to stop subprop. (also in 8g)
* Remove redundant MOVLQZX instructions.
* An attempt at issuing loads early.
  Good for 0.5% on a good day, might not be worth keeping.
  Need to understand more about whether the x86
  looks ahead to what loads might be coming up.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/6203091
2012-05-24 12:11:32 -04:00
Shenghou Ma
34ad3995e0 cmd/cc: fix uint right shift in constant evaluation
Fixes #3664.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6249048
2012-05-25 00:08:52 +08:00
Brad Fitzpatrick
f430d0e609 cmd/api: add flag to specify contexts
I needed this to explore per-GOOS/GOARCH differences in pkg
syscall for a recent CL.  Others may find it useful too.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6236046
2012-05-23 13:45:53 -07:00
Shenghou Ma
e0b0f62d96 cmd/ld: fix Linux/ARM build
CL 5823055 removed a line introduced in Linux/ARM cgo support.
        Because readsym() now returns nil for "$a", "$d" mapping symbols,
        no matter the settings of `needSym', we still have to guard against
        them in ldelf().

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6220073
2012-05-23 11:36:24 +08:00
Brad Fitzpatrick
71c1a7b777 cmd/api: add api/next.txt
This quiets all.bash noise for upcoming features we know about.

The all.bash warnings will now only print for things not in next.txt
(or in next.txt but not in the API).

Once an API is frozen, we rename next.txt to a new frozen file
(like go1.txt)

Fixes #3651

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6218069
2012-05-22 18:41:20 -07:00
Shenghou Ma
576d648b2a cmd/ld, cmd/6l, cmd/8l, cmd/5l: fix hidden/local symbol import for ELF systems
Introduce a newsym() to cmd/lib.c to add a symbol but don't add
them to hash table.
   Introduce a new bit flag SHIDDEN and bit mask SMASK to handle hidden
and/or local symbols in ELF symbol tables. Though we still need to order
the symbol table entries correctly.
   Fix for issue 3261 comment #9.
   For CL 5822049.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/5823055
2012-05-23 02:32:27 +08:00
Shenghou Ma
1c4b77a7c8 cmd/ld: take section symbols' value into account for PE
ld -r could generate multiple section symbols for the same section,
but with different values, we have to take that into account.
    Fixes #3322.
    Part of issue 3261.
    For CL 5822049.

R=golang-dev, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/5823059
2012-05-23 02:27:44 +08:00
Jan Ziak
fbaf59bf1e cmd/gc: export constants in hexadecimal
R=golang-dev, r, rsc, iant, remyoudompheng, dave
CC=golang-dev
https://golang.org/cl/6206077
2012-05-22 13:53:38 -04:00
Russ Cox
6a22e2fb3f cmd/6a: delete dead code
R=ken2
CC=golang-dev
https://golang.org/cl/6223060
2012-05-22 11:42:44 -04:00
Russ Cox
c4ea1c955e cmd/8a, cmd/8l: add BSWAPL
R=ken2
CC=golang-dev
https://golang.org/cl/6208093
2012-05-22 00:29:07 -04:00
Russ Cox
ed480128a6 cmd/6a, cmd/6l: add BSWAPL, BSWAPQ
R=ken2
CC=golang-dev
https://golang.org/cl/6209087
2012-05-22 00:12:58 -04:00
Russ Cox
8f8640a057 cmd/6g: allow use of R14, R15 now
We stopped reserving them in 2009 or so.

R=ken
CC=golang-dev
https://golang.org/cl/6215061
2012-05-21 12:59:26 -04:00
Russ Cox
9815515df1 cmd/go: fix typo
Fixes #3619.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/6211055
2012-05-17 02:00:40 -04:00
Shenghou Ma
70db440885 cmd/5c: re-enable regopt()
After CL 6185047, ./all.bash passed.

benchmark                       old ns/op    new ns/op    delta
BenchmarkAppend                      5558         4894  -11.95%
BenchmarkAppendSpecialCase           5242         4572  -12.78%
BenchmarkSelectUncontended           3719         2821  -24.15%
BenchmarkSelectContended             3776         2832  -25.00%
BenchmarkSelectNonblock              1030         1089   +5.73%
BenchmarkChanUncontended              530          422  -20.38%
BenchmarkChanContended                534          444  -16.85%
BenchmarkChanSync                    1613         1492   -7.50%
BenchmarkChanProdCons0               1520         1351  -11.12%
BenchmarkChanProdCons10               785          668  -14.90%
BenchmarkChanProdCons100              564          473  -16.13%
BenchmarkChanProdConsWork0          11205        10337   -7.75%
BenchmarkChanProdConsWork10          9806         9567   -2.44%
BenchmarkChanProdConsWork100         9413         9398   -0.16%
BenchmarkChanCreation               11687         8715  -25.43%
BenchmarkChanSem                      553          453  -18.08%
BenchmarkCallClosure                   22           22   +0.44%
BenchmarkCallClosure1                  28           28   +0.71%
BenchmarkCallClosure2                2224         1668  -25.00%
BenchmarkCallClosure3                2217         1629  -26.52%
BenchmarkCallClosure4                2240         1684  -24.82%
BenchmarkComplex128DivNormal          930          912   -1.94%
BenchmarkComplex128DivNisNaN          862          866   +0.46%
BenchmarkComplex128DivDisNaN          849          852   +0.35%
BenchmarkComplex128DivNisInf          556          583   +4.86%
BenchmarkComplex128DivDisInf          522          512   -1.92%
BenchmarkConvT2E                      175          159   -9.14%
BenchmarkConvT2EBig                  2418         1823  -24.61%
BenchmarkConvT2I                      545          549   +0.73%
BenchmarkConvI2E                       35           32   -9.58%
BenchmarkConvI2I                      404          391   -3.22%
BenchmarkAssertE2T                     75           62  -16.25%
BenchmarkAssertE2TBig                  76           63  -16.80%
BenchmarkAssertE2I                    427          409   -4.22%
BenchmarkAssertI2T                     82           66  -20.29%
BenchmarkAssertI2I                    430          416   -3.26%
BenchmarkAssertI2E                     36           32  -12.50%
BenchmarkAssertE2E                     35           35   +0.57%
BenchmarkFinalizer                   3224         2941   -8.78%
BenchmarkFinalizerRun              117392        84772  -27.79%
BenchmarkStackGrowth                 5267         5930  +12.59%
BenchmarkSyscall                      191          167  -12.57%
BenchmarkSyscallWork                 9918         7713  -22.23%
BenchmarkIfaceCmp100                 1645         1652   +0.43%
BenchmarkIfaceCmpNil100              1433         1440   +0.49%

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6202070
2012-05-17 02:58:14 +08:00
Russ Cox
0c8f469428 cmd/go: invoke godoc with import path when possible
Also add -n -x flags to doc, fmt, vet.
Also shorten unknown command error.

Fixes #3612.
Fixes #3613.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/6211053
2012-05-15 12:53:57 -04:00
Jan Ziak
f47346c5fc 8l,5l: 2% faster
R=golang-dev, for.go.yong
CC=golang-dev
https://golang.org/cl/6197080
2012-05-15 12:52:18 -04:00
Russ Cox
fcc1f2ac55 cmd/gc: make append(nil, x) error more precise
Before:
./x.go:6: first argument to append must be slice; have nil

After:
./x.go:6: first argument to append must be typed slice; have untyped nil

Fixes #3616.

R=ken2
CC=golang-dev
https://golang.org/cl/6209067
2012-05-15 12:51:58 -04:00
Dmitriy Vyukov
95643647ae runtime: add parallel for algorithm
This is factored out part of:
https://golang.org/cl/5279048/
(parallel GC)

R=bsiegert, mpimenov, rsc, minux.ma, r
CC=golang-dev
https://golang.org/cl/5986054
2012-05-11 10:50:03 +04:00
Francisco Souza
25a8a8dab8 cmd/go: fix remote help reference to "go help packages"
go help remote used to reference "go help importpath", which has
changed to "go help packages".

Fixes #3598.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6201065
2012-05-09 16:16:02 +10:00
Nigel Tao
c8332198f4 go: fix the import path "./..." not matching ".".
Tested manually.

Fixes #3554.

Before:
$ cd $GOROOT/src/pkg
$ go list io
io
$ go list io/...
io
io/ioutil
$ cd $GOROOT/src/pkg/io
$ go list .
io
$ go list ./...
io/ioutil

After:
$ cd $GOROOT/src/pkg
$ go list io
io
$ go list io/...
io
io/ioutil
$ cd $GOROOT/src/pkg/io
$ go list .
io
$ go list ./...
io
io/ioutil
$ go list ././...
io
io/ioutil
$ go list ././.././io/...
io
io/ioutil
$ go list ../image
image
$ go list ../image/...
image
image/color
image/draw
image/gif
image/jpeg
image/png
$ go list ../.../template
html/template
text/template
$ cd $GOROOT/src/pkg
$ go list ./io
io
$ go list ./io/...
io
io/ioutil
$ go list ./.../pprof
net/http/pprof
runtime/pprof
$ go list ./compress
can't load package: package compress: no Go source files in /home/nigeltao/go/src/pkg/compress
$ go list ./compress/...
compress/bzip2
compress/flate
compress/gzip
compress/lzw
compress/zlib
$ cd $GOROOT/src/pkg/code.google.com
$ go list ./p/leveldb-go/...
code.google.com/p/leveldb-go/leveldb
code.google.com/p/leveldb-go/leveldb/crc
code.google.com/p/leveldb-go/leveldb/db
code.google.com/p/leveldb-go/leveldb/memdb
code.google.com/p/leveldb-go/leveldb/memfs
code.google.com/p/leveldb-go/leveldb/record
code.google.com/p/leveldb-go/leveldb/table
code.google.com/p/leveldb-go/manualtest/filelock
$ go list ./p/.../truetype
code.google.com/p/freetype-go/example/truetype
code.google.com/p/freetype-go/freetype/truetype
$ go list ./p/.../example
warning: "./p/.../example" matched no packages
$ go list ./p/.../example/...
code.google.com/p/freetype-go/example/freetype
code.google.com/p/freetype-go/example/gamma
code.google.com/p/freetype-go/example/raster
code.google.com/p/freetype-go/example/round
code.google.com/p/freetype-go/example/truetype
code.google.com/p/x-go-binding/example/imgview
code.google.com/p/x-go-binding/example/xgb

R=rsc
CC=golang-dev
https://golang.org/cl/6194056
2012-05-09 10:43:15 +10:00
Shenghou Ma
dac4c3eee9 cmd/cgo, cmd/cc, cmd/ld: detect dynamic linker automatically
Some newer Linux distributions (Ubuntu ARM at least) use a new multiarch
directory organization, where dynamic linker is no longer in the hardcoded
path in our linker.
For example, Ubuntu 12.04 ARM hardfloat places its dynamic linker at
/lib/arm-linux-gnueabihf/ld-linux.so.3

Ref: http://lackof.org/taggart/hacking/multiarch/

Also, to support Debian GNU/kFreeBSD as a FreeBSD variant, we need this capability, so it's part of issue 3533.

This CL add a new pragma (#pragma dynlinker "path") to cc.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/6086043
2012-05-05 01:54:16 +08:00
Shenghou Ma
e7a0a7595a cmd/go: cgo for Linux/ARM
Part 4 of CL 5601044 (cgo: Linux/ARM support)

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5989058
2012-05-04 18:29:40 +08:00
Shenghou Ma
9602dd5e87 cmd/cgo: support Linux/ARM
Part 3 of CL 5601044 (cgo: Linux/ARM support)

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5991066
2012-05-04 18:26:16 +08:00
Shenghou Ma
452a9e452b cmd/5l, cmd/ld: dynamic linking library support
Part 1 of CL 5601044 (cgo: Linux/ARM support)
        Limitation: doesn't support thumb library yet.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5991065
2012-05-04 18:14:26 +08:00
Shenghou Ma
278d4a583d cmd/5c, cmd/5a, cmd/5l: ARM support for PREFETCH built-in
R=rsc
CC=golang-dev
https://golang.org/cl/6174049
2012-05-04 03:24:14 +08:00
Shenghou Ma
52ec4aa24a cmd/dist: remove stray src/pkg/runtime/z* when cleaning
R=golang-dev, bradfitz, dave, rsc, lstoakes, rsc
CC=golang-dev
https://golang.org/cl/6180044
2012-05-04 00:58:48 +08:00
Russ Cox
d42495aa80 cmd/cc: add PREFETCH built-in (like SET, USED)
This makes it possible to inline the prefetch of upcoming
memory addresses during garbage collection, instead of
needing to flush registers, make a function call, and
reload registers.  On garbage collection-heavy workloads,
this results in a 5% speedup.

Fixes #3493.

R=dvyukov, ken, r, dave
CC=golang-dev
https://golang.org/cl/5990066
2012-05-02 16:22:56 -04:00
Anthony Martin
3859032980 build: dist-based build for Plan 9
R=rsc, iant, iant, seed
CC=golang-dev
https://golang.org/cl/5608059
2012-05-01 22:32:46 -07:00
Ian Lance Taylor
82e30c681c cgo: rename C names for Go types to avoid conflicting with package
Fixes #3371.

R=rsc, bsiegert, r, mtj, iant
CC=golang-dev
https://golang.org/cl/6131060
2012-05-01 09:04:13 -07:00
Robert Hencke
84ce0f7687 cmd/go: do not ignore DepsErrors in 'go run'
Fixes #3490.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6040046
2012-04-30 17:00:24 -04:00
Russ Cox
d09943aeaf cmd/go: new tag selection logic
The new logic is "use go1 if it's there, otherwise no tag."
Nothing needs to say "I require go1.0.1", and I want to
preserve some flexibility in defining what tags mean.

Right now (before go1.0.1) there is only one possible tag,
"go1", and I'd like to keep it that way.

R=golang-dev, bradfitz, r, adg
CC=golang-dev
https://golang.org/cl/6112060
2012-04-26 14:25:28 -04:00
Anthony Martin
42aa9abae9 gc: use correct line number for EOF syntax error
I also added some debugging code that's turned
on with -xx.

Fixes #3392.

R=rsc, lvd
CC=golang-dev
https://golang.org/cl/5909058
2012-04-26 02:57:23 -07:00
Shenghou Ma
e412761488 cmd/godoc: update App Engine README and script for Go 1
R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/5849053
2012-04-26 14:24:53 +08:00
Rob Pike
97a7defed4 vet: check values for named constants as well as literals.
As in:
        const format = "%s"
        fmt.Printf(format, "hi")
Also fix a couple of bugs by rewriting the routine.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6099057
2012-04-25 12:14:38 +10:00
Shenghou Ma
dee62a440c cmd/5g: fix URL typo
R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5919054
2012-04-24 23:17:16 +08:00
Luuk van Dijk
5583060c4c cmd/gc: fix addresses escaping through closures called in-place.
Fixes #3545.

R=rsc
CC=golang-dev
https://golang.org/cl/6061043
2012-04-23 15:39:01 -04:00
Anthony Martin
3192cac587 cmd/prof: don't build on Plan 9 for now.
R=golang-dev, bradfitz, akumar
CC=golang-dev
https://golang.org/cl/5629054
2012-04-16 17:36:36 -07:00
Rémy Oudompheng
061061e77c cmd/6g: restore magic multiply for /=, %=.
Also enables turning /= 2 in a right shift.

Part of issue 2230.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6012049
2012-04-13 10:12:31 +02:00
Shenghou Ma
1a59e6239c 5l, runtime: remove softfloat emulation code when not used
This leads to ~30kB improvement on code size for ARM machines with VFP/NEON.
Example: go test -c math
       GOARM=5  GOARM=6
  Old: 1884200  1839144
  New: 1884165  1805245
  -:        35    33899

R=rsc, bradfitz, dave, kai.backman
CC=golang-dev
https://golang.org/cl/5975060
2012-04-11 04:11:27 +08:00
Shenghou Ma
2031252fb8 5a, 5l: add PLD (preload data) instruction
Supported in ARMv5TE and above, excluding ARMv5TExP.
        For CL 5990066.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5999044
2012-04-11 04:09:04 +08:00
Russ Cox
e530d6a1e0 6c, 6g, 6l: add MOVQL to make truncation explicit
Without an explicit signal for a truncation, copy propagation
will sometimes propagate a 32-bit truncation and end up
overwriting uses of the original 64-bit value.

The case that arose in practice is in C but I believe
that the same could plausibly happen in Go.
The main reason we didn't run into the same in Go
is that I (perhaps incorrectly?) drop MOVL AX, AX
during gins, so the truncation was never generated, so
it didn't confuse the optimizer.

Fixes #1315.
Fixes #3488.

R=ken2
CC=golang-dev
https://golang.org/cl/6002043
2012-04-10 12:51:59 -04:00
Russ Cox
b72c7e943c cmd/6c: fix probable code gen bug
This is a pointer being copied; MOVL can't possibly be right.

R=ken2
CC=golang-dev
https://golang.org/cl/5999043
2012-04-10 12:51:36 -04:00
Russ Cox
30bc5d7bbd cmd/8c: fix store to complex uint64 ptr
Assignment of a computed uint64 value to an
address derived with a function call was executing
the call after computing the value, which trashed
the value (held in registers).

long long *f(void) { return 0; }
void g(int x, int y) {
        *f() = (long long)x | (long long)y<<32;
}

Before:

(x.c:3)	TEXT	g+0(SB),(gok(71))
...
(x.c:4)	ORL	AX,DX
(x.c:4)	ORL	CX,BX
(x.c:4)	CALL	,f+0(SB)
(x.c:4)	MOVL	DX,(AX)
(x.c:4)	MOVL	BX,4(AX)

After:
(x.c:3)	TEXT	g+0(SB),(gok(71))
(x.c:4)	CALL	,f+0(SB)
...
(x.c:4)	ORL	CX,BX
(x.c:4)	ORL	DX,BP
(x.c:4)	MOVL	BX,(AX)
(x.c:4)	MOVL	BP,4(AX)

Fixes #3501.

R=ken2
CC=golang-dev
https://golang.org/cl/5998043
2012-04-10 10:45:58 -04:00
Shenghou Ma
edf8b03fef cmd/api: allow addition of API
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5991081
2012-04-10 22:12:09 +08:00
Russ Cox
3d462449f6 8a, 8l: add PREFETCH instructions
R=ken2
CC=golang-dev
https://golang.org/cl/5992082
2012-04-10 10:09:27 -04:00
Russ Cox
35d260fa4c 6a, 6l: add PREFETCH instructions
R=ken2
CC=golang-dev
https://golang.org/cl/5989073
2012-04-10 10:09:09 -04:00
Alexey Borzenkov
0669261af1 cmd/dist: don't fail when Mercurial is a batch file on Windows
On windows Mercurial installed with easy_install typically creates
an hg.bat batch file in Python Scripts directory, which cannot be used
with CreateProcess unless full path is specified. Work around by
launching hg via cmd.exe /c.

Additionally, fix a rare FormatMessageW crash.

Fixes #3093.

R=golang-dev, rsc, alex.brainman, aram, jdpoirier, mattn.jp
CC=golang-dev
https://golang.org/cl/5937043
2012-04-09 15:39:59 -04:00
Benny Siegert
f6d582db61 cmd/yacc: spring cleaning for units.y
* sort imports
* use runtime.GOROOT
* fix some typos

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5987054
2012-04-09 15:04:59 -04:00
Brad Fitzpatrick
a8197456b1 cmd/go: in go get, don't try to perform discovery on non-hosts
Before, "go get -v foo/bar" was assuming "foo" was a hostname
and trying to perform discovery on it. Now, require a dot in
the first path component (the hostname).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5981057
2012-04-04 07:24:13 -07:00
Shenghou Ma
bcdafaa582 5c, 6c, 8c: take GOROOT_FINAL into consideration
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5936050
2012-04-04 00:04:36 +08:00
Shenghou Ma
6af069f3e1 5a, 6a, 8a: take GOROOT_FINAL into consideration
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5940052
2012-04-04 00:03:42 +08:00
Shenghou Ma
96da953d86 godoc: update appinit.go, apply !appengine build constrain to main.go
R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/5969063
2012-04-04 00:00:26 +08:00
Ryan Hitchman
8a686792e0 gc: improve error message for composite literals with unexpected newlines
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5857045
2012-04-02 11:00:55 -04:00
Shenghou Ma
a9de5bb3eb cmd/dist, sudo.bash: don't mention sudo.bash if cov or prof is not present
Fixes #3422.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5967057
2012-04-02 22:33:38 +08:00
Robert Griesemer
5b5b42ea84 godoc: replace servePage's positional argument list
R=golang-dev, adg, bradfitz
CC=golang-dev
https://golang.org/cl/5869050
2012-03-30 10:42:56 -07:00
Rob Pike
efb134f8bf cmd/go: update docs about tags for get command
"go1" dominates. Delete the text about weekly and release.
We can revisit this once the situation changes.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5969043
2012-03-30 13:07:10 +11:00
Andrew Gerrand
d71d11fa93 cmd/godoc: use virtual filesystem to implement -templates flag
R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/5921045
2012-03-28 09:13:48 +11:00
Russ Cox
9d7076b178 cmd/go: respect $GOBIN always
Another attempt at https://golang.org/cl/5754088.

Before, we only consulted $GOBIN for source code
found in $GOROOT, but that's confusing to explain
and less useful.  The new behavior lets users set
GOBIN=$HOME/bin and have all go-compiled binaries
installed there.

Tested a few cases in test.bash.

Ran all.bash with and without $GOBIN and it works.
Even so, I expect it to break the builders,
like it did last time, we can debug from there.

Fixes #3269 (again).
Fixes #3396.
Fixes #3397.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5927051
2012-03-27 11:57:39 -04:00
Russ Cox
6b0929505b cmd/go: fix two bugs
Issue 3207 was caused by setting GOPATH=GOROOT.
This is a common mistake, so diagnose it at command start
and also correct the bug that it caused in get (downloading
to GOROOT/src/foo instead of GOROOT/src/pkg/foo).

Issue 3268 was caused by recognizing 'packages' that
had installed binaries but no source.  This behavior is not
documented and causes trouble, so remove it.  We can
revisit the concept of binary-only packages after Go 1.

Fixes #3207.
Fixes #3268.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5930044
2012-03-27 10:41:44 -04:00
Russ Cox
d6c9af6a4e cmd/go: update for go1 tag format
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5919048
2012-03-27 00:17:50 -04:00
Russ Cox
901ee5c151 cmd/dist: fix detection of go1 version
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5924044
2012-03-27 00:17:35 -04:00
Russ Cox
a3498f4be4 cmd/go: copy tag_test.go from goinstall
hg cat -r 11846 src/cmd/goinstall/tag_test.go >tag_test.go
No changes.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5919047
2012-03-26 23:44:30 -04:00
Andrew Gerrand
849ad2d0ca cmd/godoc: canonicalize custom path redirects
For example, /ref and /doc/reference.html now both redirect to /ref/.

Fixes #3401.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5916044
2012-03-27 12:44:17 +11:00
Andrew Gerrand
fd9c206718 cmd/godoc: fix app engine version
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5902060
2012-03-27 10:10:25 +11:00
Rob Pike
6421bdeb71 cmd/go: explain versions better
Summarize the desiderata for selecting versions of remote packages to get.
Fixes #3394.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5902058
2012-03-26 17:47:39 +11:00
Shenghou Ma
304404895d cmd/go: allow underscores in tool name
Otherwise we can't invoke go_bootstrap directly.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5900061
2012-03-26 10:01:17 +08:00
Evan Shaw
c26b504b0d cmd/go: add missing error check
R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/5874055
2012-03-26 09:52:29 +08:00
Ian Lance Taylor
209b2e55f7 cmd/gc: fix comment typo, assignment spacing
R=bradfitz, gri, lvd
CC=golang-dev
https://golang.org/cl/5874053
2012-03-22 11:40:12 -07:00
Ian Lance Taylor
47b6197a01 cmd/gc: when expanding append inline, preserve arguments
Fixes #3369.

R=golang-dev, gri, lvd, r
CC=golang-dev
https://golang.org/cl/5876044
2012-03-22 09:44:31 -07:00
Robert Griesemer
cfd8b84f07 godoc: use shorter titles for tabs
In a browser with many open tabs, the tab titles become short
and uninformative because they all start with the same prefix
("Package ", "Directory ", etc.).

Permit use of shorter tab titles that start with the relevant
information first.

Fixes #3365.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5865056
2012-03-21 11:29:30 -07:00
Ian Lance Taylor
3a3c5aad4e cmd/cgo: fix handling of errno for gccgo
Fixes #3332.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5868047
2012-03-21 10:38:58 -07:00
Ian Lance Taylor
c5b45aa991 cmd/go: use .o, not .{5,6,8}, for gccgo created object files
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5861044
2012-03-20 14:17:06 -07:00
Andrew Gerrand
abdb4dbe2c cmd/godoc: inform users that the playground doesn't work via local godoc
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5843065
2012-03-20 14:11:38 +11:00
Anthony Martin
e1f22bdcc5 gc: fix struct and array comparisons for new bool rules
The two optimizations for small structs and arrays
were missing the implicit cast from ideal bool.

Fixes #3351.

R=rsc, lvd
CC=golang-dev
https://golang.org/cl/5848062
2012-03-19 15:57:28 -07:00
Brad Fitzpatrick
f69132d7ad build: catch API changes during build
Adds new file api/go1.txt, locking down the current API.
Any changes to the API will need to update that file.

run.bash (but not make.bash, or Windows) will check for
accidental API changes.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5820070
2012-03-17 11:20:46 -07:00
Johan Euphrosine
2b3fd37066 godoc: use FormatText for formating code in html template.
R=golang-dev, rsc, r, adg, gri, r
CC=golang-dev
https://golang.org/cl/5835046
2012-03-16 15:33:05 -07:00
Russ Cox
cf0cbfd21a cmd/go: don't add detail to errPrintedOutput
This makes the last error-reporting CL a bit less
aggressive.  errPrintedOutput is a sentinel value
that should not be wrapped.

R=gri
CC=golang-dev
https://golang.org/cl/5845052
2012-03-16 16:35:16 -04:00
Shenghou Ma
367557cd79 cmd/pack: also recognize '\\' as path separator in filenames
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5841051
2012-03-17 01:34:44 +08:00
Robert Griesemer
cb4ed897a3 godoc: apply gofmt
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5842043
2012-03-16 09:58:23 -07:00
Shenghou Ma
9b70c70ffb cmd/go: add -fno-common by default on Darwin
Fixes part of issue 3253.
        We still need to support scattered relocations though.

R=golang-dev, bsiegert, rsc, iant
CC=golang-dev
https://golang.org/cl/5822050
2012-03-16 12:05:09 -04:00
Russ Cox
a4b2c5efbc cmd/go: work around occasional ETXTBSY running cgo
Fixes #3001.  (This time for sure!)

R=golang-dev, r, fullung
CC=golang-dev
https://golang.org/cl/5845044
2012-03-16 10:44:09 -04:00
Yasuhiro Matsumoto
7694da1f3b cmd/gofmt: show ascii in usage.
windows cmd.exe can't show utf-8 correctly basically.
chcp 65001 may make it show, but most people don't have fonts which can
show it.

R=golang-dev, rsc, adg, gri, r
CC=golang-dev
https://golang.org/cl/5820060
2012-03-15 16:38:27 -07:00
Rémy Oudompheng
3211b2cca9 cmd/cgo: add support for function export for gccgo.
A "gccgoprefix" flag is added and used by the go tool,
to mirror the -fgo-prefix flag for gccgo, whose value
is required to know how to access functions from C.

Trying to export Go methods or unexported Go functions
will not work.

Also fix go test on "main" packages.

Updates #2313.
Fixes #3262.

R=mpimenov, rsc, iant
CC=golang-dev
https://golang.org/cl/5797046
2012-03-15 23:50:25 +01:00
Brad Fitzpatrick
86c7bc6e8b misc/dist: don't ship cmd/cov or cmd/prof
Fixes #3317

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5784083
2012-03-15 15:22:56 -07:00
Brad Fitzpatrick
c898c519b0 cmd/go: quiet some logging
This should've been behind -v before but was missed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5836046
2012-03-15 15:10:01 -07:00
Russ Cox
7a84fb3a85 cmd/go: make build errors more visible
Fixes #3324.

Robert suggested not reporting errors until the end of the output.
which I'd also like to do, but errPrintedOutput makes that a bigger
change than I want to do before Go 1.  This change should at least
remove the confusion we had.

# Building packages and commands for linux/amd64.
runtime
errors
sync/atomic
unicode
unicode/utf8
math
sync
unicode/utf16
crypto/subtle
io
syscall
hash
crypto
crypto/md5
hash/crc32
crypto/cipher
crypto/hmac
crypto/sha1
go install unicode: copying /tmp/go-build816525784/unicode.a to /home/rsc/g/go/pkg/linux_amd64/unicode.a: short write
hash/adler32
container/list
container/ring
...

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5837054
2012-03-15 17:35:57 -04:00
Russ Cox
9e5db8c90a 5l, 6l, 8l: fix stack split logic for stacks near default segment size
Fixes #3310.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5823051
2012-03-15 15:22:30 -04:00
Andrew Gerrand
d528f52d87 cmd/godoc: add toys, tour button to playground
Fixes #3241.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5835043
2012-03-15 17:44:47 +11:00
Francisco Souza
235863cb12 doc: add "Godoc: documenting Go code" article
Originally published on The Go Programming Language Blog, March 31, 2011.

http://blog.golang.org/2011/03/godoc-documenting-go-code.html

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5830043
2012-03-15 14:51:44 +11:00
Andrew Gerrand
181dc14cd6 cmd/godoc: use *goroot as base path in zip file
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5781069
2012-03-15 11:31:16 +11:00
Russ Cox
95a8bab7b6 cmd/go: fix directory->import path conversion
Fixes #3306.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5821048
2012-03-14 15:12:57 -04:00
Volker Dobler
1ddc9feb53 cmd/go: trivial help message fix for go help get
Direct reference to go help build where the flags are described.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5825046
2012-03-14 12:49:57 -04:00
Andrew Gerrand
ace7d26499 cmd/godoc: s/ignore/appengine/ in appinit.go +build constraint
R=golang-dev
CC=golang-dev
https://golang.org/cl/5784072
2012-03-14 14:02:59 +11:00
Andrew Gerrand
adcb508359 godoc: fix vet warnings for untagged struct literals
src/cmd/godoc/filesystem.go:337:10: os.PathError struct literal uses untagged fields
src/cmd/godoc/filesystem.go:355:10: os.PathError struct literal uses untagged fields

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5820046
2012-03-14 13:19:39 +11:00
Robert Griesemer
b5021f3fe0 go/printer, gofmt: fix multi-line logic
A node spans multiple lines if the line difference
between start and end point is > 0 (rather than > 1).
Fixes some odd cases introduced by CL 5706055;
pointed out by dsymonds.

Added corresponding test case. The other change
in the .golden file reverts to the status before
the CL mentioned above and is correct.

gofmt -w src misc changes godoc.go back to where
it was before the CL mentioned above.

Fixes #3304.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5820044
2012-03-13 16:15:58 -07:00
Russ Cox
cc99d8ad0b gc: use quoted string format in import error
R=ken2
CC=golang-dev
https://golang.org/cl/5794077
2012-03-13 09:33:54 -04:00
Rob Pike
d0a4c9bb62 gc: allow ~ in import paths
Windows has paths like C:/Users/ADMIN~1. Also, it so happens
that go/parser allows ~ in import paths. So does the spec.
Fixes the build too.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5777073
2012-03-13 16:03:19 +11:00
Rob Pike
daacba5184 gc: include full text of import path in error message
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5783091
2012-03-13 15:35:08 +11:00
Robert Hencke
4809ad655b cmd/go: fix typo
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5777072
2012-03-12 19:41:15 -07:00
Brad Fitzpatrick
d46438c3da cmd/godoc: remove sync code
Fixes #3273

R=gri
CC=golang-dev
https://golang.org/cl/5795065
2012-03-12 15:57:38 -07:00
Francisco Souza
bb6e685b7b godoc: fix codewalk handler
For URLs ending with /, the handler did not work, trying to append
".xml" to the path.

For instance, the "Share Memory by Communicating" returned the
following error:

        open /Users/francisco.souza/lib/go/doc/codewalk/sharemem/.xml: no such file or directory

R=adg, minux.ma
CC=golang-dev
https://golang.org/cl/5797065
2012-03-13 09:08:04 +11:00
Francisco Souza
60b98d6208 doc: add C? Go? Cgo! article
Originally published on The Go Programming Language Blog, March 17, 2011.

http://blog.golang.org/2011/03/c-go-cgo.html

Update #2547.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5777054
2012-03-13 09:07:37 +11:00
Russ Cox
bf09a8c970 undo CL 5754088 / cae9a7c0db06
broke builders

««« original CL description
cmd/go: respect $GOBIN always

Before, we only consulted $GOBIN for source code
found in $GOROOT, but that's confusing to explain
and less useful.  The new behavior lets users set
GOBIN=$HOME/bin and have all go-compiled binaries
installed there.

Fixes #3269.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754088
»»»

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/5794065
2012-03-12 17:03:29 -04:00
Russ Cox
bccafa7210 cmd/go: respect $GOBIN always
Before, we only consulted $GOBIN for source code
found in $GOROOT, but that's confusing to explain
and less useful.  The new behavior lets users set
GOBIN=$HOME/bin and have all go-compiled binaries
installed there.

Fixes #3269.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754088
2012-03-12 16:49:12 -04:00
Russ Cox
4e18bfb930 cmd/go: make go get new.code/... work
Fixes #2909.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5796072
2012-03-12 16:35:15 -04:00
Russ Cox
b70925d699 cmd/go: make net/... match net too
Otherwise there's no good way to get both, and it comes up often.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5794064
2012-03-12 16:34:24 -04:00
Brad Fitzpatrick
a7c9f24907 cmd/fix: add rules for net/http -> net/http/httputil renames
And merge the httputil fix into go1rename.

R=golang-dev, r, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5696084
2012-03-12 13:25:48 -07:00
Shenghou Ma
0359621241 build: update Makefile to track source code dependencies better
Also update .hgignore to ignore y.output.

R=rsc
CC=golang-dev
https://golang.org/cl/5797061
2012-03-13 03:31:11 +08:00
Shenghou Ma
d3191f5c2b gc: correct comment in runtime.go
R=rsc, iant
CC=golang-dev
https://golang.org/cl/5777057
2012-03-13 03:24:13 +08:00
Ingo Oeser
d13b24598f cmd/go: allow ssh tunnelled bzr, git and svn
This is often used in private hosting and collaborating environments.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5753063
2012-03-12 14:41:01 -04:00
Russ Cox
da8efae9fe cmd/godoc: fix directory read
Undo CL 5783076 and apply correct fix.

The /doc hack is wrong.  The code to handle this case was
already there and just needs a simple fix:

 	// We didn't find any directories containing Go files.
 	// If some directory returned successfully, use that.
-	if len(all) == 0 && first != nil {
+	if !haveGo {
 		for _, d := range first {
 			haveName[d.Name()] = true
 			all = append(all, d)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5783079
2012-03-12 13:10:37 -04:00
Russ Cox
376fc748f6 cmd/go: stop using $GOROOT and $GOBIN in script output
They were necessary to produce a canonical script
when we checked in build scripts, but now they're just
getting in the way.

Fixes #3279.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5796068
2012-03-12 12:39:31 -04:00
Andrew Gerrand
92d4af301e cmd/godoc: always include /doc files in union filesystems
Makes Path rewrites work, as the metadata was never being scanned.

Fixes #3282.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5783076
2012-03-12 15:55:39 +11:00
David Symonds
2e1bc9e867 cmd/vet: little tweak to tagged literal script to get it closer to drop-in format.
This is a minor change that made it easier for me; if you hate it I can drop it.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5798060
2012-03-12 13:50:25 +11:00
Brad Fitzpatrick
e31fa68a43 cmd/api: work on Windows again, and make gccgo files work a bit more
handle string and []byte conversions.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5754082
2012-03-11 17:55:15 -07:00
David Symonds
764880e2b2 cmd/api: set compiler for all build contexts.
The generated syscall files for Windows are still breaking "go tool api"
(unknown function []byte); I'll look at fixing that separately.

Fixes #3285.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5777062
2012-03-12 11:25:38 +11:00
Russ Cox
cd7ae05d52 cmd/go: local import fixes
1) The -D argument should always be a pseudo-import path,
like _/Users/rsc/foo/bar, never a standard import path,
because we want local imports to always resolve to pseudo-paths.

2) Disallow local imports in non-local packages.  Otherwise
everything works but you get two copies of a package
(the real one and the "local" one) in your binary.

R=golang-dev, bradfitz, yiyu.jgl
CC=golang-dev
https://golang.org/cl/5787055
2012-03-11 15:53:42 -04:00
Shenghou Ma
29199aa4e4 cmd/gc: import path cannot start with slash on Windows
For CL 5756065.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5784065
2012-03-10 05:11:51 +08:00
Shenghou Ma
6d4da06d36 cmd/dist, cmd/go: move CGO_ENABLED from 'go tool dist env' to 'go env'
So that we don't duplicate knowledge about which OS/ARCH combination
        supports cgo.
        Also updated src/run.bash and src/sudo.bash to use 'go env'.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5792055
2012-03-10 03:42:23 +08:00
Jeremy Jackins
1e374502f4 cmd/vet: fix typo in documentation
familiy -> family

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5783061
2012-03-09 11:21:01 -08:00
Brad Fitzpatrick
312ff5b58e cmd/go: document import path meta tag discovery in go help remote
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5787059
2012-03-08 11:31:52 -08:00
Russ Cox
2c46569f57 cmd/go: add env command, use to fix misc/cgo/testso
Fixes 386 build on 64-bit machines.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/5785053
2012-03-08 14:28:44 -05:00
Shenghou Ma
736ff448de doc: various update to command documents
1. consistent usage section (go tool xxx)
        2. reformat cmd/ld document with minor correction
           document which -H flags are valid on which ld
           document -d flag can't be used on Windows.
           document -Hwindowsgui

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5782043
2012-03-09 01:31:09 +08:00
Russ Cox
9b73238daa cgo, runtime: diagnose callback on non-Go thread
Before:
$ go run x.go
signal 11 (core dumped)
$

After:
$ go run x.go
runtime: cgo callback on thread not created by Go.
signal 11 (core dumped)
$

For issue 3068.
Not a fix, but as much of a fix as we can do before Go 1.

R=golang-dev, rogpeppe, gri
CC=golang-dev
https://golang.org/cl/5781047
2012-03-08 12:12:40 -05:00
Mikio Hara
dfb1af4b97 cmd/gofmt: fix race in long test
Fixes #3249.

R=rsc
CC=golang-dev
https://golang.org/cl/5792043
2012-03-08 23:56:26 +09:00
Russ Cox
a40065ac68 cmd/godoc: add support for serving templates
doc: convert to use godoc built-in templates

tmpltohtml is gone, to avoid having a second copy of the code.
Instead, godoc -url /doc/go1.html will print the actual HTML
served for that URL.  "make" will generate files named go1.rawhtml
etc, which can be fed through tidy.

It can be hard to tell from the codereview diffs, but all the
tmpl files have been renamed to be html files and then
have "Template": true added.

R=golang-dev, adg, r, gri
CC=golang-dev
https://golang.org/cl/5782046
2012-03-08 08:39:20 -05:00
Russ Cox
2b64e00f16 cmd/go: rebuild external test package dependencies
Was missing recompilation of packages imported only
by external test packages (package foo_test), primarily
because Root was not set, so those packages looked like
they were from a different Go tree, so they were not
recompiled if they already existed.

Also clean things up so that only one call to computeStale
is needed.

Fixes #3238.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5786048
2012-03-08 08:32:38 -05:00
Russ Cox
d4fb568e04 cmd/gc: implement len(array) / cap(array) rule
The spec is looser than the current implementation.
The spec edit was made in CL 4444050 (May 2011)
but I never implemented it.

Fixes #3244.

R=ken2
CC=golang-dev
https://golang.org/cl/5785049
2012-03-07 22:43:28 -05:00
Russ Cox
43d71e7d7d cmd/cgo: silence const warnings
Fixes #3152.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5786047
2012-03-07 22:40:32 -05:00
Russ Cox
9069721b0e cmd/gc: delete old map delete in walk
R=ken2
CC=golang-dev
https://golang.org/cl/5783047
2012-03-07 22:03:35 -05:00
Russ Cox
b0996334c1 go/build, cmd/go: add support for .syso files
.syso files are system objects copied directly
into the package archive.

Fixes #1552.

R=alex.brainman, iant, r, minux.ma, remyoudompheng
CC=golang-dev
https://golang.org/cl/5778043
2012-03-07 22:03:18 -05:00
Rémy Oudompheng
5c4d6ebb11 cmd/go: support -compiler for go list, fix isStale for gccgo.
Fixes #3228.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5784044
2012-03-07 23:15:55 +01:00
Robert Griesemer
3a065c5a73 godoc: update documentation
R=rsc
CC=golang-dev
https://golang.org/cl/5758057
2012-03-07 10:19:16 -08:00
Russ Cox
807aadcd3e cmd/go: fix go test -compiler
The compiler must be changed with the Set method
so that the buildToolchain gets updated too.

Fixes #3231.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5768044
2012-03-07 12:09:43 -05:00
Russ Cox
f4b40d92c8 cmd/cgo: document CGO_LDFLAGS and CGO_CFLAGS
Fixes #3203.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5769043
2012-03-07 11:44:47 -05:00
Russ Cox
4267974c0b cmd/gc: unnamed struct types can have methods
Fixes #3143.

R=ken2
CC=golang-dev
https://golang.org/cl/5752070
2012-03-07 02:27:15 -05:00
Russ Cox
987a580b9f cmd/gc: do not confuse unexported methods of same name
Fixes #3146.

R=ken2
CC=golang-dev
https://golang.org/cl/5756074
2012-03-07 01:55:17 -05:00
Shenghou Ma
6a426169f5 cmd/go: always provide .exe suffix on windows
Fixes #3190.

R=rsc, tjyang2001, rsc
CC=golang-dev
https://golang.org/cl/5759056
2012-03-07 14:25:24 +08:00
Shenghou Ma
c086bc1d7d cmd/dist: fix build for Linux/ARM
find() returns -1 when not found.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5752068
2012-03-07 14:24:28 +08:00
Russ Cox
85ae6a18b5 cmd/go: fix run errors
$ go run
go run: no go files listed
$ go run ../../pkg/math/bits.go
go run: cannot run non-main package
$

Fixes #3168.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5755064
2012-03-07 00:01:57 -05:00
Shenghou Ma
881966d2a5 cmd/go, cmd/godoc, net: fix typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5757050
2012-03-07 12:41:43 +08:00
Russ Cox
c3f4319a24 misc/cgo: re-enable some tests
The testso directory still needs to be enabled.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5731048
2012-03-06 23:27:30 -05:00
Rob Pike
905cb4881b all: remove some references to Make.inc etc.
There are a few more but these are the easiest ones.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5756067
2012-03-07 13:51:49 +11:00
Maxim Pimenov
eb2163ffbb cmd/go: honour buildflags in go run
Either documentation or implementation
of go run's flags is wrong currently.
This change assumes the documentation
to be right.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5752054
2012-03-06 09:33:35 -05:00
Brad Fitzpatrick
932c8ddba1 cmd/go: allow go get with arbitrary URLs
This CL permits using arbitrary, non-VCS-qualified URLs as
aliases for fully VCS-qualified and/or well-known code hosting
sites.

Example 1) A VCS-qualified URL can now be shorter.

Before:
$ go get camlistore.org/r/p/camlistore.git/pkg/blobref
After:
$ go get camlistore.org/pkg/blobref

Example 2) A custom domain can be used as the import,
referencing a well-known code hosting site.

Before:
$ go get github.com/bradfitz/sonden
After:
$ go get bradfitz.com/pkg/sonden

The mechanism used is a <meta> tag in the HTML document
retrieved from fetching:

    https://<import>?go-get=1  (preferred)
    http://<import>?go-get=1   (fallback)

The meta tag should look like:

<meta name="go-import" content="import-alias-prefix vcs full-repo-root">

The full-repo-root must be a full URL root to a repository containing
a scheme and *not* containing a ".vcs" qualifier.

The vcs is one of "git", "hg", "svn", etc.

The import-alias-prefix must be a prefix or exact match of the
package being fetched with "go get".

If there are multiple meta tags, only the one with a prefix
matching the import path is used. It is an error if multiple
go-import values match the import prefix.

If the import-alias-prefix is not an exact match for the import,
another HTTP fetch is performed, at the declared root (which does
*not* need to be the domain's root).

For example, assuming that "camlistore.org/pkg/blobref" declares
in its HTML head:

<meta name="go-import" content="camlistore.org git https://camlistore.org/r/p/camlistore" />

... then:

$ go get camlistore.org/pkg/blobref

... looks at the following URLs:

   https://camlistore.org/pkg/blobref?go-get=1
   http://camlistore.org/pkg/blobref?go-get=1
   https://camlistore.org/?go-get=1
   http://camlistore.org/?go-get=1

Ultimately it finds, at the root (camlistore.org/), the same go-import:

<meta name="go-import" content="camlistore.org git https://camlistore.org/r/p/camlistore" />

... and proceeds to trust it, checking out git //camlistore.org/r/p/camlistore at
the import path of "camlistore.org" on disk.

Fixes #3099

R=r, rsc, gary.burd, eikeon, untheoretic, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5660051
2012-03-05 22:36:15 -08:00
Alex Brainman
36708a40e0 cmd/dist: use correct hg tag for go version
When looking for suitable tag always start
from current version, not the tip.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5731059
2012-03-06 17:21:39 +11:00
Russ Cox
347cc981f0 cmd/go: add -compiler
go/build: add Context.Compiler

Fixes #3157.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756047
2012-03-06 00:36:24 -05:00
Russ Cox
866317af5e cmd/godoc: fixes
These appear to have been left out of the CL I submitted earlier.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5759043
2012-03-05 22:47:35 -05:00
Russ Cox
6e3a7930eb cmd/gc: if $GOROOT_FINAL is set, rewrite file names in object files
GOROOT_FINAL is a build parameter that means "eventually
the Go tree will be installed here".  Make the file name information
match that eventual location.

Fixes #3180.

R=ken, ken
CC=golang-dev
https://golang.org/cl/5742043
2012-03-05 16:13:33 -05:00
Russ Cox
eb5db57d1a cmd/go: sync type Package and go list doc
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5730061
2012-03-05 14:41:30 -05:00
Rémy Oudompheng
c073a1602a cmd/go: honor buildflags in go test.
Fixes #3196.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5725044
2012-03-05 19:58:04 +01:00
Russ Cox
cae604f734 cmd/gc: must not inline panic, recover
R=lvd, gri
CC=golang-dev
https://golang.org/cl/5731061
2012-03-05 13:51:44 -05:00
Russ Cox
5ab9d2befd cmd/gc: show duplicate key in error
R=ken2
CC=golang-dev
https://golang.org/cl/5728064
2012-03-05 13:47:36 -05:00
Russ Cox
8e5b34e580 godoc: quiet log spam
Fixes #3191.
Sorry.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5726059
2012-03-05 13:29:13 -05:00
Russ Cox
fae0d35043 godoc: support $GOPATH, simplify file system code
The motivation for this CL is to support $GOPATH well.
Since we already have a FileSystem interface, implement a
Plan 9-style name space.  Bind each of the $GOPATH src
directories onto the $GOROOT src/pkg directory: now
everything is laid out exactly like a normal $GOROOT and
needs very little special case code.

The filter files are no longer used (by us), so I think they
can just be deleted.  Similarly, the Mapping code and the
FileSystem interface were two different ways to accomplish
the same end, so delete the Mapping code.

Within the implementation, since FileSystem is defined to be
slash-separated, use package path consistently, leaving
path/filepath only for manipulating operating system paths.

I kept the -path flag, but I think it can be deleted too.

Fixes #2234.
Fixes #3046.

R=gri, r, r, rsc
CC=golang-dev
https://golang.org/cl/5711058
2012-03-05 10:02:46 -05:00
Andrew Gerrand
7e8ed8f616 cmd: update formatting of usage messages
R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/5738045
2012-03-05 14:23:00 +11:00
Rob Pike
2c0a46d604 cmd/go: fix grammar error in help messages
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5729061
2012-03-05 11:52:31 +11:00
Andrew Gerrand
dd29609244 godoc: fix codewalks
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5732056
2012-03-04 11:53:07 +11:00
Russ Cox
604f375110 cmd/go: fix relative imports again
I tried before to make relative imports work by simply
invoking the compiler in the right directory, so that
an import of ./foo could be resolved by ./foo.a.
This required creating a separate tree of package binaries
that included the full path to the source directory, so that
/home/gopher/bar.go would be compiled in
tmpdir/work/local/home/gopher and perhaps find
a ./foo.a in that directory.

This model breaks on Windows because : appears in path
names but cannot be used in subdirectory names, and I
missed one or two places where it needed to be removed.

The model breaks more fundamentally when compiling
a test of a package that lives outside the Go path, because
we effectively use a ./ import in the generated testmain,
but there we want to be able to resolve the ./ import
of the test package to one directory and all the other ./
imports to a different directory.  Piggybacking on the compiler's
current working directory is then no longer possible.

Instead, introduce a new compiler option -D prefix that
makes the compiler turn a ./ import into prefix+that,
so that import "./foo" with -D a/b/c turns into import
"a/b/c/foo".  Then we can invent a package hierarchy
"_/" with subdirectories named for file system paths:
import "./foo" in the directory /home/gopher becomes
import "_/home/gopher/foo", and since that final path
is just an ordinary import now, all the ordinary processing
works, without special cases.

We will have to change the name of the hierarchy if we
ever decide to introduce a standard package with import
path "_", but that seems unlikely, and the detail is known
only in temporary packages that get thrown away at the
end of a build.

Fixes #3169.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5732045
2012-03-02 22:16:02 -05:00
Shenghou Ma
a142ed99d5 fix build for FreeBSD/amd64
R=rsc, golang-dev, iant
CC=golang-dev
https://golang.org/cl/5732043
2012-03-03 04:47:42 +08:00
Shenghou Ma
5aea33742a ld: allow more -L options
Dynamically allocate the libdir array, so we won't need to bother it again.
        Enhances CL 5727043.

R=rsc
CC=golang-dev
https://golang.org/cl/5731043
2012-03-03 04:14:31 +08:00