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

14271 Commits

Author SHA1 Message Date
Russ Cox
91b1f7cb15 cmd/gc: handle variable initialization by block move in liveness
Any initialization of a variable by a block copy or block zeroing
or by multiple assignments (componentwise copying or zeroing
of a multiword variable) needs to emit a VARDEF. These cases were not.

Fixes #7205.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/63650044
2014-02-13 22:45:16 -05:00
Russ Cox
7addda685d cmd/5g, cmd/8g: fix build
The test added in CL 63630043 fails on 5g and 8g because they
were not emitting the VARDEF instruction when clearing a fat
value by clearing the components. 6g had the call in the right place.

Hooray tests.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/63660043
2014-02-13 22:30:35 -05:00
Mikio Hara
b0db7e870c syscall: fix system calls with misaligned arguments on freebsd/arm
This CL enables the current tree to work with FreeBSD 10-STABLE
on ARM EABI platforms, though there are still a few test fails.

Also updates documentation.

LGTM=iant
R=iant, dave
CC=golang-codereviews
https://golang.org/cl/61060044
2014-02-14 12:22:13 +09:00
Mikio Hara
2277e8d3c9 net: disable TestDNSThreadLimit even in non-short mode by default
TestDNSThreadLimit creates tons of DNS queries and it occasionally
causes an unintentional traffic jam and/or crash of some virtual
machine software, especially its builtin networking stuff.

We can run TestDNSThreadLimit with -dnsflood flag instead.

LGTM=dave, rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/63600043
2014-02-14 12:20:21 +09:00
Russ Cox
801e40a0a4 cmd/gc: rename AFATVARDEF to AVARDEF
The "fat" referred to being used for multiword values only.
We're going to use it for non-fat values sometimes too.

No change other than the renaming.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/63650043
2014-02-13 22:17:22 -05:00
Russ Cox
824e918ca4 cmd/gc: fix liveness for addressed results
Was spuriously marking results live on entry to function.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/63640043
2014-02-13 21:11:50 -05:00
Shenghou Ma
656a402545 cmd/gc: rephrase the invalid indexing operation error message
Old:
prog.go:9: invalid operation: this[i] (index of type int)
New:
prog.go:9: invalid operation: this[i] (type int does not support indexing)

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/52540043
2014-02-13 21:01:33 -05:00
Russ Cox
a069cf048d cmd/gc: distinguish unnamed vs blank-named return variables better
Before, an unnamed return value turned into an ONAME node n with n->sym
named ~anon%d, and n->orig == n.

A blank-named return value turned into an ONAME node n with n->sym
named ~anon%d but n->orig == the original blank n. Code generation and
printing uses n->orig, so that this node formatted as _.

But some code does not use n->orig. In particular the liveness code does
not know about the n->orig convention and so mishandles blank identifiers.
It is possible to fix but seemed better to avoid the confusion entirely.

Now the first kind of node is named ~r%d and the second ~b%d; both have
n->orig == n, so that it doesn't matter whether code uses n or n->orig.

After this change the ->orig field is only used for other kinds of expressions,
not for ONAME nodes.

This requires distinguishing ~b from ~r names in a few places that care.
It fixes a liveness analysis bug without actually changing the liveness code.

TBR=ken2
CC=golang-codereviews
https://golang.org/cl/63630043
2014-02-13 20:59:39 -05:00
Russ Cox
e5d742fcad cmd/gc: relax address-of escape analysis
Make the loop nesting depth of &x depend on where x is declared,
not on where the &x appears. The latter is only a conservative
estimate of the former. Being more careful can avoid some
variables escaping, and it is easier to reason about.

It would have avoided issue 7313, although that was still a bug
worth fixing.

Not much effect in the tree: one variable in the whole tree
is saved from a heap allocation (something in x509 parsing).

LGTM=daniel.morsing
R=daniel.morsing
CC=golang-codereviews
https://golang.org/cl/62380043
2014-02-13 19:59:09 -05:00
Markus Zimmermann
e0bb5ba52c container/list: mark must be an element of the list
The methods MoveAfter and MoveBefore of the container/list package did silently corrupt the interal structure of the list if a mark element is used which is not an element of the list.

LGTM=gri
R=golang-codereviews, gobot, gri
CC=golang-codereviews
https://golang.org/cl/60980043
2014-02-13 16:43:52 -08:00
Nick Craig-Wood
eae09a59a0 math/big: Optimise ARM assembler
Tweak the ARM assembler to improve its performance.

  * Use TEQ instead of CMP which preserves the carry flag.  This means
    we can avoid saving and restoring CPSR which is very slow.

  * Use conditional instructions to read the value of the carry flag.

  * Use 3 argument ARM instructions to save instructions

  * Improve scheduling for MOVW instructions (LDR)

  * Use RSB constant to save an instruction in bitLen

Results of -test.bench 'VV|VW|VU|WW|Bit' -test.benchtime 3s on Samsung
Exynos5 Chromebook.

There are a few small regressions in the benchmarks which I believe to
be noise, perhaps due to different cacheline alignment.

The changes to bitLen are apparently no faster, however less
instructions means less I-cache usage which is a win. I suspect it
will be a win on older ARM processors.

benchmark                 old ns/op    new ns/op    delta
BenchmarkAddVV_1                 48           14  -70.84%
BenchmarkAddVV_2                 87           17  -80.25%
BenchmarkAddVV_3                126           20  -83.97%
BenchmarkAddVV_4                165           23  -86.00%
BenchmarkAddVV_5                204           26  -87.21%
BenchmarkAddVV_1e1              399           41  -89.72%
BenchmarkAddVV_1e2             3921          315  -91.97%
BenchmarkAddVV_1e3            39085         2972  -92.40%
BenchmarkAddVV_1e4           390330        29623  -92.41%
BenchmarkAddVV_1e5          3935366       343431  -91.27%
BenchmarkAddVW_1                 20           10  -49.04%
BenchmarkAddVW_2                 60           14  -76.53%
BenchmarkAddVW_3                 99           16  -83.38%
BenchmarkAddVW_4                140           18  -86.50%
BenchmarkAddVW_5                179           21  -88.04%
BenchmarkAddVW_1e1              376           33  -91.20%
BenchmarkAddVW_1e2             3933          256  -93.49%
BenchmarkAddVW_1e3            39630         2378  -94.00%
BenchmarkAddVW_1e4           396218        23623  -94.04%
BenchmarkAddVW_1e5          3972901       238403  -94.00%
BenchmarkAddMulVVW_1             11           11   -4.27%
BenchmarkAddMulVVW_2             15           15   +0.00%
BenchmarkAddMulVVW_3             18           19   +4.37%
BenchmarkAddMulVVW_4             21           21   +4.29%
BenchmarkAddMulVVW_5             24           24   -0.82%
BenchmarkAddMulVVW_1e1           40           39   -2.70%
BenchmarkAddMulVVW_1e2          329          326   -0.91%
BenchmarkAddMulVVW_1e3         3200         3098   -3.19%
BenchmarkAddMulVVW_1e4        38457        40013   +4.05%
BenchmarkAddMulVVW_1e5       461880       428580   -7.21%
BenchmarkBitLen0                  5            5   -0.19%
BenchmarkBitLen1                  5            5   +0.00%
BenchmarkBitLen2                  5            5   -0.56%
BenchmarkBitLen3                  5            5   +0.38%
BenchmarkBitLen4                  5            5   +0.19%
BenchmarkBitLen5                  5            5   +0.56%
BenchmarkBitLen8                  5            5   -0.19%
BenchmarkBitLen9                  5            5   -0.56%
BenchmarkBitLen16                 5            5   -0.19%
BenchmarkBitLen17                 5            5   -0.37%
BenchmarkBitLen31                 5            5   -1.30%
BenchmarkBitset                  72           70   -2.49%
BenchmarkBitsetNeg             1584          396  -75.00%
BenchmarkBitsetOrig            1990         1980   -0.50%
BenchmarkBitsetNegOrig         4031         2877  -28.63%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkAddVV_1             657.71      2251.28    3.42x
BenchmarkAddVV_2             730.65      3700.37    5.06x
BenchmarkAddVV_3             757.29      4754.30    6.28x
BenchmarkAddVV_4             772.95      5541.58    7.17x
BenchmarkAddVV_5             781.30      6125.59    7.84x
BenchmarkAddVV_1e1           800.33      7814.14    9.76x
BenchmarkAddVV_1e2           815.98     10129.62   12.41x
BenchmarkAddVV_1e3           818.73     10767.07   13.15x
BenchmarkAddVV_1e4           819.82     10802.12   13.18x
BenchmarkAddVV_1e5           813.14      9317.73   11.46x
BenchmarkAddVW_1            1539.56      3006.13    1.95x
BenchmarkAddVW_2            1057.66      4502.20    4.26x
BenchmarkAddVW_3             960.67      5797.65    6.04x
BenchmarkAddVW_4             913.19      6776.86    7.42x
BenchmarkAddVW_5             891.72      7467.82    8.37x
BenchmarkAddVW_1e1           850.12      9681.85   11.39x
BenchmarkAddVW_1e2           813.48     12494.27   15.36x
BenchmarkAddVW_1e3           807.45     13451.80   16.66x
BenchmarkAddVW_1e4           807.64     13545.64   16.77x
BenchmarkAddVW_1e5           805.46     13422.64   16.66x
BenchmarkAddMulVVW_1        2727.29      2847.66    1.04x
BenchmarkAddMulVVW_2        4162.30      4158.69    1.00x
BenchmarkAddMulVVW_3        5236.91      5015.98    0.96x
BenchmarkAddMulVVW_4        6090.27      5837.52    0.96x
BenchmarkAddMulVVW_5        6549.86      6598.60    1.01x
BenchmarkAddMulVVW_1e1      7850.72      8068.00    1.03x
BenchmarkAddMulVVW_1e2      9724.38      9794.40    1.01x
BenchmarkAddMulVVW_1e3      9997.18     10328.58    1.03x
BenchmarkAddMulVVW_1e4      8320.88      7997.39    0.96x
BenchmarkAddMulVVW_1e5      6928.20      7466.50    1.08x

LGTM=gri
R=golang-codereviews, dave, gri
CC=golang-codereviews
https://golang.org/cl/61290043
2014-02-13 16:19:38 -08:00
David Symonds
645a341b7d net/http: increase panic stack trace buffer size from 4 KB to 64 KB.
4 KB is a bit too small in some situations (e.g. panic during a
template execution), and ends up with an unhelpfully-truncated trace.
64 KB should be much more likely to capture the useful information.
There's not a garbage generation issue, since this code should only
be triggered when there's something seriously wrong with the program.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/63520043
2014-02-14 10:15:38 +11:00
Shenghou Ma
9abe6d9dd0 crypto/rsa: explain random parameter for GenerateKey and GenerateMultiPrimeKey.
Fixes #6850.

LGTM=agl
R=golang-codereviews, agl
CC=golang-codereviews
https://golang.org/cl/60500046
2014-02-13 15:56:48 -05:00
Shenghou Ma
c36dd4abdc cmd/go: fix cgo error output rewrite
for example, we now rewrite *_Ctype_int to *C.int.
Fixes #6781.

LGTM=iant
R=golang-codereviews, rsc, iant
CC=golang-codereviews
https://golang.org/cl/36860043
2014-02-13 15:55:14 -05:00
Russ Cox
e8ecd9f67a runtime: update malloc comment for MSpan.needzero
Missed this suggestion in CL 57680046.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/63390043
2014-02-13 14:31:48 -05:00
David du Colombier
98a76029ea lib9: fix Solaris build
In file included from src/lib9/utf/utfecpy.c:17:0:
src/lib9/utf/utfdef.h:28:0: error: "nil" redefined [-Werror]
In file included from src/lib9/utf/utfrrune.c:17:0:
src/lib9/utf/utfdef.h:28:0: error: "nil" redefined [-Werror]

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/63410043
2014-02-13 20:30:42 +01:00
David du Colombier
174b8c95f5 lib9: enable on Plan 9
This change depends on CL 57170052.

