1
0
mirror of https://github.com/golang/go synced 2024-10-04 17:21:20 -06:00
Commit Graph

2588 Commits

Author SHA1 Message Date
Russ Cox
1fddbab736 5l: fix softfloat nits
Need to load math.a so that sqrtGoC is available.
Also was missing prototype.

R=ken2
CC=golang-dev
https://golang.org/cl/4517148
2011-06-09 18:38:25 -04:00
Russ Cox
900c5fa98e gc: compactframe breaks arm - fix build
R=lvd
CC=golang-dev
https://golang.org/cl/4591063
2011-06-09 18:28:27 -04:00
Luuk van Dijk
fd2e24727e gc: nit
R=rsc
CC=golang-dev
https://golang.org/cl/4604041
2011-06-10 00:08:57 +02:00
Russ Cox
3e57d7f7bf 5l: delete dead code
Thumb code and ARM pre-V4 code is unused,
unmaintained, and almost certainly wrong by now.
Every time I try to change 5l I have to sort out
what's dead code and what's not.

30% of lines of code in this directory deleted.

R=ken2
CC=golang-dev
https://golang.org/cl/4601049
2011-06-09 18:07:56 -04:00
Luuk van Dijk
2ac375b2df gc: compact stackframe
After allocparams and walk, remove unused auto variables
and re-layout the remaining in reverse alignment order.

R=rsc
CC=golang-dev
https://golang.org/cl/4568068
2011-06-10 00:02:34 +02:00
Fan Hongjian
fc41e621e8 math: add sqrt_arm.s and sqrtGoC.go as fallback to soft fp emulation
5a: add SQRTF and SQRTD
5l: add ASQRTF and ASQRTD

Use ARMv7 VFP VSQRT instruction to speed up math.Sqrt

R=rsc, dave, m
CC=golang-dev
https://golang.org/cl/4551082
2011-06-09 17:19:08 -04:00
Russ Cox
17ca32e9db gc: nits
R=ken2
CC=golang-dev
https://golang.org/cl/4572052
2011-06-09 11:44:28 -04:00
Robert Griesemer
013cfea362 gofmt: update test script so that it passes again
(TODO: should replace this with a Go program, eventually)

R=bradfitz
CC=golang-dev
https://golang.org/cl/4584047
2011-06-08 12:05:40 -07:00
Robert Griesemer
a609a6bb63 ebnf: follow EBNF for EBNF faithfully
Apply analogous changes in godoc/spec.go.

Fixes #1829.

R=nmessenger, r
CC=golang-dev
https://golang.org/cl/4528127
2011-06-08 09:10:30 -07:00
Dave Cheney
6998ea2982 gc: alternative clang compatible abort.
Tested on clang 2.9/amd64

R=rsc, jeff, r
CC=golang-dev
https://golang.org/cl/4517143
2011-06-08 10:46:15 +10:00
Brad Fitzpatrick
be48115f48 gofix: fix diff regression from exec change
Also pass -u to diff to be consistent with gofmt.

Fixes #1619

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4591041
2011-06-07 11:53:47 -07:00
Robert Hencke
8cd7aac223 godefs: do not assume forward type references are enums
Fixes #1466.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/4564043
2011-06-07 14:28:10 -04:00
Anthony Martin
c5030e5f4b ld: fix and simplify ELF symbol generation
I started looking at this code because the nm in GNU
binutils was ignoring the first symbol in the .symtab
section.  Apparently, the System V ABI reserves the
first entry and requires all fields inside to be set
to zero.

The list of changes is as follows:

  · reserve the first symbol entry (as noted above)
  · fix the section indices for .data and .bss symbols
  · factor out common code for Elf32 and Elf64
  · remove the special case for elfsymo in [568]l/asm.c:/^asmb
  · add the "etext" symbol in 6l
  · add static symbols

R=rsc
CC=golang-dev
https://golang.org/cl/4524075
2011-06-07 14:26:16 -04:00
Caine Tighe
7c19d88b0f gc/lex.c: fix formatting of #include statement
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4564048
2011-06-07 09:57:26 -07:00
Brad Fitzpatrick
687102ed4f gofmt: fix -d regression from exec change
Fixes #1916

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4590041
2011-06-07 09:38:04 -07:00
Dave Cheney
4881e7744a cgo: support non intel gcc machine flags
R=adg
CC=golang-dev
https://golang.org/cl/4528124
2011-06-07 16:59:35 +10:00
Dave Cheney
60a4b5e4db gc: enable building under clang/2.9
To build under clang, pass the path to clang in CC when
calling ./make.bash

CC=/opt/llvm/llvm-2.9/bin/clang ./make.bash

Credit goes to jmhodges for suggestions.

R=jeff, r, ality
CC=golang-dev
https://golang.org/cl/4527098
2011-06-06 19:53:44 +10:00
Russ Cox
84f291b1bd 8g: compute register liveness during regopt
Input code like

0000 (x.go:2) TEXT    main+0(SB),$36-0
0001 (x.go:3) MOVL    $5,i+-8(SP)
0002 (x.go:3) MOVL    $0,i+-4(SP)
0003 (x.go:4) MOVL    $1,BX
0004 (x.go:4) MOVL    i+-8(SP),AX
0005 (x.go:4) MOVL    i+-4(SP),DX
0006 (x.go:4) MOVL    AX,autotmp_0000+-20(SP)
0007 (x.go:4) MOVL    DX,autotmp_0000+-16(SP)
0008 (x.go:4) MOVL    autotmp_0000+-20(SP),CX
0009 (x.go:4) CMPL    autotmp_0000+-16(SP),$0
0010 (x.go:4) JNE     ,13
0011 (x.go:4) CMPL    CX,$32
0012 (x.go:4) JCS     ,14
0013 (x.go:4) MOVL    $0,BX
0014 (x.go:4) SHLL    CX,BX
0015 (x.go:4) MOVL    BX,x+-12(SP)
0016 (x.go:5) MOVL    x+-12(SP),AX
0017 (x.go:5) CDQ     ,
0018 (x.go:5) MOVL    AX,autotmp_0001+-28(SP)
0019 (x.go:5) MOVL    DX,autotmp_0001+-24(SP)
0020 (x.go:5) MOVL    autotmp_0001+-28(SP),AX
0021 (x.go:5) MOVL    autotmp_0001+-24(SP),DX
0022 (x.go:5) MOVL    AX,(SP)
0023 (x.go:5) MOVL    DX,4(SP)
0024 (x.go:5) CALL    ,runtime.printint+0(SB)
0025 (x.go:5) CALL    ,runtime.printnl+0(SB)
0026 (x.go:6) RET     ,

is problematic because the liveness range for
autotmp_0000 (0006-0009) is nested completely
inside a span where BX holds a live value (0003-0015).
Because the register allocator only looks at 0006-0009
to see which registers are used, it misses the fact that
BX is unavailable and uses it anyway.

The n->pun = anyregalloc() check in tempname is
a workaround for this bug, but I hit it again because
I did the tempname call before allocating BX, even
though I then used the temporary after storing in BX.
This should fix the real bug, and then we can remove
the workaround in tempname.

The code creates pseudo-variables for each register
and includes that information in the liveness propagation.
Then the regu fields can be populated using that more
complete information.  With that approach, BX is marked
as in use on every line in the whole span 0003-0015,
so that the decision about autotmp_0000
(using only 0006-0009) still has all the information
it needs.

This is not specific to the 386, but it only happens in
generated code of the form

        load R1
        ...
        load var into R2
        ...
        store R2 back into var
        ...
        use R1

and for the most part the other compilers generate
the loads for a given compiled line before any of
the stores.  Even so, this may not be the case everywhere,
so the change is worth making in all three.

R=ken2, ken, ken
CC=golang-dev
https://golang.org/cl/4529106
2011-06-03 14:10:39 -04:00
Lucio De Re
9baaa6f742 8l, ld: Initial adjustments for Plan 9 native compilation of 8l
These changes are not particularly invasive and have been tested
as broadly as possible.

8l/l.h:
  -	#pragma varargck: added some, removed duplicates.

ld/dwarf.c:
  -	As Plan 9 has no NULL, changed all occurrences to nil.
  -	Added USED(size); where necessary.
  -	Added (void) argument in definition of finddebugruntimepath().
  -	Plan 9 compiler was complaining about multiple
        assignments, repeaired by breaking up the commands.
  -	Correction: havedynamic = 1; restored.

ld/go.c:
  -	Needed USED(file); in two functions.
  -	Removed unused assignments flagged by the Plan 9 compiler.

ld/lib.c:
  -	Replaced unlink() with remove() which seems available everywhere.
  -	Removed USED(c4); and USED(magic) no longer required.
  -	Removed code flagged as unused by the Plan 9 compiler.
  -	Added attributes to a number of format strings.

R=rsc
CC=golang-dev
https://golang.org/cl/4435047
2011-06-03 13:20:31 -04:00
Luuk van Dijk
ab8ed7f8dd gc: renamed walkdef to typecheckdef and moved from walk to typedef.
also inlined a typechecking function in dcl away.

R=rsc
CC=golang-dev
https://golang.org/cl/4550115
2011-06-03 17:44:02 +02:00
Luuk van Dijk
56668283f1 gc: allow tags on parameters in export section of object files.
This is in preparation of escape analysis; function parameters
can now be tagged with interesting bits by the compiler by
assigning to n->note.

tested by having typecheck put a fake tag on all parameters of
pointer type and compiling the tree.

R=rsc
CC=golang-dev
https://golang.org/cl/4524092
2011-06-03 03:54:56 +02:00
Luuk van Dijk
e59aa8ea4a gc: typecheck the whole tree before walking. preparation for some escape-analysis related changes.
R=rsc
CC=golang-dev
https://golang.org/cl/4528116
2011-06-02 18:48:17 +02:00
Brad Fitzpatrick
f259f6ba0a exec: new API, replace Run with Command
This removes exec.Run and replaces exec.Cmd with a
new implementation. The new exec.Cmd represents
both a currently-running command and also a command
being prepared. It has a good zero value.

You can Start + Wait on a Cmd, or simply Run it.
Start (and Run) deal with copying stdout, stdin,
and stderr between the Cmd's io.Readers and
io.Writers.

There are convenience methods to capture a command's
stdout and/or stderr.

R=r, n13m3y3r, rsc, gustavo, alex.brainman, dsymonds, r, adg, duzy.chan, mike.rosset, kevlar
CC=golang-dev
https://golang.org/cl/4552052
2011-06-01 15:26:53 -07:00
Luuk van Dijk
2c4edb0eea gc: make merely referencing an outer variable in a closure not force heapallocation.
before: runtime_test.BenchmarkCallClosure1       20000000              135 ns/op
after:  runtime_test.BenchmarkCallClosure1      500000000                6 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4527091
2011-06-01 17:02:43 +02:00
Rob Pike
73d57642a4 filepath: remove string constants. They are unnecessary.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4527090
2011-06-01 13:06:04 +10:00
Andrew Gerrand
581bd378ec gobuilder: include file missing from change, fix build
R=golang-dev
CC=golang-dev
https://golang.org/cl/4539099
2011-06-01 11:56:46 +10:00
Andrew Gerrand
9f0cabfab9 goinstall: document GOPATH and support relative/absolute installs
goinstall: more verbose logging with -v

Fixes #1901.

