Commit graph

2046 commits

Author SHA1 Message Date
Russ Cox 50e0749f87 [dev.cc] all: merge default (e4ab8f908aac) into dev.cc
TBR=austin
CC=golang-codereviews
https://golang.org/cl/179040044
2014-11-20 11:48:08 -05:00
Russ Cox b3932baba4 runtime: fix sudog leak
The SudoG used to sit on the stack, so it was cheap to allocated
and didn't need to be cleaned up when finished.

For the conversion to Go, we had to move sudog off the stack
for a few reasons, so we added a cache of recently used sudogs
to keep allocation cheap. But we didn't add any of the necessary
cleanup before adding a SudoG to the new cache, and so the cached
SudoGs had stale pointers inside them that have caused all sorts
of awful, hard to debug problems.

CL 155760043 made sure SudoG.elem is cleaned up.
CL 150520043 made sure SudoG.selectdone is cleaned up.

This CL makes sure SudoG.next, SudoG.prev, and SudoG.waitlink
are cleaned up. I should have done this when I did the other two
fields; instead I wasted a week tracking down a leak they caused.

A dangling SudoG.waitlink can point into a sudogcache list that
has been "forgotten" in order to let the GC collect it, but that
dangling .waitlink keeps the list from being collected.
And then the list holding the SudoG with the dangling waitlink
can find itself in the same situation, and so on. We end up
with lists of lists of unusable SudoGs that are still linked into
the object graph and never collected (given the right mix of
non-trivial selects and non-channel synchronization).

More details in golang.org/issue/9110.

Fixes #9110.

LGTM=r
R=r
CC=dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/177870043
2014-11-16 16:44:45 -05:00
Russ Cox 3e804631d9 [dev.cc] all: merge dev.power64 (7667e41f3ced) into dev.cc
This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes.

These are the files that had merge conflicts and have been edited by hand:
        malloc.go
        mem_linux.go
        mgc.go
        os1_linux.go
        proc1.go
        panic1.go
        runtime1.go

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/174180043
2014-11-14 12:10:52 -05:00
Russ Cox c99616fc67 test: fix nacl build
Disable linkx_run.go and sinit_run.go, because they
exec subprocesses, which NaCl cannot.

TBR=r
CC=golang-codereviews
https://golang.org/cl/171350043
2014-11-09 21:10:49 -05:00
Josh Bleecher Snyder 9b5444420c test: move linkx and sinit to run.go
The remaining run-only tests will be migrated to run.go in another CL.

This CL will break the build due to issues 8746 and 8806.

Update #4139
Update #8746
Update #8806

LGTM=rsc
R=rsc, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/144630044
2014-11-06 15:14:08 -05:00
Ian Lance Taylor c6e53fea10 test: comment out failing cases from sinit.go
One failing case this removes is:

var bytes = []byte("hello, world")
var copy_bytes = bytes

We could handle this in the compiler, but it requires special
case for a variable that is initialized to the value of a
variable that is initialized to a string literal converted to
[]byte.  This seems an unlikely case--it never occurs in the
standrd library--and it seems unnecessary to write the code to
handle it.

If we do want to support this case, one approach is
https://golang.org/cl/171840043.

The other failing cases are of the form

var bx bool
var copy_bx = bx

The compiler used to initialize copy_bx to false.  However,
that led to issue 7665, since bx may be initialized in non-Go
code.  The compiler no longer assumes that bx must be false,
so copy_bx can not be statically initialized.

We can fix these with https://golang.org/cl/169040043
if we also pass -complete to the compiler as part of this
test.  This is OK but it's too late in the release cycle.

Fixes #8746.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/165400043
2014-11-04 10:20:35 -08:00
Austin Clements a5e1e1599c [dev.power64] test: "fix" live.go test on power64x
On power64x, this one line in live.go reports that t is live
because of missing optimization passes.  This isn't what this
test is trying to test, so shuffle bad40 so that it still
accomplishes the intent of the test without also depending on
optimization.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/167110043
2014-11-03 17:25:36 -05:00
Austin Clements d10a115ef9 [dev.power64] test: disable nilptr3 test on power64x
The remaining failures in this test are because of incomplete
optimization support on power64x.  Tracked in issue 9058.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/168130043
2014-11-03 17:25:03 -05:00
Austin Clements 31b1207fde [dev.power64] all: merge default into dev.power64
Trivial merge except for src/runtime/asm_power64x.s and
src/runtime/signal_power64x.c

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/168950044
2014-11-03 10:53:11 -05:00
Austin Clements 6e86003651 [dev.power64] 9g: fix under-zeroing in clearfat
All three cases of clearfat were wrong on power64x.

