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

409 Commits

Author SHA1 Message Date
Austin Clements
87b4149b22 [dev.power64] runtime: fix atomicor8 for power64x
Power64 servers do not currently support sub-word size atomic
memory access, so atomicor8 uses word size atomic access.
However, previously atomicor8 made no attempt to align this
access, resulting in errors.  Fix this by aligning the pointer
to a word boundary and shifting the value appropriately.
Since atomicor8 is used in GC, add a test to runtime·check to
make sure this doesn't break in the future.

This also fixes an incorrect branch label, an incorrectly
sized argument move, and adds argument names to help go vet.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/165820043
2014-10-28 15:57:33 -04:00
Dave Cheney
cb4f5e1970 [dev.power64] runtime: fix cas64 on power64x
cas64 was jumping to the wrong offset.

LGTM=minux, rsc
R=rsc, austin, minux
CC=golang-codereviews
https://golang.org/cl/158710043
2014-10-28 11:15:48 +11:00
Dave Cheney
1b130a08d8 [dev.power64] runtime: fix power64le build
Brings defs_linux_power64le.h up to date with the big endian version.

LGTM=rsc
R=rsc, austin
CC=golang-codereviews
https://golang.org/cl/161470043
2014-10-28 09:56:33 +11:00
Austin Clements
062e354c84 [dev.power64] runtime: power64 fixes and ports of changes
Fix include paths that got moved in the great pkg/ rename.  Add
missing runtime/arch_* files for power64.  Port changes that
happened on default since branching to
runtime/{asm,atomic,sys_linux}_power64x.s (precise stacks,
calling convention change, various new and deleted functions.
Port struct renaming and fix some bugs in
runtime/defs_linux_power64.h.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/161450043
2014-10-27 17:27:03 -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
Austin Clements
3e62d2184a runtime: fix endianness assumption when decoding ftab
The ftab ends with a half functab record consisting only of
the 'entry' field followed by a uint32 giving the offset of
the next table.  Previously, symtabinit assumed it could read
this uint32 as a uintptr.  Since this is unsafe on big endian,
explicitly read the offset as a uint32.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/157660043
2014-10-27 17:12:48 -04:00
Dave Cheney
a08783f078 [dev.power64] runtime: fix SigaltstackT definition for power64le
Also updated defs3_linux.go but had to manually edit defs_linux_power64le.h. Will regenerate the file when cgo is working natively on ppc64.

LGTM=austin
R=rsc, austin
CC=golang-codereviews
https://golang.org/cl/158360043
2014-10-23 08:58:10 +11:00
Austin Clements
a9b9ecc9ef [dev.power64] runtime: fix early GC of Defer objects
go_bootstrap was panicking during runtime initialization
(under runtime.main) because Defer objects were being
prematurely GC'd.  This happened because of an incorrect
change to runtime·unrollgcprog_m to make it endian-agnostic
during the conversion of runtime bitmaps to byte arrays.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/161960044
2014-10-22 16:39:31 -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
977fba763a [dev.power64] runtime: Fix broken merge of noasm.go
The earlier dev.power64 merge missed the port of
runtime/noasm.goc to runtime/noasm_arm.go.  This CL fixes this
by moving noasm_arm.go to noasm.go and adding a +build to
share the file between arm and power64.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/158350043
2014-10-22 14:02:04 -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
Dave Cheney
d1b2913710 runtime/cgo: encode BLX directly, fixes one clang build error on arm
Fixes #8348.

Trying to work around clang's dodgy support for .arch by reverting to the external assembler didn't work out so well. Minux had a much better solution to encode the instructions we need as .word directives which avoids .arch altogether.

I've confirmed with gdb that this form produces the expected machine code

Dump of assembler code for function crosscall_arm1:
   0x00000000 <+0>:	push	{r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
   0x00000004 <+4>:	mov	r4, r0
   0x00000008 <+8>:	mov	r5, r1
   0x0000000c <+12>:	mov	r0, r2
   0x00000010 <+16>:	blx	r5
   0x00000014 <+20>:	blx	r4
   0x00000018 <+24>:	pop	{r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}

There is another compilation failure that blocks building Go with clang on arm

# ../misc/cgo/test
# _/home/dfc/go/misc/cgo/test
/tmp/--407b12.s: Assembler messages:
/tmp/--407b12.s:59: Error: selected processor does not support ARM mode `blx r0'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
FAIL	_/home/dfc/go/misc/cgo/test [build failed]

I'll open a new issue for that

LGTM=iant
R=iant, minux
CC=golang-codereviews
https://golang.org/cl/158180047
2014-10-22 12:30:15 +11:00
Keith Randall
b60d5e12e9 runtime: warn that cputicks() might not be monotonic.
Get rid of gocputicks(), it is no longer used.

LGTM=bradfitz, dave
R=golang-codereviews, bradfitz, dave, minux
CC=golang-codereviews
https://golang.org/cl/161110044
2014-10-21 14:46:07 -07:00
Keith Randall
3ec8fe45cf runtime: fix flaky TestBlockProfile test
It has been failing periodically on Solaris/x64.
Change blockevent so it always records an event if we called
SetBlockProfileRate(1), even if the time delta is negative or zero.

Hopefully this will fix the test on Solaris.
Caveat: I don't actually know what the Solaris problem is, this
is just an educated guess.

LGTM=dave
R=dvyukov, dave
CC=golang-codereviews
https://golang.org/cl/159150043
2014-10-20 15:48:42 -07:00
David du Colombier
9d06cfc810 runtime: handle non-nil-terminated environment strings on Plan 9
Russ Cox pointed out that environment strings are not
required to be nil-terminated on Plan 9.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/159130044
2014-10-20 23:03:03 +02:00
Keith Randall
e330cc16f4 runtime: dequeue the correct SudoG
select {
       case <- c:
       case <- c:
}

In this case, c.recvq lists two SudoGs which have the same G.
So we can't use the G as the key to dequeue the correct SudoG,
as that key is ambiguous.  Dequeueing the wrong SudoG ends up
freeing a SudoG that is still in c.recvq.

The fix is to use the actual SudoG pointer as the key.

LGTM=dvyukov
R=rsc, bradfitz, dvyukov, khr
CC=austin, golang-codereviews
https://golang.org/cl/159040043
2014-10-18 21:02:49 -07:00
Dmitriy Vyukov
f4de59e234 runtime/pprof: fix memory profiler test
Don't use cmd/pprof as it is not necessary installed
and does not work on nacl and plan9.
Instead just look at the raw profile.

LGTM=crawshaw, rsc
R=golang-codereviews, crawshaw, 0intro, rsc
CC=golang-codereviews
https://golang.org/cl/159010043
2014-10-17 21:28:47 +04:00
Russ Cox
fb173c4185 runtime/pprof: fix test
gogo called from GC is okay
for the same reasons that
gogo called from System or ExternalCode is okay.
All three are fake stack traces.

Fixes #8408.

LGTM=dvyukov, r
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/152580043
2014-10-17 11:23:15 -04:00
Russ Cox
58e357ef16 runtime: remove comment that leaked into CL 153710043
This doesn't actually do anything. Maybe it will some day,
but maybe not.

TBR=r
CC=golang-codereviews
https://golang.org/cl/155490043
2014-10-17 11:03:55 -04:00
Russ Cox
1ba977ccca undo CL 159990043 / 421fadcef39a
Dmitriy believes this broke Windows.
It looks like build.golang.org stopped before that,
but it's worth a shot.

««« original CL description
runtime: make pprof a little nicer

Update #8942

This does not fully address issue 8942 but it does make
the profiles much more useful, until that issue can be
fixed completely.

LGTM=dvyukov
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/159990043
»»»

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/160030043
2014-10-17 10:11:03 -04:00
Russ Cox
25f79b9dbe runtime/pprof: disable new memory test
It cannot run 'go tool pprof'. There is no guarantee that's installed.
It needs to build a temporary pprof binary and run that.
It also needs to skip the test on systems that can't build and
run binaries, namely android and nacl.

See src/cmd/nm/nm_test.go's TestNM for a template.

Update #8867
Status: Accepted

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/153710043
2014-10-16 14:58:11 -04:00
Russ Cox
7ed8723d49 runtime: make pprof a little nicer
Update #8942

This does not fully address issue 8942 but it does make
the profiles much more useful, until that issue can be
fixed completely.

LGTM=dvyukov
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/159990043
2014-10-16 14:44:55 -04:00
Dmitriy Vyukov
8f47c837fd runtime: fix memory profiler
There are 3 issues:
1. Skip argument of callers is off by 3,
so that all allocations are deep inside of memory profiler.
2. Memory profiling statistics are not updated after runtime.GC.
3. Testing package does not update memory profiling statistics
before capturing the profile.
Also add an end-to-end test.
Fixes #8867.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/148710043
2014-10-16 22:11:26 +04:00
Russ Cox
cb6f5ac0b0 runtime: remove hand-generated ptr bitmaps for reflectcall
A Go prototype can be used instead now, and the compiler
will do a better job than we will doing it by hand.
(We got it wrong in amd64p32, causing the current build
breakage.)

The auto-prototype-matching only applies to functions
without an explicit package path, so the TEXT lines for
reflectcall and callXX are s/runtime·/·/.

LGTM=khr
R=khr
CC=golang-codereviews, iant, r
https://golang.org/cl/153600043
2014-10-15 13:12:16 -04:00
Russ Cox
ff6d0a4df4 cmd/gc, runtime: fix race, nacl for writebarrier changes
The racewalk code was not updated for the new write barriers.
Make it more future-proof.

The new write barrier code assumed that +1 pointer would
be aligned properly for any type that might follow, but that's
not true on 32-bit systems where some types are 64-bit aligned.
The only system like that today is nacl/amd64p32.
Insert a dummy pointer so that the ambiguously typed
value is at +2 pointers, which is always max-aligned.

LGTM=r
R=r
CC=golang-codereviews, iant, khr
https://golang.org/cl/158890046
2014-10-14 23:24:32 -04:00
Alex Brainman
e9ecd4aec5 runtime: handle all windows exception (second attempt)
includes undo of 22318cd31d7d and also:
- always use SetUnhandledExceptionFilter on windows-386;
- crash when receive EXCEPTION_BREAKPOINT in exception handler.

Fixes #8006.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/155360043
2014-10-15 11:11:11 +11:00
Russ Cox
a3416cf5cd cmd/gc: add 2-, 3-, 4-word write barrier specializations
Assignments of 2-, 3-, and 4-word values were handled
by individual MOV instructions (and for scalars still are).
But if there are pointers involved, those assignments now
go through the write barrier routine. Before this CL, they
went to writebarrierfat, which calls memmove.
Memmove is too much overhead for these small
amounts of data.

Instead, call writebarrierfat{2,3,4}, which are specialized
for the specific amount of data being copied.
Today the write barrier does not care which words are
pointers, so size alone is enough to distinguish the cases.
If we keep these distinctions in Go 1.5 we will need to
expand them for all the pointer-vs-scalar possibilities,
so the current 3 functions will become 3+7+15 = 25,
still not a large burden (we deleted more morestack
functions than that when we dropped segmented stacks).

BenchmarkBinaryTree17           3250972583  3123910344  -3.91%
BenchmarkFannkuch11             3067605223  2964737839  -3.35%
BenchmarkFmtFprintfEmpty        101         96.0        -4.95%
BenchmarkFmtFprintfString       267         235         -11.99%
BenchmarkFmtFprintfInt          261         253         -3.07%
BenchmarkFmtFprintfIntInt       444         402         -9.46%
BenchmarkFmtFprintfPrefixedInt  374         346         -7.49%
BenchmarkFmtFprintfFloat        472         449         -4.87%
BenchmarkFmtManyArgs            1537        1476        -3.97%
BenchmarkGobDecode              13986528    12432985    -11.11%
BenchmarkGobEncode              13120323    12537420    -4.44%
BenchmarkGzip                   451925758   437500578   -3.19%
BenchmarkGunzip                 113267612   110053644   -2.84%
BenchmarkHTTPClientServer       103151      77100       -25.26%
BenchmarkJSONEncode             25002733    23435278    -6.27%
BenchmarkJSONDecode             94213717    82568789    -12.36%
BenchmarkMandelbrot200          4804246     4713070     -1.90%
BenchmarkGoParse                4646114     4379456     -5.74%
BenchmarkRegexpMatchEasy0_32    163         158         -3.07%
BenchmarkRegexpMatchEasy0_1K    433         391         -9.70%
BenchmarkRegexpMatchEasy1_32    154         138         -10.39%
BenchmarkRegexpMatchEasy1_1K    1481        1132        -23.57%
BenchmarkRegexpMatchMedium_32   282         270         -4.26%
BenchmarkRegexpMatchMedium_1K   92421       86149       -6.79%
BenchmarkRegexpMatchHard_32     5209        4718        -9.43%
BenchmarkRegexpMatchHard_1K     158141      147921      -6.46%
BenchmarkRevcomp                699818791   642222464   -8.23%
BenchmarkTemplate               132402383   108269713   -18.23%
BenchmarkTimeParse              509         478         -6.09%
BenchmarkTimeFormat             462         456         -1.30%

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/156200043
2014-10-14 16:31:09 -04:00
Keith Randall
9dc6764d3c runtime: a few optimizations of scanblock.
Lowers gc pause time by 5-10% on test/bench/garbage

LGTM=rsc, dvyukov
R=rsc, dvyukov
CC=golang-codereviews
https://golang.org/cl/157810043
2014-10-14 09:22:47 -07:00
Dmitriy Vyukov
f1c0899e6f runtime: add comment to mgc0.h
Missed that comment in CL 153990043.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/156010043
2014-10-09 17:05:38 +04:00
Alex Brainman
64736accdb undo CL 145150043 / 8b3d26697b8d
That was complete failure - builders are broken,
but original cl worked fine on my system.
I will need access to builders
to test this change properly.

««« original CL description
runtime: handle all windows exception

Fixes #8006.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/145150043
»»»

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/154180043
2014-10-09 17:24:34 +11:00
Alex Brainman
17a108ba07 runtime: handle all windows exception
Fixes #8006.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/145150043
2014-10-09 16:52:28 +11:00
Keith Randall
b02450da02 runtime: zero a few more dead pointers.
In channels, zeroing of gp.waiting is missed on a closed channel panic.
m.morebuf.g is not zeroed.

I don't expect the latter causes any problems, but just in case.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/151610043
2014-10-08 17:22:34 -07:00
Keith Randall
91e8554b8b runtime: delay freeing of shrunk stacks until gc is done.
This change prevents confusion in the garbage collector.
The collector wants to make sure that every pointer it finds
isn't junk.  Its criteria for junk is (among others) points
to a "free" span.

Because the stack shrinker modifies pointers in the heap,
there is a race condition between the GC scanner and the
shrinker.  The GC scanner can see old pointers (pointers to
freed stacks).  In particular this happens with SudoG.elem
pointers.

Normally this is not a problem, as pointers into stack spans
are ok.  But if the freed stack is the last one in its span,
the span is marked as "free" instead of "contains stacks".

This change makes sure that even if the GC scanner sees
an old pointer, the span into which it points is still
marked as "contains stacks", and thus the GC doesn't
complain about it.

This change will make the GC pause a tiny bit slower, as
the stack freeing now happens in serial with the mark pause.
We could delay the freeing until the mutators start back up,
but this is the simplest change for now.

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/158750043
2014-10-08 15:57:20 -07:00
Dmitriy Vyukov
b8fdaaf028 runtime: faster GC scan
The change contains 3 spot optimizations to scan loop:
1. Don't use byte vars, use uintptr's instead.
This seems to alleviate some codegen issue,
and alone accounts to a half of speedup.
2. Remove bitmap cache. Currently we cache only 1 byte,
so caching is not particularly effective anyway.
Removal of the cache simplifies code and positively affects regalloc.
3. Replace BitsMultiword switch with if and
do debug checks only in Debug mode.
I've benchmarked changes separately and ensured that
each of them provides speedup on top of the previous one.
This change as a whole fixes the unintentional regressions
of scan loop that were introduced during development cycle.
Fixes #8625.
Fixes #8565.

On go.benchmarks/garbage benchmark:
GOMAXPROCS=1
time:		-3.13%
cputime:	-3.22%
gc-pause-one:	-15.71%
gc-pause-total:	-15.71%

GOMAXPROCS=32
time:		-1.96%
cputime:	-4.43%
gc-pause-one:	-6.22%
gc-pause-total:	-6.22%

LGTM=khr, rsc
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://golang.org/cl/153990043
2014-10-08 13:51:12 +04:00
Russ Cox
94bdf13497 runtime: clear Defer.fn before removing from the G.defer list
Should fix the remaining 'invalid heap pointer' build failures.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/152360043
2014-10-08 00:03:50 -04:00
Russ Cox
f950a14bb5 runtime: fix windows/amd64 build
Out of stack space due to new 2-word call in freedefer.
Go back to smaller function calls.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/152340043
2014-10-07 23:39:00 -04:00
Russ Cox
2b1659b57d runtime: change Windows M.thread from void* to uintptr
It appears to be an opaque bit pattern more than a pointer.
The Go garbage collector has discovered that for m0
it is set to 0x4c.

Should fix Windows build.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/149640043
2014-10-07 23:27:25 -04:00
Russ Cox
e6708ee9b1 runtime: clear Defer.panic before removing from G.defer list
Another dangling stack pointer in a cached structure.
Same as SudoG.elem and SudoG.selectdone.

Definitely a fix, and the new test in freedefer makes the
crash reproducible, but probably not a complete fix.
I have seen one dangling pointer in a Defer.panic even
after this fix; I cannot see where it could be coming from.

I think this will fix the solaris build.
I do not think this will fix the occasional failure on the darwin build.

TBR=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/155080043
2014-10-07 23:17:31 -04:00
Keith Randall
dcc4a674d8 runtime: zero pointer-looking scalararg values
I have a CL which at every gc looks through data and bss
sections for nonpointer data (according to gc maps) that
looks like a pointer.  These are potential missing roots.

The only thing it finds are begnign, storing stack pointers
into m0.scalararg[1] and never cleaning them up.  Let's
clean them up now so the test CL passes all.bash cleanly.

The test CL can't be checked in because we might store
pointer-looking things in nonpointer data by accident.

LGTM=iant
R=golang-codereviews, iant, khr
CC=golang-codereviews
https://golang.org/cl/153210043
2014-10-07 15:21:00 -07:00
Keith Randall
6ea3746adf runtime: update heap dump format for 1.4
We no longer have full type information in the heap, so
we can't dump that any more.  Instead we dump ptr/noptr
maps so at least we can compute graph connectivity.

In addition, we still dump Iface/Eface types so together
with dwarf type info we might be able to reconstruct
types of most things in the heap.

LGTM=dvyukov
R=golang-codereviews, dvyukov, rsc, khr
CC=golang-codereviews
https://golang.org/cl/155940043
2014-10-07 13:36:16 -07:00
Russ Cox
685204747d runtime: fix _cgo_allocate(0)
Fixes a SWIG bug reported off-list.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/155990043
2014-10-07 16:27:40 -04:00
Russ Cox
11e53e46a6 runtime: crash if we see an invalid pointer into GC arena
This will help find bugs during the release freeze.
It's not clear it should be kept for the release itself.
That's issue 8861.

The most likely thing that would trigger this is stale
pointers that previously were ignored or caused memory
leaks. These were allowed due to the use of conservative
collection. Now that everything is precise, we should not
see them anymore.

The small number check reinforces what the stack copier
is already doing, catching the storage of integers in pointers.
It caught issue 8864.

The check is disabled if _cgo_allocate is linked into the binary,
which is to say if the binary is using SWIG to allocate untyped
Go memory. In that case, there are invalid pointers and there's
nothing we can do about it.

LGTM=rlh
R=golang-codereviews, dvyukov, rlh
CC=golang-codereviews, iant, khr, r
https://golang.org/cl/148470043
2014-10-07 11:07:18 -04:00
Russ Cox
18172c42ff runtime: remove type-punning for Type.gc[0], gc[1]
Depending on flags&KindGCProg,
gc[0] and gc[1] are either pointers or inlined bitmap bits.
That's not compatible with a precise garbage collector:
it needs to be always pointers or never pointers.

Change the inlined bitmap case to store a pointer to an
out-of-line bitmap in gc[0]. The out-of-line bitmaps are
dedup'ed, so that for example all pointer types share the
same out-of-line bitmap.

Fixes #8864.

LGTM=r
R=golang-codereviews, dvyukov, r
CC=golang-codereviews, iant, khr, rlh
https://golang.org/cl/155820043
2014-10-07 11:06:51 -04:00
Russ Cox
9a5b055b95 runtime: update docs, code for SetFinalizer
At last minute before 1.3 we relaxed SetFinalizer to avoid
crashes when you pass the result of a global alloc to it.
This avoids the crash but makes SetFinalizer a bit too relaxed.

Document that the finalizer of a global allocation may not run.

Tighten the SetFinalizer check to ignore a global allocation but
not ignore everything else.

Fixes #7656.

LGTM=r, iant
R=golang-codereviews, iant, r
CC=dvyukov, golang-codereviews, khr, rlh
https://golang.org/cl/145930043
2014-10-06 14:18:09 -04:00
Russ Cox
13da360845 runtime: clear sg.selectdone before saving in SudoG cache
Removes another dangling pointer that might
cause a memory leak in 1.4 or crash the GC in 1.5.

LGTM=rlh
R=golang-codereviews
CC=golang-codereviews, iant, khr, r, rlh
https://golang.org/cl/150520043
2014-10-03 15:33:29 -04:00
Russ Cox
0120f8378d runtime: clear stale values from G.param and SudoG.elem
This change was necessary on the dev.garbage branch
to keep the garbage collector from seeing pointers into
invalid heap areas.

On this default (Go 1.4) branch, the change removes
some possibility for memory leaks.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, iant, r, rlh
https://golang.org/cl/155760043
2014-10-03 13:36:48 -04:00
Russ Cox
3ffd29fb2c cmd/cc, runtime: disallow structs without tags
Structs without tags have no unique name to use in the
Go definitions generated from the C types.
This caused issue 8812, fixed by CL 149260043.
Avoid future problems by requiring struct tags.

Update runtime as needed.
(There is no other C code in the tree.)

LGTM=bradfitz, iant
R=golang-codereviews, bradfitz, dave, iant
CC=golang-codereviews, khr, r
https://golang.org/cl/150360043
2014-10-03 12:44:20 -04:00
Brad Fitzpatrick
85cdc49e8a os, syscall: add Unsetenv
Also address a TODO, making Clearenv pass through to cgo.

Based largely on Minux's earlier https://golang.org/cl/82040044

Fixes #6423

LGTM=iant, alex.brainman, r, rsc
R=rsc, iant, r, alex.brainman
CC=golang-codereviews
https://golang.org/cl/148370043
2014-10-01 11:17:15 -07:00
Keith Randall
ac9218f5f0 runtime: fix scanning of gc work buffer
GC types were not being generated for the garbage collector
work buffer.  The markfor object was being collected as a result.
This broke amd64p32 and maybe plan9 builds.  Why it didn't break
every build I'm not sure...

Fixes #8812

LGTM=0intro, rsc
R=golang-codereviews, dave, khr, 0intro, rsc
CC=golang-codereviews
https://golang.org/cl/149260043
2014-09-30 08:51:02 -07:00
Dmitriy Vyukov
12308d5a0b runtime: fix throwsplit check
Newstack runs on g0, g0->throwsplit is never set.

LGTM=rsc
R=rsc
CC=golang-codereviews, khr
https://golang.org/cl/147370043
2014-09-30 19:34:33 +04:00