Commit graph

19883 commits

Author SHA1 Message Date
Adam Langley d0e255f259 crypto/tls: add ALPN support.
Fixes #6736.

LGTM=mikioh.mikioh
R=bradfitz, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/108710046
2014-08-05 11:36:20 -07:00
Dmitriy Vyukov 81674f3135 runtime: remove type.go
We have an autogenerated version in zruntime_defs.
I am not sure what are the consequences as gdb never printed any values for me.
But it looks unnecessary to manually duplicate it.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, iant, khr
https://golang.org/cl/115660043
2014-08-05 22:32:24 +04:00
Robert Griesemer c0fca138d1 spec: comma-ok expressions return untyped boolean 2nd result
Technically a language change, this cleanup is a completely
backward compatible change that brings the boolean results
of comma-ok expressions in line with the boolean results of
comparisons: they are now all untyped booleans.

The implementation effort should be minimal (less than a
handfull lines of code, depending how well factored the
implementation of comma-ok expressions is).

Fixes #8189.

LGTM=iant, r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/112320045
2014-08-05 11:31:32 -07:00
Adam Langley 2ce052fc7a A+C: Percy Wegmann (individual CLA)
Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/121240043
2014-08-05 11:25:47 -07:00
Dmitriy Vyukov 9c0da2edfc runtime/race: add tests for maps with big keys/vals
With the recent GC changes large objects are handled somewhat differently.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/114600043
2014-08-05 18:12:38 +04:00
Dmitriy Vyukov 3950655bb5 runtime: remove outdated comment
LGTM=bradfitz, khr
R=khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/120400043
2014-08-05 17:03:06 +04:00
Ian Lance Taylor ab5d105ba9 runtime: use memmove rather than memcopy in mgc0.c
For consistency with other code, as that was the only use of
memcopy outside of alg.goc.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/122030044
2014-08-04 20:40:44 -07:00
Ian Lance Taylor ae55858e04 syscall: fix typo in comment
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/120570043
2014-08-04 20:30:26 -07:00
Ian Lance Taylor bb843c0b2f runtime: remove unused enum maxround
LGTM=minux, dave
R=golang-codereviews, minux, dave
CC=golang-codereviews
https://golang.org/cl/122030043
2014-08-04 20:29:58 -07:00
Ian Lance Taylor 6c007bb065 runtime: only use a single variable in USED
The gccgo version of USED only accepts a single variable, so
this simplifies merging.

LGTM=minux, dave
R=golang-codereviews, minux, dave
CC=golang-codereviews
https://golang.org/cl/115630043
2014-08-04 20:29:36 -07:00
Ian Lance Taylor aac1eabcee test: add test for function type in function literal
The gccgo compiler used to fail this test.  This was the root
cause of http://gcc.gnu.org/PR61308 .  The fix for the gccgo
compiler is https://golang.org/cl/122020043 .