The cases that handle 1032 bytes and up and 32 bytes and up
both use MOVDU (one directly generated in a loop and the other
via duffzero), which leaves the pointer register pointing at
the *last written* address.  The generated code was not
accounting for this, so the byte fill loop was re-zeroing the
last zeroed dword, rather than the bytes following the last
zeroed dword.  Fix this by simply adding an additional 8 byte
offset to the byte zeroing loop.

The case that handled under 32 bytes was also wrong.  It
didn't update the pointer register at all, so the byte zeroing
loop was simply re-zeroing the beginning of region.  Again,
the fix is to add an offset to the byte zeroing loop to
account for this.

LGTM=dave, bradfitz
R=rsc, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/168870043
2014-10-31 11:08:27 -04:00
Russ Cox a22c11b995 runtime: fix line number in first stack frame in printed stack trace
Originally traceback was only used for printing the stack
when an unexpected signal came in. In that case, the
initial PC is taken from the signal and should be used
unaltered. For the callers, the PC is the return address,
which might be on the line after the call; we subtract 1
to get to the CALL instruction.

Traceback is now used for a variety of things, and for
almost all of those the initial PC is a return address,
whether from getcallerpc, or gp->sched.pc, or gp->syscallpc.
In those cases, we need to subtract 1 from this initial PC,
but the traceback code had a hard rule "never subtract 1
from the initial PC", left over from the signal handling days.

Change gentraceback to take a flag that specifies whether
we are tracing a trap.

Change traceback to default to "starting with a return PC",
which is the overwhelmingly common case.

Add tracebacktrap, like traceback but starting with a trap PC.

Use tracebacktrap in signal handlers.

Fixes #7690.

LGTM=iant, r
R=r, iant
CC=golang-codereviews
https://golang.org/cl/167810044
2014-10-29 15:14:24 -04:00
Russ Cox 599199fd9f [dev.power64] all: merge default (dd5014ed9b01) into dev.power64
Still passes on amd64.

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/165110043
2014-10-29 11:45:01 -04:00
Russ Cox 6b54cc93d0 cmd/gc: fix internal compiler error in struct compare
Fixes #9006.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/167800043
2014-10-28 23:22:46 -04:00
Russ Cox 0f698be547 test: make maplinear more robust
The test just doubled a certain number of times
and then gave up. On a mostly fast but occasionally
slow machine this may never make the test run
long enough to see the linear growth.

Change test to keep doubling until the first round
takes at least a full second, to reduce the effect of
occasional scheduling or other jitter.

The failure we saw had a time for the first round
of around 100ms.

Note that this test still passes once it sees a linear
effect, even with a very small total time.
The timeout here only applies to how long the execution
must be to support a reported failure.

LGTM=khr
R=khr
CC=golang-codereviews, rlh
https://golang.org/cl/164070043
2014-10-27 18:59:02 -04:00
Austin Clements 5a653089ef [dev.power64] all: merge default into dev.power64
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/164110043
2014-10-27 17:17:06 -04:00
Russ Cox 5225854b74 cmd/gc: synthesize zeroed value for non-assignment context
CL 157910047 introduced code to turn a node representing
a zeroed composite literal into N, the nil Node* pointer
(which represents any zero, not the Go literal nil).

That's great for assignments like x = T{}, but it doesn't work
when T{} is used in a value context like T{}.v or x == T{}.
Fix those.

Should have no effect on performance; confirmed.
The deltas below are noise (compare ns/op):

