]> Cypherpunks repositories - gostls13.git/log
gostls13.git
14 years agohttp: allow handlers to send non-chunked responses
Brad Fitzpatrick [Thu, 3 Mar 2011 20:22:13 +0000 (12:22 -0800)]
http: allow handlers to send non-chunked responses

Currently all http handlers reply to HTTP/1.1 requests with
chunked responses.  This patch allows handlers to opt-out of
that behavior by pre-declaring their Content-Length (which is
then enforced) and unsetting their Transfer-Encoding or
setting it to the "identity" encoding.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4245058

14 years agoio/ioutil: add TempDir
Russ Cox [Thu, 3 Mar 2011 19:51:49 +0000 (14:51 -0500)]
io/ioutil: add TempDir

It's a little confusing that os.TempDir and ioutil.TempDir have
different meanings.  I don't know what to change the names to,
if anything.  At least they also have different signatures.

R=golang-dev, bradfitzgo, r, gri
CC=golang-dev
https://golang.org/cl/4247051

14 years agotesting: run GC before each benchmark run.
Roger Peppe [Thu, 3 Mar 2011 19:26:53 +0000 (11:26 -0800)]
testing: run GC before each benchmark run.

R=r, rh, gri, rsc
CC=golang-dev
https://golang.org/cl/4237055

14 years agofmt: make recursive scan more efficient.
Roger Peppe [Thu, 3 Mar 2011 18:43:29 +0000 (10:43 -0800)]
fmt: make recursive scan more efficient.
Detect when scan is being called recursively and
re-use the same scan state.

On my machine, for a recursion-heavy benchmark, this
results in 44x speed up. This does impose a 4% penalty
on the non-recursive case, which can be removed by
heap-allocating the saved state, at 40% performance penalty
on the recursive case. Either way is fine with me.

R=r
CC=golang-dev
https://golang.org/cl/4253049

14 years agoreflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr)
Russ Cox [Thu, 3 Mar 2011 18:20:17 +0000 (13:20 -0500)]
reflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr)

This change makes it possible to take the address of a
struct field or slice element in order to call a method that
requires a pointer receiver.

Existing code that uses the Value.Addr method will have
to change (as gob does in this CL) to call UnsafeAddr instead.

R=r, rog
CC=golang-dev
https://golang.org/cl/4239052

14 years agogc, ld: reflect support for PtrTo
Russ Cox [Thu, 3 Mar 2011 18:17:54 +0000 (13:17 -0500)]
gc, ld: reflect support for PtrTo

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

14 years agofix build (observed in wild, not on dashboard)
Russ Cox [Thu, 3 Mar 2011 16:51:16 +0000 (11:51 -0500)]
fix build (observed in wild, not on dashboard)

TBR=r
CC=golang-dev
https://golang.org/cl/4257054

14 years agobzip2: speed up decompression.
Adam Langley [Thu, 3 Mar 2011 14:13:06 +0000 (09:13 -0500)]
bzip2: speed up decompression.

This borrows a trick from the bzip2 source and effects a decent speed
up when decompressing highly compressed sources. Rather than unshuffle
the BTW block when performing the IBTW, a linked-list is threaded
through the array, in place. This improves cache hit rates.

R=bradfitzgo, bradfitzwork, cw
CC=golang-dev
https://golang.org/cl/4247047

14 years agoimage: add a decoding test for common file formats.
Nigel Tao [Thu, 3 Mar 2011 09:35:49 +0000 (20:35 +1100)]
image: add a decoding test for common file formats.

The test image was converted from doc/video-001.png using the
convert command line tool (ImageMagick 6.5.7-8) at -quality 100.

R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4259047

14 years agodoc: remove reference to bug count from install.html
Andrew Gerrand [Thu, 3 Mar 2011 05:41:03 +0000 (16:41 +1100)]
doc: remove reference to bug count from install.html

Fixes #1574.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4240066

14 years agogobuilder: add -package flag to build external packages
Andrew Gerrand [Thu, 3 Mar 2011 03:41:09 +0000 (14:41 +1100)]
gobuilder: add -package flag to build external packages

Also add -v for verbose logging.

R=rsc, gri, r, r2
CC=golang-dev
https://golang.org/cl/4172056

14 years agounsafe: fix the documentation
Rob Pike [Thu, 3 Mar 2011 03:39:08 +0000 (19:39 -0800)]
unsafe: fix the documentation
Reflection is about Pointer, not uintptr.
Also clarify that Reflect and Unreflect are indirect.

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