LGTM=rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/60840049
2014-02-13 20:06:41 +01:00
David du Colombier
705d7c164f lib9: fix inconsistencies and warnings on Plan 9
warning: src/lib9/fmt/dorfmt.c:64 unreachable code RETURN
warning: src/lib9/fmt/fltfmt.c:184 set and not used: p
warning: src/lib9/utf/utflen.c:35 unreachable code RETURN
warning: src/lib9/utf/utfrrune.c:45 unreachable code RETURN
warning: src/lib9/utf/utfrune.c:44 unreachable code RETURN

LGTM=rsc
R=rsc, iant, gobot
CC=golang-codereviews
https://golang.org/cl/57170052
2014-02-13 20:05:55 +01:00
Daniel Morsing
e0a55a6c98 cmd/gc: for loop init statement misanalyzed by escape analysis
Logically, the init statement is in the enclosing scopes loopdepth, not inside the for loop.

Fixes #7313.

LGTM=rsc
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/62430043
2014-02-13 19:04:43 +00:00
Carlos Castillo
7861cd6082 cmd/go, go/build: support .m files
go/build is changed to list the .m files in a package, and match them for build constraints, adding them to a new field: Package.MFiles.

The go tool is changed to support building .m files and linking in the results during CGO and SWIG builds. This means packages that create a C interface to calls Objective-C code from go are now go-gettable without producing and distributing .syso files. This change is analogous to the one in Go 1.2 made to support C++ built code.

This change doesn't support .mm files (Objective C++).

Also added support for these MFiles to go list's -json mode.

Fixes #6536.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/60590044
2014-02-13 10:11:44 -08:00
Kyle Isom
fc8e77ca65 crypto/x509: Add certificate signature request (CSR) support.
This change adds support for parsing and serialisation of PKCS #10,
certificate signature requests.

LGTM=agl
R=golang-codereviews, agl
CC=agl, golang-codereviews, nick
https://golang.org/cl/49830048
2014-02-13 12:54:04 -05:00
Michael T. Jones
eea28f6701 math/big: add support for general encoding interfaces
TextMarshaller and TextUnmarshaller to ease transport of
unlimited precision rational numbers.

Fixes #7287.

Consists of encode and decode functions and two test
functions, one using JSON and one using XML. Each
verifies round trips for integers (rationals with
denominator == 1) and for fractional vaues.

LGTM=gri
R=gri, cookieo9, bradfitz, mtj
CC=golang-codereviews
https://golang.org/cl/61180043
2014-02-13 08:42:19 -08:00
Dmitriy Vyukov
e0dee49688 cmd/gc: fix windows build
c:\src\go\pkg\obj\windows_amd64\libgc.a(lex.o): In function `catcher':
c:/src/go/src/cmd/gc/lex.c:181: undefined reference to `noted'

LGTM=0intro
R=0intro
CC=golang-codereviews
https://golang.org/cl/63270043
2014-02-13 20:15:19 +04:00
Russ Cox
86e3cb8da5 runtime: introduce MSpan.needzero instead of writing to span data
This cleans up the code significantly, and it avoids any
possible problems with madvise zeroing out some but
not all of the data.

Fixes #6400.

LGTM=dave
R=dvyukov, dave
CC=golang-codereviews
https://golang.org/cl/57680046
2014-02-13 11:10:31 -05:00
Dmitriy Vyukov
f8e4a2ef94 runtime: fix concurrent GC sweep
The issue was that one of the MSpan_Sweep callers
was doing sweep with preemption enabled.
Additional checks are added.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/62990043
2014-02-13 19:36:45 +04:00
David du Colombier
9c767b64ee cmd/gc: catch notes on Plan 9
LGTM=rsc
R=rsc, jas, gobot
CC=ality, golang-codereviews
https://golang.org/cl/51650051
2014-02-13 16:35:51 +01:00
Nicolas Owens
68bf5666cd net: only return unique hosts during hostname lookup on plan 9
TestLookupHost expects that no duplicate addresses are returned. when cs is consulted for a name, e.g net!localhost!1, it will possibly return multiple available paths, e.g. via il and tcp. this confuses the tests.

LGTM=aram
R=jas, 0intro, aram
CC=golang-codereviews
https://golang.org/cl/58120045
2014-02-13 10:26:16 -05:00
Alexander Larsson
87d58f44a1 archive/tar: support extended attributes
This adds support for archives with the SCHILY.xattr field in the
pax header. This is what gnu tar and star generate.
Fixes #7154.

LGTM=dsymonds
R=golang-codereviews, gobot, dsymonds
CC=golang-codereviews
https://golang.org/cl/54570043
2014-02-13 20:08:30 +11:00
Shenghou Ma
ca6186aa26 cmd/6c, cmd/8c, cmd/8g: fix print of pc (which is vlong).
While we're at it, fix a wrong for statement in cmd/8g.

LGTM=rsc
R=rsc, golang-codereviews
CC=golang-codereviews
https://golang.org/cl/62700044
2014-02-13 03:09:03 -05:00
David du Colombier
a3e3b8e9db cmd/gc: fix warnings on Plan 9
warning: src/cmd/gc/popt.c:700 format mismatch d VLONG, arg 4
warning: src/cmd/gc/popt.c:700 format mismatch d VLONG, arg 5

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/62910043
2014-02-13 07:28:22 +01:00
Russ Cox
39067c79f3 runtime/pprof: fix arm build after CL 61270043
TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/62960043
2014-02-13 01:16:20 -05:00
Russ Cox
684332f47c cmd/5g: fix regopt bug in copyprop
copyau1 was assuming that it could deduce the type of the
middle register p->reg from the type of the left or right
argument: in CMPF F1, F2, the p->reg==2 must be a D_FREG
because p->from is F1, and in CMP R1, R2, the p->reg==2 must
be a D_REG because p->from is R1.

This heuristic fails for CMP $0, R2, which was causing copyau1
not to recognize p->reg==2 as a reference to R2, which was
keeping it from properly renaming the register use when
substituting registers.

cmd/5c has the right approach: look at the opcode p->as to
decide the kind of register. It is unclear where 5g's copyau1
came from; perhaps it was an attempt to avoid expanding 5c's
a2type to include new instructions used only by 5g.

Copy a2type from cmd/5c, expand to include additional instructions,
and make it crash the compiler if asked about an instruction
it does not understand (avoid silent bugs in the future if new
instructions are added).

Should fix current arm build breakage.

While we're here, fix the print statements dumping the pred and
succ info in the asm listing to pass an int arg to %.4ud
(Prog.pc is a vlong now, due to the liblink merge).

TBR=ken2
CC=golang-codereviews
https://golang.org/cl/62730043
2014-02-13 03:54:55 +00:00
Anthony Martin
27cb59fdad cmd/5g: fix print format in peephole debugging
Fixes #7294.

LGTM=minux.ma, dave, bradfitz
R=golang-codereviews, minux.ma, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/61370043
2014-02-12 17:03:21 -08:00
Robert Sesek
5bf35df491 debug/macho: Add support for opening fat/universal binaries.
New testdata was created from existing using:
$ lipo gcc-386-darwin-exec gcc-amd64-darwin-exec -create -output fat-gcc-386-amd64-darwin-exec

Fixes #7250.

LGTM=dave
R=golang-codereviews, dave, josharian, bradfitz
CC=golang-codereviews
https://golang.org/cl/60190043
2014-02-13 11:04:13 +11:00
Dave Cheney
951508671d debug/macho: add test file for CL 60190043
From the description of CL 60190043

debug/macho: Add support for opening fat/universal binaries.

New testdata was created from existing using:
$ lipo gcc-386-darwin-exec gcc-amd64-darwin-exec -create -output
fat-gcc-386-amd64-darwin-exec

Update #7250

LGTM=iant
R=golang-codereviews, gobot, dsymonds, iant
CC=golang-codereviews
https://golang.org/cl/61720044
2014-02-13 10:58:23 +11:00
Brad Fitzpatrick
72f0ed42fa crypto/md5: always test the portable block function too
So it doesn't bitrot.

