]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 years agoruntime: add openbsd 386 defs.h
Joel Sing [Mon, 29 Aug 2011 15:07:19 +0000 (11:07 -0400)]
runtime: add openbsd 386 defs.h

Missed in previous change (4951043).

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

13 years agoruntime: add runtime· prefix to showframe
Russ Cox [Mon, 29 Aug 2011 14:55:21 +0000 (10:55 -0400)]
runtime: add runtime· prefix to showframe

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

13 years agonet: change the internal form of IPMask for IPv4
Mikio Hara [Mon, 29 Aug 2011 14:49:03 +0000 (10:49 -0400)]
net: change the internal form of IPMask for IPv4

This CL changes the internal form of IPMask for IPv4
from 16-byte to 4-byte, also adds Size method to IPMask
struct and changes output string format of IPMask.String
method.

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

13 years agoos: fix WNOHANG Waitmsg
Gustavo Niemeyer [Mon, 29 Aug 2011 14:45:37 +0000 (10:45 -0400)]
os: fix WNOHANG Waitmsg

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

13 years agoruntime: add runtime support for openbsd 386
Joel Sing [Mon, 29 Aug 2011 14:42:16 +0000 (10:42 -0400)]
runtime: add runtime support for openbsd 386

Add openbsd 386 runtime support, partially based on the existing
freebsd 386 runtime.

This requires change 4973043.

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

13 years agoruntime, syscall: use the vdso page on linux x86 for faster syscalls instead of int...
Yuval Pavel Zholkover [Mon, 29 Aug 2011 14:36:06 +0000 (10:36 -0400)]
runtime, syscall: use the vdso page on linux x86 for faster syscalls instead of int $0x80.
8l: fix handling CALL $(constant) code generated by 8a.
8a,8l: add indirect call instruction: CALL *data(SB).

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

13 years agosyscall: add openbsd 386
Joel Sing [Mon, 29 Aug 2011 14:04:28 +0000 (10:04 -0400)]
syscall: add openbsd 386

Add openbsd 386 syscall support, partially based on the existing
freebsd 386 syscall implementation.

FTR zerrors_openbsd_386.go cannot currently be completely built on
openbsd/i386 due to what appears to be a gcc bug. The constants can be
successfully generated with -m32 on openbsd/amd64 and the error
table can then be generated on openbsd/i386.

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

13 years agoruntime: openbsd thread tweaks
Joel Sing [Mon, 29 Aug 2011 13:35:13 +0000 (09:35 -0400)]
runtime: openbsd thread tweaks

- Rename sys_sched_yield() to osyield() as this is now defined in asm.h.
- Only print kern.rtheads message if rfork_thread() failed with ENOTSUP.
- Remove unused variables.

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

13 years agotime: fix Plan 9 build
Fazlul Shahriar [Mon, 29 Aug 2011 13:35:08 +0000 (09:35 -0400)]
time: fix Plan 9 build

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

13 years agogc: fix build on Plan 9
Lucio De Re [Mon, 29 Aug 2011 13:35:04 +0000 (09:35 -0400)]
gc: fix build on Plan 9

gc/bits.c
. improved format with associated cast;
gc/closure.c
gc/dcl.c
gc/range.c
gc/reflect.c
gc/sinit.c
. dropped unnecessary assignments;
gc/gen.c
. dropped unnecessary assignment;
. added static qualifier to local function definition;
gc/go.h
. added varargck pragmas;
gc/lex.c
. used {} instead of ; in if statement to suppress warning;
. replaced exit(0) with exits(0);
. added compilation conditions for SIGBUS/SIGSEGV;
. dropped unnecessary assignment;
gc/mparith2.c
. dropped four unnecessary assignments/initialisations;
gc/obj.c
. added type cast to local pointer;
gc/pgen.c
. added cast and related print format;
gc/subr.c
. replaced exit(1) with exits("error");
. replaced unlink() with remove();
. renamed local cistrmp() as ucistrmp() to remove conflict with
  Plan 9 function by the same name;
gc/swt.c
. added braces instead of ; as empty statment;
gc/typecheck.c
. added static qualifier to local function definition;
. dropped unnecessary assignments;
gc/walk.c
. dropped unnecessary assignments;
. added static qualifier to local function definitions;

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

13 years ago6g: fix build on Plan 9
Lucio De Re [Mon, 29 Aug 2011 13:34:59 +0000 (09:34 -0400)]
6g: fix build on Plan 9

src/cmd/6g/cgen.c
src/cmd/6g/gobj.c
src/cmd/6g/reg.c
. dropped unused assignments;
src/cmd/6g/gg.h
. added varargck pragmas;
src/cmd/6g/list.c
. adjusted print format for ulong casts;
src/cmd/6g/peep.c
. dropped redundant increment;

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