benchmark                          old ns/op      new ns/op      delta
BenchmarkBinaryTree17              2902919192     2915228424     +0.42%
BenchmarkFannkuch11                2597417605     2630363685     +1.27%
BenchmarkFmtFprintfEmpty           73.7           74.8           +1.49%
BenchmarkFmtFprintfString          196            199            +1.53%
BenchmarkFmtFprintfInt             213            217            +1.88%
BenchmarkFmtFprintfIntInt          336            356            +5.95%
BenchmarkFmtFprintfPrefixedInt     289            294            +1.73%
BenchmarkFmtFprintfFloat           415            416            +0.24%
BenchmarkFmtManyArgs               1281           1271           -0.78%
BenchmarkGobDecode                 10271734       10307978       +0.35%
BenchmarkGobEncode                 8985021        9079442        +1.05%
BenchmarkGzip                      410233227      412266944      +0.50%
BenchmarkGunzip                    102114554      103272443      +1.13%
BenchmarkHTTPClientServer          45297          44993          -0.67%
BenchmarkJSONEncode                19499741       19498489       -0.01%
BenchmarkJSONDecode                76436733       74247497       -2.86%
BenchmarkMandelbrot200             4273814        4307292        +0.78%
BenchmarkGoParse                   4024594        4028937        +0.11%
BenchmarkRegexpMatchEasy0_32       131            135            +3.05%
BenchmarkRegexpMatchEasy0_1K       328            333            +1.52%
BenchmarkRegexpMatchEasy1_32       115            117            +1.74%
BenchmarkRegexpMatchEasy1_1K       931            948            +1.83%
BenchmarkRegexpMatchMedium_32      216            217            +0.46%
BenchmarkRegexpMatchMedium_1K      72669          72857          +0.26%
BenchmarkRegexpMatchHard_32        3818           3809           -0.24%
BenchmarkRegexpMatchHard_1K        121398         121945         +0.45%
BenchmarkRevcomp                   613996550      615145436      +0.19%
BenchmarkTemplate                  93678525       93267391       -0.44%
BenchmarkTimeParse                 414            411            -0.72%
BenchmarkTimeFormat                396            399            +0.76%

Fixes #8947.

LGTM=r
R=r, dave
CC=golang-codereviews
https://golang.org/cl/162130043
2014-10-24 10:27:39 -04:00
Austin Clements f0bd539c59 [dev.power64] all: merge default into dev.power64
This brings dev.power64 up-to-date with the current tip of
default.  go_bootstrap is still panicking with a bad defer
when initializing the runtime (even on amd64).

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/152570049
2014-10-22 15:51:54 -04:00
Austin Clements 2bd616b1a7 build: merge the great pkg/ rename into dev.power64
This also removes pkg/runtime/traceback_lr.c, which was ported
to Go in an earlier commit and then moved to
runtime/traceback.go.

Reviewer: rsc@golang.org
          rsc: LGTM
2014-10-22 13:25:37 -04:00
Austin Clements 3208250185 [dev.power64] build: merge default into dev.power64
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/160200044
2014-10-22 11:21:16 -04:00
Ian Lance Taylor 18051c0860 test: add more cases to recover.go
test16 used to fail with gccgo.  The withoutRecoverRecursive
test would have failed in some possible implementations.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/151630043
2014-10-22 08:06:15 -07:00
Russ Cox 93fcb92257 cmd/gc: disallow call of *T method using **T variable
This brings cmd/gc in line with the spec on this question.
It might break existing code, but that code was not conformant
with the spec.

Credit to Rémy for finding the broken code.

Fixes #6366.

LGTM=r
R=golang-codereviews, r
CC=adonovan, golang-codereviews, gri
https://golang.org/cl/129550043
2014-10-20 22:04:12 -04:00
Daniel Morsing 0edafefc36 cmd/gc: emit code for extern = <N>
https://golang.org/cl/152700045/ made it possible for struct literals assigned to globals to use <N> as the RHS. Normally, this is to zero out variables on first use. Because globals are already zero (or their linker initialized value), we just ignored this.

Now that <N> can occur from non-initialization code, we need to emit this code. We don't use <N> for initialization of globals any more, so this shouldn't cause any excessive zeroing.

Fixes #8961.

LGTM=rsc
R=golang-codereviews, rsc
CC=bradfitz, golang-codereviews
https://golang.org/cl/154540044
2014-10-20 15:59:10 +01:00
Chris Manghane db4dad7fd7 cmd/gc: blank methods are not permitted in interface types
Fixes #6606.

LGTM=rsc
R=rsc
CC=golang-codereviews, gri
https://golang.org/cl/156210044
2014-10-15 09:55:13 -07:00
Chris Manghane fe8f799ef7 cmd/gc: check for initialization cycles in method values
Fixes #7960.

