runtime: fix memstats
Newly allocated memory is subtracted from inuse, while it was never added to inuse.
Span leftovers are subtracted from both inuse and idle,
while they were never added.
Fixes issue 8544.
Fixes issue 8430.

LGTM=khr, cookieo9
R=golang-codereviews, khr, cookieo9
CC=golang-codereviews, rlh, rsc
https://codereview.appspot.com/130200044
runtime: improve diagnostics of non-copyable frames

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://codereview.appspot.com/124560043
cmd/gc: fix heap buffer overflow
Fixes issue 8528.

LGTM=rsc
R=rsc, r, iant, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/128230045
runtime: convert Gosched to Go

LGTM=rlh, khr
R=golang-codereviews, rlh, bradfitz, khr
CC=golang-codereviews, rsc
https://codereview.appspot.com/127490043
runtime: fix MemStats on 32-bits
Int64's do not fit into uintptr's.

LGTM=khr
R=golang-codereviews, khr, rsc
CC=golang-codereviews, rlh
https://codereview.appspot.com/128380043
runtime: allow copying of onM frame
Currently goroutines in onM can't be copied/shrunk
(including the very goroutine that triggers GC).
Special case onM to allow copying.

LGTM=daniel.morsing, khr
R=golang-codereviews, daniel.morsing, khr, rsc
CC=golang-codereviews, rlh
https://codereview.appspot.com/124550043
runtime: always pass type to mallocgc when allocating scannable memory
We allocate scannable memory w/o type only in few places in runtime.
All these cases are not-performance critical (e.g. G or finq args buffer),
and in long term they all need to go away.
It's not worth it to have special code for this case in mallocgc.
So use special fake "notype" type for such allocations.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://codereview.appspot.com/127450044
runtime: make the GC bitmap a byte array
Half the code in the garbage collector accesses the bitmap
as an array of bytes instead of as an array of uintptrs.
This is tricky to do correctly in a portable fashion,
it breaks on big-endian systems.
Make the bitmap a byte array.
Simplifies markallocated, scanblock and span sweep along the way,
as we don't need to recalculate bitmap position for each word.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://codereview.appspot.com/125250043
cmd/6a, cmd/8a: document AJxx condition codes

LGTM=ruiu, rsc
R=rsc, ruiu
CC=golang-codereviews
https://codereview.appspot.com/130870043
runtime: fix TestGcLastTime on windows
Intended to fix:
http://build.golang.org/log/d6718ea67541b8c6be2bb14bcbc4e1c4261f67d7

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews
https://codereview.appspot.com/127520043
runtime: fix typo in comment

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/125500043
net/http: fix TimeoutHandler data races; hold lock longer

The existing lock needed to be held longer. If a timeout occured
while writing (but after the guarded timeout check), the writes
would clobber a future connection's buffer.

Also remove a harmless warning by making Write also set the
flag that headers were sent (implicitly), so we don't try to
write headers later (a no-op + warning) on timeout after we've
started writing.

Fixes Issue 8414
Fixes Issue 8209

LGTM=ruiu, adg
R=adg, ruiu
CC=golang-codereviews
https://codereview.appspot.com/123610043
syscall: replace zsyscall_windows_*.go files with a single file

zsyscall_windows_386.go and zsyscall_windows_amd64.go contain same bytes

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://codereview.appspot.com/124640043
runtime: add atomicor8 for amd64p32

LGTM=khr
R=golang-codereviews, daniel.morsing, khr, rsc
CC=golang-codereviews, khr, rlh
https://codereview.appspot.com/131950043
runtime: convert memclrBytes to Go

LGTM=khr
R=khr
CC=golang-codereviews
https://codereview.appspot.com/131980043
runtime: remove unused variable

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/128230047
runtime: convert MemProfile, BlockProfile, ThreadCreateProfile to Go.

LGTM=khr
R=golang-codereviews, bradfitz, khr
CC=golang-codereviews
https://codereview.appspot.com/123680043
cmd/api: add missing runtime struct
Fixes build.

TBR=khr
R=golang-codereviews
CC=golang-codereviews, khr
https://codereview.appspot.com/130390044
runtime: fix deadlock when gctrace
Calling ReadMemStats which does stoptheworld on m0 holding locks
was not a good idea.
Stoptheworld holding locks is a recipe for deadlocks (added check for this).
Stoptheworld on g0 may or may not work (added check for this as well).
As far as I understand scavenger will print incorrect numbers now,
as stack usage is not subtracted from heap. But it's better than deadlocking.

LGTM=khr
R=golang-codereviews, rsc, khr
CC=golang-codereviews, rlh
https://codereview.appspot.com/124670043
runtime: init GC later
Init GC later as it needs to read GOGC env var.
Fixes issue 8562.

LGTM=daniel.morsing, rsc
R=golang-codereviews, daniel.morsing, rsc
CC=golang-codereviews, khr, rlh
https://codereview.appspot.com/130990043