13 years ago5g: fix build on Plan 9
Lucio De Re [Mon, 29 Aug 2011 13:34:52 +0000 (09:34 -0400)]
5g: fix build on Plan 9

5g/cgen.c:
. USED(n4) as it is only mentioned in unreachable code later;
. dropped unused assignments;
. commented out unreachable code;
5g/cgen64.c:
5g/ggen.c:
. dropped unused assignments of function return value;
5g/gg.h:
. added varargck pragmas;
5g/peep.c:
. USED(p1) used only in unreacheable code;
. commented out unreachable code;
5g/reg.c:
. dropped unused assignment;

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

13 years agodoc/codelab/wiki: fix Makefile
Russ Cox [Mon, 29 Aug 2011 13:24:24 +0000 (09:24 -0400)]
doc/codelab/wiki: fix Makefile

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

13 years agoruntime: fix stack cleanup on windows/amd64
Hector Chu [Mon, 29 Aug 2011 12:12:56 +0000 (22:12 +1000)]
runtime: fix stack cleanup on windows/amd64

In amd64 it is the caller who cleans the stack.

R=alex.brainman, vcc.163, jp
CC=golang-dev
https://golang.org/cl/4966046

13 years agofix windows/amd64 build with newest mingw-w64
Hector Chu [Mon, 29 Aug 2011 06:17:08 +0000 (16:17 +1000)]
fix windows/amd64 build with newest mingw-w64

R=alex.brainman, golang-dev
CC=golang-dev
https://golang.org/cl/4968048

13 years agotemplate: range over channel
Rob Pike [Mon, 29 Aug 2011 05:56:52 +0000 (15:56 +1000)]
template: range over channel

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4951046

13 years agogc: fix arm build
Russ Cox [Mon, 29 Aug 2011 03:29:34 +0000 (23:29 -0400)]
gc: fix arm build

Escape analysis was incorrectly assuming that
functions without bodies don't leak their
parameters.  This meant that sync/atomic's
TestAddInt64 was allocating x on its stack,
and then x was not properly aligned for use
with the atomic 64-bit instructions.  Obviously
we should figure out the alignment story on 5g
too, but this fix is correct and should restore the
build to 'ok'.

TBR=lvd
CC=golang-dev
https://golang.org/cl/4964047

13 years agogodashboard: fix utf-8 in user names
Russ Cox [Mon, 29 Aug 2011 02:23:44 +0000 (22:23 -0400)]
godashboard: fix utf-8 in user names

Also standardize on 'utf8' as encoding name.
Apparently either is acceptable.

The user, because it is a StringProperty,
must be of type unicode in order to handle
Unicode correctly.  It must *not* have type string.

The desc, because it is a BlobProperty, must
be of type string in order to handle Unicode correctly.
It must *not* have type unicode.

Yay encoding type pedantry without static typing.

R=adg, mattn.jp
CC=golang-dev
https://golang.org/cl/4973045

13 years agoruntime: go interface to cdecl calbacks
Jaroslavas Počepko [Mon, 29 Aug 2011 00:40:28 +0000 (10:40 +1000)]
runtime: go interface to cdecl calbacks
cdecl calbacks have been implemented in C/ASM code, just Go function is missing

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/4969047

13 years agogc: tweak and enable escape analysis
Russ Cox [Sun, 28 Aug 2011 16:05:00 +0000 (12:05 -0400)]
gc: tweak and enable escape analysis

-s now means *disable* escape analysis.

Fix escape leaks for struct/slice/map literals.
Add ... tracking.
Rewrite new(T) and slice literal into stack allocation when safe.

Add annotations to reflect.
Reflect is too chummy with the compiler,
so changes like these affect it more than they should.

R=lvd, dave, gustavo
CC=golang-dev
https://golang.org/cl/4954043

13 years agoruntime: use cgo runtime functions to call windows syscalls
Alex Brainman [Sat, 27 Aug 2011 13:17:00 +0000 (23:17 +1000)]
runtime: use cgo runtime functions to call windows syscalls

R=rsc
CC=golang-dev, jp, vcc.163
https://golang.org/cl/4926042

13 years ago6l, 8l: remove JCXZ; add JCXZW, JCXZL, and JCXZQ
Jaroslavas Počepko [Fri, 26 Aug 2011 21:45:19 +0000 (17:45 -0400)]
6l, 8l: remove JCXZ; add JCXZW, JCXZL, and JCXZQ

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

13 years ago8g: fix build on Plan 9
Lucio De Re [Fri, 26 Aug 2011 21:42:59 +0000 (17:42 -0400)]
8g: fix build on Plan 9