R=rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/4524078
2011-06-01 10:48:15 +10:00
Russ Cox
15dcdf751c gc: fix m[x], _ = y.(T)
Fixes #1900.

R=ken2
CC=golang-dev
https://golang.org/cl/4561053
2011-05-31 15:52:04 -04:00
Anthony Martin
5b62ba14c4 gc: disallow ... in type conversions
Fixes #1866.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548073
2011-05-31 15:41:47 -04:00
Russ Cox
5ab096d030 gc: implement new shift rules
The change is that 1.0<<2 is now okay.

R=ken2
CC=golang-dev
https://golang.org/cl/4524084
2011-05-31 15:05:40 -04:00
Luuk van Dijk
9b82408f6d gc: elide call to runtime.closure for function literals called in-place.
before:
runtime_test.BenchmarkCallClosure        5000000               499 ns/op
runtime_test.BenchmarkCallClosure1       5000000               681 ns/op

after:
runtime_test.BenchmarkCallClosure       500000000                5 ns/op
runtime_test.BenchmarkCallClosure1       10000000              160 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4515167
2011-05-31 20:52:21 +02:00
Anthony Martin
67b4db9e9e gc: check parameter declarations in interface fields
Fixes #1663.
Fixes #1871.

R=rsc, lstoakes
CC=golang-dev
https://golang.org/cl/4530084
2011-05-31 13:41:32 -04:00
Russ Cox
2c6a2a9773 goinstall: skip standard packages
R=adg, n13m3y3r
CC=golang-dev
https://golang.org/cl/4526084
2011-05-30 18:23:16 -04:00
Robert Hencke
3fbd478a8a pkg: spelling tweaks, I-Z
also, a few miscellaneous fixes to files outside pkg

R=golang-dev, dsymonds, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/4517116
2011-05-30 18:02:59 +10:00
Alex Brainman
9107b530d8 goinstall: use bash to execute gomake
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/4551074
2011-05-30 16:15:08 +10:00
Alex Brainman
b7582852f6 gotest, pkg/exec: use bash instead of sh to execute shell scripts on windows
As suggested by dho, iant2.

R=golang-dev, rsc
CC=devon.odell, golang-dev, iant
https://golang.org/cl/4515147
2011-05-28 21:26:03 +10:00
Gustavo Niemeyer
a825e8a69f cgo: restrict #cgo directives to prevent shell expansion
Fixes issue #1879.

Directives were not directly expanded, but since their
content ended up in makefiles, further expansion would
take place there.  This prevents such artifacts by
restricting the set of characters that may be used in
a directive value.

To build the list of safe characters I went through the
contents of /usr/lib/pkgconfig and extracted LDFLAGS
and CFLAGS information, so hopefully this is a
reasonable default to get started.

R=rsc
CC=golang-dev
https://golang.org/cl/4532092
2011-05-27 08:46:51 -03:00
Gustavo Niemeyer
bddb75127f cgo: support pkg-config for flags and libs
Fixes issue #1853.

R=golang-dev, mattn.jp, adg
CC=golang-dev
https://golang.org/cl/4550084
2011-05-26 22:19:23 -03:00
Ian Lance Taylor
9ef8ebafe4 gc: patch y.tab.c to fix build when using Bison 2.5
Fixes #1843.

R=rsc
CC=golang-dev
https://golang.org/cl/4535101
2011-05-26 11:28:23 -07:00
Russ Cox
e94eb38975 gc: typo
R=ken2
CC=golang-dev
https://golang.org/cl/4539086
2011-05-25 10:19:50 -04:00
Russ Cox
2286471651 5g: alignment fixes
Makes all.bash work after echo 4 >/proc/cpu/alignment,
which means kill the process on an unaligned access.

The default behavior on DreamPlug/GuruPlug/SheevaPlug
is to simulate an ARMv3 and just let the unaligned accesses
stop at the word boundary, resulting in all kinds of surprises.

Fixes #1240.

R=ken2
CC=golang-dev
https://golang.org/cl/4551064
2011-05-25 10:18:49 -04:00
Russ Cox
831c684434 5l: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/4538095
2011-05-25 09:44:05 -04:00
Russ Cox
64b497c62a ld: add -w to disable dwarf, make errors obviously from dwarf
Reenable dwarf output on Mac.
Was writing headers but no actual dwarf data.

Fixes #1877 (accidentally).
Workaround for issue 1878.

R=lvd
CC=golang-dev
https://golang.org/cl/4515139
2011-05-25 08:25:33 -04:00
Wei Guangjing
2ad58d48fb 8l: emit resources (.rsrc) in Windows PE.
R=alex.brainman, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4516055
2011-05-25 07:53:00 -04:00
Russ Cox
d2b2b3f4a8 6l, 8l: fix Mach-O binaries with many dynamic libraries
R=ken2
CC=golang-dev
https://golang.org/cl/4529084
2011-05-24 19:50:13 -04:00
Anthony Martin
0b209b36b6 gc: relax assignability of method receivers
The spec was adjusted in commit df410d6a4842 to allow the
implicit assignment of strutures with unexported fields in
method receivers.  This change updates the compiler.

Also moved bug322 into fixedbugs and updated golden.out
to reflect the removal of the last known bug.

Fixes #1402.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4526069
2011-05-24 19:48:19 -04:00
Robert Griesemer
3c7271f057 go spec: be precise with the use of the informal ellipsis … and the Go token ...
Fixes #1867.

R=r
CC=golang-dev
https://golang.org/cl/4538092
2011-05-24 14:18:44 -07:00
Dave Cheney
648f25b237 5l: fix set but not used warnings
R=rsc, iant
CC=golang-dev
https://golang.org/cl/4538083
2011-05-21 08:00:53 -07:00
Russ Cox
975ba88e0e cgo: use packed struct to fix Windows behavior
R=golang-dev, mattn.jp, jcowgar, iant
CC=golang-dev
https://golang.org/cl/4535080
2011-05-18 14:08:12 -04:00
Wei Guangjing
b256358008 6l: fix emit windows dwarf sections
R=alex.brainman, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4532069
2011-05-18 13:12:38 -04:00
Anthony Martin
f570d9d765 8g: fix conversion from float to uint64
The code for converting negative floats was
incorrectly loading an FP control word from
the stack without ever having stored it there.

Thanks to Lars Pensjö for reporting this bug.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4515091
2011-05-16 22:14:56 -04:00
Alexey Borzenkov
b701cf3332 runtime: make StackSystem part of StackGuard
Fixes #1779

R=rsc
CC=golang-dev
https://golang.org/cl/4543052
2011-05-16 16:57:49 -04:00
Russ Cox
e69b9ddd42 ld: do not emit reference to dynamic library named ""
Fixes #1778.

R=ken2
CC=golang-dev
https://golang.org/cl/4550047
2011-05-16 16:24:17 -04:00
Russ Cox
2d310a0087 5c, 5g: another attempt at silencing gcc
R=ken2
CC=golang-dev
https://golang.org/cl/4535074
2011-05-16 16:15:13 -04:00
Russ Cox
40745a579c 5l: delete pre-ARMv4 instruction implementations
Add implementation for addr<->reg short moves.
Align large data, for ARM.

R=ken2
CC=golang-dev
https://golang.org/cl/4545050
2011-05-16 16:14:37 -04:00
Robert Hencke
d49844bcce gofmt: skip bug340.go in test.sh
bug340.go is a test case for a syntax error

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4523069
2011-05-14 23:06:50 -07:00
Luuk van Dijk
36cec789cd gc: generalize dst = append(src,...) inlining to arbitrary src and dst arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/4517057
2011-05-14 00:35:10 +02:00
Robert Griesemer
ba006e6b6a go/types: type checker API + testing infrastructure
At the moment types.Check() only deals with global
types and only partially so. But the framework is
there to compute them and check for cycles. An initial
type test is passing.

First step of a series of CLs to come.

R=rsc
CC=golang-dev
https://golang.org/cl/4425063
2011-05-13 15:31:09 -07:00
Russ Cox
2d174db6a6 5c, 5g: fix build with too-smart gcc
R=ken2
CC=golang-dev
https://golang.org/cl/4543049
2011-05-13 12:15:46 -04:00
Brad Fitzpatrick
05a1b7ec41 http: remove finalURL from Client.Get; move to Response
This CL:

-- removes Response.RequestMethod string
-- adds Response.Request *Request
-- removes the finalURL result parameter from client.Get()
-- adds a gofix rule for callers of http.Get which assign
   the final url to the blank identifier; warning otherwise

Caller who did:

res, finalURL, err := http.Get(...)

now need to do:

res, err := http.Get(...)
if err != nil {
   ...
}
finalURL := res.Request.URL.String()

R=rsc
CC=golang-dev
https://golang.org/cl/4535056
2011-05-13 07:31:24 -07:00
Alex Brainman
34ac4ec30c 6l, 8l: emit windows dwarf sections similar to other platforms
R=golang-dev, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4517056
2011-05-13 16:05:47 +10:00
Robert Hencke
a005617c5a gotest: document unit of time for elapsed()
R=golang-dev
CC=golang-dev
https://golang.org/cl/4543044
2011-05-12 22:00:14 -07:00
Russ Cox
70798eaad6 5l, 8l: add ELF symbol table to binary
Should have been added long ago.
Thanks to Alex Brainman for noticing.

R=ken2
CC=golang-dev
https://golang.org/cl/4538046
2011-05-11 23:59:36 -04:00
Anthony Martin
4fca395321 ld: fix alignment of rodata section on Plan 9
This was causing a panic in the reflect package
since type.* pointers with their low bits set are
assumed to have certain flags set that disallow
the use of reflection.

Thanks to Pavel and Taru for help tracking down
this bug.

R=rsc, paulzhol, taruti
CC=golang-dev
https://golang.org/cl/4511041
2011-05-11 23:52:05 -04:00
Lorenzo Stoakes
f58d911698 gc: fix type switch error message for invalid cases.
Fixes #1606.

R=rsc
CC=golang-dev
https://golang.org/cl/4532045
2011-05-11 23:41:59 -04:00
Luuk van Dijk
d6b2925923 gc: inline append when len<cap
issue 1604

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4313062
2011-05-11 16:35:11 +02:00
Russ Cox
3f335f80b4 gc: fix unsafe.Sizeof
Fixes #1608.
Fixes #1787.

R=ken2
CC=golang-dev
https://golang.org/cl/4530045
2011-05-10 17:00:15 -04:00
Joe Poirier
733fde588b windows: reset command var to sh for correct error output messages
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4492043
2011-05-06 22:05:04 -07:00
Roger Peppe
1dc914bc0d cgo: put CFLAGS before filename argument
This means that the -x flag can work, which could enable
support for other languages (e.g. objective-C).

R=iant, rsc
CC=golang-dev
https://golang.org/cl/4476049
2011-05-06 13:35:51 -07:00
Robert Griesemer
e49d50e203 gofmt: update test.sh (exclude a file w/ incorrect syntax)
R=iant, iant2
CC=golang-dev
https://golang.org/cl/4453058
2011-05-03 09:56:18 -07:00
Russ Cox
296d6871a8 ld: make ELF binaries with no shared library dependencies static binaries
$ file $GOROOT/bin/{godoc,goyacc}
/home/rsc/g/go/bin/godoc:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not strpped
/home/rsc/g/go/bin/goyacc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
$

Fixes #1758.