Like the sha1 version (https://golang.org/cl/62270043)

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/62420043
2014-02-12 13:31:05 -08:00
Russ Cox
73a304356b runtime: fix non-concurrent sweep
State of the world:

CL 46430043 introduced a new concurrent sweep but is broken.

CL 62360043 made the new sweep non-concurrent
to try to fix the world while we understand what's wrong with
the concurrent version.

This CL fixes the non-concurrent form to run finalizers.
This CL is just a band-aid to get the build green again.

Dmitriy is working on understanding and then fixing what's
wrong with the concurrent sweep.

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/62370043
2014-02-12 15:54:21 -05:00
Dmitriy Vyukov
3cac829ff4 runtime: temporary disable concurrent GC sweep
We see failures on builders, e.g.:
http://build.golang.org/log/70bb28cd6bcf8c4f49810a011bb4337a61977bf4

LGTM=rsc, dave
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/62360043
2014-02-13 00:03:27 +04:00
Anthony Martin
2cae0591cd cmd/cc, cmd/gc, cmd/ld: consolidate print format routines
We now use the %A, %D, %P, and %R routines from liblink
across the board.

Fixes #7178.
Fixes #7055.

LGTM=iant
R=golang-codereviews, gobot, rsc, dave, iant, remyoudompheng
CC=golang-codereviews
https://golang.org/cl/49170043
2014-02-12 14:29:11 -05:00
Brad Fitzpatrick
14c5c8a93a crypto/sha1: always test the portable block function too
So it doesn't bitrot.

LGTM=agl
R=golang-codereviews, agl
CC=golang-codereviews
https://golang.org/cl/62270043
2014-02-12 11:27:36 -08:00
Dmitriy Vyukov
bf0d71af29 runtime: more precise mprof sampling
Better sampling of objects that are close in size to sampling rate.
See the comment for details.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/43830043
2014-02-12 22:36:45 +04:00
Dmitriy Vyukov
5e72fae9b2 runtime: improve cpu profiles for GC/syscalls/cgo
Current "System->etext" is not very informative.
Add parent "GC" frame.
Replace un-unwindable syscall/cgo frames with Go stack that leads to the call.

LGTM=rsc
R=rsc, alex.brainman, ality
CC=golang-codereviews
https://golang.org/cl/61270043
2014-02-12 22:31:36 +04:00
Nick Craig-Wood
44c252bda2 An ARM version of sha1block.go with a big improvement in throughput
(up to 2.8x).

This is a partially unrolled version which performs better for small
hashes and only sacrifices a small amount of ultimate speed to a fully
unrolled version which uses 5k of code.

Code size

  Before 1636 bytes
  After 1880 bytes
  15% larger

Benchmarks on Samsung Exynos 5 ARMv7 Chromebook

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes         1907         1136  -40.43%
BenchmarkHash1K            20280         7547  -62.79%
BenchmarkHash8K           148469        52576  -64.59%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         4.19         7.04    1.68x
BenchmarkHash1K            50.49       135.68    2.69x
BenchmarkHash8K            55.18       155.81    2.82x

LGTM=dave, agl
R=dave, bradfitz, agl, adg, nick
CC=golang-codereviews
https://golang.org/cl/56990044
2014-02-12 13:24:52 -05:00
Dmitriy Vyukov
2ea859a779 runtime: refactor level-triggered IO support
Remove GOOS_solaris ifdef from netpoll code,
instead introduce runtime edge/level triggered IO flag.
Replace armread/armwrite with a single arm(mode) function,
that's how all other interfaces look like and these functions
will need to do roughly the same thing anyway.

LGTM=rsc
R=golang-codereviews, dave, rsc
CC=golang-codereviews
https://golang.org/cl/55500044
2014-02-12 22:24:29 +04:00
Dmitriy Vyukov
e1ee04828d runtime: refactor chan code
1. Make internal chan functions static.
2. Move selgen local variable instead of a member of G struct.
3. Change "bool *pres/selected" parameter of chansend/chanrecv to "bool block",
   which is simpler, faster and less code.
-37 lines total.

LGTM=rsc
R=golang-codereviews, dave, gobot, rsc
CC=bradfitz, golang-codereviews, iant, khr
https://golang.org/cl/58610043
2014-02-12 22:21:38 +04:00
Dmitriy Vyukov
3c3be62201 runtime: concurrent GC sweep
Moves sweep phase out of stoptheworld by adding
background sweeper goroutine and lazy on-demand sweeping.

It turned out to be somewhat trickier than I expected,
because there is no point in time when we know size of live heap
nor consistent number of mallocs and frees.
So everything related to next_gc, mprof, memstats, etc becomes trickier.

At the end of GC next_gc is conservatively set to heap_alloc*GOGC,
which is much larger than real value. But after every sweep
next_gc is decremented by freed*GOGC. So when everything is swept
next_gc becomes what it should be.

For mprof I had to introduce 3-generation scheme (allocs, revent_allocs, prev_allocs),
because by the end of GC we know number of frees for the *previous* GC.

Significant caution is required to not cross yet-unknown real value of next_gc.
This is achieved by 2 means:
1. Whenever I allocate a span from MCentral, I sweep a span in that MCentral.
2. Whenever I allocate N pages from MHeap, I sweep until at least N pages are
returned to heap.
This provides quite strong guarantees that heap does not grow when it should now.

http-1
allocated                    7036         7033      -0.04%
allocs                         60           60      +0.00%
cputime                     51050        46700      -8.52%
gc-pause-one             34060569      1777993     -94.78%
gc-pause-total               2554          133     -94.79%
latency-50                 178448       170926      -4.22%
latency-95                 284350       198294     -30.26%
latency-99                 345191       220652     -36.08%
rss                     101564416    101007360      -0.55%
sys-gc                    6606832      6541296      -0.99%
sys-heap                 88801280     87752704      -1.18%
sys-other                 7334208      7405928      +0.98%
sys-stack                  524288       524288      +0.00%
sys-total               103266608    102224216      -1.01%
time                        50339        46533      -7.56%
virtual-mem             292990976    293728256      +0.25%

garbage-1
allocated                 2983818      2990889      +0.24%
allocs                      62880        62902      +0.03%
cputime                  16480000     16190000      -1.76%
gc-pause-one            828462467    487875135     -41.11%
gc-pause-total            4142312      2439375     -41.11%
rss                    1151709184   1153712128      +0.17%
sys-gc                   66068352     66068352      +0.00%
sys-heap               1039728640   1039728640      +0.00%
sys-other                37776064     40770176      +7.93%
sys-stack                 8781824      8781824      +0.00%
sys-total              1152354880   1155348992      +0.26%
time                     16496998     16199876      -1.80%
virtual-mem            1409564672   1402281984      -0.52%

LGTM=rsc
R=golang-codereviews, sameer, rsc, iant, jeremyjackins, gobot
CC=golang-codereviews, khr
https://golang.org/cl/46430043
2014-02-12 22:16:42 +04:00
Dmitriy Vyukov
3b85f9b7e1 encoding/json: fix test failure
$ go test -cpu=1,1,1,1,1,1,1,1,1 encoding/json
--- FAIL: TestIndentBig (0.00 seconds)
        scanner_test.go:131: Indent(jsonBig) did not get bigger
On 4-th run initBig generates an empty array.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/49930051
2014-02-12 21:50:58 +04:00
Adam Langley
384f4380e8 crypto/subtle: panic if slices of different lengths are passed to ConstantTimeCompare.
ConstantTimeCompare has always been documented to take equal length
slices but perhaps this is too subtle, even for 'subtle'.

Fixes #7304.

LGTM=hanwen, bradfitz
R=golang-codereviews, hanwen, bradfitz
CC=golang-codereviews
https://golang.org/cl/62190043
2014-02-12 11:58:48 -05:00
Adam Langley
6b29f7bfbe crypto/tls: better error messages.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/60580046
2014-02-12 11:20:01 -05:00
Rick Arnold
5e711b473c net/http: make responseAndError satisfy the net.Error interface
Allow clients to check for timeouts without relying on error substring
matching.

Fixes #6185.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/55470048
2014-02-12 07:59:58 -08:00
Robert Dinu
c507601102 debug/pe: delete unnecessary type conversions
Fixes #7104.

LGTM=iant
R=golang-dev, iant
CC=golang-codereviews
https://golang.org/cl/61480049
2014-02-12 07:35:54 -08:00
Robert Griesemer
947aaf275c go/parser: better error messages for if/switch/for conditions/expressions
Fixes #7102.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/56770045
2014-02-11 16:45:31 -08:00
Shenghou Ma
4687b54147 cmd/ld, cmd/6l: part 2 of solaris/amd64 linker changes.
Second part of the solaris/amd64 linker changes: relocation and symbol table.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/61330043
2014-02-11 18:43:05 -05:00
Robert Griesemer
13a5958db3 go/parser: check presence of 2nd and 3rd index in 3-index slice
Fixes #7305.

LGTM=adonovan
R=bradfitz, adonovan
CC=golang-codereviews
https://golang.org/cl/58950045
2014-02-11 13:40:37 -08:00
Daniel Morsing
85e4cb2f10 cmd/6g, cmd/8g, cmd/5g: make the undefined instruction have no successors
The UNDEF instruction was listed in the instruction data as having the next instruction in the stream as its successor. This confused the optimizer into adding a load where it wasn't needed, in turn confusing the liveness analysis pass for GC bitmaps into thinking that the variable was live.

Fixes #7229.

LGTM=iant, rsc
R=golang-codereviews, bradfitz, iant, dave, rsc
CC=golang-codereviews
https://golang.org/cl/56910045
2014-02-11 20:25:40 +00:00
Brad Fitzpatrick
517f4a9683 archive/zip: re-use flate.Writers when writing compressed files
Prevents a ton of garbage. (Noticed this when writing large
Camlistore zip archives to Amazon Glacier)

Note that the Closer part of the io.WriteCloser is never given
to users. It's an internal detail of the package.

benchmark                         old ns/op     new ns/op     delta
BenchmarkCompressedZipGarbage     42884123      40732373      -5.02%

benchmark                         old allocs     new allocs     delta
BenchmarkCompressedZipGarbage     204            149            -26.96%

benchmark                         old bytes     new bytes     delta
BenchmarkCompressedZipGarbage     4397576       66744         -98.48%

LGTM=adg, rsc
R=adg, rsc
CC=golang-codereviews
https://golang.org/cl/54300053
2014-02-11 11:41:25 -08:00
Dmitriy Vyukov
e5a4211b36 runtime: do not profile blocked netpoll on windows
There is frequently a thread hanging on GQCS,
currently it skews profiles towards netpoll,
but it is not bad and is not consuming any resources.

R=alex.brainman
CC=golang-codereviews
https://golang.org/cl/61560043
2014-02-11 13:41:46 +04:00
David du Colombier
120218afeb runtime: homogenize panic strings on Plan 9
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/61410046
2014-02-11 09:34:43 +01:00
Andrew Gerrand
c4b279ba5a archive/zip: use correct test, fix 32-bit build
LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/61070047
2014-02-11 16:27:14 +11:00
Andrew Gerrand
413e28da0d archive/zip: actually test uncompressed size
Fixes #7292.

LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/61650046
2014-02-11 16:09:42 +11:00
Brendan Daniel Tracey
d30949693c cmd/gc: change compile error to "use of package %S without selector"
At present, when a package identifier is used outside of a selector expression, gc gives the error "use of package %S outside selector". However, in the selector expression x.f, the spec defines f as the selector. This change makes the error clearer.

Fixes #7133.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/50060047
2014-02-10 20:27:31 -05:00
Robert Griesemer
4d1301949a container/heap: avoid and/or ambiguity in documentation
(per suggestion by Doug McIlroy)

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/50580046
2014-02-10 12:48:56 -08:00
David du Colombier
76dcb9b346 runtime: handle "sys: trap: divide error" note on Plan 9
Fixes #7286.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/61410044
2014-02-10 21:47:52 +01:00
Dmitriy Vyukov
db9fb7b9ab cmd/go: fix comment
R=r
CC=golang-codereviews
https://golang.org/cl/61650044
2014-02-10 21:48:43 +04:00
Dmitriy Vyukov
373e1e94d8 runtime: fix crash during cpu profiling
mp->mcache can be concurrently modified by runtime·helpgc.
In such case sigprof can remember mcache=nil, then helpgc sets it to non-nil,
then sigprof restores it back to nil, GC crashes with nil mcache.

R=rsc
CC=golang-codereviews
https://golang.org/cl/58860044
2014-02-10 20:24:47 +04:00
Dmitriy Vyukov
e56e4e0193 cmd/go: better advice for heap profiling
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/60760048
2014-02-10 18:59:07 +04:00
Dmitriy Vyukov
0229dc6dbe runtime: do not cpu profile idle threads on windows
Currently this leads to a significant skew towards 'etext' entry,
since all idle threads are profiled every tick.
Before:
Total: 66608 samples
   63188  94.9%  94.9%    63188  94.9% etext
     278   0.4%  95.3%      278   0.4% sweepspan
     216   0.3%  95.6%      448   0.7% runtime.mallocgc
     122   0.2%  95.8%      122   0.2% scanblock
     113   0.2%  96.0%      113   0.2% net/textproto.canonicalMIMEHeaderKey
After:
Total: 8008 samples
    3949  49.3%  49.3%     3949  49.3% etext
     231   2.9%  52.2%      231   2.9% scanblock
     211   2.6%  54.8%      211   2.6% runtime.cas64
     182   2.3%  57.1%      408   5.1% runtime.mallocgc
     178   2.2%  59.3%      178   2.2% runtime.atomicload64

LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=golang-codereviews
https://golang.org/cl/61250043
2014-02-10 15:40:55 +04:00
Dave Cheney
ff5f9bbf6a cmd/go: skip $ORIGIN test on darwin systems
Fixes #7293.

Update #7261

The bsd ld(1) does not understand $ORIGIN and has restrictions on using -rpath when using clang(1), the default compiler on darwin.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/58480045
2014-02-10 13:35:39 +11:00
Dave Cheney
414b45d91a cmd/go: fix test.bash
Fixes #7260.

Fix three broken tests in test.bash

The test for issue 4568 was confused by go $ACTION . producing a package root of "", avoiding this mode fixes the test but weakens the test.

The test for issue 4773 was broken on linux because math/Rand would fail to resolve as a package causing the test for duplicates to be skipped.

Finally, the last breakage was a small change in the error message.

Also, add test for foldDup.

LGTM=iant
R=iant, rsc
CC=golang-codereviews
https://golang.org/cl/61070044
2014-02-10 10:41:47 +11:00
Brad Fitzpatrick
730f51ab58 archive/zip: add flate writing benchmark
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/60530049
2014-02-09 13:56:47 -08:00
Shenghou Ma
6ebf59b953 include, linlink, cmd/6l, cmd/ld: part 1 of solaris/amd64 linker changes.
rsc suggested that we split the whole linker changes into three parts.
This is the first one, mostly dealing with adding Hsolaris.

LGTM=iant
R=golang-codereviews, iant, dave
CC=golang-codereviews
https://golang.org/cl/54210050
2014-02-09 16:45:38 -05:00
Mikio Hara
65675a3e24 syscall: add missing include statement to bootstrap error code and signal generator
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/54300054
2014-02-09 17:20:59 +09:00
Rémy Oudompheng
2b93c4dd06 cmd/6g: faster memmove/memset-like code using unaligned load/stores.
This changes makes sgen and clearfat use unaligned instructions for
the trailing bytes, like the runtime memmove does, resulting in faster
code when manipulating types whose size is not a multiple of 8.

LGTM=khr
R=khr, iant, rsc
CC=golang-codereviews
https://golang.org/cl/51740044
2014-02-07 23:58:21 +01:00
David du Colombier
d0591d5ebd cmd/gc: revert CL 60740044
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/60590047
2014-02-07 17:05:16 +01:00
David du Colombier
f95a311c9b cmd/gc: fix nil pointer dereference
LGTM=iant
R=golang-codereviews, dave, iant
CC=golang-codereviews
https://golang.org/cl/60740044
2014-02-07 15:43:40 +01:00
Alex Brainman
a747adf798 net: remove superfluous type conversion
LGTM=minux.ma, dvyukov
R=golang-codereviews, minux.ma, dvyukov
CC=golang-codereviews
https://golang.org/cl/60900043
2014-02-07 16:58:45 +11:00
Keith Randall
da7cf0ba5d runtime: faster memclr on x86.
Use explicit SSE writes instead of REP STOSQ.

benchmark               old ns/op    new ns/op    delta
BenchmarkMemclr5               22            5  -73.62%
BenchmarkMemclr16              27            5  -78.49%
BenchmarkMemclr64              28            6  -76.43%
BenchmarkMemclr256             34            8  -74.94%
BenchmarkMemclr4096           112           84  -24.73%
BenchmarkMemclr65536         1902         1920   +0.95%

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/60090044
2014-02-06 17:43:22 -08:00
Alex Brainman
aac872e118 os/exec: use filepath.Base in Command
filepath.Base covers all scenarios
(for example paths like d:hello.txt)
on windows

LGTM=iant, bradfitz
R=golang-codereviews, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/59740050
2014-02-07 12:30:30 +11:00
Mikio Hara
546081fd01 syscall: make use of signed char explicit in generating z-files on freebsd/arm
This CL is in preparation to make cgo work on freebsd/arm.

The signedness of C char might be a problem when we make bare syscall
APIs, Go structures, using built-in bootstrap scripts with cgo because
they do translate C stuff to Go stuff internally. For now almost all
the C compilers assume that the type of char will be unsigned on arm
by default but it makes a different view from amd64, 386.

This CL just passes -fsigned-char, let the type of char be signed,
option which is supported on both gcc and clang to the underlying C
compilers through cgo for avoiding such inconsistency on syscall API.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/59740051
2014-02-07 10:23:53 +09:00
Mikio Hara
5d871c7ef0 syscall: regenerate EABI call convention compliant syscalls for freebsd/arm
This CL is in preparation to make cgo work on freebsd/arm.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/59490051
2014-02-07 10:23:26 +09:00
Mikio Hara
aa29cd98dc syscall: fix build on freebsd/arm
This CL is in preparation to make cgo work on freebsd/arm.

It's just for fixing build fails on freebsd/arm, we still need to
update z-files later for fixing several package test fails.

How to generate z-files on freebsd/arm in the bootstrapping phase:
1. run freebsd on appropriate arm-eabi platforms
2. both syscall z-files and runtime def-files in the current tree are
   broken about EABI padding, fix them by hand
3. run make.bash again to build $GOTOOLDIR/cgo
4. use $GOTOOLDIR/cgo directly

LGTM=iant
R=iant, dave
CC=golang-codereviews
https://golang.org/cl/59490052
2014-02-07 10:23:02 +09:00
Mikio Hara
61fe7d8308 runtime/cgo: fix build on freebsd/arm
This CL is in preparation to make cgo work on freebsd/arm.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/60500044
2014-02-07 10:22:34 +09:00
Mikio Hara
8e56eb8b57 runtime: fix build on freebsd/arm
This CL is in preparation to make cgo work on freebsd/arm.

How to generate defs-files on freebsd/arm in the bootstrapping phase:
1. run freebsd on appropriate arm-eabi platforms
2. both syscall z-files and runtime def-files in the current tree are
   broken about EABI padding, fix them by hand
3. run make.bash again to build $GOTOOLDIR/cgo
4. use $GOTOOLDIR/cgo directly

LGTM=minux.ma, iant
R=iant, minux.ma, dave
CC=golang-codereviews
https://golang.org/cl/59580045
2014-02-07 10:22:13 +09:00
Jakub Ryszard Czarnowicz
d3b9567a15 net/mail: correctly handle whitespaces when formatting an email address
Whitespace characters are allowed in quoted-string according to RFC 5322 without
being "Q"-encoding. Address.String() already always formats the name portion in
quoted string, so whitespace characters should be allowed in there.

Fixes #6641.

LGTM=dave, dsymonds
R=golang-codereviews, gobot, dsymonds, dave
CC=golang-codereviews
https://golang.org/cl/55770043
2014-02-07 10:49:10 +11:00
Shenghou Ma
c66956cdb1 cmd/go: do not create world-writable files.
Fixes #7240.

LGTM=tommi.virtanen, bradfitz
R=golang-codereviews, tommi.virtanen, bradfitz
CC=golang-codereviews
https://golang.org/cl/60480045
2014-02-06 17:54:33 -05:00
Richard Musiol
547a82c36c math/big: replace goto with for loop
I just added support for goto statements to my GopherJS project and now I am trying to get rid of my patches. These occurrences of goto however are a bit problematic:
GopherJS has to emulate gotos, so there is some performance drawback when doing so. In this case the drawback is major, since this is a core function of math/big which is called quite often. Additionally I can't see any reason here why the implementation with gotos should be preferred over my proposal.
That's why I would kindly ask to include this patch, even though it is functional equivalent to the existing code.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/55470046
2014-02-06 14:44:30 -08:00
Elias Naur
2dc759d7c6 cmd/go, cmd/cgo, make.bash: cross compiling with cgo enabled
Introduce two new environment variables, CC_FOR_TARGET and CXX_FOR_TARGET.
CC_FOR_TARGET defaults to CC and is used when compiling for GOARCH, while
CC remains for compiling for GOHOSTARCH.
CXX_FOR_TARGET defaults to CXX and is used when compiling C++ code for
GOARCH.

CGO_ENABLED defaults to disabled when cross compiling and has to be
explicitly enabled.

Update #4714

LGTM=minux.ma, iant
R=golang-codereviews, minux.ma, iant, rsc, dominik.honnef
CC=golang-codereviews
https://golang.org/cl/57100043
2014-02-06 09:11:00 -08:00
Shenghou Ma
8a2dd16c74 encoding/json: mention escaping of '&'
Fixes #7034.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/57140043
2014-02-05 01:24:51 -05:00
Josh Bleecher Snyder
57bc80b5e8 cmd/go, doc/go1.3.txt: misc/benchcmp has been replaced by go tool benchcmp
Fixes #7016.

LGTM=r
R=r
CC=adg, bradfitz, dave, golang-codereviews
https://golang.org/cl/60100043
2014-02-04 11:53:13 -08:00
Josh Bleecher Snyder
d885aeaaa4 text/tabwriter: improve panic backtraces
Fixes #7117.

LGTM=gri
R=golang-codereviews, gobot, gri
CC=golang-codereviews
https://golang.org/cl/53310044
2014-02-04 10:19:02 -08:00
Anthony Martin
c2d02b3b9f crypto/tls: do not send the current time in hello messages
This reduces the ability to fingerprint TLS connections.

The impeteus for this change was a recent change to OpenSSL
by Nick Mathewson:

http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=2016265dfb

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/57230043
2014-02-04 10:51:37 -05:00
Dmitriy Vyukov
3baceaa151 runtime: add more chan benchmarks
Add benchmarks for:
1. non-blocking failing receive (polling of "stop" chan)
2. channel-based semaphore (gate pattern)
3. select-based producer/consumer (pass data through a channel, but also wait on "stop" and "timeout" channels)

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant, khr
https://golang.org/cl/59040043
2014-02-04 09:41:48 +04:00
Elias Naur
9ed5995cfe liblink, cmd/5l: restore flag_shared
CL 56120043 fixed and cleaned up TLS on ARM after introducing liblink, but
left flag_shared broken. This CL restores the (unsupported) flag_shared
behaviour by simply rewriting access to $runtime.tlsgm(SB) with
runtime.tlsgm(SB), to compensate for the extra indirection when going from
the R_ARM_TLS_LE32 relocation to the R_ARM_TLS_IE32 relocation.

Also, remove unnecessary symbol lookup left after 56120043.

LGTM=iant
R=iant, rsc
CC=golang-codereviews
https://golang.org/cl/57000043
2014-02-03 14:49:57 -08:00
Elias Naur
1dd4da1459 liblink, cmd/5a, cmd/5l: restore cgo on older ARM processors
CL 56120043 fixed TLS handling on ARM after the introduction of
liblink but left older ARM processors broken.

Before liblink, the MRC instruction was replaced with a fallback
on older ARMs. CL 56120043 removed that, because the rewrite matched
bit patterns on the AWORD pseudo-instruction and could therefore change
unrelated AWORDs that happened to match.

This CL adds an AMRC instruction to encode both MRC and MCR previously
encoded as AWORDs. Then, in liblink, the AMRC instructions are either
rewritten to AWORD, or, on goarm < 7, replaced with a branch to the
fallback.

./all.bash completes successfully on an ARMv7 with either GOARM=7 or
GOARM=5. I have verified that the fallback is indeed present in both
runtime.save_gm and runtime.load_gm when GOARM=5 but not when GOARM=7.

If all goes well, this should fix the armv5 builders.

LGTM=iant
R=iant, rsc
CC=golang-codereviews
https://golang.org/cl/55540044
2014-02-03 14:07:54 -08:00
Brad Fitzpatrick
e6d8bfe218 os/exec: fix Command with relative paths
Command was (and is) documented like:
"If name contains no path separators, Command uses LookPath to
resolve the path to a complete name if possible. Otherwise it
uses name directly."

But that wasn't true. It always did LookPath, and then
set a sticky error that the user couldn't unset.
And then if cmd.Dir was changed, Start would still fail
due to the earlier sticky error being set.

This keeps LookPath in the same place as before (so no user
visible changes in cmd.Path after Command), but only does
it when the documentation says it will happen.

Also, clarify the docs about a relative Dir path.

No change in any existing behavior, except using Command
is now possible with relative paths. Previously it only
worked if you built the *Cmd by hand.

Fixes #7228

LGTM=iant
R=iant
CC=adg, golang-codereviews
https://golang.org/cl/59580044
2014-02-03 16:32:13 -05:00
Brad Fitzpatrick
4723308ff5 net/http: make a test fail harder, earlier
LGTM=dave
R==r, r, dave
CC=golang-codereviews
https://golang.org/cl/59810043
2014-02-03 16:01:58 -05:00
Dave Cheney
d98b3a7ee5 time: use an alternative method of yielding during Overflow timer test
Fixes #6874.

Use runtime.GC() as a stronger version of runtime.Gosched() which tends to bias the running goroutine in an otherwise idle system. This appears to reduce the worst case number of spins from 600 down to 30 on my 2 core system under high load.

LGTM=iant
R=golang-codereviews, lucio.dere, iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/56540046
2014-02-02 16:05:07 +11:00
Ian Lance Taylor
fabd261fe2 time: use names for beginning and end of zone transition times
No functional changes, just more readable code.

LGTM=r
R=golang-codereviews, gobot, r
CC=golang-codereviews
https://golang.org/cl/59240043
2014-01-31 17:22:10 -08:00
Rob Pike
7e494f8500 unicode: delete appearance of unused LowerUpper term from comment
If a LowerUpper ever happens, maketables will complain.

Fixes #7002.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/59210044
2014-01-31 15:10:18 -08:00
Ian Lance Taylor
52a73239bb time: correctly handle timezone before first transition time
LGTM=r
R=golang-codereviews, r, arnehormann, bradfitz
CC=golang-codereviews
https://golang.org/cl/58450043
2014-01-31 14:40:13 -08:00
Dmitriy Vyukov
1b2e435b15 runtime: fix typos in test
I don't know what is n, but it exists somewhere there.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/58710043
2014-01-31 18:09:53 +04:00
Nathan John Youngman
99a1e76291 syscall: add ERROR_MORE_DATA to Windows for os/fsnotify
LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=dave, golang-codereviews
https://golang.org/cl/58900044
2014-01-31 17:43:46 +11:00
Shawn Smith
99d23dfdfd crypto/rand: add tests for Int, Prime
LGTM=rsc, dave
R=golang-codereviews, dave, josharian, rsc
CC=golang-codereviews
https://golang.org/cl/46490043
2014-01-31 11:43:48 +11:00
Rémy Oudompheng
502958ffa6 cmd/gc: do not consider length zero arrays as comparable.
Array values are comparable if values of the array element type
are comparable.

Fixes #6526.

LGTM=khr
R=rsc, bradfitz, khr
CC=golang-codereviews
https://golang.org/cl/58580043
2014-01-31 00:30:56 +01:00
Ian Lance Taylor
1683dab725 cmd/ld: fix bug with "runtime/cgo" in external link mode
In external link mode the linker explicitly adds the string
constant "runtime/cgo".  It adds the string constant using the
same symbol name as the compiler, but a different format.  The
compiler assumes that the string data immediately follows the
string header, but the linker puts the two in different
sections.  The result is bad string data when the compiler
sees "runtime/cgo" used as a string constant.

The compiler assumption is in datastring in [568]g/gobj.c.
The linker layout is in addstrdata in ld/data.c.  The compiler
assumption is valid for string literals.  The linker is not
creating a string literal, so its assumption is also valid.

There are a few ways to avoid this problem.  This patch fixes
it by only doing the fake import of runtime/cgo if necessary,
and by only creating the string symbol if necessary.

Fixes #7234.

LGTM=dvyukov
R=golang-codereviews, dvyukov, bradfitz
CC=golang-codereviews
https://golang.org/cl/58410043
2014-01-30 09:25:47 -08:00
David du Colombier
73b0d84c83 net/http: temporarily disable the failing tests on Plan 9
Update #7237

LGTM=bradfitz
R=jas, bradfitz
CC=golang-codereviews
https://golang.org/cl/57190045
2014-01-30 11:12:08 +01:00
Dmitriy Vyukov
e48751e217 runtime: increase page size to 8K
Tcmalloc uses 8K, 32K and 64K pages, and in custom setups 256K pages.
Only Chromium uses 4K pages today (in "slow but small" configuration).
The general tendency is to increase page size, because it reduces
metadata size and DTLB pressure.
This change reduces GC pause by ~10% and slightly improves other metrics.

json-1
allocated                 8037492      8038689      +0.01%
allocs                     105762       105573      -0.18%
cputime                 158400000    155800000      -1.64%
gc-pause-one              4412234      4135702      -6.27%
gc-pause-total            2647340      2398707      -9.39%
rss                      54923264     54525952      -0.72%
sys-gc                    3952624      3928048      -0.62%
sys-heap                 46399488     46006272      -0.85%
sys-other                 5597504      5290304      -5.49%
sys-stack                  393216       393216      +0.00%
sys-total                56342832     55617840      -1.29%
time                    158478890    156046916      -1.53%
virtual-mem             256548864    256593920      +0.02%

garbage-1
allocated                 2991113      2986259      -0.16%
allocs                      62844        62652      -0.31%
cputime                  16330000     15860000      -2.88%
gc-pause-one            789108229    725555211      -8.05%
gc-pause-total            3945541      3627776      -8.05%
rss                    1143660544   1132253184      -1.00%
sys-gc                   65609600     65806208      +0.30%
sys-heap               1032388608   1035599872      +0.31%
sys-other                37501632     22777664     -39.26%
sys-stack                 8650752      8781824      +1.52%
sys-total              1144150592   1132965568      -0.98%
time                     16364602     15891994      -2.89%
virtual-mem            1327296512   1313746944      -1.02%

This is the exact reincarnation of already LGTMed:
https://golang.org/cl/45770044
which must not break darwin/freebsd after:
https://golang.org/cl/56630043
TBR=iant

LGTM=khr, iant
R=iant, khr
CC=golang-codereviews
https://golang.org/cl/58230043
2014-01-30 13:28:19 +04:00
Brad Fitzpatrick
ae8251b0aa net/http: use a struct instead of a string in transport conn cache key
The Transport's idle connection cache is keyed by a string,
for pre-Go 1.0 reasons.  Ever since Go has been able to use
structs as map keys, there's been a TODO in the code to use
structs instead of allocating strings. This change does that.

Saves 3 allocatins and ~100 bytes of garbage per client
request. But because string hashing is so fast these days
(thanks, Keith), the performance is a wash: what we gain
on GC and not allocating, we lose in slower hashing. (hashing
structs of strings is slower than 1 string)

This seems a bit faster usually, but I've also seen it be a
bit slower. But at least it's how I've wanted it now, and it
the allocation improvements are consistent.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/58260043
2014-01-30 09:57:04 +01:00
Rémy Oudompheng
7a73f32725 encoding/gob: fix two crashes on corrupted data.
Fixes #6323.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/56870043
2014-01-30 07:54:57 +01:00
Jeff Sickel
1e89eb2c31 net: net: better IPv4 stack probe on Plan 9
LGTM=mischief, mikioh.mikioh
R=golang-codereviews, 0intro, mischief, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/53960044
2014-01-30 09:49:32 +09:00
Rob Pike
289d46399b cmd/8g: don't crash if Prog->u.branch is nil
The code is copied from cmd/6g.
Empirically, all branch targets are nil in this code so
something is still wrong, but at least this stops 8g -S
from crashing.

Update #7178

LGTM=dave, iant
R=iant, dave
CC=golang-codereviews
https://golang.org/cl/58400043
2014-01-29 16:14:45 -08:00
Dmitriy Vyukov
327e431057 runtime: prepare for 8K pages
Ensure than heap is PageSize aligned.

LGTM=iant
R=iant, dave, gobot
CC=golang-codereviews
https://golang.org/cl/56630043
2014-01-29 18:18:46 +04:00
Brad Fitzpatrick
ff29be14c4 net/http: read as much as possible (including EOF) during chunked reads
This is the chunked half of https://golang.org/cl/49570044 .

We want full reads to return EOF as early as possible, when we
know we're at the end, so http.Transport client connections are eagerly
re-used in the common case, even if no Read or Close follows.

To do this, make the chunkedReader.Read fill up its argument p []byte
buffer as much as possible, as long as that doesn't involve doing
any more blocking reads to read chunk headers. That means if we
have a chunk EOF ("0\r\n") sitting in the incoming bufio.Reader,
we see it and set EOF on our final Read.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/58240043
2014-01-29 13:44:21 +01:00
Brad Fitzpatrick
01e3b4fc6a net/http: reuse client connections earlier when Content-Length is set
Set EOF on the final Read of a body with a Content-Length, which
will cause clients to recycle their connection immediately upon
the final Read, rather than waiting for another Read or Close
(neither of which might come).  This happens often when client
code is simply something like:

  err := json.NewDecoder(resp.Body).Decode(&dest)
  ...

Then there's usually no subsequent Read. Even if the client
calls Close (which they should): in Go 1.1, the body was
slurped to EOF, but in Go 1.2, that was then treated as a
Close-before-EOF and the underlying connection was closed.
But that's assuming the user even calls Close. Many don't.
Reading to EOF also causes a connection be reused. Now the EOF
arrives earlier.

This CL only addresses the Content-Length case. A future CL
will address the chunked case.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/49570044
2014-01-29 11:23:45 +01:00
Mikio Hara
731e6f7d1d net: fix incoming connection's network name handling on unix networks
Fixes #7183.

LGTM=iant
R=golang-codereviews, gobot, iant
CC=golang-codereviews
https://golang.org/cl/57520043
2014-01-29 09:51:31 +09:00
Adam Langley
90c066da52 encoding/asn1: support set tag when unmarshaling.
This change also addresses some places where the comments were lacking.

Fixes #7087.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/56700043
2014-01-28 14:12:25 -05:00
Dmitriy Vyukov
d62379eef5 runtime: more chan tests
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/57390043
2014-01-28 22:45:14 +04:00
Dmitriy Vyukov
d176e3d7c5 runtime: prefetch next block in mallocgc
json-1
cputime                  99600000     98600000      -1.00%
time                    100005493     98859693      -1.15%

garbage-1
cputime                  15760000     15440000      -2.03%
time                     15791759     15471701      -2.03%

LGTM=khr
R=golang-codereviews, gobot, khr, dave
CC=bradfitz, golang-codereviews, iant
https://golang.org/cl/57310043
2014-01-28 22:38:39 +04:00
Dmitriy Vyukov
d409e44cfb runtime: fix buffer overflow in make(chan)
On 32-bits one can arrange make(chan) params so that
the chan buffer gives you access to whole memory.

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant, khr
https://golang.org/cl/50250045
2014-01-28 22:37:35 +04:00
Dmitriy Vyukov
ce884036d2 runtime: adjust malloc race instrumentation for tiny allocs
Tiny alloc memory block is shared by different goroutines running on the same thread.
We call racemalloc after enabling preemption in mallocgc,
as the result another goroutine can act on not yet race-cleared tiny block.
Call racemalloc before enabling preemption.
Fixes #7224.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/57730043
2014-01-28 22:34:32 +04:00
Mikio Hara
c88a671925 net: make it possible to use FilePacketConn with IPConn
Fixes #6803.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/57560043
2014-01-28 03:18:27 -08:00
Andrew Gerrand
5be96aad00 io: clarify MultiReader documentation
Fixes #7216.

LGTM=minux.ma
R=golang-codereviews, minux.ma
CC=golang-codereviews
https://golang.org/cl/54740044
2014-01-28 19:49:29 +11:00
Michael Hudson-Doyle
9f8f0a1bfa cmd/go: When linking with gccgo pass .a files in the order they are discovered
Under some circumstances linking a test binary with gccgo can fail, because
the installed version of the library ends up before the version built for the
test on the linker command line.

This admittedly slightly hackish fix fixes this by putting the library archives
on the linker command line in the order that a pre-order depth first traversal
of the dependencies gives them, which has the side effect of always putting the
version of the library built for the test first.

Fixes #6768

LGTM=rsc
R=golang-codereviews, minux.ma, gobot, rsc, dave
CC=golang-codereviews
https://golang.org/cl/28050043
2014-01-28 16:47:09 +11:00
David du Colombier
610dc92eac build: fix typos in run.rc
LGTM=bradfitz
R=jas, bradfitz
CC=golang-codereviews
https://golang.org/cl/52940044
2014-01-28 06:17:38 +01:00
Keith Randall
28479f2c32 cmd/gc: liveness: don't add fallthough edge after panic
update #7205

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/50730044
2014-01-27 18:04:34 -08:00
Fredrik Enestad
96471b65d5 httputil: in ReverseProxy, strip hop-by-hop headers from the backend response
Fixes #5967.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/57370043
2014-01-27 15:24:58 -08:00
Vincent Vanackere
d7c14655a9 runtime/debug: fix incorrect Stack output if package path contains a dot
Although debug.Stack is deprecated, it should still return the correct result.
Output before this CL (using a trivial library in $GOPATH/test.com/a):
/home/vince/src/test.com/a/lib.go:9 (0x42311e)
        com/a.ShowStack: os.Stdout.Write(debug.Stack())

Output with this CL applied:
/home/vince/src/test.com/a/lib.go:9 (0x42311e)
        ShowStack: os.Stdout.Write(debug.Stack())

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/57330043
2014-01-27 14:00:00 -08:00
Dmitriy Vyukov
86a3a54284 runtime: fix windows build
Currently windows crashes because early allocs in schedinit
try to allocate tiny memory blocks, but m->p is not yet setup.
I've considered calling procresize(1) earlier in schedinit,
but this refactoring is better and must fix the issue as well.
Fixes #7218.

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/54570045
2014-01-28 00:26:56 +04:00
Dmitriy Vyukov
179d41fecc runtime: tune P retake logic
When GOMAXPROCS>1 the last P in syscall is never retaken
(because there are already idle P's -- npidle>0).
This prevents sysmon thread from sleeping.
On a darwin machine the program from issue 6673 constantly
consumes ~0.2% CPU. With this change it stably consumes 0.0% CPU.
Fixes #6673.

R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant, khr
https://golang.org/cl/56990045
2014-01-27 23:17:46 +04:00
Keith Randall
ea86752206 cmd/6a: include MOVQL opcode.
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/54660046
2014-01-27 11:17:12 -08:00
Brad Fitzpatrick
a18f4ab569 all: use {bytes,strings}.NewReader instead of bytes.Buffers
Use the smaller read-only bytes.NewReader/strings.NewReader instead
of a bytes.Buffer when possible.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/54660045
2014-01-27 11:05:01 -08:00
Ian Lance Taylor
bd997b24f7 debug/dwarf, debug/elf: add support for reading DWARF 4 type info
In DWARF 4 the debug info for large types is put into
.debug_type sections, so that the linker can discard duplicate
info.  This change adds support for reading type units.

Another small change included here is that DWARF 3 supports
storing the byte offset of a struct field as a formData rather
than a formDwarfBlock.

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/56300043
2014-01-27 10:18:22 -08:00
Dmitriy Vyukov
e1a91c5b89 runtime: fix buffer overflow in stringtoslicerune
On 32-bits n*sizeof(r[0]) can overflow.
Or it can become 1<<32-eps, and mallocgc will "successfully"
allocate 0 pages for it, there are no checks downstream
and MHeap_Grow just does:
npage = (npage+15)&~15;
ask = npage<<PageShift;

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews
https://golang.org/cl/54760045
2014-01-27 20:29:21 +04:00
Dmitriy Vyukov
bace9523ee runtime: smarter slice grow
When growing slice take into account size of the allocated memory block.
Also apply the same optimization to string->[]byte conversion.
Fixes #6307.

benchmark                    old ns/op    new ns/op    delta
BenchmarkAppendGrowByte        4541036      4434108   -2.35%
BenchmarkAppendGrowString     59885673     44813604  -25.17%

LGTM=khr
R=khr
CC=golang-codereviews, iant, rsc
https://golang.org/cl/53340044
2014-01-27 15:11:12 +04:00
David du Colombier
496c030c50 time: increase timeout of TestOverflowRuntimeTimer on Plan 9
LGTM=dvyukov
R=dvyukov
CC=golang-codereviews
https://golang.org/cl/53000043
2014-01-27 11:11:44 +01:00
Jeff Sickel
03e4f25849 runtime/pprof: plan9 fails the TestGoroutineSwitch, skip for now.
LGTM=r
R=golang-codereviews, 0intro, r
CC=golang-codereviews
https://golang.org/cl/55430043
2014-01-25 10:09:08 -08:00
Dmitriy Vyukov
ce8045f393 sync: support Pool under race detector
Fixes #7203.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/53020044
2014-01-25 20:11:16 +04:00
Dmitriy Vyukov
1fa7029425 runtime: combine small NoScan allocations
Combine NoScan allocations < 16 bytes into a single memory block.
Reduces number of allocations on json/garbage benchmarks by 10+%.

json-1
allocated                 8039872      7949194      -1.13%
allocs                     105774        93776     -11.34%
cputime                 156200000    100700000     -35.53%
gc-pause-one              4908873      3814853     -22.29%
gc-pause-total            2748969      2899288      +5.47%
rss                      52674560     43560960     -17.30%
sys-gc                    3796976      3256304     -14.24%
sys-heap                 43843584     35192832     -19.73%
sys-other                 5589312      5310784      -4.98%
sys-stack                  393216       393216      +0.00%
sys-total                53623088     44153136     -17.66%
time                    156193436    100886714     -35.41%
virtual-mem             256548864    256540672      -0.00%

garbage-1
allocated                 2996885      2932982      -2.13%
allocs                      62904        55200     -12.25%
cputime                  17470000     17400000      -0.40%
gc-pause-one            932757485    925806143      -0.75%
gc-pause-total            4663787      4629030      -0.75%
rss                    1151074304   1133670400      -1.51%
sys-gc                   66068352     65085312      -1.49%
sys-heap               1039728640   1024065536      -1.51%
sys-other                38038208     37485248      -1.45%
sys-stack                 8650752      8781824      +1.52%
sys-total              1152485952   1135417920      -1.48%
time                     17478088     17418005      -0.34%
virtual-mem            1343709184   1324204032      -1.45%

LGTM=iant, bradfitz
R=golang-codereviews, dave, iant, rsc, bradfitz
CC=golang-codereviews, khr
https://golang.org/cl/38750047
2014-01-24 22:35:11 +04:00
Dmitriy Vyukov
f8e0057bb7 sync: scalable Pool
Introduce fixed-size P-local caches.
When local caches overflow/underflow a batch of items
is transferred to/from global mutex-protected cache.

benchmark                    old ns/op    new ns/op    delta
BenchmarkPool                    50554        22423  -55.65%
BenchmarkPool-4                 400359         5904  -98.53%
BenchmarkPool-16                403311         1598  -99.60%
BenchmarkPool-32                367310         1526  -99.58%

BenchmarkPoolOverlflow            5214         3633  -30.32%
BenchmarkPoolOverlflow-4         42663         9539  -77.64%
BenchmarkPoolOverlflow-8         46919        11385  -75.73%
BenchmarkPoolOverlflow-16        39454        13048  -66.93%

BenchmarkSprintfEmpty                    84           63  -25.68%
BenchmarkSprintfEmpty-2                 371           32  -91.13%
BenchmarkSprintfEmpty-4                 465           22  -95.25%
BenchmarkSprintfEmpty-8                 565           12  -97.77%
BenchmarkSprintfEmpty-16                498            5  -98.87%
BenchmarkSprintfEmpty-32                492            4  -99.04%

BenchmarkSprintfString                  259          229  -11.58%
BenchmarkSprintfString-2                574          144  -74.91%
BenchmarkSprintfString-4                651           77  -88.05%
BenchmarkSprintfString-8                868           47  -94.48%
BenchmarkSprintfString-16               825           33  -95.96%
BenchmarkSprintfString-32               825           30  -96.28%

BenchmarkSprintfInt                     213          188  -11.74%
BenchmarkSprintfInt-2                   448          138  -69.20%
BenchmarkSprintfInt-4                   624           52  -91.63%
BenchmarkSprintfInt-8                   691           31  -95.43%
BenchmarkSprintfInt-16                  724           18  -97.46%
BenchmarkSprintfInt-32                  718           16  -97.70%

BenchmarkSprintfIntInt                  311          282   -9.32%
BenchmarkSprintfIntInt-2                333          145  -56.46%
BenchmarkSprintfIntInt-4                642          110  -82.87%
BenchmarkSprintfIntInt-8                832           42  -94.90%
BenchmarkSprintfIntInt-16               817           24  -97.00%
BenchmarkSprintfIntInt-32               805           22  -97.17%

BenchmarkSprintfPrefixedInt             309          269  -12.94%
BenchmarkSprintfPrefixedInt-2           245          168  -31.43%
BenchmarkSprintfPrefixedInt-4           598           99  -83.36%
BenchmarkSprintfPrefixedInt-8           770           67  -91.23%
BenchmarkSprintfPrefixedInt-16          829           54  -93.49%
BenchmarkSprintfPrefixedInt-32          824           50  -93.83%

BenchmarkSprintfFloat                   418          398   -4.78%
BenchmarkSprintfFloat-2                 295          203  -31.19%
BenchmarkSprintfFloat-4                 585          128  -78.12%
BenchmarkSprintfFloat-8                 873           60  -93.13%
BenchmarkSprintfFloat-16                884           33  -96.24%
BenchmarkSprintfFloat-32                881           29  -96.62%

BenchmarkManyArgs                      1097         1069   -2.55%
BenchmarkManyArgs-2                     705          567  -19.57%
BenchmarkManyArgs-4                     792          319  -59.72%
BenchmarkManyArgs-8                     963          172  -82.14%
BenchmarkManyArgs-16                   1115          103  -90.76%
BenchmarkManyArgs-32                   1133           90  -92.03%

LGTM=rsc
R=golang-codereviews, bradfitz, minux.ma, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/46010043
2014-01-24 22:29:53 +04:00
Dmitriy Vyukov
9fa9613e0b runtime: do not zero terminate strings
On top of "tiny allocator" (cl/38750047), reduces number of allocs by 1% on json.
No code must rely on zero termination. So will also make debugging simpler,
by uncovering issues earlier.

json-1
allocated                 7949686      7915766      -0.43%
allocs                      93778        92790      -1.05%
time                    100957795     97250949      -3.67%
rest of the metrics are too noisy.

LGTM=r
R=golang-codereviews, r, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/40370061
2014-01-24 22:29:01 +04:00
Russ Cox
a81692e265 cmd/gc: add zeroing to enable precise stack accounting
There is more zeroing than I would like right now -
temporaries used for the new map and channel runtime
calls need to be eliminated - but it will do for now.

This CL only has an effect if you are building with

        GOEXPERIMENT=precisestack ./all.bash

(or make.bash). It costs about 5% in the overall time
spent in all.bash. That number will come down before
we make it on by default, but this should be enough for
Keith to try using the precise maps for copying stacks.

amd64 only (and it's not really great generated code).

TBR=khr, iant
CC=golang-codereviews
https://golang.org/cl/56430043
2014-01-23 23:11:04 -05:00
Russ Cox
b377c9c6a9 liblink, runtime: fix cgo on arm
The addition of TLS to ARM rewrote the MRC instruction
differently depending on whether we were using internal
or external linking mode. That's clearly not okay, since we
don't know that during compilation, which is when we now
generate the code. Also, because the change did not introduce
a real MRC instruction but instead just macro-expanded it
in the assembler, liblink is rewriting a WORD instruction that
may actually be looking for that specific constant, which would
lead to very unexpected results. It was also using one value
that happened to be 8 where a different value that also
happened to be 8 belonged. So the code was correct for those
values but not correct in general, and very confusing.

Throw it all away.

Replace with the following. There is a linker-provided symbol
runtime.tlsgm with a value (address) set to the offset from the
hardware-provided TLS base register to the g and m storage.
Any reference to that name emits an appropriate TLS relocation
to be resolved by either the internal linker or the external linker,
depending on the link mode. The relocation has exactly the
semantics of the R_ARM_TLS_LE32 relocation, which is what
the external linker provides.

This symbol is only used in two routines, runtime.load_gm and
runtime.save_gm. In both cases it is now used like this:

        MRC		15, 0, R0, C13, C0, 3 // fetch TLS base pointer
        MOVW	$runtime·tlsgm(SB), R2
        ADD	R2, R0 // now R0 points at thread-local g+m storage

It is likely that this change breaks the generation of shared libraries
on ARM, because the MOVW needs to be rewritten to use the global
offset table and a different relocation type. But let's get the supported
functionality working again before we worry about unsupported
functionality.

LGTM=dave, iant
R=iant, dave
CC=golang-codereviews
https://golang.org/cl/56120043
2014-01-23 22:51:39 -05:00
Keith Randall
be5d2d4432 runtime: Print elision message if we skipped frames on traceback.
Fixes bug 7180

R=golang-codereviews, dvyukov
CC=golang-codereviews, gri
https://golang.org/cl/55810044
2014-01-23 12:47:30 -08:00
Dmitriy Vyukov
0ad2cd004c bufio: fix benchmarks behavior
Currently the benchmarks lie to testing package by doing O(N)
work under StopTimer. And that hidden O(N) actually consitutes
the bulk of benchmark work (e.g includes GC per iteration).
This behavior accounts for windows-amd64-race builder hangs.

Before:
BenchmarkReaderCopyOptimal-4	 1000000	      1861 ns/op
BenchmarkReaderCopyUnoptimal-4	  500000	      3327 ns/op
BenchmarkReaderCopyNoWriteTo-4	   50000	     34549 ns/op
BenchmarkWriterCopyOptimal-4	  100000	     16849 ns/op
BenchmarkWriterCopyUnoptimal-4	  500000	      3126 ns/op
BenchmarkWriterCopyNoReadFrom-4	   50000	     34609 ns/op
ok  	bufio	65.273s

After:
BenchmarkReaderCopyOptimal-4	10000000	       172 ns/op
BenchmarkReaderCopyUnoptimal-4	10000000	       267 ns/op
BenchmarkReaderCopyNoWriteTo-4	  100000	     22905 ns/op
BenchmarkWriterCopyOptimal-4	10000000	       170 ns/op
BenchmarkWriterCopyUnoptimal-4	10000000	       226 ns/op
BenchmarkWriterCopyNoReadFrom-4	  100000	     20575 ns/op
ok  	bufio	14.074s

Note the change in total time.

LGTM=alex.brainman, rsc
R=golang-codereviews, alex.brainman, rsc
CC=golang-codereviews
https://golang.org/cl/51360046
2014-01-23 15:13:21 -05:00
Dmitriy Vyukov
8371b0142e undo CL 45770044 / d795425bfa18
Breaks darwin and freebsd.

««« original CL description
runtime: increase page size to 8K
Tcmalloc uses 8K, 32K and 64K pages, and in custom setups 256K pages.
Only Chromium uses 4K pages today (in "slow but small" configuration).
The general tendency is to increase page size, because it reduces
metadata size and DTLB pressure.
This change reduces GC pause by ~10% and slightly improves other metrics.

json-1
allocated                 8037492      8038689      +0.01%
allocs                     105762       105573      -0.18%
cputime                 158400000    155800000      -1.64%
gc-pause-one              4412234      4135702      -6.27%
gc-pause-total            2647340      2398707      -9.39%
rss                      54923264     54525952      -0.72%
sys-gc                    3952624      3928048      -0.62%
sys-heap                 46399488     46006272      -0.85%
sys-other                 5597504      5290304      -5.49%
sys-stack                  393216       393216      +0.00%
sys-total                56342832     55617840      -1.29%
time                    158478890    156046916      -1.53%
virtual-mem             256548864    256593920      +0.02%

garbage-1
allocated                 2991113      2986259      -0.16%
allocs                      62844        62652      -0.31%
cputime                  16330000     15860000      -2.88%
gc-pause-one            789108229    725555211      -8.05%
gc-pause-total            3945541      3627776      -8.05%
rss                    1143660544   1132253184      -1.00%
sys-gc                   65609600     65806208      +0.30%
sys-heap               1032388608   1035599872      +0.31%
sys-other                37501632     22777664     -39.26%
sys-stack                 8650752      8781824      +1.52%
sys-total              1144150592   1132965568      -0.98%
time                     16364602     15891994      -2.89%
virtual-mem            1327296512   1313746944      -1.02%

R=golang-codereviews, dave, khr, rsc, khr
CC=golang-codereviews
https://golang.org/cl/45770044
»»»

R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/56060043
2014-01-23 19:56:59 +04:00
Dmitriy Vyukov
6d603af6dc runtime: increase page size to 8K
Tcmalloc uses 8K, 32K and 64K pages, and in custom setups 256K pages.
Only Chromium uses 4K pages today (in "slow but small" configuration).
The general tendency is to increase page size, because it reduces
metadata size and DTLB pressure.
This change reduces GC pause by ~10% and slightly improves other metrics.

json-1
allocated                 8037492      8038689      +0.01%
allocs                     105762       105573      -0.18%
cputime                 158400000    155800000      -1.64%
gc-pause-one              4412234      4135702      -6.27%
gc-pause-total            2647340      2398707      -9.39%
rss                      54923264     54525952      -0.72%
sys-gc                    3952624      3928048      -0.62%
sys-heap                 46399488     46006272      -0.85%
sys-other                 5597504      5290304      -5.49%
sys-stack                  393216       393216      +0.00%
sys-total                56342832     55617840      -1.29%
time                    158478890    156046916      -1.53%
virtual-mem             256548864    256593920      +0.02%

garbage-1
allocated                 2991113      2986259      -0.16%
allocs                      62844        62652      -0.31%
cputime                  16330000     15860000      -2.88%
gc-pause-one            789108229    725555211      -8.05%
gc-pause-total            3945541      3627776      -8.05%
rss                    1143660544   1132253184      -1.00%
sys-gc                   65609600     65806208      +0.30%
sys-heap               1032388608   1035599872      +0.31%
sys-other                37501632     22777664     -39.26%
sys-stack                 8650752      8781824      +1.52%
sys-total              1144150592   1132965568      -0.98%
time                     16364602     15891994      -2.89%
virtual-mem            1327296512   1313746944      -1.02%

R=golang-codereviews, dave, khr, rsc, khr
CC=golang-codereviews
https://golang.org/cl/45770044
2014-01-23 18:59:43 +04:00
Rob Pike
d07d08e60f cmd/gc: add the word 'archive' to the documentation for -pack
The term "package file" is unclear.

R=iant, dave
CC=golang-codereviews
https://golang.org/cl/54760044
2014-01-22 15:55:56 -08:00
Gautham Thambidorai
988ffc0fe2 crypto/tls: Client side support for TLS session resumption.
Adam (agl@) had already done an initial review of this CL in a branch.

Added ClientSessionState to Config which now allows clients to keep state
required to resume a TLS session with a server. A client handshake will try
and use the SessionTicket/MasterSecret in this cached state if the server
acknowledged resumption.

We also added support to cache ClientSessionState object in Config that will
be looked up by server remote address during the handshake.

R=golang-codereviews, agl, rsc, agl, agl, bradfitz, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/15680043
2014-01-22 18:24:03 -05:00
David du Colombier
021c11683c debug/plan9obj: implement parsing of Plan 9 a.out executables
It implements parsing of the header and symbol table for both
32-bit and 64-bit Plan 9 binaries. The nm tool was updated to
use this package.

R=rsc, aram
CC=golang-codereviews
https://golang.org/cl/49970044
2014-01-22 23:30:52 +01:00
Russ Cox
f7245c0626 runtime: fix typo in ARM code
The typo was introduced by one of Dmitriy's CLs this morning.
The fix makes the ARM build compile again; it still won't pass
its tests, but one thing at a time.

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/55770044
2014-01-22 16:39:39 -05:00
Russ Cox
91fbf6f159 testing: fix SkipNow and FailNow to avoid panic(nil) check
Sorry, too many windows in which to run all.bash.
Fixes build.

TBR=r
CC=golang-codereviews
https://golang.org/cl/55790043
2014-01-22 16:34:02 -05:00
Jeff Sickel
52125738f3 net: plan9 changes for default net directory
This change include updates to the probeIPv4Stack
and probeIPv6Stack to ensure that one or both
protocols are supported by ip(3).
The addition of fdMutex to netFD fixes the
TestTCPConcurrentAccept failures.
Additional changes add support for keepalive.

R=golang-codereviews, 0intro
CC=golang-codereviews, rsc
https://golang.org/cl/49920048
2014-01-22 22:21:53 +01:00
Russ Cox
ae56210708 testing: diagnose buggy tests that panic(nil)
Fixes #6546.

LGTM=dave, bradfitz, r
R=r, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/55780043
2014-01-22 16:04:50 -05:00
David du Colombier
1351638314 cmd/gc, cmd/ld: fix Plan 9 warnings
warning: /usr/go/src/cmd/gc/obj.c:23 format mismatch -10d VLONG, arg 9
warning: /usr/go/src/cmd/gc/plive.c:1680 set and not used: printed
warning: /usr/go/src/cmd/ld/lib.c:332 non-interruptable temporary
warning: /usr/go/src/cmd/ld/lib.c:338 non-interruptable temporary

R=rsc
CC=golang-codereviews
https://golang.org/cl/53820046
2014-01-22 21:21:18 +01:00
Michael Gehring
bdd78a088d archive/tar: add dragonfly build tag
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/55720044
2014-01-22 10:58:38 -08:00
Michael Gehring
15dcd671be syscall: add syscall.Termios on dragonfly, openbsd
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/55720043
2014-01-22 10:39:10 -08:00
Brad Fitzpatrick
ba8c92c166 syscall: use unsafe.Pointer in BSD kevent
Doesn't really matter for the most part, since the runtime-integrated
network poller uses its own kevent implementation, but for people using
the syscall directly, we should use an unsafe.Pointer for the precise GC
to retain the pointer arguments.

Also push down unsafe.Pointer a bit further in exec_linux.go, not
that there are any GC preemption points in the middle and sys
is still live anyway.

R=golang-codereviews, dvyukov
CC=golang-codereviews, iant
https://golang.org/cl/55520043
2014-01-22 10:35:41 -08:00
Dmitriy Vyukov
b7b93a7154 runtime: fix code formatting
Place && at the end of line.
Offset expression continuation.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/55380044
2014-01-22 13:30:12 +04:00
Dmitriy Vyukov
9cbd2fb1aa runtime: remove locks from netpoll hotpaths
Introduces two-phase goroutine parking mechanism -- prepare to park, commit park.
This mechanism does not require backing mutex to protect wait predicate.
Use it in netpoll. See comment in netpoll.goc for details.
This slightly reduces contention between reader, writer and read/write io notifications;
and just eliminates a bunch of mutex operations from hotpaths, thus making then faster.

benchmark                             old ns/op    new ns/op    delta
BenchmarkTCP4ConcurrentReadWrite           2109         1945   -7.78%
BenchmarkTCP4ConcurrentReadWrite-2         1162         1113   -4.22%
BenchmarkTCP4ConcurrentReadWrite-4          798          755   -5.39%
BenchmarkTCP4ConcurrentReadWrite-8          803          748   -6.85%
BenchmarkTCP4Persistent                    9411         9240   -1.82%
BenchmarkTCP4Persistent-2                  5888         5813   -1.27%
BenchmarkTCP4Persistent-4                  4016         3968   -1.20%
BenchmarkTCP4Persistent-8                  3943         3857   -2.18%

R=golang-codereviews, mikioh.mikioh, gobot, iant, rsc
CC=golang-codereviews, khr
https://golang.org/cl/45700043
2014-01-22 11:27:16 +04:00
Dmitriy Vyukov
cb86d86786 runtime/race: race instrument reads/writes in select cases
The new select tests currently fail (the race is not detected).

R=khr
CC=golang-codereviews
https://golang.org/cl/54220043
2014-01-22 10:36:17 +04:00
Dmitriy Vyukov
98b50b89a8 runtime: allocate goroutine ids in batches
Helps reduce contention on sched.goidgen.

benchmark                               old ns/op    new ns/op    delta
BenchmarkCreateGoroutines-16                  259          237   -8.49%
BenchmarkCreateGoroutinesParallel-16          127           43  -66.06%

R=golang-codereviews, dave, bradfitz, khr
CC=golang-codereviews, rsc
https://golang.org/cl/46970043
2014-01-22 10:34:36 +04:00
Dmitriy Vyukov
8a3c587dc1 runtime: fix and improve CPU profiling
- do not lose profiling signals when we have no mcache (possible for syscalls/cgo)
- do not lose any profiling signals on windows
- fix profiling of cgo programs on windows (they had no m->thread setup)
- properly setup tls in cgo programs on windows
- check _beginthread return value

Fixes #6417.
Fixes #6986.

R=alex.brainman, rsc
CC=golang-codereviews
https://golang.org/cl/44820047
2014-01-22 10:30:10 +04:00
Jeff Sickel
f69391dd9e liblink: include missing pragmas for plan9 formatter
R=rsc, r, 0intro
CC=golang-codereviews
https://golang.org/cl/36060047
2014-01-22 06:23:19 +01:00
Rémy Oudompheng
20137eb4b9 cmd/gc: preserve qualified names of unexported methods in imports.
Fixes #6295.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/20850043
2014-01-21 22:55:50 -05:00
Dominik Honnef
062ae45711 cmd/gc: do not typecheck nil types in multiple assignment
Fixes #6572.

LGTM=rsc, daniel.morsing, rsc
R=golang-codereviews, bradfitz, minux.ma, iant, rsc, gobot, daniel.morsing
CC=golang-codereviews
https://golang.org/cl/14516055
2014-01-21 22:44:54 -05:00
Brad Fitzpatrick
f00af3da1c syscall: use unsafe.Pointer instead of uintptr in net syscalls
In particular: setsockopt, getsockopt, bind, connect.

There are probably more.

All platforms cross-compile with make.bash, and all.bash still
pases on linux/amd64.

Update #7169

R=rsc
CC=golang-codereviews
https://golang.org/cl/55410043
2014-01-21 18:54:49 -08:00
Dave Cheney
db37050f21 cmd/go: do not require a valid archChar when using -compiler gccgo
Fixes #7152.

R=iant, rsc, gobot
CC=golang-codereviews
https://golang.org/cl/54790044
2014-01-22 12:19:11 +11:00
Russ Cox
dab127baf5 liblink: remove use of linkmode on ARM
Now that liblink is compiled into the compilers and assemblers,
it must not refer to the "linkmode", since that is not known until
link time. This CL makes the ARM support no longer use linkmode,
which fixes a bug with cgo binaries that contain their own TLS
variables.

The x86 code must also remove linkmode; that is issue 7164.

Fixes #6992.

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/55160043
2014-01-21 19:46:34 -05:00
Brad Fitzpatrick
367ad4534f syscall: rename method Flock_t.Lock to func FcntlFlock
Update #7059

R=rsc
CC=golang-codereviews
https://golang.org/cl/55370043
2014-01-21 16:27:39 -08:00
Brad Fitzpatrick
5d3033c590 syscall: add Flock_t.Lock method
Fixes #7059

R=golang-codereviews, iant, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/53470043
2014-01-21 14:52:44 -08:00
Keith Randall
c8c18614af runtime: if "panic during panic"'s stacktrace fails, don't recurse.
R=golang-codereviews, iant, khr, dvyukov
CC=golang-codereviews
https://golang.org/cl/54160043
2014-01-21 14:34:37 -08:00
Russ Cox
2a2a3baac4 cmd/link: add testdata/pclntab.6 (fix build)
Sorry, "hg status" hides .6 files by default.
We should probably fix that.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/55290043
2014-01-21 17:12:30 -05:00
Ian Lance Taylor
bec1a3e258 cmd/gc: document -pack flag
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/55140044
2014-01-21 11:54:21 -08:00
Russ Cox
a453f28c70 cmd/link: pclntab generation
R=iant
CC=golang-codereviews
https://golang.org/cl/53820043
2014-01-21 13:47:47 -05:00
Russ Cox
0dd26f276d cmd/gc: fix build
The AKILL stuff is not ready yet and
was not meant to be in the last CL.

R=iant
CC=golang-codereviews
https://golang.org/cl/55170043
2014-01-21 13:46:14 -05:00
Russ Cox
eb592d8289 cmd/gc: do not follow uintptr passed as function argument
The escape analysis works by tracing assignment paths from
variables that start with pointer type, or addresses of variables
(addresses are always pointers).  It does allow non-pointers
in the path, so that in this code it sees x's value escape into y:

        var x *[10]int
        y := (*int)(unsafe.Pointer(uintptr(unsafe.Pointer(x))+32))

It must allow uintptr in order to see through this kind of
"pointer arithmetic".

It also traces such values if they end up as uintptrs passed to
functions. This used to be important because packages like
encoding/gob passed around uintptrs holding real pointers.

The introduction of precise collection of stacks has forced
code to be more honest about which declared stack variables
hold pointers and which do not. In particular, the garbage
collector no longer sees pointers stored in uintptr variables.
Because of this, packages like encoding/gob have been fixed.

There is not much point in the escape analysis accepting
uintptrs as holding pointers at call boundaries if the garbage
collector does not.

Excluding uintptr-valued arguments brings the escape
analysis in line with the garbage collector and has the
useful side effect of making arguments to syscall.Syscall
not appear to escape.

That is, this CL should yield the same benefits as
CL 45930043 (rolled back in CL 53870043), but it does
so by making uintptrs less special, not more.

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/53940043
2014-01-21 13:31:34 -05:00
Russ Cox
8027660abc cmd/gc: fix crash in -live debugging output
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/53930043
2014-01-21 13:31:22 -05:00
Ian Lance Taylor
cdc556556c cmd/ld: support archives larger than 2G
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/53950043
2014-01-21 09:29:19 -08:00
Ian Lance Taylor
6111dc4e71 liblink: check for symgrow size too large
Many calls to symgrow pass a vlong value.  Change the function
to not implicitly truncate, and to instead give an error if
the value is too large.

R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/54010043
2014-01-21 06:12:54 -08:00
Dmitriy Vyukov
cb133c6607 runtime: do not collect GC roots explicitly
Currently we collect (add) all roots into a global array in a single-threaded GC phase.
This hinders parallelism.
With this change we just kick off parallel for for number_of_goroutines+5 iterations.
Then parallel for callback decides whether it needs to scan stack of a goroutine
scan data segment, scan finalizers, etc. This eliminates the single-threaded phase entirely.
This requires to store all goroutines in an array instead of a linked list
(to allow direct indexing).
This CL also removes DebugScan functionality. It is broken because it uses
unbounded stack, so it can not run on g0. When it was working, I've found
it helpless for debugging issues because the two algorithms are too different now.
This change would require updating the DebugScan, so it's simpler to just delete it.

With 8 threads this change reduces GC pause by ~6%, while keeping cputime roughly the same.

garbage-8
allocated                 2987886      2989221      +0.04%
allocs                      62885        62887      +0.00%
cputime                  21286000     21272000      -0.07%
gc-pause-one             26633247     24885421      -6.56%
gc-pause-total             873570       811264      -7.13%
rss                     242089984    242515968      +0.18%
sys-gc                   13934336     13869056      -0.47%
sys-heap                205062144    205062144      +0.00%
sys-other                12628288     12628288      +0.00%
sys-stack                11534336     11927552      +3.41%
sys-total               243159104    243487040      +0.13%
time                      2809477      2740795      -2.44%

R=golang-codereviews, rsc
CC=cshapiro, golang-codereviews, khr
https://golang.org/cl/46860043
2014-01-21 13:06:57 +04:00
Dmitriy Vyukov
0e027fca42 runtime: delete proc.p
It's entirely outdated today.

R=golang-codereviews, bradfitz, gobot, r
CC=golang-codereviews
https://golang.org/cl/43500045
2014-01-21 12:49:55 +04:00
Dmitriy Vyukov
1ba04c171a runtime: per-P defer pool
Instead of a per-goroutine stack of defers for all sizes,
introduce per-P defer pool for argument sizes 8, 24, 40, 56, 72 bytes.

For a program that starts 1e6 goroutines and then joins then:
old: rss=6.6g virtmem=10.2g time=4.85s
new: rss=4.5g virtmem= 8.2g time=3.48s

R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/42750044
2014-01-21 11:20:23 +04:00
Keith Randall
abd588aa83 runtime: fix race detector by recording read by chansend.
R=golang-codereviews, dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/54060043
2014-01-21 11:17:44 +04:00
Dmitriy Vyukov
d5a36cd6bb runtime: zero 2-word memory blocks in-place
Currently for 2-word blocks we set the flag to clear the flag. Makes no sense.
In particular on 32-bits we call memclr always.

R=golang-codereviews, dave, iant
CC=golang-codereviews, khr, rsc
https://golang.org/cl/41170044
2014-01-21 10:53:51 +04:00
Dmitriy Vyukov
b039abfc3e runtime: fix specials deadlock
The deadlock is between span->specialLock and proflock:

goroutine 11 [running]:
runtime.MProf_Free(0x7fa272d26508, 0xc210054180, 0xc0)
        src/pkg/runtime/mprof.goc:220 +0x27
runtime.freespecial(0x7fa272d1e088, 0xc210054180, 0xc0)
        src/pkg/runtime/mheap.c:691 +0x6a
runtime.freeallspecials(0x7fa272d1af50, 0xc210054180, 0xc0)
        src/pkg/runtime/mheap.c:717 +0xb5
runtime.free(0xc210054180)
        src/pkg/runtime/malloc.goc:190 +0xfd
selectgo(0x7fa272a5ef58)
        src/pkg/runtime/chan.c:1136 +0x2d8
runtime.selectgo(0xc210054180)
        src/pkg/runtime/chan.c:840 +0x12
runtime_test.func·058()
        src/pkg/runtime/proc_test.go:146 +0xb4
runtime.goexit()
        src/pkg/runtime/proc.c:1405
created by runtime_test.TestTimerFairness
        src/pkg/runtime/proc_test.go:152 +0xd1

goroutine 12 [running]:
addspecial(0xc2100540c0, 0x7fa272d1e0a0)
        src/pkg/runtime/mheap.c:569 +0x88
runtime.setprofilebucket(0xc2100540c0, 0x7fa272d26508)
        src/pkg/runtime/mheap.c:668 +0x73
runtime.MProf_Malloc(0xc2100540c0, 0xc0, 0x0)
        src/pkg/runtime/mprof.goc:212 +0x16b
runtime.mallocgc(0xc0, 0x0, 0xc200000000)
        src/pkg/runtime/malloc.goc:142 +0x239
runtime.mal(0xbc)
        src/pkg/runtime/malloc.goc:703 +0x38
newselect(0x2, 0x7fa272a5cf60)
        src/pkg/runtime/chan.c:632 +0x53
runtime.newselect(0xc200000002, 0xc21005f000)
        src/pkg/runtime/chan.c:615 +0x28
runtime_test.func·058()
        src/pkg/runtime/proc_test.go:146 +0x37
runtime.goexit()
        src/pkg/runtime/proc.c:1405
created by runtime_test.TestTimerFairness
        src/pkg/runtime/proc_test.go:152 +0xd1

Fixes #7099.

R=golang-codereviews, khr
CC=golang-codereviews
https://golang.org/cl/53120043
2014-01-21 10:48:37 +04:00
Dmitriy Vyukov
d76a1e593c runtime: fix test on windows
The test prints an excessive \n when /dev/null is not present.

R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/54890043
2014-01-21 10:44:08 +04:00
Dmitriy Vyukov
bfd3c223f9 net: fix data race in test
Fixes #7157.

R=alex.brainman, bradfitz
CC=golang-codereviews
https://golang.org/cl/54880043
2014-01-21 10:35:27 +04:00
Dmitriy Vyukov
90eca36a23 runtime: ensure fair scheduling during frequent GCs
What was happenning is as follows:
Each writer goroutine always triggers GC during its scheduling quntum.
After GC goroutines are shuffled so that the timer goroutine is always second in the queue.
This repeats infinitely, causing timer goroutine starvation.
Fixes #7126.

R=golang-codereviews, shanemhansen, khr, khr
CC=golang-codereviews
https://golang.org/cl/53080043
2014-01-21 10:24:42 +04:00
Brad Fitzpatrick
cfb9cf0f06 expvar: sort maps, fix race
It's pretty distracting to use expvar with the output of both
the top-level map and map values jumping around randomly.

Also fixes a potential race where multiple clients trying to
increment a map int or float key at the same time could lose
updates.

R=golang-codereviews, couchmoney
CC=golang-codereviews
https://golang.org/cl/54320043
2014-01-20 09:59:23 -08:00
Brad Fitzpatrick
6592aeb8f3 net/http, net/http/httputil: make chunked reader alloc test more robust
Use testing.AllocsPerRun now that it exists, instead of doing it by hand.

Fixes #6076

R=golang-codereviews, alex.brainman
CC=golang-codereviews
https://golang.org/cl/53810043
2014-01-19 10:02:10 -08:00
Michael Gehring
081e2d0153 syscall: add syscall.Termios on netbsd
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/54290043
2014-01-19 09:57:02 -08:00
Mikio Hara
b51e15780f syscall: fix typo
R=r
CC=golang-codereviews
https://golang.org/cl/54040043
2014-01-18 16:02:59 +09:00
Keith Randall
6c9f198c9a runtime: print stack trace when "panic during panic"
Fixes bug 7145

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/53970043
2014-01-17 18:47:40 -08:00
Mikio Hara
985893acff syscall: fix build
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/54000043
2014-01-18 11:22:32 +09:00
Mikio Hara
3baa98f26d syscall: make getrlimit, setrlimit tests work on unix variants
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/53690043
2014-01-18 08:34:31 +09:00
Keith Randall
6f6a9445c9 runtime, cmd/gc: Get rid of vararg channel calls.
Vararg C calls present a problem for the GC because the
argument types are not derivable from the signature.  Remove
them by passing pointers to channel elements instead of the
channel elements directly.

R=golang-codereviews, gobot, rsc, dvyukov
CC=golang-codereviews
https://golang.org/cl/53430043
2014-01-17 14:48:45 -08:00
Russ Cox
98178b345a runtime: fix TestLFStackStress
Fixes #7138.

R=r, bradfitz, dave
CC=dvyukov, golang-codereviews
https://golang.org/cl/53910043
2014-01-17 17:42:24 -05:00
Russ Cox
5c9585953f undo CL 45930043 / c22889382a17
The compiler change is an ugly hack.
We can do better.

««« original CL description
syscall: mark arguments to Syscall as noescape
Heap arguments to "async" syscalls will break when/if we have moving GC anyway.
With this change is must not break until moving GC, because a user must
reference the object in Go to preserve liveness. Otherwise the code is broken already.
Reduces number of leaked params from 125 to 36 on linux.

R=golang-codereviews, mikioh.mikioh, bradfitz
CC=cshapiro, golang-codereviews, khr, rsc
https://golang.org/cl/45930043
»»»

R=golang-codereviews, r
CC=bradfitz, dvyukov, golang-codereviews
https://golang.org/cl/53870043
2014-01-17 16:58:14 -05:00
Rob Pike
451667a67f syscall: allocate 64 bits of "basep" for Getdirentries
Recent crashes on 386 Darwin appear to be caused by this system call
smashing the stack. Phenomenology shows that allocating more data
here addresses the probem.
The guess is that since the actual system call is getdirentries64, 64 is
what we should allocate.

Should fix the darwin/386 build.

R=rsc
CC=golang-codereviews
https://golang.org/cl/53840043
2014-01-17 13:19:00 -08:00
David Symonds
23e72645dd regexp: remove unnecessary sentence in doc comment.
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/53190046
2014-01-17 09:06:28 -08:00