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

1109 Commits

Author SHA1 Message Date
Russ Cox
1903ad7189 cmd/gc, reflect, runtime: switch to indirect func value representation
Step 1 of http://golang.org/s/go11func.

R=golang-dev, r, daniel.morsing, remyoudompheng
CC=golang-dev
https://golang.org/cl/7393045
2013-02-21 17:01:13 -05:00
Carl Shapiro
f466617a62 cmd/5g, cmd/5l, cmd/6l, cmd/8l, cmd/gc, cmd/ld, runtime: accurate args and locals information
Previously, the func structure contained an inaccurate value for
the args member and a 0 value for the locals member.

This change populates the func structure with args and locals
values computed by the compiler.  The number of args was
already available in the ATEXT instruction.  The number of
locals is now passed through in the new ALOCALS instruction.

This change also switches the unit of args and locals to be
bytes, just like the frame member, instead of 32-bit words.

R=golang-dev, bradfitz, cshapiro, dave, rsc
CC=golang-dev
https://golang.org/cl/7399045
2013-02-21 12:52:26 -08:00
Russ Cox
5833c96b0a runtime: better error from TestGcSys when gc is disabled
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7390047
2013-02-21 13:30:31 -05:00
Dmitriy Vyukov
94fab3cad3 runtime: fix heap corruption
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7397049
2013-02-21 21:59:46 +04:00
Dmitriy Vyukov
a0955a2aa2 runtime: split minit() to mpreinit() and minit()
mpreinit() is called on the parent thread and with mcache (can allocate memory),
minit() is called on the child thread and can not allocate memory.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7389043
2013-02-21 16:24:38 +04:00
Russ Cox
6c976393ae runtime: allow cgo callbacks on non-Go threads
Fixes #4435.

R=golang-dev, iant, alex.brainman, minux.ma, dvyukov
CC=golang-dev
https://golang.org/cl/7304104
2013-02-20 17:48:23 -05:00
Dmitriy Vyukov
1e063eea38 runtime: prepare for M's running w/o mcache
Can not happen ATM. In preparation for the new scheduler.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7388043
2013-02-20 21:17:56 +04:00
Dmitriy Vyukov
e25f19a638 runtime: introduce entersyscallblock()
In preparation for the new scheduler.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7386044
2013-02-20 20:21:45 +04:00
Dmitriy Vyukov
e5b0bcebdb runtime/debug: deflake TestFreeOSMemory
This is followup to https://golang.org/cl/7319050/

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7379043
2013-02-20 12:34:16 +04:00
Dmitriy Vyukov
06a488fa97 runtime: fix deadlock detector false negative
Fixes #4819.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7322086
2013-02-20 12:15:02 +04:00
Dmitriy Vyukov
a92e11a256 runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again
and again.
This is https://golang.org/cl/7310096 but with return instead of break
in the nested switch.
Fixes #4820.

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7304102
2013-02-20 12:13:04 +04:00
Carl Shapiro
7f9c02a10d runtime: add conversion specifier to printf for char values
R=r, golang-dev
CC=golang-dev
https://golang.org/cl/7327053
2013-02-19 18:05:44 -08:00
Russ Cox
cb32ea9c19 runtime: replace bubble sort with heap sort in select
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/7304106
2013-02-19 10:15:13 -05:00
Robin Eklind
d137a2cb56 src: use internal tests if possible
If a test can be placed in the same package ("internal"), it is placed
there. This facilitates testing of package-private details. Because of
dependency cycles some packages cannot be tested by internal tests.

R=golang-dev, rsc, mikioh.mikioh
CC=golang-dev, r
https://golang.org/cl/7323044
2013-02-19 10:02:01 -05:00
Russ Cox
86d509b463 runtime: preparation for non-Go threads running Go code
* Handle p==nil in signalstack by setting SS_DISABLE flag.
* Make minit only allocate a signal g if there's not one already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7323072
2013-02-18 13:43:12 -05:00
Dmitriy Vyukov
d62239b5f6 runtime/debug: make TestFreeOSMemory repeatable
Fixes #4835.

