1
0
mirror of https://github.com/golang/go synced 2024-10-01 18:18:32 -06:00
Commit Graph

21080 Commits

Author SHA1 Message Date
Austin Clements
b76e836042 [dev.cc] runtime: allow more address bits in lfstack on Power64
Previously, lfstack assumed Linux limited user space addresses
to 43 bits on Power64 based on a paper from 2001.  It turns
out the limit is now 46 bits, so lfstack was truncating
pointers.

Raise the limit to 48 bits (for some future proofing and to
make it match amd64) and add a self-test that will fail in a
useful way if ever unpack(pack(x)) != x.

With this change, dev.cc passes all.bash on power64le.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/174430043
2014-11-19 11:30:58 -05:00
Alex Brainman
b27c0618eb [dev.cc] runtime: update sys_windows_386.s and sys_windows_amd64.s for Go conversion
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/176970043
2014-11-19 11:55:15 +11:00
Austin Clements
f4627d1b05 [dev.cc] runtime: merge power64 onM/onM_signalok into systemstack
This is the power64 component of CL 174950043.

With this, dev.cc compiles on power64 and power64le and passes
most tests if GOGC=off (but crashes in go_bootstrap if GC is
on).

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/175290043
2014-11-18 15:50:36 -05:00
Austin Clements
70f6769b60 [dev.cc] runtime: catch defs_linux_power64*.go up to other archs
Fix a constant conversion error.  Add set_{sec,nsec} for
timespec and set_usec for timeval.  Fix type of
sigaltstackt.ss_size.

LGTM=rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/180840043
2014-11-18 15:19:48 -05:00
Austin Clements
0da27cb8b0 [dev.cc] runtime: convert power64-specific .c and .h files to Go
The power64 equivalent of CL 174860043

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/179890043
2014-11-18 15:19:37 -05:00
Austin Clements
3f27c3ae37 [dev.cc] runtime: convert power64 assembly files for C to Go transition
The power64 equivalent of CL 168510043

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/178940043
2014-11-18 15:19:26 -05:00
Austin Clements
54d731452d [dev.cc] runtime: convert power64 signal handlers from C to Go
The power64 equivalent of CL 168500044

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/175280043
2014-11-18 15:19:09 -05:00
Austin Clements
cf06ea68d5 [dev.cc] 9a: make RET a synonym for RETURN; use "g" instead of "R30"
Previously, 9a was the only assembler that had a different
name for RET, causing unnecessary friction in simple files
that otherwise assembled on all architectures.  Add RET so
these work on 9a.

This also renames "R30" to "g" to avoid unintentionally
clobbering g in assembly code.  This parallels a change made
to 5a.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/178030043
2014-11-18 15:18:52 -05:00
Austin Clements
1a68ac2538 [dev.cc] cmd/9c: remove
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/175940043
2014-11-18 15:18:42 -05:00
Russ Cox
0fe444d3e8 [dev.cc] runtime: generate GOOS- and GOARCH-specific files with go generate
Eventually I'd like almost everything cmd/dist generates
to be done with 'go generate' and checked in, to simplify
the bootstrap process. The only thing cmd/dist really needs
to do is write things like the current experiment info and
the current version.

This is a first step toward that. It replaces the _NaCl etc
constants with generated ones goos_nacl, goos_darwin,
goarch_386, and so on.

LGTM=dave, austin
R=austin, dave, bradfitz
CC=golang-codereviews, iant, r
https://golang.org/cl/174290043
2014-11-18 12:07:50 -05:00
Russ Cox
312a64ec4e [dev.cc] runtime: convert defs_linux_power64*.h to go
LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/176990043
2014-11-18 11:38:23 -05:00
Austin Clements
0e8fed098c [dev.cc] runtime: two missed references to "M stack"
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/177940043
2014-11-18 09:54:50 -05:00
David du Colombier
2c2a6df4e9 [dev.cc] cmd/gc: fix warning on Plan 9
warning: src/cmd/gc/walk.c:1769 set and not used: on

LGTM=rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/175850043
2014-11-17 20:46:42 +01:00
Alex Brainman
fc288681cf [dev.cc] runtime: replace deleted netpollfd function
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/169710043
2014-11-17 17:18:21 +11:00
David du Colombier
7aa89ea798 [dev.cc] cmd/8g: work around "out of fixed registers" on Plan 9
This change works around the "out of fixed registers"
issue with the Plan 9 C compiler on 386, introduced by
the Bits change to uint64 in CL 169060043.