14 years agogc: fix init of packages named main
Gustavo Niemeyer [Wed, 2 Mar 2011 21:18:17 +0000 (16:18 -0500)]
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

14 years agoruntime: fix unused variable warning
Dave Cheney [Wed, 2 Mar 2011 20:29:13 +0000 (15:29 -0500)]
runtime: fix unused variable warning

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

14 years agoxml: fix typo in test.
Yasuhiro Matsumoto [Wed, 2 Mar 2011 20:05:52 +0000 (15:05 -0500)]
xml: fix typo in test.

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

14 years agogoinstall: protect against malicious filenames.
Roger Peppe [Wed, 2 Mar 2011 20:04:08 +0000 (15:04 -0500)]
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

14 years agobuild: simplify clean.bash
Dave Cheney [Wed, 2 Mar 2011 19:57:47 +0000 (14:57 -0500)]
build: simplify clean.bash

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

14 years agofix build
Russ Cox [Wed, 2 Mar 2011 19:52:35 +0000 (14:52 -0500)]
fix build

TBR=rog
CC=golang-dev
https://golang.org/cl/4259046

14 years agobuild: fix race condition building enam.o
Dave Cheney [Wed, 2 Mar 2011 19:22:39 +0000 (14:22 -0500)]
build: fix race condition building enam.o

R=golang-dev, rsc
CC=albert.strasheim, golang-dev
https://golang.org/cl/4240055

14 years agocgo: put temporary source files in _obj.
Roger Peppe [Wed, 2 Mar 2011 19:22:33 +0000 (14:22 -0500)]
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

14 years agofmt: allow recursive calls to Fscan etc.
Roger Peppe [Wed, 2 Mar 2011 18:54:23 +0000 (10:54 -0800)]
fmt: allow recursive calls to Fscan etc.
Add a new Read method to ScanState so that it
satisfies the io.Reader interface; rename
Getrune and Ungetrune to ReadRune and UnreadRune.
Make sure ReadRune does not read past width restrictions;
remove now-unnecessary Width method from ScanState.
Also make the documentation a little clearer as to
how ReadRune and UnreadRune are used.

R=r, r2
CC=golang-dev
https://golang.org/cl/4240056

14 years agoruntime: record goroutine creation pc and display in traceback
Russ Cox [Wed, 2 Mar 2011 18:42:02 +0000 (13:42 -0500)]
runtime: record goroutine creation pc and display in traceback

package main

func main() {
        go func() { *(*int)(nil) = 0 }()
        select{}
}

panic: runtime error: invalid memory address or nil pointer dereference

[signal 0xb code=0x1 addr=0x0 pc=0x1c96]

runtime.panic+0xac /Users/rsc/g/go/src/pkg/runtime/proc.c:1083
        runtime.panic(0x11bf0, 0xf8400011f0)
runtime.panicstring+0xa3 /Users/rsc/g/go/src/pkg/runtime/runtime.c:116
        runtime.panicstring(0x29a57, 0x0)
runtime.sigpanic+0x144 /Users/rsc/g/go/src/pkg/runtime/darwin/thread.c:470
        runtime.sigpanic()
main._func_001+0x16 /Users/rsc/g/go/src/pkg/runtime/x.go:188
        main._func_001()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:150
        runtime.goexit()
----- goroutine created by -----
main.main+0x3d /Users/rsc/g/go/src/pkg/runtime/x.go:4

goroutine 1 [4]:
runtime.gosched+0x77 /Users/rsc/g/go/src/pkg/runtime/proc.c:598
        runtime.gosched()
runtime.block+0x27 /Users/rsc/g/go/src/pkg/runtime/chan.c:680
        runtime.block()
main.main+0x44 /Users/rsc/g/go/src/pkg/runtime/x.go:5
        main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:77
        runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:150
        runtime.goexit()
----- goroutine created by -----
_rt0_amd64+0x8e /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:64

Fixes #1563.

R=r
CC=golang-dev
https://golang.org/cl/4243046

14 years agohttp: initialize request Header for the transport
Brad Fitzpatrick [Wed, 2 Mar 2011 18:21:56 +0000 (10:21 -0800)]
http: initialize request Header for the transport

Fixes #1558

R=rsc, r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4260042