R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7319050
2013-02-18 15:46:36 +04:00
Joel Sing
556dd0bfbd runtime: fix sigaction struct on freebsd
Fix the sa_mask member of the sigaction struct - on FreeBSD this is
declared as a sigset_t, which is an array of four unsigned ints.
Replace the current int64 with Sigset from defs_freebsd_GOARCH, which
has the correct definition.

Unbreaks the FreeBSD builds.

R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7333047
2013-02-18 03:23:29 +11:00
Georg Reinke
f1037f0e86 runtime: fix build on openbsd
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/7312104
2013-02-17 02:06:59 +11:00
Dave Cheney
21327e1970 runtime: fix unused variable warning
R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/7312103
2013-02-16 14:32:04 +11:00
Russ Cox
60526ca6d1 undo CL 7310096 / 59da6744d66d
broke windows build

««« original CL description
runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again and again.
Fixes #4820.

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

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/7343050
2013-02-15 17:54:46 -05:00
Russ Cox
0c3b17a55a runtime: allow mem profiles with GOGC=off
Fixes #3586.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7304098
2013-02-15 14:48:58 -05:00
Russ Cox
6c1539bb01 runtime: show frame pointer values during throw
Should help if stack overflows start happening again.

Fixes #3582.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7311098
2013-02-15 14:48:47 -05:00
Russ Cox
c8214c78bd runtime: make return from main wait for active panic
Arguably if this happens the program is buggy anyway,
but letting the panic continue looks better than interrupting it.
Otherwise things like this are possible, and confusing:

$ go run x.go
panic: $ echo $?
0
$

Fixes #3934.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7322083
2013-02-15 14:48:35 -05:00
Russ Cox
318309a51f runtime/pprof: adjust reported line numbers to show call sites
This is the same logic used in the standard tracebacks.
The caller pc is the pc after the call, so except in the
fake "call" caused by a panic, back up the pc enough
that the lookup will use the previous instruction.

Fixes #4150.
Fixes #4151.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7317047
2013-02-15 14:27:16 -05:00
Russ Cox
8a6ff3ab34 runtime: allocate heap metadata at run time
Before, the mheap structure was in the bss,
but it's quite large (today, 256 MB, much of
which is never actually paged in), and it makes
Go binaries run afoul of exec-time bss size
limits on some BSD systems.

Fixes #4447.

R=golang-dev, dave, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7307122
2013-02-15 14:27:03 -05:00
Dmitriy Vyukov
f87b7f67b2 runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again and again.
Fixes #4820.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7310096
2013-02-15 22:22:13 +04:00
Russ Cox
d3d89ae7d2 runtime: check rt_sigaction return values on linux
(If the mask size is wrong the system call fails.)

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7305097
2013-02-15 13:13:19 -05:00
Russ Cox
c7f7bbbf03 runtime: fix build on linux
In addition to the compile failure fixed in signal*.c,
preserving the signal mask led to very strange crashes.
Testing shows that looking for SIG_IGN is all that
matters to get along with nohup, so reintroduce
sigset_zero instead of trying to preserve the signal mask.

TBR=iant
CC=golang-dev
https://golang.org/cl/7323067
2013-02-15 12:18:33 -05:00
Russ Cox
f3407f445d runtime: fix running under nohup
There are two ways nohup(1) might be implemented:
it might mask away the signal, or it might set the handler
to SIG_IGN, both of which are inherited across fork+exec.
So two fixes:

* Make sure to preserve the inherited signal mask at
minit instead of clearing it.

* If the SIGHUP handler is SIG_IGN, leave it that way.

Fixes #4491.

R=golang-dev, mikioh.mikioh, iant
CC=golang-dev
https://golang.org/cl/7308102
2013-02-15 11:18:55 -05:00
Dmitriy Vyukov
a9824f178d runtime: fix debug output
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7312101
2013-02-15 17:04:02 +04:00
Alan Donovan
e49f945603 runtime: expand error for signal received on non-Go thread.
We call runtime.findnull dynamically to avoid exceeding the
static nosplit stack limit check.  (Thanks minux!)

Fixes #4048.