The purpose of this CL is to be able to properly
follow the conversion of the Plan 9 runtime to Go
on the Plan 9 builders.

This CL could be reverted once the Go compilers will
be converted to Go.

Thanks to Nick Owens for investigating this issue.

LGTM=rsc
R=rsc
CC=austin, golang-codereviews, mischief
https://golang.org/cl/177860043
2014-11-16 22:55:07 +01:00
Dave Cheney
2ceca80e3f [dev.cc] runtime: fix _sfloat thunk
* _sfloat dispatches to runtime._sfloat2 with the Go calling convention, so the seecond argument is a [15]uint32, not a *[15]uint32.
* adjust _sfloat2 to return the new pc in 68(R13) as expected.

LGTM=rsc
R=minux, austin, rsc
CC=golang-codereviews
https://golang.org/cl/174160043
2014-11-15 13:27:05 +11:00
Dave Cheney
14d23bfd7b [dev.cc] runtime: fix bus error accessing auxv random data on arm5
It's rather unsporting of the kernel to give us a pointer to unaligned memory.

This fixes one crash, the next crash occurs in the soft float emulation.

LGTM=minux, rsc, austin
R=minux, rsc, austin
CC=golang-codereviews
https://golang.org/cl/177730043
2014-11-15 09:57:02 +11:00
David du Colombier
1f420c13bd [dev.cc] liblink: fix warnings on Plan 9
warning: src/liblink/asm9.c:501 set and not used: bflag
warning: src/liblink/list9.c:259 format mismatch .5lux INT, arg 4
warning: src/liblink/list9.c:261 format mismatch .5lux INT, arg 3
warning: src/liblink/list9.c:319 more arguments than format VLONG
warning: src/liblink/obj9.c:222 set and not used: autoffset

LGTM=bradfitz, austin
R=rsc, bradfitz
CC=austin, golang-codereviews
https://golang.org/cl/175070043
2014-11-14 22:57:33 +01:00
Russ Cox
580cba42f4 [dev.cc] runtime: change set_sec to take int64
Fixes build.
Tested that all these systems can make.bash.

TBR=austin
CC=golang-codereviews
https://golang.org/cl/177770043
2014-11-14 14:50:00 -05:00
Russ Cox
5fce15a2a3 [dev.cc] runtime: fix lfstack for amd64 addresses in top half of addr space
While we are here, add the linux/power64 version.

LGTM=austin
R=austin
CC=aram, dvyukov, golang-codereviews
https://golang.org/cl/177750043
2014-11-14 12:55:23 -05:00
Russ Cox
a87e4a2d01 [dev.cc] runtime: fix linux build
TBR=austin
CC=golang-codereviews
https://golang.org/cl/176760044
2014-11-14 12:55:10 -05:00
Joel Sing
1d05d5880e [dev.cc] runtime: convert dragonfly/amd64 port to Go
LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/176750043
2014-11-15 04:47:20 +11: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
Joel Sing
9ad6b7e322 [dev.cc] runtime: convert openbsd/386 port to Go
LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/173200044
2014-11-15 03:55:14 +11:00
Aram Hăvărneanu
9d6825edee [dev.cc] runtime: fix nil pointer crash handler bug on Solaris
This change fixes the Solaris port.

LGTM=dave, rsc
R=rsc, dave
CC=brad, golang-codereviews
https://golang.org/cl/168600045
2014-11-14 14:25:49 +01:00
Alex Brainman
0438182c30 [dev.cc] runtime: convert netpoll_windows.c to Go
LGTM=rsc
R=rsc
CC=dvyukov, golang-codereviews
https://golang.org/cl/172530043
2014-11-14 14:07:28 +11:00
Joel Sing
ba603c3100 [dev.cc] runtime: convert openbsd/amd64 port to Go
LGTM=rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/171660043
2014-11-14 13:01:12 +11:00
Austin Clements
743bdf612a [dev.power64] 9g: implement regopt
This adds registerization support to 9g equivalent to what the
other compilers have.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/174980043
2014-11-13 13:51:44 -05:00
Austin Clements
231b8d61e9 [dev.power64] 9l: remove enum as's tag for c2go
None of the other compilers have a tag for this enum.
Cleaning all of this up to use proper types will happen after
the conversion.