R=iant
CC=golang-dev
https://golang.org/cl/4428079
2011-05-03 01:56:23 -04:00
Russ Cox
4002014cf8 http/pprof: fix POST reading bug
R=bradfitz
CC=golang-dev
https://golang.org/cl/4430075
2011-05-02 17:34:22 -04:00
Robert Griesemer
c783e68ff5 godoc: added -index flag to enable/disable search index
Fixes #1647.

R=adg, rsc1, r2, rsc, r
CC=golang-dev
https://golang.org/cl/4444083
2011-05-02 13:28:02 -07:00
Russ Cox
a46a311dec 5a, 6a, 8a, cc: remove old environment variables
Uses of $INCLUDE and $NPROC are left over from Plan 9.
Remove them to avoid causing confusion.

R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4445079
2011-05-02 11:24:32 -04:00
Russ Cox
8133cb3565 gc: preserve original expression for errors
Fixes #1722.

R=ken2
CC=golang-dev
https://golang.org/cl/4442099
2011-04-28 13:14:35 -04:00
Lorenzo Stoakes
b6f0632e93 gc: correctly handle fields of pointer type to recursive forward references
Previously, whether declaring a type which copied the structure of a type it was referenced in via a pointer field would work depended on whether you declared it before or after the type it copied, e.g. type T2 T1; type T1 struct { F *T2 } would work, however type T1 struct { F *T2 }; type T2 T1 wouldn't.

Fixes #667.

R=rsc
CC=golang-dev
https://golang.org/cl/4313064
2011-04-28 00:13:49 -04:00
Russ Cox
09092a78e6 cgo: handle versioned ELF symbols
Fixes #1397.

R=iant
CC=golang-dev
https://golang.org/cl/4444064
2011-04-27 23:21:03 -04:00
Russ Cox
5eeaca12d3 gopack: preserve safe flag when not adding unsafe objects to archive
R=dsymonds
CC=golang-dev
https://golang.org/cl/4436060
2011-04-27 09:20:53 -04:00
Andrew Gerrand
ca8a055f5c goinstall: support GOPATH; building and installing outside the Go tree
For example, with GOPATH set like so
        GOPATH=/home/adg/gocode
And after creating some subdirectories
        mkdir /home/adg/gocode/{bin,pkg,src}

I can use goinstall to install the github.com/nf/goto web server,
which depends on the github.com/nf/stat package, with
        goinstall github.com/nf/goto

This downloads and installs all dependencies (that aren't already
installed) like so
        /home/adg/gocode/bin/goto
        /home/adg/gocode/pkg/darwin_amd64/github.com/nf/stat.a
        /home/adg/gocode/src/github.com/nf/goto/...
        /home/adg/gocode/src/github.com/nf/stat/...

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4438043
2011-04-27 11:00:34 +10:00
Alex Brainman
2d99974ec5 8l: do not emit empty dwarf pe sections
This change will allow to generate valid executable,
even if rsc disables dwarf generation, as it happend
at revision 9a64273f9d68.

R=rsc
CC=golang-dev, lvd, vcc
https://golang.org/cl/4425066
2011-04-26 17:12:16 +10:00
Russ Cox
bac8f18035 gc: fix order of operations for f() < g().
Also, 6g was passing uninitialized
Node &n2 to regalloc, causing non-deterministic
register collisions (but only when both left and
right hand side of comparison had function calls).

Fixes #1728.

R=ken2
CC=golang-dev
https://golang.org/cl/4425070
2011-04-26 00:57:03 -04:00
Russ Cox
4684df520f gc: explain why invalid receiver types are invalid
Fixes #1680.

R=ken2
CC=golang-dev
https://golang.org/cl/4446061
2011-04-25 17:16:44 -04:00
Russ Cox
c2c7ee2736 ld: fix 6l -d on Mac, diagnose invalid use of -d
R=r
CC=golang-dev
https://golang.org/cl/4430064
2011-04-25 13:57:52 -04:00
Russ Cox
07abf1c732 fix tree for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067
2011-04-25 13:39:36 -04:00
Russ Cox
41342dc73c gofix: add support for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4450053
2011-04-25 13:39:00 -04:00
Fazlul Shahriar
f1781bec3b 8g,8l: fix "set but not used" gcc error
$ gcc --version
gcc (GCC) 4.6.0 20110415 (prerelease)

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4442080
2011-04-25 12:14:30 -04:00
Russ Cox
3a1fdc655e gc: fix import width bug
Fixes #1705.

R=ken2
CC=golang-dev
https://golang.org/cl/4443060
2011-04-25 12:08:48 -04:00
Robert Hencke
883d68f885 gc: allow complex types to be receiver types
Fixes #1716.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4439068
2011-04-25 12:02:54 -04:00
Russ Cox
c0a895fc0a gc: fix conversion of user-defined string type to []byte
Fixes #1709.

R=ken2
CC=golang-dev
https://golang.org/cl/4438068
2011-04-23 10:55:32 -04:00
Russ Cox
815a1b84c7 gc: fix return variable named _
Fixes #1712.

R=ken2
CC=golang-dev
https://golang.org/cl/4445055
2011-04-23 10:54:19 -04:00
Russ Cox
7879d3118c gc: fix line number at EOF
Fixes #1474.

R=ken2
CC=golang-dev
https://golang.org/cl/4432061
2011-04-23 10:54:05 -04:00
Anthony Martin
c7008f47ec ld: fix Plan 9 symbol table
Static symbols were not being marked as such.

I also made the 'z' symbols use the first byte of
the name instead of an explicit NUL so that if
the symbol table format is ever changed, the only
place that would need updating is addhist().

R=rsc
CC=golang-dev
https://golang.org/cl/4366047
2011-04-23 10:53:49 -04:00
Lucio De Re
f367c13c79 8l/prof.c: #if 0 is not accepted by the Plan 9 native toolchain.
The solution may be a bit of a sledgehammer, but it looks like
a temporary situation anyway.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4400042
2011-04-21 17:03:58 -04:00
Albert Strasheim
10d1680efb cgo: avoid "incompatible pointer type" warning
R=rsc
CC=golang-dev
https://golang.org/cl/4409041
2011-04-21 17:02:52 -04:00
Quan Yong Zhai
256df10eae gc: fix copy([]int, string) error message
R=rsc
CC=golang-dev
https://golang.org/cl/4433064
2011-04-21 12:09:29 -04:00
Russ Cox
f10a7882c6 gc: another pointer to interface message
R=ken2
CC=golang-dev
https://golang.org/cl/4444056
2011-04-21 08:20:29 -04:00
Russ Cox
5ff3336490 gc: correct handling of unexported method names in embedded interfaces
go/types: update for export data format change
reflect: require package qualifiers to match during interface check
runtime: require package qualifiers to match during interface check
test: fixed bug324, adapt to be silent

Fixes #1550.
Issue 1536 remains open.

R=gri, ken2, r
CC=golang-dev
https://golang.org/cl/4442071
2011-04-21 08:14:50 -04:00
Alex Brainman
5aad514674 syscall: correct Windows CreateProcess input parameters
Fixes #1718.

R=golang-dev, rsc, peterGo, r
CC=golang-dev
https://golang.org/cl/4435059
2011-04-21 10:36:27 +10:00
Russ Cox
047e698c52 ld: remove MachoLoad limit
Fixes #1571.

R=ken2
CC=golang-dev
https://golang.org/cl/4443052
2011-04-20 16:25:00 -04:00
Russ Cox
ec735c4ec8 gc: fix error for +string
Fixes #1710.

R=ken2
CC=golang-dev
https://golang.org/cl/4444054
2011-04-20 16:12:47 -04:00
Robert Griesemer
7412583e89 gofix, gofmt: update documentation
gofmt: also fix a typo in gofmt.go

R=rsc, r
CC=golang-dev
https://golang.org/cl/4431055
2011-04-20 11:01:21 -07:00
David Crawshaw
123e89fef1 gofmt: add -diff
Some code duplication with gofix.

R=rsc, gri, bradfitzgo, r2, adg, peterGo, r, brainman
CC=golang-dev
https://golang.org/cl/4430054
2011-04-20 10:07:56 -07:00
Andrew Gerrand
aaa6ce2301 goinstall: support building executable commands
This CL gives goinstall the ability to build commands,
not just packages.

"goinstall foo.googlecode.com/hg/bar" will build the command named
"bar" and install it to GOBIN. "goinstall ." will use the name of the
local directory as the command name.

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4426045
2011-04-20 12:02:29 +10:00
Russ Cox
3bac16a6bf reflect: allow Slice of arrays
R=r
CC=golang-dev
https://golang.org/cl/4444049
2011-04-18 20:00:42 -04:00
Russ Cox
b331f3cfd0 5c: make alignment rules match 5g, just like 6c matches 6g
I should have done this a year ago in:

        changeset:   5137:686b18098944
        user:        Russ Cox <rsc@golang.org>
        date:        Thu Mar 25 14:05:54 2010 -0700
        files:       src/cmd/8c/swt.c
        description:
        make alignment rules match 8g, just like 6c matches 6g.

        R=ken2
        CC=golang-dev
        https://golang.org/cl/760042

R=ken2
CC=golang-dev
https://golang.org/cl/4437054
2011-04-18 18:50:31 -04:00
Russ Cox
cded21a337 changes for more restricted reflect.SetValue
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4423043
2011-04-18 14:36:22 -04:00
Russ Cox
beb64bbd6e gc: fix complex move again
R=ken2
CC=golang-dev
https://golang.org/cl/4443047
2011-04-18 13:22:31 -04:00
Russ Cox
3d36a81fcc undo 4439044
cannot use regalloc with floating point on 386.
will redo some other way.

R=ken2
CC=golang-dev
https://golang.org/cl/4439045
2011-04-15 19:17:16 -04:00
Russ Cox
a12d70f60d gc: fix complex move bug
R=ken2
CC=golang-dev
https://golang.org/cl/4439044
2011-04-15 16:16:33 -04:00
Russ Cox
de5616fbb4 gc: print of unsafe.Pointer
Got lost when I introduced TUNSAFEPTR.

R=ken2
CC=golang-dev
https://golang.org/cl/4442046
2011-04-15 16:16:20 -04:00
Ian Lance Taylor
4c137b6162 5g: correct size of reg array.
Found by gcc 4.5.2 -Werror build reported on IRC by niemeyer.

R=ken2, rsc, r2
CC=golang-dev
https://golang.org/cl/4438042
2011-04-15 13:09:57 -07:00
Rob Pike
07dc26f88d 6l: fix another "set and not used".
R=rsc
CC=golang-dev
https://golang.org/cl/4433042
2011-04-15 08:31:32 -07:00
Russ Cox
db7a2024f9 gc: printing of multiple assignment
R=ken2
CC=golang-dev
https://golang.org/cl/4429043
2011-04-15 10:34:55 -04:00
Dave Cheney
29cf90a4ef libmach: fix warnings.
Fixes #1706.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4413051
2011-04-14 23:58:08 -04:00
Russ Cox
89fc2c8f4f gopack: fix prefix bug
When prefix doesn't match, was deleting entire .6 file.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4427041
2011-04-14 23:34:14 -04:00
Robert Griesemer
604c161e32 gofmt: exclude test case that doesn't compile w/o errors
R=r, r2
CC=golang-dev
https://golang.org/cl/4398048
2011-04-14 17:06:38 -07:00
Robert Griesemer
c78cddd7de gofmt: gofmt test harness bug fix
Don't use the rewrite rule from a previous test
for the next test if there is no rewrite rule
provided.

