Commit graph

16466 commits

Author SHA1 Message Date
Rémy Oudompheng 2c1acc18f4 test: correct sizeof.go.
It would not pass on amd64 due to alignment of pointers.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9949043
2013-06-02 19:10:11 +02:00
Shenghou Ma 5b097e7951 cmd/cgo: using __typeof__(a->r) instead of putting invalid TYPE in "a->r = (const TYPE)"
Thanks kballard for the hint.
Fixes #4857.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9649045
2013-06-02 22:46:53 +08:00
Rémy Oudompheng 5a810f7c0a cmd/fix: remove obsolete testdata.
The corresponding rules have been removed for Go 1.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9940044
2013-06-02 15:40:32 +02:00
Rémy Oudompheng 57d89fb659 cmd/fix: check type assertion in netipv6zone rule.
Fixes #5461.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9947043
2013-06-02 15:39:47 +02:00
Rémy Oudompheng f8067ad67a hgignore: cleanup obsolete entries.
R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/9935043
2013-06-02 11:36:09 +02:00
Dave Cheney a28609d66f testing: fix rounding error in roundDown10
Fixes #5599.

Thanks to minux.ma for the suggested fix.

As we now have a harness to test testing internal functions I added some coverage for testing.roundUp, as it is the main consumer of roundDown10.

R=minux.ma, kr, r
CC=golang-dev
https://golang.org/cl/9926043
2013-06-02 09:13:12 +10:00
Dmitriy Vyukov 83d4cd758c runtime: minor code style improvements (followup to change 9778049)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9693044
2013-06-02 01:45:26 +04:00
Anthony Martin b40d98562f build: remove special definition of Runemax on Plan 9
The Bell Labs distribution now supports 21-bit runes.

R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/9249045
2013-06-01 12:03:21 -07:00
Daniel Morsing bf9a00bc8f cmd/gc: fix overflow in array bounds calculation.
Fixes #5609.

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/9757045
2013-06-01 16:33:54 +02:00
Oling Cat 5b7d422a05 doc/go1.1.html: remove extra space; close some tags.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9941043
2013-06-01 10:28:04 -04:00
Keith Randall 7f0ee023ba runtime: revert of CL 8852047: do hashmap grow work during reads.
seems to break freebsd-386.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9915047
2013-05-31 21:44:32 -07:00
Keith Randall 07b6add0ca runtime: do hashmap grow work during reads.
Before this change, grow work was done only
during map writes to ensure multithreaded safety.
This can lead to maps remaining in a partially
grown state for a long time, potentially forever.
This change allows grow work to happen during reads,
which will lead to grow work finishing sooner, making
the resulting map smaller and faster.

Grow work is not done in parallel.  Reads can
happen in parallel while grow work is happening.

R=golang-dev, dvyukov, khr, iant
CC=golang-dev
https://golang.org/cl/8852047
2013-05-31 20:58:31 -07:00
Keith Randall 71f061043d runtime/gc: Run garbage collector on g0 stack
instead of regular g stack. We do this so that the g stack
we're currently running on is no longer changing.  Cuts
the root set down a bit (g0 stacks are not scanned, and
we don't need to scan gc's internal state).  Also an
enabler for copyable stacks.

R=golang-dev, cshapiro, khr, 0xe2.0x9a.0x9b, dvyukov, rsc, iant
CC=golang-dev
https://golang.org/cl/9754044
2013-05-31 20:43:33 -07:00
Anthony Martin af7f7b7515 lib9/utf: remove unneccesary includes
R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/8651043
2013-05-31 15:53:26 -07:00
Carl Shapiro 31be5deae4 cmd/5g, cmd/6g, cmd/8g: provide embedded trampolines with argument size information
An embedded trampoline is a function that exists to marshal
a receiver of type *S to a receiver of type *T when T is an
embedded field in S.

Embedded trampolines are generated by a special path through
the compiler and are not subject to the general analysis and
annotation done to functions.  Their effects must be provided
explicitly.

R=golang-dev, r, daniel.morsing, minux.ma
CC=golang-dev
https://golang.org/cl/9874043
2013-05-31 13:34:57 -07:00
Anthony Martin 252161cadc misc/dashboard/builder: add environment variables for Plan 9
We require $objtype in make.rc and rc needs $path for finding commands.

Also include $cputype which we may use in the future.

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/9905043
2013-05-31 12:18:43 -07:00
Alberto García Hierro 84485361f9 cmd/go: Add support for including C++ files in packages
* Add a CXXFiles field to Package, which includes .cc, .cpp and .cxx  files.
* CXXFiles are compiled using g++, which can be overridden using the CXX environment variable.
* Include .hh, .hpp and .hxx files in HFiles.
* Add support for CPPFLAGS (used for both C and C++) and CXXFLAGS (used only for C++) in cgo directive.
* Changed pkg-config cgo directive to modify CPPFLAGS rather than CFLAGS, so both C and C++ files get any flag returned by pkg-config --cflags.

Fixes #1476.