8g/cgen.c:
8g/gobj.c
. dropped unnecessary assignments;
8g/gg.h
. added varargckk pragmas;
8g/ggen.c
. dropped duplicate assignment;
8g/gsubr.c
. adjusted format in print statement;
. dropped unnecessary assignment;
. replaced GCC's _builtin_return_address(0) with Plan 9's
  getcallerpc(&n) which is defined as a macro in <u.h>;
8g/list.c
. adjusted format in snprint statement;
8g/opt.h
. added varargck pragma (Adr*) that is specific for the invoking
  modules;
8g/peep.c
. dropped unnecessary incrementation;

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

13 years ago6l, 8l: handle forward JCXZ
Jaroslavas Počepko [Fri, 26 Aug 2011 21:20:19 +0000 (17:20 -0400)]
6l, 8l: handle forward JCXZ

R=rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4963044

13 years agoA+C: Jaroslavas Počepko (individual CLA)
Russ Cox [Fri, 26 Aug 2011 21:20:01 +0000 (17:20 -0400)]
A+C: Jaroslavas Počepko (individual CLA)

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

13 years agomime: fix build
Russ Cox [Fri, 26 Aug 2011 21:19:52 +0000 (17:19 -0400)]
mime: fix build

The fix is to add ' ' after ';' so that we match
what we used to generate.
Packages like http look for the string with
the space in it, and I don't see a reason to
be so terse.

Also s/buffer/b/

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/4959044

13 years agoio: add TeeReader
Hector Chu [Fri, 26 Aug 2011 21:08:59 +0000 (17:08 -0400)]
io: add TeeReader

TeeReader is a Reader that writes what it reads.

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

13 years agomime: text charset defaults
Pascal S. de Kloe [Fri, 26 Aug 2011 20:55:25 +0000 (16:55 -0400)]
mime: text charset defaults

Enforce + document the UTF-8 default.

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

13 years agomime: media type formatter
Pascal S. de Kloe [Fri, 26 Aug 2011 20:55:18 +0000 (16:55 -0400)]
mime: media type formatter

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

13 years agocgo: fixes callback for windows amd64
Wei Guangjing [Fri, 26 Aug 2011 20:43:37 +0000 (16:43 -0400)]
cgo: fixes callback for windows amd64

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

13 years ago8l: add openbsd
Joel Sing [Fri, 26 Aug 2011 19:39:23 +0000 (15:39 -0400)]
8l: add openbsd

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

13 years agosyscall: Handle RTM_NEWROUTE in ParseNetlinkRouteAttr on Linux.
Albert Strasheim [Fri, 26 Aug 2011 19:38:42 +0000 (15:38 -0400)]
syscall: Handle RTM_NEWROUTE in ParseNetlinkRouteAttr on Linux.

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

13 years agonet: disable "tcp" test on openbsd
Joel Sing [Fri, 26 Aug 2011 19:38:02 +0000 (15:38 -0400)]
net: disable "tcp" test on openbsd

Doing a socket/listen on an unspecified address with an unspecified
address family is likely to result in an AF_INET6 socket on an IPv6
capable system, which under OpenBSD means IPv6 only - not IPv4 *and*
IPv6. In this case trying to connect to this socket from an IPv4
loopback address is not going to end well.

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

13 years agotime: fix zone during windows test
Russ Cox [Fri, 26 Aug 2011 19:15:23 +0000 (15:15 -0400)]
time: fix zone during windows test
Factor out sleep interrupt.

Fixes #1109.

R=alex.brainman, go.peter.90, mattn.jp
CC=golang-dev
https://golang.org/cl/4968041

13 years agoxml: marshal "parent>child" tags correctly
Ross Light [Fri, 26 Aug 2011 15:29:52 +0000 (12:29 -0300)]
xml: marshal "parent>child" tags correctly

Fixes #2119

R=m.n.summerfield, adg, kevlar, rsc, gustavo, n13m3y3r
CC=golang-dev
https://golang.org/cl/4941042

13 years agojson: fix decode bug with struct tag names with ,opts being ignored
Brad Fitzpatrick [Fri, 26 Aug 2011 08:27:33 +0000 (12:27 +0400)]
json: fix decode bug with struct tag names with ,opts being ignored

When the encoder was updated to respect the ",omitempty"
struct tag options, the decoder half was never updated to know
about the new struct tag format. (the format is now an optional
name, followed by zero or more ",option" strings)

This only affected people who used ",omitempty" along with
a field name. In that case, the serialized JSON wouldn't
decode to the original value.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/4965049

13 years agohttp: support setting Transport's TLS client config
Brad Fitzpatrick [Fri, 26 Aug 2011 06:06:35 +0000 (10:06 +0400)]
http: support setting Transport's TLS client config

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