R=r, r2
CC=golang-dev
https://golang.org/cl/4419045
2011-04-14 16:33:29 -07:00
Robert Griesemer
a49e7f393f gofmt: don't crash when rewriting nil interfaces in AST.
The new reflection API makes it an error to call value.Set(x)
if x is invalid. Guard for it.

Added corresponding test case.

Fixes #1696.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4398047
2011-04-14 14:25:25 -07:00
Rob Pike
a89c0ff39e for GCC4.6: fix a bunch of set-and-not-used errors.
R=rsc
CC=golang-dev
https://golang.org/cl/4406048
2011-04-14 13:31:37 -07:00
Brad Fitzpatrick
02cae293cc gotest: generate gofmt-compliant code
R=r
CC=golang-dev
https://golang.org/cl/4400047
2011-04-14 11:50:00 -07:00
Russ Cox
3441bda959 gotest: add timing, respect $GOARCH
R=r, r2
CC=golang-dev
https://golang.org/cl/4370049
2011-04-14 10:59:33 -04:00
Russ Cox
bd43a2d9ff ld: defend against some broken object files
Fixes #1698.
Fixes #1699.

R=ken2
CC=golang-dev
https://golang.org/cl/4419041
2011-04-14 10:42:48 -04:00
Russ Cox
bd77eedacf gc: fix use of typekind array in error messages
Fixes #1697.

R=ken2
CC=golang-dev
https://golang.org/cl/4395045
2011-04-14 09:33:53 -04:00
Luuk van Dijk
dd93df35b9 runtime: fix gdb support for channels.
R=rsc
CC=golang-dev
https://golang.org/cl/4418043
2011-04-14 15:32:20 +02:00
Russ Cox
507df959e4 runtime: drop chan circular linked list in favor of circular buffer
The list elements are already being allocated out of a
single memory buffer.  We can drop the Link* pointer
following and the memory it requires, replacing it with
index operations.

The change also keeps a channel from containing a pointer
back into its own allocation block, which would create a
cycle.  Blocks involved in cycles are not guaranteed to be
finalized properly, and channels depend on finalizers to
free OS-level locks on some systems.  The self-reference
was keeping channels from being garbage collected.

runtime-gdb.py will need to be updated in order to dump
the content of buffered channels with the new data structure.

Fixes #1676.

R=ken2, r
CC=golang-dev
https://golang.org/cl/4411045
2011-04-13 23:42:06 -04:00
Russ Cox
017e73c1b2 gc: fix func syntax error
Fixes #1685.

R=ken2
CC=golang-dev
https://golang.org/cl/4414042
2011-04-13 22:48:21 -04:00
Rob Pike
bb855f985a govet: make name-matching for printf etc. case-insensitive.
Update goyacc, cgo to be more canonical in their naming and silence the new warnings.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4417042
2011-04-13 16:57:44 -07:00
Robert Griesemer
a2e286828b gofmt: gofmt -s -w src misc
R=r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406044
2011-04-13 15:13:59 -07:00
Robert Griesemer
5666ec8735 fix build: disable gofmt test script, enable gotest testing instead
R=rsc
CC=golang-dev
https://golang.org/cl/4403045
2011-04-13 14:24:38 -07:00
Robert Griesemer
99f069a97f gofmt: add test framework in Go
- replaced existing testdata/test.sh with new gofmt_test
- added initial test case for rewrite tests

TODO: Need to add more tests.

R=rsc
CC=golang-dev
https://golang.org/cl/4368063
2011-04-13 13:59:59 -07:00
Robert Griesemer
3d4b55ad5b gofmt: minor refactor to permit easy testing
R=rsc
CC=golang-dev
https://golang.org/cl/4397046
2011-04-13 13:57:53 -07:00
Rob Pike
e6cf42c39a gofix: fix embarrassing typo in osopen.go
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4411044
2011-04-13 13:49:24 -07:00
Russ Cox
1d26908d3f build: use gcc -Werror
Better to fix the warnings that we find.

R=iant
CC=golang-dev
https://golang.org/cl/4406042
2011-04-13 16:18:09 -04:00
Robert Griesemer
a5ca635287 gofmt: avoid endless loops
With the (partial) resolution of identifiers done
by the go/parser, ast.Objects point may introduce
cycles in the AST. Don't follow *ast.Objects, and
replace them with nil instead (they are likely
incorrect after a rewrite anyway).

- minor manual cleanups after reflect change automatic rewrite
- includes fix by rsc related to reflect change

Fixes #1667.

R=rsc
CC=golang-dev
https://golang.org/cl/4387044
2011-04-13 09:38:13 -07:00
Lucio De Re
36b6d1aaf2 8l: correct Plan 9 compiler warnings
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4390047
2011-04-12 16:21:01 -04:00
Lucio De Re
11e07d23ed ld: ELF header function declarations.
Added "void" inside "()" for two functions.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4381056
2011-04-12 11:00:09 -07:00
Luuk van Dijk
0cc055e8f7 ld: fix dwarf decoding of strings for struct's fieldnames
Moved Sym printing to Yconv.
Fixed warning in data.c

R=rsc
CC=golang-dev
https://golang.org/cl/4378052
2011-04-11 16:38:37 -04:00
Russ Cox
1bc84b7e18 ld: 25% faster
The ld time was dominated by symbol table processing, so
  * increase hash table size
  * emit fewer symbols in gc (just 1 per string, 1 per type)
  * add read-only lookup to avoid creating spurious symbols
  * add linked list to speed whole-table traversals

Breaks dwarf generator (no idea why), so disable dwarf.

Reduces time for 6l to link godoc by 25%.

R=ken2
CC=golang-dev
https://golang.org/cl/4383047
2011-04-09 09:44:20 -04:00
Russ Cox
23f6479be6 8g: optimize byte mov
Rewrite MOVB with less expensive
instruction when possible.

Suggested by atomic symbol.

benchmark                                        old ns/op    new ns/op    delta
crc32.BenchmarkCrc32KB                               13066         3942  -69.83%
crc64.BenchmarkCrc64KB                                8780         5949  -32.24%
lzw.BenchmarkDecoder1e4                             771224       636538  -17.46%
lzw.BenchmarkDecoder1e5                            7101218      6096634  -14.15%
lzw.BenchmarkDecoder1e6                           69762020     60789400  -12.86%
lzw.BenchmarkEncoder1e4                             707968       638812   -9.77%
lzw.BenchmarkEncoder1e5                            6567122      5965552   -9.16%
lzw.BenchmarkEncoder1e6                           65006000     58911680   -9.38%
utf8_test.BenchmarkRuneCountTenASCIIChars              166          165   -0.60%
utf8_test.BenchmarkRuneCountTenJapaneseChars           246          258   +4.88%
utf8_test.BenchmarkEncodeASCIIRune                      13           10  -23.08%
utf8_test.BenchmarkEncodeJapaneseRune                   37           16  -56.76%
utf8_test.BenchmarkDecodeASCIIRune                      23           21   -8.70%
utf8_test.BenchmarkDecodeJapaneseRune                   58           32  -44.83%

R=ken2
CC=golang-dev
https://golang.org/cl/4381045
2011-04-08 13:53:59 -04:00
Russ Cox
e7c4a6dfca gc: fix weird error message
Fixes #1670.

R=ken2
CC=golang-dev
https://golang.org/cl/4386045
2011-04-08 13:53:32 -04:00
Russ Cox
d26e73646e ld: fix arm build
R=ken2
CC=golang-dev, mikkel
https://golang.org/cl/4384048
2011-04-08 13:42:11 -04:00
Rob Pike
ddd0fa1744 gotest: Fix fix for \r\n on windows.
R=rsc, brainman, rh, r2
CC=golang-dev
https://golang.org/cl/4366045
2011-04-08 09:50:20 -07:00
Russ Cox
db5c5d6fa6 update go tree for reflect changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4353043
2011-04-08 12:27:58 -04:00
Russ Cox
fb94eb1922 gofix: reflect changes
R=gri
CC=golang-dev
https://golang.org/cl/4343047
2011-04-08 12:27:24 -04:00
Russ Cox
877c1892bb gofix: add -diff, various fixes and helpers
* add -diff command line option
  * use scoping information in refersTo, isPkgDot, isPtrPkgDot.
  * add new scoping-based helpers countUses, rewriteUses, assignsTo, isTopName.
  * rename rewrite to walk, add walkBeforeAfter.
  * add toy typechecker, a placeholder for go/types

R=gri
CC=golang-dev
https://golang.org/cl/4285053
2011-04-08 12:27:08 -04:00
Russ Cox
846a368b88 gofix: be more conservative about rewrite to os.Create
Rewrite only if we understood all the flags we saw.

R=r
CC=golang-dev
https://golang.org/cl/4376046
2011-04-08 10:59:25 -04:00
Alex Brainman
d976314776 gotest: handle \r\n returned by gomake on Windows (fixes build)
R=golang-dev, peterGo, rsc1
CC=Joe Poirier, golang-dev
https://golang.org/cl/4370048
2011-04-08 23:53:57 +10:00
Robert Griesemer
1baffa7da0 gotype: use go/types GcImporter
R=rsc
CC=golang-dev
https://golang.org/cl/4358043
2011-04-07 21:42:30 -07:00
Russ Cox
35c880b1e2 gc: bug327
Fixes #1674.

R=ken2
CC=golang-dev
https://golang.org/cl/4368057
2011-04-07 18:53:47 -04:00
Mikkel Krautz
2aceea630f ld: fix Mach-O X86_64_RELOC_SIGNED relocations
Fixes #1658.

R=rsc
CC=golang-dev
https://golang.org/cl/4344066
2011-04-07 14:20:42 -04:00
Mikkel Krautz
cf3323f511 ld: fix Mach-O bss bug
Fixes #1559.

R=rsc
CC=golang-dev, peterGo, rog
https://golang.org/cl/4356046
2011-04-07 13:17:28 -04:00
Rob Pike
63e28ae4ab gotest: fix windows build.
R=rsc
CC=golang-dev
https://golang.org/cl/4339055
2011-04-05 13:51:49 -07:00
Rob Pike
88a8ac08b9 gotest: fix a bug in error handling.
If the command couldn't be found, argv[0] would be wiped.
Also, fix a print statement not to refer to make - it was a vestige of a prior form.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4360048
2011-04-05 12:51:10 -07:00
Peter Mundy
b2bf14acd9 gotest: fixes for [^.]_test file pattern
R=rsc, r
CC=golang-dev
https://golang.org/cl/4339054
2011-04-05 11:49:44 -07:00
Russ Cox
de3aac609c gofix: don't rewrite O_APPEND opens
R=r, rog
CC=golang-dev
https://golang.org/cl/4364041
2011-04-05 11:12:02 -04:00
Rob Pike
8a90fd3c72 os: New Open API.
We replace the current Open with:
OpenFile(name, flag, perm) // same as old Open
Open(name) // same as old Open(name, O_RDONLY, 0)
Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666)

This CL includes a gofix module and full code updates: all.bash passes.
(There may be a few comments I missed.)

The interesting packages are:
        gofix
        os