LGTM=minux, rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/166690043
2014-11-13 13:48:59 -05:00
Austin Clements
c3dadb3d19 [dev.power64] 6g,8g: remove unnecessary and incorrect reg use scanning
Previously, the 6g and 8g registerizers scanned for used
registers beyond the end of a region being considered for
registerization.  This ancient artifact was copied from the C
compilers, where it was probably necessary to track implicitly
used registers.  In the Go compilers it's harmless (because it
can only over-restrict the set of available registers), but no
longer necessary because the Go compilers correctly track
register use/set information.  The consequences of this extra
scan were (at least) that 1) we would not consider allocating
the AX register if there was a deferproc call in the future
because deferproc uses AX as a return register, so we see the
use of AX, but don't track that AX is set by the CALL, and 2)
we could not consider allocating the DX register if there was
a MUL in the future because MUL implicitly sets DX and (thanks
to an abuse of copyu in this code) we would also consider DX
used.

This commit fixes these problems by nuking this code.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/174110043
2014-11-13 13:34:20 -05:00
Joel Sing
b2ec4cf50c [dev.cc] runtime: make SIGSYS notifiable on freebsd (again)
This was originally done to the C port in rev 17d3b45534b5 and
seemingly got lost during the conversion.

LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/167700043
2014-11-14 04:29:03 +11:00
Aram Hăvărneanu
e088e16256 [dev.cc] runtime: convert Solaris port to Go
Memory management was consolitated with the BSD ports, since
it was almost identical.

Assembly thunks are gone, being replaced by the new //go:linkname
feature.

This change supersedes CL 138390043 (runtime: convert solaris
netpoll to Go), which was previously reviewed and tested.

This change is only the first step, the port now builds,
but doesn't run. Binaries fail to exec:

    ld.so.1: 6.out: fatal: 6.out: TLS requirement failure : TLS support is unavailable
    Killed

This seems to happen because binaries don't link with libc.so
anymore. We will have to solve that in a different CL.

Also this change is just a rough translation of the original
C code, cleanup will come in a different CL.