13 years agobytes.Buffer: clarify that NewBuffer is not for beginners
Rob Pike [Fri, 26 Aug 2011 05:09:23 +0000 (15:09 +1000)]
bytes.Buffer: clarify that NewBuffer is not for beginners

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

13 years agowebsocket: Implements new version of WebSocket protocol.
Fumitoshi Ukai [Fri, 26 Aug 2011 03:12:08 +0000 (13:12 +1000)]
websocket: Implements new version of WebSocket protocol.

This introduces new APIs.
- DialConfig can open client connection using Config, so user can specify protocol version, tls.Config if necessary.

- Message can be used to send/receive text/binary data in a frame.
- JSON can be used to send/receive JSON data in a frame.

R=golang-dev, adg, rsc, m, tarmigan, raul.san, yohcop
CC=golang-dev
https://golang.org/cl/4635084

13 years agosyscall: SOMAXCONN should be 0x7fffffff at winsock2.
Yasuhiro Matsumoto [Fri, 26 Aug 2011 02:36:46 +0000 (12:36 +1000)]
syscall: SOMAXCONN should be 0x7fffffff at winsock2.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/4955042

13 years agoimage/tiff: decoder optimization.
Benny Siegert [Fri, 26 Aug 2011 01:36:52 +0000 (11:36 +1000)]
image/tiff: decoder optimization.

Write to image.*.Pix directly in the case of RGB, RGBA and NRGBA
images. For the latter two, the file format matches the memory layout
so a simple copy can be used.

RGB image before/after:
tiff.BenchmarkDecoder 748137 ns/op (62.39 MB/s) 251256 ns/op (185.76 MB/s) x3.0

NRGBA image before/after:
tiff.BenchmarkDecoder 775540 ns/op (80.12 MB/s) 116721 ns/op (532.34 MB/s) x6.6

R=nigeltao
CC=golang-dev
https://golang.org/cl/4929046

13 years agoimage/tiff: add a decode benchmark.
Benny Siegert [Fri, 26 Aug 2011 01:31:59 +0000 (11:31 +1000)]
image/tiff: add a decode benchmark.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4917049

13 years agogodoc: added systematic throttling to indexing goroutine
Robert Griesemer [Fri, 26 Aug 2011 00:46:43 +0000 (17:46 -0700)]
godoc: added systematic throttling to indexing goroutine

- implemented stand-alone Throttle mechanism
- added new flag -index_throttle to godoc
- index throttling enables index creation when running
  godoc on app engine as it keeps godoc responsive

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

13 years agogo/build: separate test imports out when scanning
Gustavo Niemeyer [Fri, 26 Aug 2011 00:00:20 +0000 (21:00 -0300)]
go/build: separate test imports out when scanning

This fixes goinstall so it doesn't try to install unneeded
packages or get confused with non-existent loops.

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

13 years agonet: move internal string manipulation routines to parse.go
Mikio Hara [Thu, 25 Aug 2011 23:22:46 +0000 (19:22 -0400)]
net: move internal string manipulation routines to parse.go

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

13 years agonet: make use of IPv4len, IPv6len
Mikio Hara [Thu, 25 Aug 2011 23:00:04 +0000 (19:00 -0400)]
net: make use of IPv4len, IPv6len

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

13 years agogoinstall: report lack of $GOPATH on errors
Gustavo Niemeyer [Thu, 25 Aug 2011 22:12:03 +0000 (19:12 -0300)]
goinstall: report lack of $GOPATH on errors

Fixes #2175.

R=alex.brainman, rsc, gustavo, adg
CC=golang-dev
https://golang.org/cl/4929047

13 years agostrconv: put decimal on stack
Russ Cox [Thu, 25 Aug 2011 21:54:14 +0000 (17:54 -0400)]
strconv: put decimal on stack

This makes decimal a good test
case for the escape analysis.

With escape analysis:

benchmark                 old ns/op    new ns/op    delta
BenchmarkAtof64Decimal         1954          243  -87.56%
BenchmarkAtof64Float           2008          293  -85.41%
BenchmarkAtof64FloatExp       10106         8814  -12.78%
BenchmarkAtof64Big             5113         3486  -31.82%

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

13 years agodoc: emphasize that environment variables are optional
Russ Cox [Thu, 25 Aug 2011 20:53:54 +0000 (16:53 -0400)]
doc: emphasize that environment variables are optional

Also update $GOARM description.

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

13 years agobuild: fix more unused parameters
Russ Cox [Thu, 25 Aug 2011 20:29:56 +0000 (16:29 -0400)]
build: fix more unused parameters

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