LGTM=rsc
R=rsc
CC=golang-codereviews, gri
https://golang.org/cl/159800045
2014-10-14 19:12:10 -07:00
Chris Manghane d83e43ccc6 test: add test for gccgo-specific issue 8079
LGTM=gri
R=gri
CC=golang-codereviews, iant
https://golang.org/cl/159850044
2014-10-13 12:33:45 -07:00
Evan Kroske 55df81d37f cmd/gc: prohibit short variable declarations containing duplicate symbols
Fixes #6764.
Fixes #8435.

LGTM=rsc
R=golang-codereviews, r, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/116440046
2014-10-06 17:16:39 -04:00
Russ Cox 454d1b0e8b cmd/gc: fix call order in array literal of slice literal of make chan
Fixes #8761.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/144530045
2014-09-30 12:48:47 -04:00
Ian Lance Taylor f6fc14094a cmd/ld: don't automatically mark symbols created by -X as reachable
This fixes the bug in which the linker reports "missing Go
type information" when a -X option refers to a symbol that is
not used.

Fixes #8821.

LGTM=rsc
R=rsc, r
CC=golang-codereviews
https://golang.org/cl/151000043
2014-09-28 08:27:05 -07:00
Russ Cox 870f4e190c cmd/gc: emit error for out-of-bounds slice of constant string
Fixes #7200.

LGTM=gri, iant
R=golang-codereviews, gri, iant
CC=golang-codereviews, r
https://golang.org/cl/150020044
2014-09-25 13:24:43 -04:00
Russ Cox 52e9bcafe1 cmd/gc: print x++ (not x += 1) in errors about x++
Fixes #8311.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/146270043
2014-09-25 13:13:02 -04:00
Russ Cox 53c66543e0 cmd/gc: avoid infinite recursion on invalid recursive type
Fixes #8507.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/144560043
2014-09-25 13:08:37 -04:00
Russ Cox 43c4287b25 cmd/gc: fix import of package with var func returning _
Fixes #8280.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/146240043
2014-09-24 16:53:34 -04:00
Russ Cox 00d2f916ad cmd/gc: run escape analysis always (even in -N mode)
Fixes #8585.
Removes some little-used code paths.

LGTM=josharian
R=golang-codereviews, minux, josharian
CC=golang-codereviews, iant, r
https://golang.org/cl/132970043
2014-09-24 15:20:03 -04:00
Russ Cox 653fb6d872 liblink: make GO_ARGS the default for functions beginning with ·
If there is a leading ·, assume there is a Go prototype and
attach the Go prototype information to the function.
If the function is not called from Go and does not need a
Go prototype, it can be made file-local instead (using name<>(SB)).

This fixes the current BSD build failures, by giving functions like
sync/atomic.StoreUint32 argument stack map information.

Fixes #8753.

LGTM=khr, iant
R=golang-codereviews, iant, khr, bradfitz
CC=golang-codereviews, r, rlh
https://golang.org/cl/142150043
2014-09-16 17:39:55 -04:00
Russ Cox 8d61334dd5 cmd/gc: say 'non-constant array bound' instead of 'invalid array bound'
Fixes #8196.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/141510044
2014-09-16 10:21:54 -04:00
Josh Bleecher Snyder c3dbf56a14 cmd/ld: document that -X overwrites initialized variables
Fixes #7626.

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/144870045
2014-09-15 18:16:45 -07:00
Josh Bleecher Snyder f197988ca5 test: make maplinear iterdelete test less flaky
iterdelete's run time varies; occasionally we get unlucky. To reduce spurious failures, average away some of the variation.

On my machine, 8 of 5000 runs (0.15%) failed before this CL. After this CL, there were no failures after 35,000 runs.

I confirmed that this adjusted test still fails before CL 141270043.

LGTM=khr
R=khr
CC=bradfitz, golang-codereviews
https://golang.org/cl/140610043
2014-09-15 10:56:37 -07:00
Rémy Oudompheng e024ed5ca4 cmd/gc: don't walk static nodes generated by anylit.
During anylit run, nodes such as SLICEARR(statictmp, [:])
may be generated and are expected to be found unchanged by
gen_as_init.

In some walks (in particular walkselect), the statement
may be walked again and lowered to its usual form, leading to a
crash.

Fixes #8017.
Fixes #8024.
Fixes #8058.

LGTM=rsc
R=golang-codereviews, dvyukov, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/112080043
2014-09-15 18:31:47 +02:00
Rémy Oudompheng 8d47b08255 cmd/gc: generate type alg after calling dowidth.
Previously it might happen before calling dowidth and
result in a compiler crash.