[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

LGTM=rsc
R=rsc, dave
CC=golang-codereviews, iant, khr, minux, r, rlh
https://golang.org/cl/174960043
2014-11-13 16:07:10 +01:00
Alex Brainman
a0862a175d [dev.cc] runtime: convert mem_windows.c to Go
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/175000043
2014-11-13 14:53:13 +11:00
Alex Brainman
e5d01a5ffc [dev.cc] runtime: add missing cb_max const
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/169490043
2014-11-13 12:05:36 +11:00
Austin Clements
8c060d9392 [dev.power64] liblink: improve documentation of struct Prog
LGTM=dave, rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/169460043
2014-11-12 17:19:02 -05:00
Joel Sing
37cae806cb [dev.cc] [dev.cc] runtime: fix freebsd cgo __progname export
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/174050043
2014-11-12 17:18:22 -05:00
Austin Clements
60f66aa817 [dev.power64] 9g: proginfo fixes
For D_OREG addresses, store the used registers in regindex
instead of reguse because they're really part of addressing.

Add implicit register use/set for DUFFZERO/DUFFCOPY.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/174050044
2014-11-12 14:58:43 -05:00
Russ Cox
656be317d0 [dev.cc] runtime: delete scalararg, ptrarg; rename onM to systemstack
Scalararg and ptrarg are not "signal safe".
Go code filling them out can be interrupted by a signal,
and then the signal handler runs, and if it also ends up
in Go code that uses scalararg or ptrarg, now the old
values have been smashed.
For the pieces of code that do need to run in a signal handler,
we introduced onM_signalok, which is really just onM
except that the _signalok is meant to convey that the caller
asserts that scalarg and ptrarg will be restored to their old
values after the call (instead of the usual behavior, zeroing them).

Scalararg and ptrarg are also untyped and therefore error-prone.

Go code can always pass a closure instead of using scalararg
and ptrarg; they were only really necessary for C code.
And there's no more C code.

For all these reasons, delete scalararg and ptrarg, converting
the few remaining references to use closures.

Once those are gone, there is no need for a distinction between
onM and onM_signalok, so replace both with a single function
equivalent to the current onM_signalok (that is, it can be called
on any of the curg, g0, and gsignal stacks).

The name onM and the phrase 'm stack' are misnomers,
because on most system an M has two system stacks:
the main thread stack and the signal handling stack.

Correct the misnomer by naming the replacement function systemstack.

Fix a few references to "M stack" in code.

The main motivation for this change is to eliminate scalararg/ptrarg.
Rick and I have already seen them cause problems because
the calling sequence m.ptrarg[0] = p is a heap pointer assignment,
so it gets a write barrier. The write barrier also uses onM, so it has
all the same problems as if it were being invoked by a signal handler.
We worked around this by saving and restoring the old values
and by calling onM_signalok, but there's no point in keeping this nice
home for bugs around any longer.

This CL also changes funcline to return the file name as a result
instead of filling in a passed-in *string. (The *string signature is
left over from when the code was written in and called from C.)
That's arguably an unrelated change, except that once I had done
the ptrarg/scalararg/onM cleanup I started getting false positives
about the *string argument escaping (not allowed in package runtime).
The compiler is wrong, but the easiest fix is to write the code like
Go code instead of like C code. I am a bit worried that the compiler
is wrong because of some use of uninitialized memory in the escape
analysis. If that's the reason, it will go away when we convert the
compiler to Go. (And if not, we'll debug it the next time.)

LGTM=khr
R=r, khr
CC=austin, golang-codereviews, iant, rlh
https://golang.org/cl/174950043
2014-11-12 14:54:31 -05:00
Russ Cox
e98f2d597e [dev.cc] runtime/cgo: add comment about import _ "unsafe"
LGTM=bradfitz, r
R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/167650043
2014-11-12 14:54:04 -05:00
Austin Clements
c1e8c57c3d [dev.power64] 9g: fix width check and width calculation for OADDR
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/174970043
2014-11-12 14:16:49 -05:00
Russ Cox
a9695a5d38 [dev.cc] runtime/cgo: fix freebsd build?
Last try and then someone with a FreeBSD has to do it.

TBR=r
CC=golang-codereviews
https://golang.org/cl/171590043
2014-11-11 23:28:26 -05:00
Russ Cox
9e719ceefe [dev.cc] runtime: fix arm5 build
TBR=r
CC=golang-codereviews
https://golang.org/cl/168600043
2014-11-11 23:24:54 -05:00
Russ Cox
22293bb1a4 [dev.cc] runtime/cgo: add missing import _ "unsafe" for //go:linkname
Will prod freebsd build along.
Not claiming it will fix it.

TBR=r
CC=golang-codereviews
https://golang.org/cl/171580044
2014-11-11 23:19:59 -05:00
Russ Cox
aac17fd4e1 [dev.cc] runtime: convert freebsd to Go
It builds.
Don't know if it works, but it's a lot closer than having everything in C.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/168590043
2014-11-11 23:00:29 -05:00
Russ Cox
c81d248eca [dev.cc] runtime: convert softfloat_arm.c to Go + build fixes
Also include onM_signalok fix from issue 8995.

Fixes linux/arm build.
Fixes #8995.

LGTM=r
R=r, dave
CC=golang-codereviews
https://golang.org/cl/168580043
2014-11-11 22:30:02 -05:00
Russ Cox
8420df622a [dev.cc] runtime: bring back mgc0.h
This was recorded as an hg mv instead of an hg cp.
For now a C version is needed for the Go compiler.

TBR=r
CC=golang-codereviews
https://golang.org/cl/174020043
2014-11-11 18:50:02 -05:00
Russ Cox
9204821731 [dev.cc] runtime: convert arch-specific .c and .h files to Go
The conversion was done with an automated tool and then
modified only as necessary to make it compile and run.

vlrt.c was only called from C. Pure delete.

[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

LGTM=r
R=r, austin
CC=dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/174860043
2014-11-11 17:09:09 -05:00
Russ Cox
e785e3acf8 [dev.cc] runtime: convert operating system support code from C to Go
The conversion was done with an automated tool and then
modified only as necessary to make it compile and run.

[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

LGTM=r
R=r
CC=austin, dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/174830044
2014-11-11 17:08:54 -05:00
Russ Cox
b2cdf30eb6 [dev.cc] runtime: convert scheduler from C to Go
The conversion was done with an automated tool and then
modified only as necessary to make it compile and run.

[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

LGTM=r
R=r, daniel.morsing
CC=austin, dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/172260043
2014-11-11 17:08:33 -05:00
Russ Cox
59e3e5354d [dev.cc] runtime: convert race implementation from C to Go
The conversion was done with an automated tool and then
modified only as necessary to make it compile and run.

[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

LGTM=r
R=r
CC=austin, dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/172250044
2014-11-11 17:08:14 -05:00