13 years agogc: shuffle #includes
Russ Cox [Thu, 25 Aug 2011 20:25:10 +0000 (16:25 -0400)]
gc: shuffle #includes

#include "go.h" (or "gg.h")

becomes

#include <u.h>
#include <libc.h>
#include "go.h"

so that go.y can #include <stdio.h>
after <u.h> but before "go.h".
This is necessary on Plan 9.

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

13 years agobuild: fix unused parameters
Russ Cox [Thu, 25 Aug 2011 20:08:13 +0000 (16:08 -0400)]
build: fix unused parameters

Found with gcc 4.6 -Wunused -Wextra
but should be applicable to Plan 9 too.

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

13 years agotemplate: Grammar fix for template documentation.
Bill Neubauer [Thu, 25 Aug 2011 16:25:19 +0000 (12:25 -0400)]
template: Grammar fix for template documentation.

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

13 years agogc: fix some spurious leaks
Russ Cox [Thu, 25 Aug 2011 13:26:13 +0000 (09:26 -0400)]
gc: fix some spurious leaks

Probably will spark some discussion.  ☺

R=lvd
CC=golang-dev
https://golang.org/cl/4948041

13 years agohttp: return 413 instead of 400 when the request body is too large
Dave Cheney [Thu, 25 Aug 2011 10:00:00 +0000 (14:00 +0400)]
http: return 413 instead of 400 when the request body is too large

RFC2616 says servers should return this status code when
rejecting requests that are too large.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.14

R=bradfitz
CC=golang-dev
https://golang.org/cl/4962041

13 years agoexp/template/html: add some tests for ">" attributes.
Nigel Tao [Thu, 25 Aug 2011 03:48:21 +0000 (13:48 +1000)]
exp/template/html: add some tests for ">" attributes.

R=mikesamuel
CC=golang-dev
https://golang.org/cl/4956042

13 years agoexp/template/html: Reworked escapeText to recognize attr boundaries.
Mike Samuel [Thu, 25 Aug 2011 01:24:43 +0000 (11:24 +1000)]
exp/template/html: Reworked escapeText to recognize attr boundaries.

The following testcases now pass:

`<a href=x` tests that we do not error on partial unquoted attrs.
`<a href=x ` tests that spaces do end unquoted attrs on spaces.
`<a href=''` tests that we recognize the end of single quoted attrs.
`<a href=""` tests that we recognize the end of double quoted attrs.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/4932051

13 years agoversion.bash: update VERSION on -save if already present
Gustavo Niemeyer [Thu, 25 Aug 2011 01:10:25 +0000 (22:10 -0300)]
version.bash: update VERSION on -save if already present

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

13 years agogofix: forgot to rename the URL type
Rob Pike [Thu, 25 Aug 2011 00:16:11 +0000 (10:16 +1000)]
gofix: forgot to rename the URL type
Fixes #2182

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

13 years agobufio: handle a "\r\n" that straddles the buffer.
Andrew Gerrand [Wed, 24 Aug 2011 22:44:12 +0000 (08:44 +1000)]
bufio: handle a "\r\n" that straddles the buffer.

Fixes #2164.

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

13 years agobig: fix nat.scan bug
Evan Shaw [Wed, 24 Aug 2011 21:55:03 +0000 (14:55 -0700)]
big: fix nat.scan bug

Scanning "0" with detected base did not actually set the nat to 0.

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

13 years agogc: simplify escape analysis recursion
Russ Cox [Wed, 24 Aug 2011 20:47:32 +0000 (16:47 -0400)]
gc: simplify escape analysis recursion

Merge escassign(N, x), escassign(x, N), escexpr(n), and escstmt(n) into esc(n).

1. Renaming
https://golang.org/cl/4917050/diff2/1:2001/src/cmd/gc/esc.c

2. Merging.
https://golang.org/cl/4917050/diff2/2001:4001/src/cmd/gc/esc.c

3. Simplify esccall.
https://golang.org/cl/4917050/diff2/4001:5002/src/cmd/gc/esc.c

R=lvd
CC=golang-dev
https://golang.org/cl/4917050

13 years agomisc/emacs: refine label detection
Russ Cox [Wed, 24 Aug 2011 20:47:12 +0000 (16:47 -0400)]
misc/emacs: refine label detection

Based on idea in
http://patch-tracker.debian.org/patch/series/view/golang/1:59-1/008-emacs-mode-key-literal-indent.patch

Fixes #2174.

R=amdragon, ajmani, amdragon
CC=golang-dev
https://golang.org/cl/4922049

13 years agomath: fix Pow10 loop
Volker Dobler [Wed, 24 Aug 2011 17:59:52 +0000 (13:59 -0400)]
math: fix Pow10 loop