Fixes #8060.

LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/110980044
2014-09-15 18:24:16 +02:00
Josh Bleecher Snyder 8cc6cb2f17 test: return errors earlier in run.go
Fixes #8184.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/137510043
2014-09-11 12:47:17 -07:00
Russ Cox fcb4cabba4 cmd/gc: emit write barriers
A write *p = x that needs a write barrier (not all do)
now turns into runtime.writebarrierptr(p, x)
or one of the other variants.

The write barrier implementations are trivial.
The goal here is to emit the calls in the correct places
and to incur the cost of those function calls in the Go 1.4 cycle.

Performance on the Go 1 benchmark suite below.
Remember, the goal is to slow things down (and be correct).

We will look into optimizations in separate CLs, as part of
the process of comparing Go 1.3 against tip in order to make
sure Go 1.4 runs at least as fast as Go 1.3.

benchmark                          old ns/op      new ns/op      delta
BenchmarkBinaryTree17              3118336716     3452876110     +10.73%
BenchmarkFannkuch11                3184497677     3211552284     +0.85%
BenchmarkFmtFprintfEmpty           89.9           107            +19.02%
BenchmarkFmtFprintfString          236            287            +21.61%
BenchmarkFmtFprintfInt             246            278            +13.01%
BenchmarkFmtFprintfIntInt          395            458            +15.95%
BenchmarkFmtFprintfPrefixedInt     343            378            +10.20%
BenchmarkFmtFprintfFloat           477            525            +10.06%
BenchmarkFmtManyArgs               1446           1707           +18.05%
BenchmarkGobDecode                 14398047       14685958       +2.00%
BenchmarkGobEncode                 12557718       12947104       +3.10%
BenchmarkGzip                      453462345      472413285      +4.18%
BenchmarkGunzip                    114226016      115127398      +0.79%
BenchmarkHTTPClientServer          114689         112122         -2.24%
BenchmarkJSONEncode                24914536       26135942       +4.90%
BenchmarkJSONDecode                86832877       103620289      +19.33%
BenchmarkMandelbrot200             4833452        4898780        +1.35%
BenchmarkGoParse                   4317976        4835474        +11.98%
BenchmarkRegexpMatchEasy0_32       150            166            +10.67%
BenchmarkRegexpMatchEasy0_1K       393            402            +2.29%
BenchmarkRegexpMatchEasy1_32       125            142            +13.60%
BenchmarkRegexpMatchEasy1_1K       1010           1236           +22.38%
BenchmarkRegexpMatchMedium_32      232            301            +29.74%
BenchmarkRegexpMatchMedium_1K      76963          102721         +33.47%
BenchmarkRegexpMatchHard_32        3833           5463           +42.53%
BenchmarkRegexpMatchHard_1K        119668         161614         +35.05%
BenchmarkRevcomp                   763449047      706768534      -7.42%
BenchmarkTemplate                  124954724      134834549      +7.91%
BenchmarkTimeParse                 517            511            -1.16%
BenchmarkTimeFormat                501            514            +2.59%

benchmark                         old MB/s     new MB/s     speedup
BenchmarkGobDecode                53.31        52.26        0.98x
BenchmarkGobEncode                61.12        59.28        0.97x
BenchmarkGzip                     42.79        41.08        0.96x
BenchmarkGunzip                   169.88       168.55       0.99x
BenchmarkJSONEncode               77.89        74.25        0.95x
BenchmarkJSONDecode               22.35        18.73        0.84x
BenchmarkGoParse                  13.41        11.98        0.89x
BenchmarkRegexpMatchEasy0_32      213.30       191.72       0.90x
BenchmarkRegexpMatchEasy0_1K      2603.92      2542.74      0.98x
BenchmarkRegexpMatchEasy1_32      254.00       224.93       0.89x
BenchmarkRegexpMatchEasy1_1K      1013.53      827.98       0.82x
BenchmarkRegexpMatchMedium_32     4.30         3.31         0.77x
BenchmarkRegexpMatchMedium_1K     13.30        9.97         0.75x
BenchmarkRegexpMatchHard_32       8.35         5.86         0.70x
BenchmarkRegexpMatchHard_1K       8.56         6.34         0.74x
BenchmarkRevcomp                  332.92       359.62       1.08x
BenchmarkTemplate                 15.53        14.39        0.93x