Everything else is automatically generated except for hand tweaks to:
        src/pkg/io/ioutil/ioutil.go
        src/pkg/io/ioutil/tempfile.go
        src/pkg/crypto/tls/generate_cert.go
        src/cmd/goyacc/goyacc.go
        src/cmd/goyacc/units.y

R=golang-dev, bradfitzwork, rsc, r2
CC=golang-dev
https://golang.org/cl/4357052
2011-04-04 23:42:14 -07:00
Russ Cox
d3ca620baf gotest: fix build
TBR=r
CC=golang-dev
https://golang.org/cl/4351047
2011-04-04 16:35:40 -04:00
Rob Pike
60c4c3464b path/filepath.Glob: add an error return.
The error will only occur for invalid patterns, but without this
error path there is no way to know that Glob has failed due to
an invalid pattern.

R=rsc
CC=golang-dev
https://golang.org/cl/4346044
2011-04-04 13:09:34 -07:00
Russ Cox
6865cc0e8e gc: avoid saying same error 3 times
R=ken2
CC=golang-dev
https://golang.org/cl/4316051
2011-04-01 20:52:38 -04:00
Alex Brainman
799be52b35 gotest: another attempt to make it run on Windows
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4347041
2011-04-01 13:38:33 +11:00
Alex Brainman
6c651728d8 gotest: execute gomake properly on Windows
R=peterGo, rsc, Joe Poirier
CC=golang-dev
https://golang.org/cl/4280087
2011-04-01 10:10:15 +11:00
Ian Lance Taylor
554082d6b1 testing: add -test.timeout option.
Since Go code can deadlock, this lets a testsuite driver set a
time limit for the test to run.  This is simple but imperfect,
in that it only catches deadlocks in Go code, not in the
runtime scheduler.

R=r, rsc, iant2
CC=golang-dev
https://golang.org/cl/4326048
2011-03-31 15:27:51 -07:00
Rob Pike
7d77e3117c gotest: another try at flags.
doc.go contains the details. The short story:
- command line is passed to the binary
- a new flag, -file, is needed to name files
- known flags have the "test." prefix added for convenience.
- gotest-specific flags are trimmed from the command line.

The effect should be that most existing uses are unaffected,
the ability to name files is still present, and it's nicer to use.
The downside is a lot more code in gotest.

Also allow a test to be called just Test.

R=rsc, niemeyer, rog, r2
CC=golang-dev
https://golang.org/cl/4307049
2011-03-30 21:14:49 -07:00
Russ Cox
5a7a074261 gopack: comment out debugging print
TBR=r
CC=golang-dev
https://golang.org/cl/4333048
2011-03-30 22:41:32 -04:00
Russ Cox
3d2e57a312 gopack: add P flag to remove prefix from filename information
R=r, r2
CC=golang-dev
https://golang.org/cl/4307047
2011-03-30 22:19:02 -04:00
Robert Griesemer
7a5bbfd47f gotype: support for more tests, added one new test
also: minor fix to parser

Note: gotest won't run the gotype test yet until
it permits TestXXX functions where XXX is empty.