Pow10 failed for MinInt32 (endless loop until out of
memory).  Fix by returning 0 and +Inf for all arguments
where the result is not representable in a float64.
Fixes #2159.

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

13 years agonet: make use of IPv4len, IPv6len
Mikio Hara [Wed, 24 Aug 2011 17:59:33 +0000 (13:59 -0400)]
net: make use of IPv4len, IPv6len

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

13 years agocov: remove tautological #defines
Lucio De Re [Wed, 24 Aug 2011 17:59:17 +0000 (13:59 -0400)]
cov: remove tautological #defines

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

13 years agogc: Escape analysis.
Luuk van Dijk [Wed, 24 Aug 2011 17:07:08 +0000 (19:07 +0200)]
gc: Escape analysis.

For now it's switch-on-and-offable with -s, and the effects can be inspected
with -m.  Defaults are the old codepaths.

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

13 years agogodoc: use virtual file system when generating package synopses
Robert Griesemer [Wed, 24 Aug 2011 16:52:16 +0000 (09:52 -0700)]
godoc: use virtual file system when generating package synopses

Fix for godoc on app engine.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4922050

13 years agotest: put GOROOT/bin before all others in run
Luuk van Dijk [Wed, 24 Aug 2011 14:12:20 +0000 (16:12 +0200)]
test: put GOROOT/bin before all others in run

If you installed a 6g in /usr/bin it interferes
with test/run otherwise.

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

13 years agohttp: adjust test threshold for larger suse buffers
Brad Fitzpatrick [Wed, 24 Aug 2011 12:09:49 +0000 (16:09 +0400)]
http: adjust test threshold for larger suse buffers

My theory is that suse has larger TCP buffer sizes
by default.  I now check over 100MB, rather than over 2MB.
100MB is ~halfway between the 1MB limit and the 200MB
request that's attempted.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4926048

13 years agohttp: on invalid request, send 400 response
Brad Fitzpatrick [Wed, 24 Aug 2011 09:10:22 +0000 (13:10 +0400)]
http: on invalid request, send 400 response

Fixes #2160

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4930049

13 years agoexp/norm: Reduced the size of the byte buffer used by reorderBuffer by half by reusin...
Marcel van Lohuizen [Wed, 24 Aug 2011 09:05:45 +0000 (11:05 +0200)]
exp/norm: Reduced the size of the byte buffer used by reorderBuffer by half by reusing space when combining.

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

13 years agoreflect: add Value.Bytes, Value.SetBytes methods
Russ Cox [Wed, 24 Aug 2011 02:50:08 +0000 (22:50 -0400)]
reflect: add Value.Bytes, Value.SetBytes methods

This allows code that wants to handle
[]byte separately to get at the actual slice
instead of just at individual bytes.
It seems to come up often enough.

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

13 years agogo/build: add test support & use in gotest
Russ Cox [Wed, 24 Aug 2011 02:45:30 +0000 (22:45 -0400)]
go/build: add test support & use in gotest

A side-effect is that, just like foo_386.go
is only built on 386, foo_386_test.go is only
built for testing on 386.

R=adg, r, mattn.jp
CC=golang-dev
https://golang.org/cl/4942050

13 years agogobuilder: increase log limit
Russ Cox [Wed, 24 Aug 2011 02:39:39 +0000 (22:39 -0400)]
gobuilder: increase log limit

It's a balance between fetching too much
and falling far enough behind that you can't
catch up.  We missed 20 commits in a row
when the builders were down for a few days.
This gives us a little more leeway.

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

13 years agohttp: delete error kludge
Russ Cox [Wed, 24 Aug 2011 02:39:25 +0000 (22:39 -0400)]
http: delete error kludge

The kludge is targeted at broken web browsers
like Chrome and IE, but it gets in the way of
sending 400 or 500-series error results with
formatted bodies in response to AJAX requests
made by pages executing in those browsers.

Now the AJAX cases will work and Chrome
and IE will be as broken with Go servers as
they are with all the other servers.

Fixes #2169.

R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/4930047

13 years agobuild: avoid redundant bss declarations
Russ Cox [Wed, 24 Aug 2011 02:39:14 +0000 (22:39 -0400)]
build: avoid redundant bss declarations

Some compilers care, sadly.

R=iant, ken
CC=golang-dev
https://golang.org/cl/4931042

13 years agonet: add ParseMAC function
Paul Borman [Wed, 24 Aug 2011 02:38:43 +0000 (22:38 -0400)]
net: add ParseMAC function

ParseMAC parses a string representing MAC-48, EUI-48, or EUI-64 into
a HardwareAddr.

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