LGTM=rlh
R=rlh
CC=dvyukov, golang-codereviews, iant, khr, r
https://golang.org/cl/136380043
2014-09-11 12:17:45 -04:00
Keith Randall 689dc60c14 runtime: add timing test for iterate/delete map idiom.
LGTM=bradfitz, iant
R=iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/140510043
2014-09-10 22:54:07 -07:00
Russ Cox 220a6de47e build: adjustments for move from src/pkg to src
This CL adjusts code referring to src/pkg to refer to src.

Immediately after submitting this CL, I will submit
a change doing 'hg mv src/pkg/* src'.
That change will be too large to review with Rietveld
but will contain only the 'hg mv'.

This CL will break the build.
The followup 'hg mv' will fix it.

For more about the move, see golang.org/s/go14nopkg.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/134570043
2014-09-08 00:06:45 -04:00
Russ Cox b6951bcc0b runtime: increase stack split limit again
Increase NOSPLIT reservation from 192 to 384 bytes.
The problem is that the non-Unix systems (Solaris and Windows)
just can't make system calls in a small amount of space,
and then worse they do things that are complex enough
to warrant calling runtime.throw on failure.
We don't have time to rewrite the code to use less stack.

I'm not happy about this, but it's still a small amount.

The good news is that we're doing this to get to only
using copying stacks for stack growth. Once that is true,
we can drop the default stack size from 8k to 4k, which
should more than make up for the bytes we're losing here.

LGTM=r
R=iant, r, bradfitz, aram.h
CC=golang-codereviews
https://golang.org/cl/140350043
2014-09-06 21:16:13 -04:00
Russ Cox 8473695797 runtime: fix panic/wrapper/recover math
The gp->panicwrap adjustment is just fatally flawed.
Now that there is a Panic.argp field, update that instead.
That can be done on entry only, so that unwinding doesn't
need to worry about undoing anything. The wrappers
emit a few more instructions in the prologue but everything
else in the system gets much simpler.

It also fixes (without trying) a broken test I never checked in.

Fixes #7491.

LGTM=khr
R=khr
CC=dvyukov, golang-codereviews, iant, r
https://golang.org/cl/135490044
2014-09-06 13:19:08 -04:00
Russ Cox f8f630f5ec runtime: use reflect.call during panic instead of newstackcall
newstackcall creates a new stack segment, and we want to
be able to throw away all that code.

LGTM=khr
R=khr, iant
CC=dvyukov, golang-codereviews, r
https://golang.org/cl/139270043
2014-09-05 16:51:45 -04:00
Keith Randall 8217b4a203 runtime: convert panic/recover to Go
created panic1.go just so diffs were available.
After this CL is in, I'd like to move panic.go -> defer.go
and panic1.go -> panic.go.

LGTM=rsc
R=rsc, khr
CC=golang-codereviews
https://golang.org/cl/133530045
2014-09-05 10:04:16 -04:00
Russ Cox 397bdb216f runtime: increase nosplit area to 192
In CL 131450043, which raised it to 160,
I'd raise it to 192 if necessary.
Apparently it is necessary on windows/amd64.

One note for those concerned about the growth:
in the old segmented stack world, we wasted this much
space at the bottom of every stack segment.
In the new contiguous stack world, each goroutine has
only one stack segment, so we only waste this much space
once per goroutine. So even raising the limit further might
still be a net savings.

Fixes windows/amd64 build.

TBR=r
CC=golang-codereviews
https://golang.org/cl/132480043
2014-08-30 00:56:52 -04:00
Ian Lance Taylor de7fea0d61 test: add test that caused gccgo to crash on valid code
Update #8612

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/135170043
2014-08-28 19:51:21 -07:00
Russ Cox fe91006a02 runtime: give nosplit functions 32 more bytes of headroom
The Go calling convention uses more stack space than C.
On 64-bit systems we've been right up against the limit
(128 bytes, so only 16 words) and doing awful things to
our source code to work around it. Instead of continuing
to do awful things, raise the limit to 160 bytes.
I am prepared to raise the limit to 192 bytes if necessary,
but I think this will be enough.

Should fix current link-time stack overflow errors on
        - nacl/arm
        - netbsd/amd64
        - openbsd/amd64
        - solaris/amd64
        - windows/amd64

TBR=r
CC=golang-codereviews, iant
https://golang.org/cl/131450043
2014-08-27 14:08:26 -04:00