R=iant, r
CC=bradfitz, gobot, golang-dev, iant, minux.ma, remyoudompheng, seb.binet
https://golang.org/cl/8248043
2013-05-31 11:33:36 -07:00
Robert Griesemer ab5c762a46 spec: better wording re: receiving from closed channels
As suggested by ej@evanjones.ca.

Fixes #5604.

R=r
CC=golang-dev
https://golang.org/cl/9899043
2013-05-31 11:21:37 -07:00
Dave Cheney 787976c739 testing: add test for issue 5599
Update #5599

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/9738052
2013-05-31 23:03:22 +10:00
Dmitriy Vyukov 9ba551bb87 runtime: fix heap coalescing bug introduced in cl/9802043
mheap.map become a pointer, so nelem(h->map) returns 1 rather than the map size.
As the result coalescing with subsequent spans does not happen.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9649046
2013-05-31 10:58:50 +04:00
Dmitriy Vyukov 86da989ee5 runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.
Reincarnation of committed and rolled back https://golang.org/cl/9805043
The latent bugs that it revealed are fixed:
https://golang.org/cl/9837049
https://golang.org/cl/9778048

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9778049
2013-05-31 10:42:30 +04:00
Keith Randall d6f89d735e runtime: set MSpan.limit properly for large spans.
Then use the limit to make sure MHeap_LookupMaybe & inlined
copies don't return a span if the pointer is beyond the limit.
Use this fact to optimize all call sites.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/9869045
2013-05-30 21:32:20 -07:00
Rob Pike 85fc2f70ac doc/go1.2.txt: AllocsPerRun now quantized
R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/9728045
2013-05-30 12:41:20 -04:00
Rob Pike cf5dd6ad64 testing: quantize AllocsPerRun
As the code now says:

We are forced to return a float64 because the API is silly, but do
the division as integers so we can ask if AllocsPerRun()==1
instead of AllocsPerRun()<2.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9837049
2013-05-30 11:28:08 -04:00
Dmitriy Vyukov e17281b397 runtime: rename mheap.maps to mheap.spans
as was dicussed in cl/9791044

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9853046
2013-05-30 17:09:58 +04:00
Dmitriy Vyukov 573d25a423 runtime: mark runtime.goexit as nosplit
Required for preemptive scheduler, see the comment.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/9841047
2013-05-30 14:11:49 +04:00
Rémy Oudompheng 2c4b029b75 cmd/gc: use escape analysis result for make([]T, constant
Escape analysis already gives that the underlying array
does not escape but the result was ignored.

Fixes #5484.

R=golang-dev, dave, daniel.morsing
CC=golang-dev
https://golang.org/cl/9662046
2013-05-30 08:32:00 +02:00
Lucio De Re 0b88587d22 cmd/[568]l/obj.c: NULL is not recognised in Plan 9 build, use nil instead.
Fixes #5591.

R=golang-dev, dave, minux.ma, cshapiro
CC=carl shapiro <cshapiro, golang-dev
https://golang.org/cl/9839046
2013-05-30 15:02:10 +10:00
Alex Brainman 77d4347bf2 misc/dist: remove lingering ~ file
Fixes #5405.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/9856043
2013-05-30 12:11:17 +10:00
Carl Shapiro 037a1a9f31 cmd/ld, runtime: emit pointer maps for nosplits identified by the linker
A nosplits was assumed to have no argument information and no
pointer map.  However, nosplits created by the linker often
have both.  This change uses the pointer map size as an
alternate source of argument size when processing a nosplit.

In addition, the symbol table construction pointer map size
and argument size consistency check is strengthened.  If a
nptrs is greater than 0 it must be equal to the number of
argument words.

R=golang-dev, khr, khr
CC=golang-dev
https://golang.org/cl/9666047
2013-05-29 17:16:57 -07:00
Shenghou Ma 5d081792b6 cmd/5a, cmd/dist, runtime: support m/g in the assembler, drop support for R9/R10
to avoid unintentionally clobber R9/R10.
Thanks Lucio for the suggestion.

PS: yes, this could be considered a big change (but not an API change), but
as it turns out even temporarily changes R9/R10 in user code is unsafe and
leads to very hard to diagnose problems later, better to disable using R9/R10
when the user first uses it.
See CL 6300043 and CL 6305100 for two problems caused by misusing R9/R10.

R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/9840043
2013-05-30 03:03:52 +08:00
Shenghou Ma a307c5c9b7 misc/cgo/test: check API compatibility for cgo pseudo-functions
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9826043
2013-05-30 02:59:57 +08:00
Carl Shapiro 322c08f2f7 cmd/gc: remove unused bit vector comparison code
R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9738045
2013-05-29 11:46:14 -07:00
Jan Ziak a3e0002e6a runtime: remove all badcallback() functions
R=iant
CC=golang-dev
https://golang.org/cl/9738046
2013-05-29 17:51:17 +02:00
Rob Pike d84132cce7 fmt: change evalutation of indexed arg to match docs
The old code put the index before the period in the precision;
it should be after so it's always before the star, as documented.
A little trickier to do in one pass but compensated for by more
tests and catching a couple of other error cases.

R=rsc
CC=golang-dev
https://golang.org/cl/9751044
2013-05-29 11:29:29 -04:00
John Shahid ca986a2c81 crypto/tls: Check all certificates in the path.
Currently we only check the leaf node's issuer against the list of
distinguished names in the server's CertificateRequest message. This
will fail if the client certiciate has more than one certificate in
the path and the leaf node issuer isn't in the list of distinguished
names, but the issuer's issuer was in the distinguished names.

R=agl, agl
CC=gobot, golang-dev
https://golang.org/cl/9795043
2013-05-29 11:21:32 -04:00
Adam Langley 9fae8658ba A+C: John Shahid (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/9798049
2013-05-29 11:18:05 -04:00
Dmitriy Vyukov e932c2035f runtime: make notetsleep() return false if timeout happens
This is needed for preemptive scheduler, because during
stoptheworld we want to wait with timeout and re-preempt
M's on timeout.

R=golang-dev, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/9375043
2013-05-29 11:49:45 +04:00
Katrina Owen 605da0e2a2 doc: Fix typo in approximation of square root
See https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number

R=golang-dev, minux.ma, adg
CC=golang-dev
https://golang.org/cl/9145044
2013-05-29 13:49:51 +10:00
Andrew Gerrand 28c64e3006 A+C: add Katrina Owen (individual CLA)
R=golang-dev
CC=golang-dev
https://golang.org/cl/9853043
2013-05-29 13:49:31 +10:00
Carl Shapiro 4e0a51c210 cmd/5l, cmd/6l, cmd/8l, cmd/gc, runtime: generate and use bitmaps of argument pointer locations
With this change the compiler emits a bitmap for each function
covering its stack frame arguments area.  If an argument word
is known to contain a pointer, a bit is set.  The garbage
collector reads this information when scanning the stack by
frames and uses it to ignores locations known to not contain a
pointer.

R=golang-dev, bradfitz, daniel.morsing, dvyukov, khr, khr, iant, cshapiro
CC=golang-dev
https://golang.org/cl/9223046
2013-05-28 17:59:10 -07:00
Dmitriy Vyukov 8bbb08533d runtime: make mheap statically allocated again
This depends on: 9791044: runtime: allocate page table lazily
Once page table is moved out of heap, the heap becomes small.
This removes unnecessary dereferences during heap access.
No logical changes.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9802043
2013-05-28 22:14:47 +04:00
Dmitriy Vyukov 671814b904 runtime: allocate page table lazily
This removes the 256MB memory allocation at startup,
which conflicts with ulimit.
Also will allow to eliminate an unnecessary memory dereference in GC,
because the page table is usually mapped at known address.
Update #5049.
Update #5236.

R=golang-dev, khr, r, khr, rsc
CC=golang-dev
https://golang.org/cl/9791044
2013-05-28 22:04:34 +04:00
Dmitriy Vyukov 081129e286 runtime: allocate internal symbol table eagerly
we need it for GC anyway.

R=golang-dev, khr, dave, khr
CC=golang-dev
https://golang.org/cl/9728044
2013-05-28 21:10:10 +04:00
Dmitriy Vyukov 4d6bfcf245 os/exec: fix test hang
Currently the test closes random files descriptors,
which leads to hang (in particular if netpoll fd is closed).
Try to open only fd 3, since the parent process expects it to be fd 3 anyway.
Fixes #5571.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9778048
2013-05-28 21:09:27 +04:00
Dmitriy Vyukov 2f5825d427 runtime: fix heap corruption during GC
The 'n' variable is used during rescan initiation in GC_END case,
but it's overwritten with chan capacity in GC_CHAN case.
As the result rescan is done with the wrong object size.
Fixes #5554.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9831043
2013-05-28 19:17:47 +04:00
Shenghou Ma d8fd8d89ea runtime: use m and g, instead of R9 and R10, in ARM assembly files
also don't clobber R9 if it is about to crash.

In response to https://golang.org/cl/9251043/#msg2.

R=golang-dev, khr, khr, dave
CC=golang-dev
https://golang.org/cl/9778046
2013-05-28 20:13:02 +08:00
Dmitriy Vyukov 828c68f8d8 undo CL 9805043 / 776aba85ece8
multiple failures on amd64

««« original CL description
runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.

R=golang-dev, daniel.morsing, khr
CC=golang-dev
https://golang.org/cl/9805043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/9822043
2013-05-28 11:14:39 +04:00
Dmitriy Vyukov 5166013f75 runtime: inline MCache_Alloc() into mallocgc()
benchmark                    old ns/op    new ns/op    delta
BenchmarkMalloc8                    68           62   -8.63%
BenchmarkMalloc16                   75           69   -7.94%
BenchmarkMallocTypeInfo8           102           98   -3.73%
BenchmarkMallocTypeInfo16          108          103   -4.63%

R=golang-dev, dave, khr
CC=golang-dev
https://golang.org/cl/9790043
2013-05-28 11:05:55 +04:00
Dmitriy Vyukov 47e0a3d7b1 runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.

R=golang-dev, daniel.morsing, khr
CC=golang-dev
https://golang.org/cl/9805043
2013-05-28 10:47:35 +04:00