13 years agomisc/dashboard: remove limit for json package list
Andrew Gerrand [Tue, 23 Aug 2011 23:52:03 +0000 (09:52 +1000)]
misc/dashboard: remove limit for json package list

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

13 years agogo/ast cleanup: base File/PackageExports on FilterFile/FilterPackage code
Robert Griesemer [Tue, 23 Aug 2011 23:03:42 +0000 (16:03 -0700)]
go/ast cleanup: base File/PackageExports on FilterFile/FilterPackage code

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

13 years agogo/ast: adjustments to filter function
Robert Griesemer [Tue, 23 Aug 2011 21:17:18 +0000 (14:17 -0700)]
go/ast: adjustments to filter function

CL 4938041 made some incorrect changes to the filter
function which caused a different doc/codelab/wiki/index.html
file to be generated.

Added FilterFileExports and FilterPackageExports function.
Same as the existing FileExpors/PackageExports functions
but using shared code. The old functions will be removed
in the next CL.

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

13 years agogc: fix pc/line table
Julian Phillips [Tue, 23 Aug 2011 21:01:14 +0000 (17:01 -0400)]
gc: fix pc/line table

When a line directive was encountered we would push a new 'z' entry into
the history to indicate the start of new file attributation, and a 'Z'
entry to change line numbering.  However we didn't pop the 'z' entry, so
we were actually corrupting the history stack.  The most obvious
occurance of this was in the code that build the symbol tables for the
DWARF information - where an internal stack in the linker would overflow
when more than a few line directives were encountered in a single stack
(Issue 1878).  So now we pop the 'z' entry when we encounter the end of
the file that the directive was in, which maintains the history stack
integrity.

Also, although new 'z' entries for new files had relative paths
expanded, the same was not done for line directives.  Now we do it for
line directives also - so that the now correct DWARF information has the
full path available.

Fixes #1878.

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

13 years agoruntime: fix void warnings
Russ Cox [Tue, 23 Aug 2011 17:13:27 +0000 (13:13 -0400)]
runtime: fix void warnings

Add -V flag to 6c command line to keep them fixed.

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

13 years agogo/parser: fix type switch scoping
Robert Griesemer [Tue, 23 Aug 2011 16:22:41 +0000 (09:22 -0700)]
go/parser: fix type switch scoping

Introduce extra scope for the variable declared by a
TypeSwitchGuard so that it doesn't conflict with vars
declared by the initial SimpleStmt of a type switch.

This is a replacement for CL 4896053 which caused
a build breakage.

Also:
- explicitly detect type switches (as opposed to detecting
  expression switches and then do extra testing for type switches)
- fix all outstanding TODOs in parser.go
- ran all tests

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

13 years agohttp: add MaxBytesReader to limit request body size
Brad Fitzpatrick [Tue, 23 Aug 2011 08:17:21 +0000 (12:17 +0400)]
http: add MaxBytesReader to limit request body size

This adds http.MaxBytesReader, similar to io.LimitReader,
but specific to http, and for preventing a class of DoS
attacks.

This also makes the 10MB ParseForm limit optional (if
not already set by a MaxBytesReader), documents it,
and also adds "PUT" as a valid verb for parsing forms
in the request body.

Improves issue 2093 (DoS protection)
Fixes #2165 (PUT form parsing)

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

13 years agoeffective go: fix erroneous quoting of ampersands that cropped up
Rob Pike [Tue, 23 Aug 2011 03:54:29 +0000 (13:54 +1000)]
effective go: fix erroneous quoting of ampersands that cropped up

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

13 years agoruntime: simplify stack traces
Russ Cox [Tue, 23 Aug 2011 03:26:39 +0000 (23:26 -0400)]
runtime: simplify stack traces

Make the stack traces more readable for new
Go programmers while preserving their utility for old hands.

- Change status number [4] to string.
- Elide frames in runtime package (internal details).
- Swap file:line and arguments.
- Drop 'created by' for main goroutine.
- Show goroutines in order of allocation:
  implies main goroutine first if nothing else.

There is no option to get the extra frames back.
Uncomment 'return 1' at the bottom of symtab.c.

$ 6.out
throw: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.main()
       /Users/rsc/g/go/src/pkg/runtime/x.go:22 +0x8a

goroutine 2 [select (no cases)]:
main.sel()
       /Users/rsc/g/go/src/pkg/runtime/x.go:11 +0x18
created by main.main
       /Users/rsc/g/go/src/pkg/runtime/x.go:19 +0x23

goroutine 3 [chan receive]:
main.recv(0xf8400010a0, 0x0)
       /Users/rsc/g/go/src/pkg/runtime/x.go:15 +0x2e
created by main.main
       /Users/rsc/g/go/src/pkg/runtime/x.go:20 +0x50