LGTM=dave, bradfitz
R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/121200043
2014-08-04 19:50:49 -07:00
Brad Fitzpatrick 77df26f0bd archive/zip: accept bogus trailing zeros in extras
Popular tools both add incorrect trailing zeroes to the zip
extras, and popular tools accept trailing zeros. We seemed to
be the only ones being strict here. Stop being strict. :(

Fixes #8186

LGTM=ruiu, adg, dave
R=adg, ruiu, dave
CC=frohrweck, golang-codereviews
https://golang.org/cl/117550044
2014-08-04 16:12:55 -07:00
Mikio Hara 5c055e74d0 net: consolidate sockaddrToAddr functions
This CL removes sockaddrToAddr functions from socket creation
operations to avoid the bug like issue 7183.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/105100046
2014-08-05 06:10:46 +09:00
Rob Pike fdaeec580f encoding/gob: save a call to userType
Avoid some pressure on the global mutex by lifting the call to userType
out of the closure.
TOTH to Matt Harden.

LGTM=crawshaw, ruiu
R=golang-codereviews, crawshaw, ruiu
CC=golang-codereviews
https://golang.org/cl/117520043
2014-08-03 15:14:59 -07:00
Brad Fitzpatrick aa69a3c386 net: fix Dial comment about IPv6 addresses
LGTM=r
R=golang-codereviews, r
CC=adg, golang-codereviews
https://golang.org/cl/118550043
2014-08-01 21:35:03 -07:00
Peter Collingbourne fe513d8b3e cmd/go: use correct link flags if main package contains C++/ObjC files
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/117470043
2014-08-01 16:45:33 -07:00
Keith Randall 668a55a882 runtime: move constants from map header to map type
A good cleanup anyway, and it makes some room for an additional
field needed for issue 8412.

Update #8412

LGTM=iant
R=iant, khr
CC=golang-codereviews
https://golang.org/cl/112700043
2014-08-01 14:38:56 -07:00
David du Colombier 6d20e72587 test/run: go fmt
LGTM=josharian, r
R=golang-codereviews, josharian, r
CC=golang-codereviews
https://golang.org/cl/120160043
2014-08-01 22:34:36 +02:00
Josh Bleecher Snyder bc9e160443 runtime: prevent pointless jmp in amd64 and 386 memmove
6a and 8a rearrange memmove such that the fallthrough from move_1or2 to move_0 ends up being a JMP to a RET. Insert an explicit RET to prevent such silliness.

Do the same for memclr as prophylaxis.

benchmark                old ns/op     new ns/op     delta
BenchmarkMemmove1        4.59          4.13          -10.02%
BenchmarkMemmove2        4.58          4.13          -9.83%

LGTM=khr
R=golang-codereviews, dvyukov, minux, ruiu, bradfitz, khr
CC=golang-codereviews
https://golang.org/cl/120930043
2014-08-01 06:21:08 -07:00
Alex Brainman 74b62b4864 runtime: implement monotonic clocks on windows
Update #6007.

LGTM=minux, dvyukov
R=golang-codereviews, dvyukov, patrick, aram.h, minux
CC=golang-codereviews
https://golang.org/cl/108700045
2014-08-01 11:18:11 +10:00
Keith Randall 8ee2a6658b runtime: missed a file in alg checkin
TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/122740044
2014-07-31 15:12:53 -07:00
Keith Randall a2a9768414 runtime: convert hash functions to Go calling convention.
Create proper closures so hash functions can be called
directly from Go.  Rearrange calling convention so return
value is directly accessible.

LGTM=dvyukov
R=golang-codereviews, dvyukov, dave, khr
CC=golang-codereviews
https://golang.org/cl/119360043
2014-07-31 15:07:05 -07:00
Rui Ueyama 5a3336096f strconv: remove needless cast
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119340043
2014-07-31 13:54:42 -07:00
Keith Randall 721c8735df runtime: move built-in print routines to go.
Fixes #8297

LGTM=bradfitz
R=golang-codereviews, bradfitz, khr, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/119240043
2014-07-31 13:48:48 -07:00
Keith Randall 53304558f9 runtime: fix 32 bit build.
int(maxMem) is negative on 32 bits.  Need to use
unsigned arithmetic.

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/121000045
2014-07-31 13:07:16 -07:00
Keith Randall cc9ec52d73 runtime: convert slice operations to Go.
LGTM=bradfitz, dvyukov
R=golang-codereviews, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/120190044
2014-07-31 12:43:40 -07:00
Josh Bleecher Snyder 2c982ce9a0 cmd/gc: fix example flag in comment
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/118480044
2014-07-31 10:34:51 -07:00
Keith Randall 1e0b378905 runtime: use right mask to extract type kind
Cleanup from recent malloc changes.

LGTM=dvyukov
R=dvyukov
CC=golang-codereviews
https://golang.org/cl/120960043
2014-07-31 09:32:09 -07:00
Dmitriy Vyukov cecca43804 runtime: get rid of free
Several reasons:
1. Significantly simplifies runtime.
2. This code proved to be buggy.
3. Free is incompatible with bump-the-pointer allocation.
4. We want to write runtime in Go, Go does not have free.
5. Too much code to free env strings on startup.

LGTM=khr
R=golang-codereviews, josharian, tracey.brendan, khr
CC=bradfitz, golang-codereviews, r, rlh, rsc
https://golang.org/cl/116390043
2014-07-31 12:55:40 +04:00
Nigel Tao 17992f7a06 image/jpeg: rename some internal variables.
LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/120980043
2014-07-31 17:34:48 +10:00
Keith Randall 5a008acec1 runtime: cast to uintptr to match %p formatter.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/121920043
2014-07-30 20:24:03 -07:00
Matthew Dempsky 58241bfdf7 runtime: fix cmallocgc's C prototype
LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/121910043
2014-07-30 17:08:33 -07:00
Keith Randall 1329d044cf runtime: fix stack memory test
Stand-alone this test is fine.  Run together with
others, however, the stack used can actually go
negative because other tests are freeing stack
during its execution.

This behavior is new with the new stack allocator.
The old allocator never returned (min-sized) stacks.

This test is fairly poor - it needs to run in
isolation to be accurate.  Maybe we should delete it.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/119330044
2014-07-30 11:02:40 -07:00
Rob Pike aff7883d9a runtime: fix assembler macro definitions to be consistent in use of center-dot
The DISPATCH and CALLFN macro definitions depend on an inconsistency
between the internal cpp mini-implementation and the language proper in
whether center-dot is an identifier character. The macro depends on it not
being an identifier character, but the resulting code depends on it being one.

Remove the dependence on the inconsistency by placing the center-dot into
the macro invocation rather that the body.

No semantic change. This is just renaming macro arguments.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119320043
2014-07-30 10:11:44 -07:00
Keith Randall d703ac338e runtime: fix freebsd build. Assignment is int32* on 32 bit
machines and int64* on 64 bit machines.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/117330044
2014-07-30 09:18:00 -07:00
Keith Randall 4aa50434e1 runtime: rewrite malloc in Go.
This change introduces gomallocgc, a Go clone of mallocgc.
Only a few uses have been moved over, so there are still
lots of uses from C. Many of these C uses will be moved
over to Go (e.g. in slice.goc), but probably not all.
What should remain of C's mallocgc is an open question.

LGTM=rsc, dvyukov
R=rsc, khr, dave, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/108840046
2014-07-30 09:01:52 -07:00
Rui Ueyama fe4fc94b04 mime/multipart: delay reading random source
If a user sets his/her own boundary string with SetBoundary,
we don't need to call randomBoundary at all.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/95760043
2014-07-29 18:24:50 -07:00
Mikio Hara 678ba85e53 undo CL 107280044 / ee11f19bc514
preparing for the syscall package freeze.

««« original CL description
syscall: consolidate, simplify socket options for Unix-like systems

Also exposes common socket option functions on Solaris.

Update #7174
Update #7175

LGTM=aram
R=golang-codereviews, aram
CC=golang-codereviews
https://golang.org/cl/107280044
»»»

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/121880043
2014-07-30 10:02:16 +09:00
Mikio Hara 3bf75e691f undo CL 104290043 / 1d13818e6b3d
preparing for the syscall package freeze.

««« original CL description
syscall: add source-specific multicast socket options for FreeBSD

Update #8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/104290043
»»»

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/113660043
2014-07-30 10:01:32 +09:00
Rui Ueyama a219ff25c6 bufio: fix rot13Reader bug in test
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/118410043
2014-07-29 17:56:28 -07:00
Mikio Hara ed963c908d undo CL 102610045 / 7244ce3ae9db
preparing for the syscall package freeze.

««« original CL description
syscall: regenerate z-files for darwin

Updates z-files from 10.7 kernel-based to 10.9 kernel-based.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/102610045
»»»

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/114530044
2014-07-30 09:47:39 +09:00
Mikio Hara d7566da188 undo CL 101460043 / 746e175af5d2
preparing for the syscall package freeze.

««« original CL description
syscall: add source-specific multicast socket options for Darwin

Update #8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/101460043
»»»

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/115350043
2014-07-30 09:25:37 +09:00
Rob Pike 2edc04ccb1 A+C: fixed doubled entry
Delete an erroneously doubled name in both files. Once is enough.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/118420043
2014-07-29 17:18:00 -07:00
Mihai Borobocea bfdeb57cc3 fmt: measure width in runes not bytes with %c and %q for ints
This is meant to share my progress on Issue 8275, if it's useful to you. I'm not familiar with the formatter's internals, so this change is likely naive.

Change these calls to measure width in runes not bytes:
fmt.Printf("(%5q)\n", '§')
fmt.Printf("(%3c)\n", '§')

 Fixes #8275.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/104320043
2014-07-29 16:46:53 -07:00
Keith Randall d2204e6c0e cmd/gc: don't allow escaping arguments in the runtime package.
This is a case that was missed in https://golang.org/cl/105280047/

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/120910043
2014-07-29 14:38:08 -07:00
Rob Pike fbfd32b80c A+C: Mihai Borobocea (individual CLA)
Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/115370044
2014-07-29 13:34:47 -07:00
Dmitriy Vyukov dfa5a99ebb runtime: generate type info for chans
LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr
https://golang.org/cl/115280043
2014-07-29 22:06:47 +04:00
Dmitriy Vyukov fe3ee5741d runtime: verify hmap type size
LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr
https://golang.org/cl/114510044
2014-07-29 22:06:20 +04:00
Dmitriy Vyukov d514e2915c runtime: mark global var as NOPTR
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/120280044
2014-07-29 15:18:01 +04:00
Dmitriy Vyukov 5dab2da954 runtime: mark global var as NOPTR
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/119300043
2014-07-29 14:45:07 +04:00