R=r
CC=golang-dev
https://golang.org/cl/4300053
2011-03-30 15:27:23 -07:00
Robert Griesemer
61aaadf217 gotest: exclude . files when parsing directories (per r's suggestion)
R=r, rsc1, iant2
CC=golang-dev
https://golang.org/cl/4329044
2011-03-30 09:46:11 -07:00
Andrew Gerrand
6b567d26b7 godoc: remove errant space in HTML tag
R=gri
CC=golang-dev
https://golang.org/cl/4277087
2011-03-30 16:41:41 +11:00
Robert Griesemer
1afc37fa7e go/printer/gofmt: remove special case for multi-line raw strings
As a special case, multi-line raw strings (i.e., strings in `` quotes)
were not indented if they were the only token on a line. This heuristic
was meant to improve formatting for multi-line raw strings where sub-
sequent lines are not indented at the level of the surrounding code.
Multiple people have complained about this. Removing the heuristic
again because it makes the formatting more regular, easier to under-
stand, and simplifies the implementation.

- manual changes to ebnf/ebnf_test.go for readability
- gofmt -w src misc

Fixes #1643.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4307045
2011-03-29 18:30:59 -07:00
Rob Pike
d844aae690 prints: fix a couple of formatting errors caught by govet
R=rsc, agl, agl1
CC=golang-dev
https://golang.org/cl/4337041
2011-03-29 14:03:08 -07:00
Rob Pike
fb80f63cf7 gotest: replace the shell script with the compiled program written in go.
Update the make sequence: gotest must now be installed after the packages.

R=rsc
CC=golang-dev
https://golang.org/cl/4323044
2011-03-29 13:29:20 -07:00
Rob Pike
518c0adb17 govet: fix bug introduced at 4313054
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4336042
2011-03-29 13:18:52 -07:00
Rob Pike
f61b7e5dc5 gotry: move into its own directory, separate from gotest.
R=rsc
CC=golang-dev
https://golang.org/cl/4327045
2011-03-29 13:00:24 -07:00
Rob Pike
62ed6ee6c4 ngotest: correctly handle packages with tests outside the package.
R=rsc
CC=golang-dev
https://golang.org/cl/4330043
2011-03-29 12:50:41 -07:00
Rob Pike
e393efc499 ngotest: a new gotest command, written in Go.
It runs all tests correctly and saves significant time by avoiding the shell script.
However, this is just the code for the command, for review.
A separate CL will move this into the real gotest, which will take some dancing.

R=rsc, peterGo, bsiegert, albert.strasheim, rog, niemeyer, r2
CC=golang-dev
https://golang.org/cl/4281073
2011-03-29 10:11:33 -07:00
Robert Griesemer
536531769b CL 4291070: incorporating rsc's feedback
R=rsc
CC=golang-dev
https://golang.org/cl/4313054
2011-03-29 09:08:23 -07:00
Russ Cox
2a1b4a83fc gofix: netdial
R=adg
CC=golang-dev
https://golang.org/cl/4278053
2011-03-28 23:29:00 -04:00
Robert Griesemer
b2658452a6 go/scanner: return literal as string instead of []byte
Removed many string conversions in dependent code.
Runs all tests. No change to gofmt output.

R=r
CC=golang-dev
https://golang.org/cl/4291070
2011-03-28 16:44:28 -07:00
Robert Griesemer
5be77a204b go/ast: implemented NewPackage
NewPackage creates an ast.Package node from
a set of package files and resolves unresolved
identifiers.

Also:
- Changed semantics of Scope.Insert: If an
  object is inserted w/o errors, the result
  is nil (before it was obj).
- Fixed an identifier resolution bug in the
  parser: map keys must not be resolved.

gotype runs through several go/* packages
and successfully resolves all (non-field/method)
identifiers.

R=rog, rsc
CC=golang-dev
https://golang.org/cl/4298044
2011-03-28 10:46:26 -07:00
Ian Lance Taylor
2795b13156 gc: remove interim ... error which rejects valid code.
It's been six months.

R=rsc
CC=golang-dev
https://golang.org/cl/4289073
2011-03-25 18:31:55 -07:00
Rob Pike
d406f8f650 testing: set up structure for faster testing using the new -test.short flag.
New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.

Use -test.short to make one package (crypto ecdsa) run much faster.
More changes to come.

Once this is in, I will update the long-running tests to use the new flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4317043
2011-03-25 14:50:44 -07:00
Russ Cox
543acc97f9 testing: add -test.cpuprofile flag
R=r
CC=golang-dev
https://golang.org/cl/4272066
2011-03-23 18:17:14 -04:00
Luuk van Dijk
14b9032f84 5l/6l/8l: undo spadj cleanup at ARET for following instructions in the same stackframe.
5l was already correct, clarified comment and added diags for unmaintained code.

R=rsc
CC=golang-dev
https://golang.org/cl/4277070
2011-03-23 23:11:29 +01:00
Brad Fitzpatrick
054a0c338f gotest: fix gofmt issue in generated _testmain.go
R=rsc, r
CC=golang-dev
https://golang.org/cl/4287074
2011-03-23 14:23:05 -07:00
Russ Cox
f2483c74f6 gofmt: add profiling flag
R=gri
CC=golang-dev
https://golang.org/cl/4295062
2011-03-23 14:28:38 -04:00
Russ Cox
fba0606220 godefs: handle volatile
R=iant
CC=golang-dev
https://golang.org/cl/4291063
2011-03-23 11:33:53 -04:00
Andrew Gerrand
005fe41125 godoc: add -template flag to specify custom templates
R=gri, niemeyer, rsc1
CC=golang-dev
https://golang.org/cl/4291059
2011-03-23 09:44:23 +11:00
Robert Griesemer
76061f7240 go/printer: Revert API change of CL 4274075.
Revert changes to printer.Config. Pass in the
nodeSizes map trough an internal helper function.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4309042
2011-03-22 14:14:26 -07:00
Russ Cox
1da382c871 gopprof: fix bug: do not rotate 180 degrees for large scrolls
R=r
CC=golang-dev
https://golang.org/cl/4273088
2011-03-22 02:04:59 -04:00
Andrew Gerrand
d4b19bdbed ld: return > 0 exit code on unsafe import
R=rsc
CC=golang-dev
https://golang.org/cl/4273092
2011-03-22 15:00:21 +11:00
Robert Griesemer
4a33d440b8 go/printer, gofmt: avoid exponential layout algorithm
Use memoization to avoid repeated recomputation of nested
node sizes. Speeds up testdata/slow.input by several orders
of magnitude.

- added respective test case
- added timeout to test code
- deleted some unrelated unused code

Fixes #1628.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4274075
2011-03-21 17:15:59 -07:00
Andrew Gerrand
f91e677e12 goinstall: add -clean flag to docs
Fixes #1629.

R=rsc
CC=golang-dev
https://golang.org/cl/4291057
2011-03-21 14:18:12 +11:00
Russ Cox
893e02ab59 gopprof: update list of memory allocation functions
R=r, r2
CC=golang-dev
https://golang.org/cl/4275057
2011-03-18 20:55:21 -04:00
Robert Griesemer
3be0921e73 cgo: fix index-out-of-bounds bug
R=rsc
CC=golang-dev
https://golang.org/cl/4284057
2011-03-18 12:38:38 -07:00
Yasuhiro Matsumoto
8c4a2ae6f8 godoc: No need to use filepath.IsAbs()
R=golang-dev, brainman, gri
CC=golang-dev
https://golang.org/cl/4277062
2011-03-18 09:28:23 -07:00
Yasuhiro Matsumoto
b22e29d9bf godoc: fix path problem for windows.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4299044
2011-03-17 22:27:30 -07:00
Ken Thompson
61c83b6407 sinit.c: recursion in sinit
fixes #1617

R=rsc
CC=golang-dev
https://golang.org/cl/4277059
2011-03-17 16:47:00 -07:00
Russ Cox
e39dc76884 gc: fix crash when using -u
R=ken2
CC=golang-dev
https://golang.org/cl/4278056
2011-03-16 21:05:40 -04:00
Andrew Gerrand
4bd0a54435 gofix: httpserver - rewrite rw.SetHeader to rw.Header.Set
R=rsc
CC=golang-dev
https://golang.org/cl/4271048
2011-03-17 09:59:18 +11:00
Robert Griesemer
7ea8cdaabd go/ast: merge CaseClause and TypeCaseClause
(per rsc's suggestion)

R=rsc
CC=golang-dev
https://golang.org/cl/4276057
2011-03-16 14:25:59 -07:00
Rob Pike
b8e4fbb79c testing: compile regexp only once
The -test.run and -test.bench flags were compilng the regexp for ever test
function, which was mucking up memory profiles.   Add a simple wrapper
to save the compiled state so that the regexp is compiled only once for
each flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4274063
2011-03-16 10:32:21 -07:00
Rob Pike
d3c61fc214 testing: fix build
Dependency on bufio crept in during last CL; this breaks the cycle.
Also add a missing '-' to the documentation.

R=rsc
CC=golang-dev
https://golang.org/cl/4274061
2011-03-16 10:12:25 -07:00
Rob Pike
afaa30694c testing: add -test.memprofile and -test.memprofilerate flags.
These allow a test to generate memory profiles automatically.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4273064
2011-03-16 09:53:58 -07:00
Alex Brainman
bcd747204d gofix: fix godoc doc
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4290049
2011-03-16 15:20:46 +11:00
Russ Cox
35c274a0da gofix: fix procattr registration, tests
R=adg
CC=golang-dev
https://golang.org/cl/4275054
2011-03-16 13:58:09 +11:00
Russ Cox
d7106f280d gofix: procattr
R=adg
CC=golang-dev
https://golang.org/cl/4274059
2011-03-15 22:33:57 -04:00
Roger Peppe
aa55c05213 os, syscall: add ProcAttr type. Change StartProcess etc. to use it.
The Windows code is untested.

R=rsc, gri, brainman, rsc1
CC=golang-dev
https://golang.org/cl/4253052
2011-03-15 14:41:19 -04:00
Russ Cox
a34f1bbb22 gofix: new command for updating code to new release
R=bradfitzgo, dsymonds, r, gri, adg
CC=golang-dev
https://golang.org/cl/4282044
2011-03-15 14:15:41 -04:00
Russ Cox
66f09fd459 gc: diagnose unused labels
R=ken2
CC=golang-dev
https://golang.org/cl/4287047
2011-03-15 14:05:37 -04:00
Russ Cox
35cee9f5d8 gofmt: simpler walkDir
Swapping the goroutines lets them reuse the
communication completion on v instead of
needing a second channel (done).

R=gri
CC=golang-dev
https://golang.org/cl/4287045
2011-03-15 14:04:47 -04:00
Russ Cox
c5e474dd88 5l: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/4279053
2011-03-14 15:43:58 -04:00
Russ Cox
e6f3aa6c36 gc: include all dependencies in export metadata
This change records more metadata about what
influenced the creation of the object file.
Specifically, if a package imports, say, "fmt" but does not
need to describe any fmt types in its own export data,
that package's object file did not mention the dependency
on "fmt" before.  Now it does.

Listing the import is purely informational.
It has no effect on which files are opened or consulted
when importing a package.

Import lines are marked indirect when they are needed
to explain the API but were not imported directly.
For example http imports crypto/tls and exports
a struct with a field of type tls.ConnectionState,
which contains an x509.Certificate.  Since http does
not import x509 but needs to explain the x509.Certificate
type in its export data, the import of x509 is marked
as indirect.  These import lines were always present;
marking them with the indirect comment makes clear
which were imported directly and which are incidental.

R=ken2
CC=golang-dev
https://golang.org/cl/4295048
2011-03-14 13:22:34 -04:00
Robert Griesemer
c734b50b11 gotype: clean handling of stdin, added tests
- removed uses of global variables
- minor cleanups

R=r
CC=golang-dev
https://golang.org/cl/4277044
2011-03-11 16:15:33 -08:00
Russ Cox
8bf34e3356 gc, runtime: replace closed(c) with x, ok := <-c
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/4259064
2011-03-11 14:47:26 -05:00
Robert Griesemer
dbff0adaa7 gotype: commandline tool to typecheck go programs
First version. Handles scope analysis only at the
moment.

R=rsc, r, eds
CC=golang-dev
https://golang.org/cl/4259065
2011-03-11 10:27:25 -08:00
Russ Cox
e6c9bccd33 gopack: omit time stamps
This makes it possible to build a package twice
and get the same bytes both times.

R=r, dsymonds, r2
CC=golang-dev
https://golang.org/cl/4248077
2011-03-11 10:08:49 -05:00
Robert Griesemer
2099e9fdac gofmt: remove -trace and -ast flags
Functionality was only present for
debuggging and now is available in
gocheck where is makes more sense.

R=rsc
CC=golang-dev
https://golang.org/cl/4239078
2011-03-10 12:54:18 -08:00
Brad Fitzpatrick
aae7b695ac http: move RemoteAddr & UsingTLS from ResponseWriter to Request
ResponseWriter.RemoteAddr() string -> Request.RemoteAddr string
ResponseWriter.UsingTLS() bool -> Request.TLS *tls.ConnectionState

R=rsc, bradfitzwork
CC=gburd, golang-dev
https://golang.org/cl/4248075
2011-03-10 08:17:22 -08:00
Brad Fitzpatrick
2c420ece67 http: change ResponseWriter.SetHeader(k,v) to Header() accessor
Caller code needs to change:

rw.SetHeader("Content-Type", "text/plain")
to:
rw.Header().Set("Content-Type", "text/plain")

This now permits returning multiple headers
with the same name using Add:

rw.Header().Add("Set-Cookie", "..")
rw.Header().Add("Set-Cookie", "..")

This patch also fixes serialization of headers, removing newline characters.

Fixes #488
Fixes #914

R=rsc
CC=gburd, golang-dev
https://golang.org/cl/4239076
2011-03-09 09:41:01 -08:00
Lorenzo Stoakes
fe8639a9fb gc: fix comments in go.h
Trivial fix to '// n' comments against etype enum in go.h, as these have
got out of sync.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4240097
2011-03-09 08:35:18 -08:00
Russ Cox
f0ab14647a ld: preserve symbol sizes during data layout
Fixes the broken linux/amd64 build.
The symbol table, itself a symbol, was having
its size rounded up to the nearest word boundary.
If the rounding add >7 zero bytes then it confused
the debug/gosym symbol table parser.  So you've
got a 1/8 chance to hit the bug on an amd64 system.

Just started in the recent change because I fixed
the rounding to round to word boundary instead
of to 4-byte boundary.

R=r
CC=golang-dev
https://golang.org/cl/4241056
2011-03-09 11:18:29 -05:00
Rob Pike
8138654aa8 govet: handle '*' in print format strings.
While we're on govet, fix a couple of mistakes in a test.

Fixes #1592.

R=rsc
CC=golang-dev
https://golang.org/cl/4239071
2011-03-08 14:36:56 -08:00
Anthony Martin
f3ed1ad50c 5l, 8l: output missing section symbols
R=rsc
CC=golang-dev
https://golang.org/cl/4252067
2011-03-08 17:15:20 -05:00
Russ Cox
7a09a88274 5l, 6l, 8l: omit symbols for type, string, go.string
Much of the bulk of Go binaries is the symbol tables,
which give a name to every C string, Go string,
and reflection type symbol.  These names are not worth
much other than seeing what's where in a binary.

This CL deletes all those names from the symbol table,
instead aggregating the symbols into contiguous blocks
and giving them the names "string.*", "go.string.*", and "type.*".

Before:
$ 6nm $(which godoc.old) | sort | grep ' string\.' | tail -10
  59eda4 D string."aa87ca22be8b05378eb1c71...
  59ee08 D string."b3312fa7e23ee7e4988e056...
  59ee6c D string."func(*token.FileSet, st...
  59eed0 D string."func(io.Writer, []uint8...
  59ef34 D string."func(*tls.Config, *tls....
  59ef98 D string."func(*bool, **template....
  59effc D string."method(p *printer.print...
  59f060 D string."method(S *scanner.Scann...
  59f12c D string."func(*struct { begin in...
  59f194 D string."method(ka *tls.ecdheRSA...
$

After:
$ 6nm $(which godoc) | sort | grep ' string\.' | tail -10
  5e6a30 D string.*
$

Those names in the "Before" are truncated for the CL.
In the real binary they are the complete string, up to
a certain length, or else a unique identifier.
The same applies to the type and go.string symbols.

Removing the names cuts godoc by more than half:

-rwxr-xr-x 1 rsc rsc 9153405 2011-03-07 23:19 godoc.old
-rwxr-xr-x 1 rsc rsc 4290071 2011-03-07 23:19 godoc

For what it's worth, only 80% of what's left gets loaded
into memory; the other 20% is dwarf debugging information
only ever accessed by gdb:

-rwxr-xr-x 1 rsc rsc 3397787 2011-03-07 23:19 godoc.nodwarf

R=r, cw
CC=golang-dev
https://golang.org/cl/4245072
2011-03-08 14:14:28 -05:00
Russ Cox
9267b0ddf1 nm: document -S flag
R=r
CC=golang-dev
https://golang.org/cl/4247066
2011-03-08 13:04:30 -05:00
Luuk van Dijk
da42312268 6l,8l: fix gdb crash.
DWARF function types no longer need to be pointer-ified explicitly.
Fixes #1579.

R=rsc, lvd1
CC=golang-dev
https://golang.org/cl/4247065
2011-03-08 18:28:42 +01:00
Russ Cox
4c052844dd gc: fix handling of return values named _
Fixes #1586.

R=ken2
CC=golang-dev
https://golang.org/cl/4244057
2011-03-07 19:36:17 -05:00
Russ Cox
5c2666c18c gc: unsafe.Pointer is not a pointer
Change unsafe.Pointer to be its own kind of
type, instead of making it equivalent to *any.
The change complicates import and export
but avoids the need to find all the places that
operate on pointers but should not operate on
unsafe.Pointer.

Fixes #1566. (a different way)
Fixes #1582.

R=ken2
CC=golang-dev
https://golang.org/cl/4264050
2011-03-07 15:10:01 -05:00
Gustavo Niemeyer
e08f0c18c9 goinstall: handle .c files with gc when cgo isn't used
As a data point, this enables goinstall to handle the standard
syscall package almost unchanged (there's one file with the _bsd
extension, and a .c file which isn't supposed to be compiled in).

R=rsc
CC=golang-dev
https://golang.org/cl/4259057
2011-03-07 12:53:39 -05:00
Gustavo Niemeyer
ff40deee62 goinstall: handle .s files with gc
As a data point, with this change goinstall is able to
fully build package big out of the box.

R=rsc
CC=golang-dev
https://golang.org/cl/4264049
2011-03-07 12:08:52 -05:00
Russ Cox
5946e46138 goinstall: fix build
func init runs *after* var declarations

TBR=niemeyer
CC=golang-dev
https://golang.org/cl/4260055
2011-03-07 11:33:26 -05:00
Gustavo Niemeyer
70f08b47a0 goinstall: handle $(GOOS) and $(GOARCH) in filenames
This enables goinstall to handle .go and .c files (for cgo)
which are named after the following patterns:

    name_$(GOOS).*
    name_$(GOARCH).*
    name_$(GOOS)_$(GOARCH).*

Files with those names are only included if the $(GOOS) and
$(GOARCH) match the current system.

R=rsc
CC=golang-dev
https://golang.org/cl/4172055
2011-03-07 10:54:53 -05:00
Gustavo Niemeyer
99686ec789 cgo: fix dwarf type parsing
The recursive algorithm used to parse types in cgo
has a bug related to building the C type representation.

As an example, when the recursion starts at a type *T,
the C type representation won't be known until type T
itself is parsed.  But then, it is possible that type T
references the type **T internally.  The latter
representation is built based on the one of *T, which
started the recursion, so it won't attempt to parse it
again, and will instead use the current representation
value for *T, which is still empty at this point.

This problem was fixed by introducing a simple TypeRepr
type which builds the string representation lazily,
analogous to how the Go type information is built within
the same algorithm.  This way, even if a type
representation is still unknown at some level in the
recursion, representations dependant on it can still
be created correctly.

R=rsc
CC=golang-dev
https://golang.org/cl/4244052
2011-03-06 18:05:57 -05:00
Gustavo Niemeyer
04ca4f8242 path/filepath: new OS-specific path support
The path package now contains only functions which
deal with slashed paths, sensible for any OS when dealing
with network paths or URLs.  OS-specific functionality
has been moved into the new path/filepath package.

This also includes fixes for godoc, goinstall and other
packages which were mixing slashed and OS-specific paths.

R=rsc, gri, mattn, brainman
CC=golang-dev
https://golang.org/cl/4252044
2011-03-06 17:33:23 -05:00
Russ Cox
1169559658 cgo: use correct frame size for 0 arguments
Passing a frame size of 1 was causing the cgo callback
to push 1 byte of arguments onto the stack, making
the stack pointer misaligned, which had the effect of
hiding all the pointers on the stack from the garbage
collector.

SWIG only wraps calls to C++ virtual methods, so it
always has at least 1 argument, so SWIG does not need
to be fixed too.

Fixes #1328.

R=iant
CC=golang-dev
https://golang.org/cl/4261046
2011-03-05 14:24:44 -05:00
David Symonds
633df67b66 gc, gopack: add some missing flags to the docs.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4260051
2011-03-04 20:21:26 -08:00
Robert Griesemer
21f3080d0f gofmt: exclude test file that is not legal Go
R=r, r2
CC=golang-dev
https://golang.org/cl/4252053
2011-03-03 16:52:56 -08:00
Russ Cox
44fd7573aa gc, ld: reflect support for PtrTo
R=ken2
CC=golang-dev
https://golang.org/cl/4245055
2011-03-03 13:17:54 -05:00
Gustavo Niemeyer
daffc2d2ef gc: fix init of packages named main
This change removes the special case which existed
for handling the initalization of the main package,
so that other modules named 'main' get properly
initialized when imported.

Note that gotest of main packages will break in most
cases without this.

R=rsc
CC=golang-dev
https://golang.org/cl/4190050
2011-03-02 16:18:17 -05:00
Roger Peppe
c1fdb6f156 goinstall: protect against malicious filenames.
It was possible to make package run arbitrary
commands when installing if its filenames contained
make metacharacters.

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4248041
2011-03-02 15:04:08 -05:00
Dave Cheney
9a8c079075 build: fix race condition building enam.o
R=golang-dev, rsc
CC=albert.strasheim, golang-dev
https://golang.org/cl/4240055
2011-03-02 14:22:39 -05:00
Roger Peppe
9704d4ec3d cgo: put temporary source files in _obj.
Fixes #1572.
Initially I tried changing things so all object
files get put in _obj, but it's too much - everything
needs changing. Perhaps some other time.

R=rsc
CC=golang-dev
https://golang.org/cl/4237050
2011-03-02 14:22:33 -05:00
Rob Pike
41a23ca08b goyacc: clarify it's package, not binary, that has
conflict and explain that you could put the grammars
in separate packages instead.

I could be talked into rolling back the previous change
and just making a doc change instead, but I'm content
to let it stand.

R=rsc
CC=golang-dev
https://golang.org/cl/4240053
2011-02-28 20:47:52 -08:00
Rob Pike
bb0e7bda35 goyacc: provide -p flag to set prefix for names.
This should allow multiple goyacc grammars to be
compiled into the same binary. There's a chance it
Fixes #1562.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4256044
2011-02-28 17:43:16 -08:00
Dave Cheney
432b4f309b build: convert src/cmd to use make directly and simplify src/make.bash
R=adg, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/4221047
2011-03-01 09:20:32 +11:00
Russ Cox
7da86983a8 gc: bug325 / issue 1566
Fixes #1566.

R=ken2
CC=golang-dev
https://golang.org/cl/4259041
2011-02-28 17:16:44 -05:00
Russ Cox
895631770a 8a, 8l: add CMPXCHG8B, XADDB, XADDL, XADDW
R=ken2
CC=golang-dev
https://golang.org/cl/4240041
2011-02-25 01:04:29 -05:00
Russ Cox
96c785de39 5a, 5l: add LDREXD, STREXD
R=ken2
CC=golang-dev
https://golang.org/cl/4239041
2011-02-25 01:03:54 -05:00
Robert Griesemer
27ccb41c4a godoc: accept symbolic links as path names provided to -path
When providing addition file systems to godoc via -path, the
path names may be symbolic links. Follow them.

Also: better logging of error and special conditions.

R=r, dsymonds, r2
CC=golang-dev
https://golang.org/cl/4217045
2011-02-24 16:24:51 -08:00
Russ Cox
8d36a78440 reflect: add pointer word to CommonType
The pointer will eventually let us find *T given T.
This CL just makes room for it, always storing a zero.

R=r, r2
CC=golang-dev
https://golang.org/cl/4221046
2011-02-24 17:11:20 -05:00
Russ Cox
d94bf76239 ld: weak symbols
A reference to the address of weak.foo resolves at link time
to the address of the symbol foo if foo would end up in the
binary anyway, or to zero if foo would not be in the binary.

For example:

        int xxx = 1;
        int yyy = 2;
        int weak·xxx;
        int weak·yyy;

        void main·main(void) {
                runtime·printf("%p %p %p\n", &xxx, &weak·xxx, &weak·yyy);
        }

prints the same non-nil address twice, then 0 (because yyy is not
referenced so it was dropped from the binary).

This will be used by the reflection tables.

R=iant
CC=golang-dev
https://golang.org/cl/4223044
2011-02-24 16:45:45 -05:00
Robert Griesemer
c9021a1afe godoc: fix writeFileAtomically utility function
If the filename was absolute, writeFileAtomically
used the wrong filename for ioutil.TempFile leading
to non-existent directories and the TempFile would
fail.

R=r, r2
CC=golang-dev
https://golang.org/cl/4224043
2011-02-24 11:13:20 -08:00
Robert Griesemer
11bda7df47 godoc: log errors when reading filter files
R=r, r2
CC=golang-dev
https://golang.org/cl/4230042
2011-02-24 10:22:32 -08:00
Alex Brainman
75fb2f6c82 8l/6l: new -Hwindowsgui flag allows to build windows gui pe
Fixes #1516.

R=rsc, mattn
CC=golang-dev
https://golang.org/cl/4214041
2011-02-24 16:10:30 +11:00
Russ Cox
63c24081a0 5g: fix optimizer bug
same as in issue below, never fixed on ARM

changeset:   5498:3fa1372ca694
user:        Ken Thompson <ken@golang.org>
date:        Thu May 20 17:31:28 2010 -0700

description:
fix issue 798
cannot allocate an audomatic temp
while real registers are allocated.
there is a chance that the automatic
will be allocated to one of the
allocated registers. the fix is to
not registerize such variables.

R=rsc
CC=golang-dev
https://golang.org/cl/1202042

R=ken2
CC=golang-dev
https://golang.org/cl/4226042
2011-02-23 13:21:39 -05:00
Kyle Consalus
07cc8b9ad2 Make.pkg, doc: Replace references to "-benchmarks" and "-match" with "-test.bench" and "-test.run".
R=r
CC=golang-dev
https://golang.org/cl/4197041
2011-02-22 20:23:21 -08:00
Alex Brainman
0cf6f8c096 5l/6l/8l: use enums for header type and symbolic strings for -H option values
Thanks to rsc for the suggestion.

R=r
CC=golang-dev
https://golang.org/cl/4174060
2011-02-23 14:30:40 +11:00
Russ Cox
bdbea6e410 arm: fix build
Changes on laptop were not sync'ed to machine
where I ran hg submit.

R=r
CC=golang-dev
https://golang.org/cl/4195048
2011-02-22 21:10:02 -05:00
Russ Cox
52943bfe4d gc: require if condition
R=ken2, r2
CC=golang-dev
https://golang.org/cl/4195045
2011-02-22 18:23:29 -05:00
Russ Cox
d9fd11443c ld: detect stack overflow due to NOSPLIT
Fix problems found.

On amd64, various library routines had bigger
stack frames than expected, because large function
calls had been added.

runtime.assertI2T: nosplit stack overflow
        120	assumed on entry to runtime.assertI2T
        8	after runtime.assertI2T uses 112
        0	on entry to runtime.newTypeAssertionError
        -8	on entry to runtime.morestack01

runtime.assertE2E: nosplit stack overflow
        120	assumed on entry to runtime.assertE2E
        16	after runtime.assertE2E uses 104
        8	on entry to runtime.panic
        0	on entry to runtime.morestack16
        -8	after runtime.morestack16 uses 8

runtime.assertE2T: nosplit stack overflow
        120	assumed on entry to runtime.assertE2T
        16	after runtime.assertE2T uses 104
        8	on entry to runtime.panic
        0	on entry to runtime.morestack16
        -8	after runtime.morestack16 uses 8

runtime.newselect: nosplit stack overflow
        120	assumed on entry to runtime.newselect
        56	after runtime.newselect uses 64
        48	on entry to runtime.printf
        8	after runtime.printf uses 40
        0	on entry to vprintf
        -8	on entry to runtime.morestack16

runtime.selectdefault: nosplit stack overflow
        120	assumed on entry to runtime.selectdefault
        56	after runtime.selectdefault uses 64
        48	on entry to runtime.printf
        8	after runtime.printf uses 40
        0	on entry to vprintf
        -8	on entry to runtime.morestack16

runtime.selectgo: nosplit stack overflow
        120	assumed on entry to runtime.selectgo
        0	after runtime.selectgo uses 120
        -8	on entry to runtime.gosched

On arm, 5c was tagging functions NOSPLIT that should
not have been, like the recursive function printpanics:

printpanics: nosplit stack overflow
        124	assumed on entry to printpanics
        112	after printpanics uses 12
        108	on entry to printpanics
        96	after printpanics uses 12
        92	on entry to printpanics
        80	after printpanics uses 12
        76	on entry to printpanics
        64	after printpanics uses 12
        60	on entry to printpanics
        48	after printpanics uses 12
        44	on entry to printpanics
        32	after printpanics uses 12
        28	on entry to printpanics
        16	after printpanics uses 12
        12	on entry to printpanics
        0	after printpanics uses 12
        -4	on entry to printpanics

R=r, r2
CC=golang-dev
https://golang.org/cl/4188061
2011-02-22 17:40:40 -05:00
Andrew Gerrand
06a923ada0 godoc: serve robots.txt raw
R=gri, niemeyer, rsc, r2, r
CC=golang-dev
https://golang.org/cl/4188063
2011-02-19 05:46:20 +11:00
Russ Cox
f07a45f23d fix build
pieces of an upcoming CL leaked into CL 4168056

TBR=r
CC=golang-dev
https://golang.org/cl/4180057
2011-02-18 12:37:16 -05:00
Russ Cox
afac1c2654 ld: drop rpath
Was required by old cgo but we don't
generate stub .so files anymore.

Update #1527.

R=iant
CC=golang-dev
https://golang.org/cl/4168056
2011-02-18 11:35:36 -05:00
Gustavo Niemeyer
6d9db54be5 testing: rename cmdline flags to avoid conflicts
Flags defined in the testing package may conflict
with real flags defined in the main package, or in
any other imported package.

This change makes them less likely to be used for
other purposes.

R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4167055
2011-02-17 16:17:33 -08:00
Wei Guangjing
8ba4df2e9a 6l: pe fixes
R=rsc, brainman
CC=golang-dev
https://golang.org/cl/4182061
2011-02-18 10:58:47 +11:00
Russ Cox
6e03ed32c7 gc: interface error message fixes
Fixes #1526.

R=ken2
CC=golang-dev
https://golang.org/cl/4190051
2011-02-17 16:33:26 -05:00
Jeff R. Allen
3a2d64789b gc: make string const comparison unsigned
Make compile-time string const comparison match semantics
of runtime.cmpstring.

Fixes #1515.

R=rsc
CC=golang-dev, rog
https://golang.org/cl/4172049
2011-02-16 17:57:15 -05:00
Alex Brainman
074354c2ea 8l,6l: allow for more os threads to be created on Windows
Program listed http://code.google.com/p/go/issues/detail?id=1495
(with nRequester set to 10000) will crash with

runtime: failed to create new OS thread (have 4526 already; errno=8)

instead of

runtime: failed to create new OS thread (have 618 already; errno=8).

R=golang-dev, rsc, vcc
CC=golang-dev
https://golang.org/cl/4172046
2011-02-16 16:08:42 +11:00
Robert Griesemer
e6ee0d2492 godoc: don't hide package lookup error if there's no command with the same name
Fixes #1514.

R=r, r2
CC=golang-dev
https://golang.org/cl/4173050
2011-02-14 17:41:47 -08:00
Ken Thompson
888ab02228 5ld: part of 64bit eor - forgot to check in.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4176046
2011-02-11 20:13:57 -08:00
Robert Griesemer
7e3d98bc9c gofmt: exclude testcase with incorrect syntax
R=r, r2
CC=golang-dev
https://golang.org/cl/4160047
2011-02-11 16:24:35 -08:00
Lorenzo Stoakes
b57ac97c27 gc: correct receiver in method missing error
Fixes #1324.

R=rsc1, r, rsc
CC=golang-dev
https://golang.org/cl/3435042
2011-02-11 17:47:58 -05:00
Ken Thompson
ca5179d3f6 5ld: stoped generating 64-bit eor
R=rsc
CC=golang-dev
https://golang.org/cl/4182049
2011-02-11 13:22:35 -08:00
Yuval Pavel Zholkover
7e77623120 8l, runtime: place G and M pointers relative to _tos on Plan 9, instead of hardcoded values for USTKTOP.
This should allow executing both on native Plan 9 and inside 9vx.

R=rsc
CC=golang-dev
https://golang.org/cl/3993044
2011-02-11 13:39:05 -05:00
Robert Griesemer
a75e5fc670 godoc: godoc: Use IsAbs to test for absolute paths (fix for win32).
One more case.

R=r, r2
CC=golang-dev
https://golang.org/cl/4170044
2011-02-10 16:32:51 -08:00
Yasuhiro Matsumoto
3b3568ba49 godoc: Use IsAbs to test for absolute paths (fix for win32).
R=gri
CC=golang-dev
https://golang.org/cl/4129046
2011-02-10 16:00:24 -08:00
Ken Thompson
cc4d57abac peep: more bugs
R=r
CC=golang-dev
https://golang.org/cl/4176042
2011-02-09 16:03:02 -08:00
Robert Griesemer
334f52ac49 godoc: optimizations: don't call Write for 0-length data
- guard some calls to Write that frequently may have 0-length data
- fix an invariant

R=r
CC=golang-dev
https://golang.org/cl/4179041
2011-02-09 15:06:05 -08:00
Rob Pike
fb9e37cd9b template: reverse order of arguments to Execute
In line with other functions such as Fprintf, put the
thing to be written first.

Apologies for the breakages this is sure to cause.

R=rsc, gri, adg, eds, r2, aam
CC=golang-dev
https://golang.org/cl/4169042
2011-02-09 14:23:01 -08:00
Ken Thompson
acc82ad721 peep: bug fix
R=r
CC=golang-dev
https://golang.org/cl/4173041
2011-02-09 13:13:17 -08:00
Robert Griesemer
d916cca327 go/printer: remove notion of "Styler", remove HTML mode
Neither gofmt nor godoc are making use of a Styler (for
token-specific formatting) anymore. Stylers interacted in complicated
ways with HTML-escaping which was why the printer needed an HTML mode
in the first place.

godoc now uses a more powerful and general text formatting
function that does HTML escaping, text selection, and can
handle token-specific formatting if so desired (currently
used only for comments).

As a consequence, cleaned up uses of go/printer in godoc;
simplified the various write utility functions, and also
removed the need for the "html" template format (in favor of
html-esc which now does the same and is used more pervasively).

Applied gofmt -w src misc to verify no changes occured,
and tested godoc manually.

There should be no visible changes except that (type) code
snippets presented for godoc package documentation now
uses the same formatting as for general source code and
thus comments get the comment-specific color here as well
(not the case at the moment).

(TODO: godoc needs a good automatic test suite).

R=rsc
CC=golang-dev
https://golang.org/cl/4152042
2011-02-09 09:52:32 -08:00
Gustavo Niemeyer
4521782514 cgo: fix handling of signed enumerations
Structs defined in C as containing a field with
an enum type are currently translated to Go as
a struct with an unsigned integer field, even if
some of the values contained in the enum are
negative.

This modification takes in consideration the values
defined in the enum, and conditionally defines the
Go type as signed if necessary.

The logic introduced was tested with gcc, which
will increase the type size if it contains both
negative numbers and values greater than 2^b/2-1,
and refuses to compile values which would be
problematic (2^64-1, but in fact the ISO C
restricts the range to the size of int).

R=rsc
CC=golang-dev
https://golang.org/cl/4119058
2011-02-08 23:50:14 -05:00
Russ Cox
e6f9b2f110 fix build clean.bash
TBR=r
CC=golang-dev
https://golang.org/cl/4151042
2011-02-08 22:39:39 -05:00
Ken Thompson
5080d7617a cgen64: dont use MVN instruction
R=r
CC=golang-dev
https://golang.org/cl/4154043
2011-02-08 17:30:23 -08:00
Ken Thompson
dc331e6565 peep: more optimization
R=r
CC=golang-dev
https://golang.org/cl/4149044
2011-02-08 16:55:59 -08:00
Ken Thompson
e26b741523 peep: fix optimization bug
R=r
CC=golang-dev
https://golang.org/cl/4105058
2011-02-07 17:21:04 -08:00
Ken Thompson
2799e0ecb9 peep: fix bug in peep optimizer.
reg: enable peep optimizer.
cgen64: better int64 code.

R=r
CC=golang-dev
https://golang.org/cl/3989065
2011-02-07 15:00:30 -08:00
Rob Pike
0ae041735a ld: fix build (uvlong vs uint64 conflict on freebsd)
R=rsc
CC=golang-dev
https://golang.org/cl/4023071
2011-02-07 14:40:36 -08:00
Rob Pike
fb55941539 loader: move the XputY routines into the ld directory.
Fixes the build for 5l, and also removes an inconsequential bug in 8l.

R=rsc
CC=golang-dev
https://golang.org/cl/4127051
2011-02-07 14:34:21 -08:00
Robert Griesemer
eeafc06538 gofmt: no need for lexical compare of src and res (optimization)
R=r
CC=golang-dev
https://golang.org/cl/4130046
2011-02-04 15:36:32 -08:00
Yuval Pavel Zholkover
c14c4e55e0 8l: fix crash writing Plan 9 binaries
Was crashing with GOOS=plan9 unless -s was passed.
Add symbols and line numbers to Plan 9 a.out.

R=rsc
CC=golang-dev
https://golang.org/cl/4080050
2011-02-04 14:33:21 -05:00
Russ Cox
6c5e4e1854 build: allow clean.bash to work on fresh checkout
Must be invoked as ./clean.bash --gomake make
(or --gomake gmake, depending on the name of
GNU make).

R=niemeyer
CC=golang-dev
https://golang.org/cl/4023065
2011-02-04 14:33:08 -05:00
Alex Brainman
4ecebfea53 os: implement new Process api
Fixes #1004.
Fixes #1460.

R=mattn, r, niemeyer, rog, rsc
CC=golang-dev
https://golang.org/cl/4029053
2011-02-04 14:41:26 +11:00
Yasuhiro Matsumoto
8b9d6e38be gopack: unused variable.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4121057
2011-02-03 17:29:09 -08:00
Robert Griesemer
ea2c6a3e59 godoc: minor internal fix
The value of the internal flag includeNonGoFile
really is the value of the fulltextIndex flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4044052
2011-02-03 16:05:57 -08:00
Russ Cox
9d3db4b62e gotest: enable unit tests for cmd directories
R=r
CC=golang-dev
https://golang.org/cl/4001056
2011-02-03 14:54:01 -05:00
Russ Cox
c1a695c160 gc, ld: package name main no longer reserved
R=ken2
CC=golang-dev
https://golang.org/cl/4128054
2011-02-03 14:17:20 -05:00
Gustavo Niemeyer
ab15a978fb cgo: os/arch dependent #cgo directives
This enables #cgo directives to contain a os/arch
specification which restricts the definition of
the given option to matching systems.

For example:

#cgo amd64 CFLAGS: -DAMD64=1
#cgo linux CFLAGS: -DLINUX=1
#cgo linux/amd64 CFLAGS: -DLINUX_ON_AMD64=1

R=rsc
CC=golang-dev
https://golang.org/cl/4121048
2011-02-03 13:51:47 -05:00
Russ Cox
3f61184e1b gc, ld: detect stale or incompatible object files
The object files begin with a header that is

        $GOARCH

on a line by itself.  This CL changes that header to

        go object $GOOS $GOARCH release.2011-01-01 4567+

where the final two fields are the most recent release
tag and the current hg version number.

All objects imported into a Go compilation or linked into an
executable must have the same header line, and that header
line must match the compiler and linker versions.

The effect of this will be that if you update and run all.bash
and then try to link in objects compiled with an earlier version
of the compiler (or invoke the wrong version of the compiler),
you will get an error showing the different headers instead
of perhaps silent incompatibility.

Normal usage with all.bash should be unaffected, because
all.bash deletes all the object files in $GOROOT/pkg/$GOOS_$GOARCH
and cleans all intermediate object files before starting.

This change is intended to diagnose stale objects arising when
users maintaining alternate installation directories forget to
rebuild some of their files after updating.

It should help make the adoption of $GOPATH (CL 3780043)
less error-prone.

R=ken2, r
CC=golang-dev
https://golang.org/cl/4023063
2011-02-03 13:51:43 -05:00
Eoghan Sherry
cf63e34b1d gc: correct rounding of denormal constants
Fixes #1463.

R=rsc
CC=golang-dev
https://golang.org/cl/4079060
2011-02-02 22:36:54 -05:00