goroutine 4 [chan receive (nil chan)]:
main.recv(0x0, 0x0)
       /Users/rsc/g/go/src/pkg/runtime/x.go:15 +0x2e
created by main.main
       /Users/rsc/g/go/src/pkg/runtime/x.go:21 +0x66
$

$ 6.out index
panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
        /Users/rsc/g/go/src/pkg/runtime/x.go:25 +0xb9
$

$ 6.out nil
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x22ca]

goroutine 1 [running]:
main.main()
        /Users/rsc/g/go/src/pkg/runtime/x.go:28 +0x211
$

$ 6.out panic
panic: panic

goroutine 1 [running]:
main.main()
        /Users/rsc/g/go/src/pkg/runtime/x.go:30 +0x101
$

R=golang-dev, qyzhai, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/4907048

13 years agold: handle Plan 9 ar format
Lucio De Re [Tue, 23 Aug 2011 03:24:38 +0000 (23:24 -0400)]
ld: handle Plan 9 ar format

The Go version has 64 character long section names; originally,
in Plan 9, the limit was 16.  To provide compatibility, this
change allows the input length to be either the target length
or the earlier option. The section name is extended with spaces
where required.

This has been tested to work without regressions in the
Go environment, testing the older alternative has not been
possible yet.

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

13 years agosyscall: openbsd amd64 syscall support
Joel Sing [Tue, 23 Aug 2011 03:24:32 +0000 (23:24 -0400)]
syscall: openbsd amd64 syscall support

Add support for syscalls on openbsd amd64. This is based on the
existing freebsd amd64 implementation.

R=mikioh.mikioh, rsc, yourcomputerpal
CC=golang-dev
https://golang.org/cl/4798060

13 years agobuild: add openbsd
Joel Sing [Tue, 23 Aug 2011 03:24:25 +0000 (23:24 -0400)]
build: add openbsd

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

13 years agoos: disable Hostname test on OpenBSD
Joel Sing [Tue, 23 Aug 2011 03:24:16 +0000 (23:24 -0400)]
os: disable Hostname test on OpenBSD

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

13 years agold: remove duplicate bss definitions
Russ Cox [Tue, 23 Aug 2011 03:23:57 +0000 (23:23 -0400)]
ld: remove duplicate bss definitions

The EXTERN lines in elf.h already define these.
That's not a problem for most C compilers, but
apparently it is for some copies of the OS X linker.

Fixes #2167.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4936044

13 years agoexp/template/html: differentiate URL-valued attributes (such as href)
Nigel Tao [Tue, 23 Aug 2011 03:22:26 +0000 (13:22 +1000)]
exp/template/html: differentiate URL-valued attributes (such as href)
from others (such as title) during escaping.

R=r, mikesamuel, dsymonds
CC=golang-dev
https://golang.org/cl/4919042

13 years agogo/ast: generalize ast.FilterFile
Robert Griesemer [Tue, 23 Aug 2011 01:51:51 +0000 (18:51 -0700)]
go/ast: generalize ast.FilterFile

ast.FilterFile(src, ast.IsExported) has the same
effect as ast.FileExports(src) with this change.

1st step towards removing FileExports - it is
just a special case of FilterFile with this CL.

Added corresponding test.

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

13 years agogodoc: add dummy playground.js to silence godoc warning at start-up
Robert Griesemer [Mon, 22 Aug 2011 21:06:07 +0000 (14:06 -0700)]
godoc: add dummy playground.js to silence godoc warning at start-up

Fixes #2173.

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

13 years agogo/ast: fix ast.MergePackageFiles to collect infos about imports
Sebastien Binet [Mon, 22 Aug 2011 19:53:05 +0000 (12:53 -0700)]
go/ast: fix ast.MergePackageFiles to collect infos about imports

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

13 years agoruntime: Remove extraneous word in comment.
Ian Lance Taylor [Mon, 22 Aug 2011 19:40:45 +0000 (12:40 -0700)]
runtime: Remove extraneous word in comment.

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

13 years agoeffective go: extract and test a couple more examples.
Rob Pike [Mon, 22 Aug 2011 12:46:59 +0000 (22:46 +1000)]
effective go: extract and test a couple more examples.

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

13 years agogob: explain that Debug isn't useful unless it's compiled in.
Rob Pike [Mon, 22 Aug 2011 12:43:49 +0000 (22:43 +1000)]
gob: explain that Debug isn't useful unless it's compiled in.

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

13 years agoexp/norm: added implemenation for []byte versions of methods.
Marcel van Lohuizen [Mon, 22 Aug 2011 10:52:04 +0000 (12:52 +0200)]
exp/norm: added implemenation for []byte versions of methods.

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