14 years agohttp: give ParseHTTPVersion a real example.
David Symonds [Tue, 1 Mar 2011 23:10:12 +0000 (10:10 +1100)]
http: give ParseHTTPVersion a real example.

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

14 years agohttp: expose Client's Transport
Brad Fitzpatrick [Tue, 1 Mar 2011 22:07:28 +0000 (14:07 -0800)]
http: expose Client's Transport

This is again an intentionally minimal change.

The plan is to keep Client's zero value be a usable
client, with optional fields being added over time
(e.g. cookie manager, redirect policy, auth)

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

14 years agodocs: make "runtime" a word only as a name for the package.
Rob Pike [Tue, 1 Mar 2011 21:54:22 +0000 (13:54 -0800)]
docs: make "runtime" a word only as a name for the package.

Computer people have an agglutinating streak that I like to resist.
As a time of execution: run time.
As an adjective: run-time.
As a noun: run-time support/code/library.

Signed,
Mr. Pedant.

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

14 years agofmt: delete debugging print that crept in to test.
Rob Pike [Tue, 1 Mar 2011 21:39:44 +0000 (13:39 -0800)]
fmt: delete debugging print that crept in to test.
(you'd never see it, but ouch.)
Spotted by Florian Weimer.

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

14 years agofmt: make %#p suppress leading 0x
Rob Pike [Tue, 1 Mar 2011 21:25:52 +0000 (13:25 -0800)]
fmt: make %#p suppress leading 0x

Fixes bug 1567.

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

14 years agohttp: export parseHTTPVersion.
David Symonds [Tue, 1 Mar 2011 11:38:18 +0000 (22:38 +1100)]
http: export parseHTTPVersion.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4244045

14 years agodoc: add FAQ about large binaries and stack vs heap allocation
Andrew Gerrand [Tue, 1 Mar 2011 10:35:46 +0000 (21:35 +1100)]
doc: add FAQ about large binaries and stack vs heap allocation
doc: add internationalization to roadmap

R=rsc, r, r2
CC=golang-dev
https://golang.org/cl/4251047

14 years agogoyacc: clarify it's package, not binary, that has
Rob Pike [Tue, 1 Mar 2011 04:47:52 +0000 (20:47 -0800)]
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

14 years agogoyacc: provide -p flag to set prefix for names.
Rob Pike [Tue, 1 Mar 2011 01:43:16 +0000 (17:43 -0800)]
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

14 years agobuild: convert src/cmd to use make directly and simplify src/make.bash
Dave Cheney [Mon, 28 Feb 2011 22:20:32 +0000 (09:20 +1100)]
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

14 years agogc: bug325 / issue 1566
Russ Cox [Mon, 28 Feb 2011 22:16:44 +0000 (17:16 -0500)]
gc: bug325 / issue 1566

Fixes #1566.

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

14 years agobuild: move $GOBIN ahead of /bin, /usr/bin in build $PATH
Russ Cox [Mon, 28 Feb 2011 19:55:27 +0000 (14:55 -0500)]
build: move $GOBIN ahead of /bin, /usr/bin in build $PATH

Otherwise if there is an installed /usr/bin/6g the build
will use that one instead of the one it builds.

R=r
CC=golang-dev
https://golang.org/cl/4249045

14 years agoxml: permit nested directives
Chris Dollin [Mon, 28 Feb 2011 19:09:04 +0000 (14:09 -0500)]
xml: permit nested directives

Return <!DOCTYPE ...> with nested directives as one big token.

Fixes #1549.

R=niemeyer, rsc
CC=golang-dev
https://golang.org/cl/4216050

14 years agotemplate: document the delimiters better
Rob Pike [Mon, 28 Feb 2011 18:27:33 +0000 (10:27 -0800)]
template: document the delimiters better

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

14 years agosyscall: regenerate zerrors_freebsd_amd64.go
Mikio Hara [Mon, 28 Feb 2011 15:21:19 +0000 (10:21 -0500)]
syscall: regenerate zerrors_freebsd_amd64.go

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

14 years agoruntime: idle goroutine
Russ Cox [Mon, 28 Feb 2011 04:32:42 +0000 (23:32 -0500)]
runtime: idle goroutine

This functionality might be used in environments
where programs are limited to a single thread,
to simulate a select-driven network server.  It is
not exposed via the standard runtime API.

R=r, r2
CC=golang-dev
https://golang.org/cl/4254041

14 years agocompress/lzw: don't use a closure in NewReader, which avoids having
Nigel Tao [Sat, 26 Feb 2011 05:42:49 +0000 (16:42 +1100)]
compress/lzw: don't use a closure in NewReader, which avoids having
to move some variables from the stack to the heap.

Sorted benchmark runs on my 2007-era Mac Mini (GOARCH=amd64, GOOS=linux):

Before:
lzw.BenchmarkDecoder        2000        878176 ns/op
lzw.BenchmarkDecoder        2000        878415 ns/op
lzw.BenchmarkDecoder        2000        880352 ns/op
lzw.BenchmarkDecoder        2000        898445 ns/op
lzw.BenchmarkDecoder        2000        901728 ns/op

After:
lzw.BenchmarkDecoder        2000        859065 ns/op
lzw.BenchmarkDecoder        2000        859402 ns/op
lzw.BenchmarkDecoder        2000        860035 ns/op
lzw.BenchmarkDecoder        2000        860555 ns/op
lzw.BenchmarkDecoder        2000        861109 ns/op

The ratio of before/after median times is 1.024.

The runtime.MemStats.Mallocs delta per loop drops from 109 to 104.

R=r, r2, dfc
CC=golang-dev
https://golang.org/cl/4253043

14 years agocompress/lzw: fix the stupidity of allocating and zeroing a new buffer
Nigel Tao [Fri, 25 Feb 2011 22:25:29 +0000 (09:25 +1100)]
compress/lzw: fix the stupidity of allocating and zeroing a new buffer
on each loop iteration, yielding a 20x performance improvement.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4240044

14 years agocrypto/openpgp: fix test prints
Rob Pike [Fri, 25 Feb 2011 21:44:37 +0000 (13:44 -0800)]
crypto/openpgp: fix test prints

R=agl, agl1
CC=golang-dev
https://golang.org/cl/4255041

14 years agoruntime: omit breakpoint during terminal panic
Russ Cox [Fri, 25 Feb 2011 20:17:34 +0000 (15:17 -0500)]
runtime: omit breakpoint during terminal panic

again.
CL 4222043 missed this case.

R=brainman, r, r2
CC=golang-dev
https://golang.org/cl/4235043

14 years agosync/atomic: make BUG comment godoc-compatible
Russ Cox [Fri, 25 Feb 2011 19:40:36 +0000 (14:40 -0500)]
sync/atomic: make BUG comment godoc-compatible

go/doc wants to see text after BUG(uid): on the same line
in order to treat it as an official bug comment.

R=gri
CC=golang-dev
https://golang.org/cl/4250043

14 years agoruntime: use kernel-supplied cas on linux/arm
Russ Cox [Fri, 25 Feb 2011 19:29:55 +0000 (14:29 -0500)]
runtime: use kernel-supplied cas on linux/arm

Using the kernel-supplied compare-and-swap code
on linux/arm means that runtime doesn't have to care
whether this is GOARM=5 or GOARM=6 anymore.

Fixes #1494.

R=r, r2
CC=golang-dev
https://golang.org/cl/4245043

14 years agosync: use sync/atomic
Russ Cox [Fri, 25 Feb 2011 19:29:47 +0000 (14:29 -0500)]
sync: use sync/atomic

Remove references to custom assembly routines.

R=r, r2
CC=golang-dev
https://golang.org/cl/4241043

14 years agosync/atomic: new package
Russ Cox [Fri, 25 Feb 2011 19:29:36 +0000 (14:29 -0500)]
sync/atomic: new package

Fixes #170.

R=gri, iant, r, r2
CC=golang-dev
https://golang.org/cl/4241041

14 years agoA+C: Chris Dollin (individual CLA)
Russ Cox [Fri, 25 Feb 2011 19:05:44 +0000 (14:05 -0500)]
A+C: Chris Dollin (individual CLA)

R=r, r2, gri
CC=ehog.hedge, golang-dev
https://golang.org/cl/4240043

14 years agogob: make recursive map and slice types work.
Rob Pike [Fri, 25 Feb 2011 17:45:06 +0000 (09:45 -0800)]
gob: make recursive map and slice types work.

Before this fix, types such as
        type T map[string]T
caused infinite recursion in the gob implementation.
Now they just work.

Fixes #1518.

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

14 years ago8a, 8l: add CMPXCHG8B, XADDB, XADDL, XADDW
Russ Cox [Fri, 25 Feb 2011 06:04:29 +0000 (01:04 -0500)]
8a, 8l: add CMPXCHG8B, XADDB, XADDL, XADDW

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

14 years ago5a, 5l: add LDREXD, STREXD
Russ Cox [Fri, 25 Feb 2011 06:03:54 +0000 (01:03 -0500)]
5a, 5l: add LDREXD, STREXD

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

14 years agobug324.go: test case for issue 1550
Robert Griesemer [Fri, 25 Feb 2011 03:29:25 +0000 (19:29 -0800)]
bug324.go: test case for issue 1550

Also: renamed fixedbugs/bug322.go to fixedbugs/bug323.go
because we already have a bugs/bug322.go and bug322.dir.

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

14 years agotag release.2011-02-24
Andrew Gerrand [Fri, 25 Feb 2011 03:24:08 +0000 (14:24 +1100)]
tag release.2011-02-24

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

14 years agorelease.2011-02-24 weekly.2011-02-24
Andrew Gerrand [Fri, 25 Feb 2011 03:13:14 +0000 (14:13 +1100)]
release.2011-02-24

R=r, rsc
CC=golang-dev
https://golang.org/cl/4213044

14 years agocrypto/openpgp: add package
Adam Langley [Fri, 25 Feb 2011 01:19:53 +0000 (20:19 -0500)]
crypto/openpgp: add package

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/3989052

14 years agogodoc: accept symbolic links as path names provided to -path
Robert Griesemer [Fri, 25 Feb 2011 00:24:51 +0000 (16:24 -0800)]
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

14 years agoruntime: add empty windows/signals.h file to fix build
Alex Brainman [Fri, 25 Feb 2011 00:16:39 +0000 (11:16 +1100)]
runtime: add empty windows/signals.h file to fix build

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4223049

14 years agocompress/lzw: implement an encoder.
Nigel Tao [Thu, 24 Feb 2011 22:20:04 +0000 (09:20 +1100)]
compress/lzw: implement an encoder.

R=rsc, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4209043

14 years agoreflect: add pointer word to CommonType
Russ Cox [Thu, 24 Feb 2011 22:11:20 +0000 (17:11 -0500)]
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

14 years agoruntime: fix signal stack bug
Russ Cox [Thu, 24 Feb 2011 21:46:44 +0000 (13:46 -0800)]
runtime: fix signal stack bug

In CL 4188061 I changed malg to allocate the requested
number of bytes n, not n+StackGuard, so that the
allocations would use rounder numbers.

The allocation of the signal stack asks for 32k and
then used g->stackguard as the base, but g->stackguard
is StackGuard bytes above the base.  Previously, asking
for 32k meant getting 32k+StackGuard bytes, so using
g->stackguard as the base was safe.  Now, the actual base
must be computed, so that the signal handler does not
run StackGuard bytes past the top of the stack.

Was causing flakiness mainly in programs that use the
network, because they sometimes write to closed network
connections, causing SIGPIPEs.  Was also causing problems
in the doc/progs test.

Also fix Makefile so that changes to stack.h trigger rebuild.

R=bradfitzgo, r, r2
CC=golang-dev
https://golang.org/cl/4230044

14 years agold: weak symbols
Russ Cox [Thu, 24 Feb 2011 21:45:45 +0000 (16:45 -0500)]
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

14 years agohttp: remove debugging log statement
Russ Cox [Thu, 24 Feb 2011 19:36:18 +0000 (14:36 -0500)]
http: remove debugging log statement

Issue 1547 is fixed.

R=bradfitzgo, r
CC=golang-dev
https://golang.org/cl/4209045

14 years agogodoc: fix writeFileAtomically utility function
Robert Griesemer [Thu, 24 Feb 2011 19:13:20 +0000 (11:13 -0800)]
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

14 years agogodoc: log errors when reading filter files
Robert Griesemer [Thu, 24 Feb 2011 18:22:32 +0000 (10:22 -0800)]
godoc: log errors when reading filter files

R=r, r2
CC=golang-dev
https://golang.org/cl/4230042

14 years agofmt: stop giving characters to the Scan method of Scanner
Rob Pike [Thu, 24 Feb 2011 18:14:19 +0000 (10:14 -0800)]
fmt: stop giving characters to the Scan method of Scanner
when we hit a newline during *scanln routines.

Fixes #1490.

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

14 years ago8l/6l: new -Hwindowsgui flag allows to build windows gui pe
Alex Brainman [Thu, 24 Feb 2011 05:10:30 +0000 (16:10 +1100)]
8l/6l: new -Hwindowsgui flag allows to build windows gui pe

Fixes #1516.

R=rsc, mattn
CC=golang-dev
https://golang.org/cl/4214041

14 years agobuild: remove unused nacl conditional from make.bash
Dave Cheney [Thu, 24 Feb 2011 04:56:53 +0000 (15:56 +1100)]
build: remove unused nacl conditional from make.bash

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4217042

14 years agonet: *netFD.Read to return os.EOF on eof (fixes windows build)
Alex Brainman [Wed, 23 Feb 2011 23:17:45 +0000 (10:17 +1100)]
net: *netFD.Read to return os.EOF on eof (fixes windows build)

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

14 years agohttp: set method GET on Get() requests
Brad Fitzpatrick [Wed, 23 Feb 2011 23:03:30 +0000 (15:03 -0800)]
http: set method GET on Get() requests

R=adg, bradfitzwork
CC=golang-dev
https://golang.org/cl/4229042

14 years agobuild: remove _gcc_main.c during make clean
Russ Cox [Wed, 23 Feb 2011 20:51:27 +0000 (15:51 -0500)]
build: remove _gcc_main.c during make clean

R=r, r2
CC=golang-dev
https://golang.org/cl/4226043

14 years agoruntime: always run stackalloc on scheduler stack
Russ Cox [Wed, 23 Feb 2011 20:51:20 +0000 (15:51 -0500)]
runtime: always run stackalloc on scheduler stack

Avoids deadlocks like the one below, in which a stack split happened
in order to call lock(&stacks), but then the stack unsplit cannot run
because stacks is now locked.

The only code calling stackalloc that wasn't on a scheduler
stack already was malg, which creates a new goroutine.

runtime.futex+0x23 /home/rsc/g/go/src/pkg/runtime/linux/amd64/sys.s:139
       runtime.futex()
futexsleep+0x50 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:51
       futexsleep(0x5b0188, 0x300000003, 0x100020000, 0x4159e2)
futexlock+0x85 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:119
       futexlock(0x5b0188, 0x5b0188)
runtime.lock+0x56 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:158
       runtime.lock(0x5b0188, 0x7f0d27b4a000)
runtime.stackfree+0x4d /home/rsc/g/go/src/pkg/runtime/malloc.goc:336
       runtime.stackfree(0x7f0d27b4a000, 0x1000, 0x8, 0x7fff37e1e218)
runtime.oldstack+0xa6 /home/rsc/g/go/src/pkg/runtime/proc.c:705
       runtime.oldstack()
runtime.lessstack+0x22 /home/rsc/g/go/src/pkg/runtime/amd64/asm.s:224
       runtime.lessstack()
----- lessstack called from goroutine 2 -----
runtime.lock+0x56 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:158
       runtime.lock(0x5b0188, 0x40a5e2)
runtime.stackalloc+0x55 /home/rsc/g/go/src/pkg/runtime/malloc.c:316
       runtime.stackalloc(0x1000, 0x4055b0)
runtime.malg+0x3d /home/rsc/g/go/src/pkg/runtime/proc.c:803
       runtime.malg(0x1000, 0x40add9)
runtime.newproc1+0x12b /home/rsc/g/go/src/pkg/runtime/proc.c:854
       runtime.newproc1(0xf840027440, 0x7f0d27b49230, 0x0, 0x49f238, 0x40, ...)
runtime.newproc+0x2f /home/rsc/g/go/src/pkg/runtime/proc.c:831
       runtime.newproc(0x0, 0xf840027440, 0xf800000010, 0x44b059)
...

R=r, r2
CC=golang-dev
https://golang.org/cl/4216045

14 years agoruntime: omit breakpoint during terminal panic
Russ Cox [Wed, 23 Feb 2011 20:42:13 +0000 (15:42 -0500)]
runtime: omit breakpoint during terminal panic

A terminal panic (one that prints a stack trace and exits)
has been calling runtime.breakpoint before calling exit,
so that if running under a debugger, the debugger can
take control.  When not running under a debugger, though,
this causes an additional SIGTRAP on Unix and pop-up
dialogs on Windows.

Support for debugging Go programs has gotten good
enough that we can rely on the debugger to set its own
breakpoint on runtime.exit if it wants to look around.

R=r, r2
CC=golang-dev
https://golang.org/cl/4222043

14 years agohttp: introduce start of Client and ClientTransport
Brad Fitzpatrick [Wed, 23 Feb 2011 20:20:50 +0000 (12:20 -0800)]
http: introduce start of Client and ClientTransport

Much yet to come, but this is a safe first step, introducing
an in-the-future configurable Client object (where policy for
cookies, auth, redirects will live) as well as introducing a
ClientTransport interface for sending requests.

The CL intentionally ignores everything around the creation
and configuration of Clients and merely ports/wraps the old
interfaces to/around Client/ClientTransport.

R=rsc, dsymonds, nigeltao, bradfitzwork
CC=golang-dev
https://golang.org/cl/4182086

14 years agoruntime: pass to signal handler value of g at time of signal
Russ Cox [Wed, 23 Feb 2011 19:47:42 +0000 (14:47 -0500)]
runtime: pass to signal handler value of g at time of signal

The existing code assumed that signals only arrived
while executing on the goroutine stack (g == m->curg),
not while executing on the scheduler stack (g == m->g0).

Most of the signal handling trampolines correctly saved
and restored g already, but the sighandler C code did not
have access to it.

Some rewriting of assembly to make the various
implementations as similar as possible.

Will need to change Windows too but I don't
understand how sigtramp gets called there.

R=r
CC=golang-dev
https://golang.org/cl/4203042

14 years agoruntime: traceback through active lessstack
Russ Cox [Wed, 23 Feb 2011 19:47:22 +0000 (14:47 -0500)]
runtime: traceback through active lessstack

With this change, a panic trace due to a signal arriving while
running on the scheduler stack during a lessstack
(a stack unsplit) will trace through the lessstack to show
the state of the goroutine that was unsplitting its stack.

R=r
CC=golang-dev
https://golang.org/cl/4206042

14 years ago5g: fix optimizer bug
Russ Cox [Wed, 23 Feb 2011 18:21:39 +0000 (13:21 -0500)]
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

14 years agosync: make package comment appear
Robert Griesemer [Wed, 23 Feb 2011 18:12:38 +0000 (10:12 -0800)]
sync: make package comment appear

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

14 years agogob: protect against pure recursive types.
Rob Pike [Wed, 23 Feb 2011 17:49:35 +0000 (09:49 -0800)]
gob: protect against pure recursive types.

There are further changes required for things like
recursive map types.  Recursive struct types work
but the mechanism needs generalization.  The
case handled in this CL is pathological since it
cannot be represented at all by gob, so it should
be handled separately. (Prior to this CL, encode
would recur forever.)

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

14 years agocompress/bzip2: fix bugs
Adam Langley [Wed, 23 Feb 2011 17:02:41 +0000 (12:02 -0500)]
compress/bzip2: fix bugs

(Once again, proving that a fuzz tester is the first thing that I
should try.)

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4227042

14 years agocodereview: fix clpatch with empty diffs
Gustavo Niemeyer [Wed, 23 Feb 2011 16:48:40 +0000 (11:48 -0500)]
codereview: fix clpatch with empty diffs

Avoid passing the placeholder diff to hgpatch, so that
clpatch-ing an empty diff grabs the metadata and warns
about it being empty, rather than failing with a
hard-to-debug problem ("mkdir: no such file or dir",
no metadata, etc).

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

14 years agojson: use base64 to encode []byte
Roger Peppe [Wed, 23 Feb 2011 16:32:29 +0000 (11:32 -0500)]
json: use base64 to encode []byte

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

14 years agocompress/bzip2: add package.
Adam Langley [Wed, 23 Feb 2011 15:23:28 +0000 (10:23 -0500)]
compress/bzip2: add package.

This code implements bzip2 decompression only.

R=bradfitzgo, r2, nigeltao, rsc
CC=golang-dev
https://golang.org/cl/4176051

14 years agocompress/lzw: implement a decoder.
Nigel Tao [Wed, 23 Feb 2011 09:52:43 +0000 (20:52 +1100)]
compress/lzw: implement a decoder.

R=rsc
CC=bsiegert, golang-dev, mpl
https://golang.org/cl/4182081

14 years agohttp: introduce Header type, implement with net/textproto
Petar Maymounkov [Wed, 23 Feb 2011 05:39:25 +0000 (00:39 -0500)]
http: introduce Header type, implement with net/textproto
textproto: introduce Header type
websocket: use new interface to access Header

R=rsc, mattn
CC=golang-dev
https://golang.org/cl/4185053

14 years agoMake.pkg, doc: Replace references to "-benchmarks" and "-match" with "-test.bench...
Kyle Consalus [Wed, 23 Feb 2011 04:23:21 +0000 (20:23 -0800)]
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

14 years agogo/parser: if and switch statements still can have empty init statements
Robert Griesemer [Wed, 23 Feb 2011 04:10:09 +0000 (20:10 -0800)]
go/parser: if and switch statements still can have empty init statements

This is a fix for the overly aggressive CL 4173075.
Ran all tests.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4203041

14 years agonet: refactor windows code
Alex Brainman [Wed, 23 Feb 2011 03:40:24 +0000 (14:40 +1100)]
net: refactor windows code

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

14 years ago5l/6l/8l: use enums for header type and symbolic strings for -H option values
Alex Brainman [Wed, 23 Feb 2011 03:30:40 +0000 (14:30 +1100)]
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

14 years agoexp/eval, go/printer: fix build
Robert Griesemer [Wed, 23 Feb 2011 02:17:03 +0000 (18:17 -0800)]
exp/eval, go/printer: fix build

There are some minor irregularities in the printer
output (some paren's are present that should be
removed), but these are unrelated issues.
Will review in a 2nd step.

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

14 years agoarm: fix build
Russ Cox [Wed, 23 Feb 2011 02:10:02 +0000 (21:10 -0500)]
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

14 years agogo/ast, parser: condition in if statement is mandatory
Robert Griesemer [Wed, 23 Feb 2011 01:25:10 +0000 (17:25 -0800)]
go/ast, parser: condition in if statement is mandatory

As a result, parsing a "control clause" is now sufficiently
different for if, switch, and for statements that the code
is not factored out anymore. The code is a bit longer but
clearer in each individual case.

Reflect the changes in AST.

R=r, r2
CC=golang-dev
https://golang.org/cl/4173075

14 years agogo spec: make condition mandatory in if statements
Robert Griesemer [Tue, 22 Feb 2011 23:31:57 +0000 (15:31 -0800)]
go spec: make condition mandatory in if statements

Plus a few minor HTML fixes.

Fixes #1535.

R=r, rsc, ken2, iant, r2
CC=golang-dev
https://golang.org/cl/4185065

14 years agogc: require if condition
Russ Cox [Tue, 22 Feb 2011 23:23:29 +0000 (18:23 -0500)]
gc: require if condition

R=ken2, r2
CC=golang-dev
https://golang.org/cl/4195045

14 years agotest: do not depend on implicit if condition
Russ Cox [Tue, 22 Feb 2011 23:23:14 +0000 (18:23 -0500)]
test: do not depend on implicit if condition

Deleted test/ken/robif.go because test/if.go is
the same program modulo formatting.

R=golang-dev, gri, r2
CC=golang-dev
https://golang.org/cl/4186068

14 years agold: detect stack overflow due to NOSPLIT
Russ Cox [Tue, 22 Feb 2011 22:40:40 +0000 (17:40 -0500)]
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

14 years agomisc/dashboard/builder: talk to hg with utf-8 encoding always.
Andrew Gerrand [Tue, 22 Feb 2011 20:47:53 +0000 (07:47 +1100)]
misc/dashboard/builder: talk to hg with utf-8 encoding always.

Fixes #1465.

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

14 years ago.hgignore: add *.cgo*.{c,go}
Gustavo Niemeyer [Tue, 22 Feb 2011 20:42:10 +0000 (15:42 -0500)]
.hgignore: add *.cgo*.{c,go}

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

14 years agogob: compute information about a user's type once.
Rob Pike [Tue, 22 Feb 2011 20:31:57 +0000 (12:31 -0800)]
gob: compute information about a user's type once.
Other than maybe cleaning the code up a bit, this has
little practical effect for now, but lays the foundation
for remembering the method set of a type, which can
be expensive.

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

14 years agogo spec: fix local link
Robert Griesemer [Tue, 22 Feb 2011 17:34:13 +0000 (09:34 -0800)]
go spec: fix local link

Fixes #1543.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4169068

14 years agoreflect: add a secret method to ArrayOrSliceType.
Rob Pike [Tue, 22 Feb 2011 17:21:50 +0000 (09:21 -0800)]
reflect: add a secret method to ArrayOrSliceType.
It was observed that the interface was generic enough
that several other types implemented it too.

Fixes #1530.

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