R=rsc, minux.ma, ality
CC=golang-dev
https://golang.org/cl/7232066
2013-02-14 23:37:14 -05:00
Dmitriy Vyukov
6a828482fa runtime: add more tests for LockOSThread()
Just test some additional paths through the scheduler.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7331044
2013-02-15 00:02:12 +04:00
Dmitriy Vyukov
691455f780 runtime: move stack management related code to stack.c
No code changes.
This is mainly in preparation to scheduler changes,
oldstack/newstack are not related to scheduling.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7311085
2013-02-14 12:37:55 +04:00
Russ Cox
e5dae3baaa runtime: tweak addfinroots to preserve original pointer
Use local variable so that stack trace will show value of v.

Fixes #4790.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7300106
2013-02-13 22:31:45 -05:00
Dmitriy Vyukov
4a524311f4 runtime: instrument slicebytetostring for race detection
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7322068
2013-02-13 18:29:59 +04:00
Shenghou Ma
2fdd60b9b6 go/build, runtime/cgo: cgo support for NetBSD/ARM
R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/7229082
2013-02-13 01:06:52 +08:00
Shenghou Ma
37aba1aa77 runtime: NetBSD/ARM support
R=rsc, dave
CC=golang-dev
https://golang.org/cl/7289044
2013-02-13 01:00:04 +08:00
Jan Ziak
1e01fba2fc runtime: precise garbage collection of hashmaps
R=golang-dev, rsc
CC=dave, dvyukov, golang-dev, minux.ma, remyoudompheng
https://golang.org/cl/7252047
2013-02-08 16:00:33 -05:00
Dmitriy Vyukov
0a9f1ab8bb runtime/race: deflake tests
With the new scheduler races in the tests are reported during execution of other tests.
The change joins goroutines started during the tests.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7310066
2013-02-08 19:24:50 +04:00
Dmitriy Vyukov
45636db01b runtime: fix integer overflow
The problem happens when end=0, then end-1 is very big number.
Observed with the new scheduler.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7307073
2013-02-08 19:05:19 +04:00
Shenghou Ma
6c54bf9916 runtime: fix build for Linux/ARM
R=dave, rsc
CC=golang-dev
https://golang.org/cl/7299055
2013-02-08 13:24:38 +08:00
Dmitriy Vyukov
0a40cd2661 runtime/race: switch to explicit race context instead of goroutine id's
Removes limit on maximum number of goroutines ever existed.
code.google.com/p/goexecutor tests now pass successfully.
Also slightly improves performance.
Before: $ time ./flate.test -test.short
real	0m9.314s
After:  $ time ./flate.test -test.short
real	0m8.958s
Fixes #4286.
The runtime is built from llvm rev 174312.

R=rsc
CC=golang-dev
https://golang.org/cl/7218044
2013-02-06 11:40:54 +04:00
Shenghou Ma
7de3d71797 runtime: save LR to stack when panicking to handle leaf function traceback
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7289047
2013-02-06 01:18:37 +08:00
Dmitriy Vyukov
6b1b613d6a runtime/race: do not include pthread.h
Fixes #4721.

R=alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7275048
2013-02-05 13:08:07 +04:00
Russ Cox
472354f81e runtime/debug: add controls for garbage collector
Fixes #4090.

R=golang-dev, iant, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/7229070
2013-02-04 00:00:55 -05:00
Russ Cox
f02067a99a cmd/gc: implement latest rules for checking make sizes
Fixes #4085.

R=ken2
CC=golang-dev
https://golang.org/cl/7277047
2013-02-03 14:28:44 -05:00
Russ Cox
2eafbb8878 cmd/gc: elide self-assignment during return
More efficient, less racy code.

Fixes #4014.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/7275047
2013-02-03 01:18:28 -05:00
Ian Lance Taylor
e5ea2d5335 runtime: fix windows build
Fixes #4743.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7284044
2013-02-02 11:41:04 -08:00
Elias Naur
44cf814d50 runtime, cmd/ld: make code more position-independent
Change the stack unwinding code to compensate for the dynamic
relocation of symbols.
Change the gc instruction GC_CALL to use a relative offset instead of
an absolute address.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7248048
2013-02-01 11:24:49 -08:00
Russ Cox
b0a29f393b runtime: cgo-related fixes
* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.

Fixes #3774.
Fixes #3775.
Fixes #3797.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7228081
2013-02-01 08:34:41 -08:00