text/template: 0xef is an integer, not a floating-point value.
The discriminator in the execution engine was stupid.
Add a test to the parse package too. The problem wasn't there
but the particular case ('e' in a hex integer) was not covered.

Fixes issue 8622.

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://codereview.appspot.com/133530043
net: fix parsing literal IP address in builtin dns stub resolver

This CL fixes a bug introduced by CL 128820043 which is that
builtin dns stub resolver doesn't work well with literal IPv6
address namesever entries in /etc/resolv.conf.

Also simplifies resolv.conf parser and adds more test cases.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://codereview.appspot.com/140040043
runtime: give 2 words back in notetsleep_internal

I really hoped we could avoid this nonsense, but it appears not.

Should fix windows/amd64 build breakage.

TBR=iant
CC=golang-codereviews
https://codereview.appspot.com/137120043
net: fix parsing literal IPv6 address with zone identifier in builtin dns stub resolver

Fixes issue 8619.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/132560043
runtime: refactor/fix asmcgocall/asmcgocall_errno

Instead of making asmcgocall call asmcgocall_errno,
make both load args into registers and call a shared
assembly function.

On amd64, this costs 1 word in the asmcgocall_errno path
but saves 3 words in the asmcgocall path, and the latter
is what happens on critical nosplit paths on Windows.

On arm, this fixes build failures: asmcgocall was writing
the arguments for asmcgocall_errno into the wrong
place on the stack. Passing them in registers avoids the
decision entirely.

On 386, this isn't really needed, since the nosplit paths
have twice as many words to work with, but do it for consistency.

Update issue 8635
Fixes arm build (except GOARM=5).

TBR=iant
CC=golang-codereviews
https://codereview.appspot.com/134390043
runtime: reject onM calls from gsignal stack

The implementation and use patterns of onM assume
that they run on either the m->curg or m->g0 stack.

Calling onM from m->gsignal has two problems:

(1) When not on g0, onM switches to g0 and then "back" to curg.
If we didn't start at curg, bad things happen.

(2) The use of scalararg/ptrarg to pass C arguments and results
assumes that there is only one onM call at a time.
If a gsignal starts running, it may have interrupted the
setup/teardown of the args for an onM on the curg or g0 stack.
Using scalararg/ptrarg itself would smash those.

We can fix (1) by remembering what g was running before the switch.

We can fix (2) by requiring that uses of onM that might happen
on a signal handling stack must save the old scalararg/ptrarg
and restore them after the call, instead of zeroing them.
The only sane way to do this is to introduce a separate
onM_signalsafe that omits the signal check, and then if you
see a call to onM_signalsafe you know the surrounding code
must preserve the old scalararg/ptrarg values.
(The implementation would be that onM_signalsafe just calls
fn if on the signal stack or else jumps to onM. It's not necessary
to have two whole copies of the function.)

(2) is not a problem if the caller and callee are both Go and
a closure is used instead of the scalararg/ptrarg slots.

For now, I think we can avoid calling onM from code executing
on gsignal stacks, so just reject it.

In the long term, (2) goes away (as do the scalararg/ptrarg slots)
once everything is in Go, and at that point fixing (1) would be
trivial and maybe worth doing just for regularity.

LGTM=iant
R=golang-codereviews, iant
CC=dvyukov, golang-codereviews, khr, r
https://codereview.appspot.com/135400043
runtime: correct various Go -> C function calls

Some things get converted.
Other things (too complex or too many C deps) get onM calls.
Other things (too simple) get #pragma textflag NOSPLIT.

After this CL, the offending function list is basically:
        - panic.c
        - netpoll.goc
        - mem*.c
        - race stuff
        - readgstatus
        - entersyscall/exitsyscall

LGTM=r, iant
R=golang-codereviews, r, iant
CC=dvyukov, golang-codereviews, khr
https://codereview.appspot.com/140930043
runtime: fix sigtrampPC on Windows

The arm5 build breakage at CL 139110043 was caused by
calling funcPC on a lessstack defined as a struct{}.
That symbol ended up with a non-4-aligned address,
which caused the memory fault that broke the builders.
The definition of lessstack was fixed in CL 140880043.

Tracking that down suggested that it would be worth
looking for the same bug elsewhere in the directory.
This is the only one I found.

LGTM=bradfitz
R=golang-codereviews, dave, bradfitz
CC=dvyukov, golang-codereviews, iant, khr, r
https://codereview.appspot.com/134410043
runtime: fix onM test for curg on arm

TBR=iant
CC=golang-codereviews
https://codereview.appspot.com/137130043
runtime: fix int64 reconstruction in semasleep

I had this right in one of my clients, but apparently not the one I submitted from.

Fixes 386 builds.

TBR=dfc
CC=golang-codereviews
https://codereview.appspot.com/138000045
runtime: fix nacl/amd64p32 build

BP is not a legal register on nacl.

TBR=iant
CC=golang-codereviews
https://codereview.appspot.com/140980043
runtime: convert netpoll to Go
The common code is converted, epoll and kqueue are converted.
Windows and solaris are still C.

LGTM=rsc
R=golang-codereviews, rsc, dave
CC=golang-codereviews, iant, khr, rsc
https://codereview.appspot.com/132910043
runtime: fix arm build

TBR=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/140990043
runtime: fix Plan 9 build

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/138050043
runtime: fix typos

LGTM=dvyukov
R=dvyukov
CC=golang-codereviews
https://codereview.appspot.com/141000043
runtime: fix netbsd build

TBR=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/140220043
runtime: fix solaris netpoll

TBR=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/141030043
androidtest.bash: drop noisy adb sync output

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/138070043
go/parser: initialize file set even in only some tests are run

Without this fix, some tests crashed (e.g. go test -run Invalid).

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://codereview.appspot.com/133580043
runtime: reconvert sigqueue.goc from C to Go

The original conversion in CL 132090043 cut up
the function in an attempt to avoid converting most
of the code to Go. This contorts the control flow.

While debugging the onM signal stack bug,
I reconverted sigqueue.goc in its entirety.
This restores the original control flow, which is
much easier to understand.

The current conversion is correct, it's just complex
and will be hard to maintain. The new one is as
readable as the original code.

I uploaded sigqueue.goc as the initial copy of
sigqueue.go in the CL, so if you view the diffs
of sigqueue.go comparing against patch set 2 [sic]
it will show the actual starting point.

For example:
https://codereview.appspot.com/136160043/diff2/20001:60001/src/pkg/runtime/sigqueue.go

LGTM=dvyukov, iant
R=golang-codereviews, dvyukov, iant
CC=golang-codereviews, khr, r
https://codereview.appspot.com/136160043