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

283 Commits

Author SHA1 Message Date
Russ Cox
8ac35be145 runtime: fix build failures after CL 137410043
No promise about correctness, but they do build.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/143720043
2014-09-09 14:02:37 -04:00
Russ Cox
15b76ad94b runtime: assume precisestack, copystack, StackCopyAlways, ScanStackByFrames
Commit to stack copying for stack growth.

We're carrying around a surprising amount of cruft from older schemes.
I am confident that precise stack scans and stack copying are here to stay.

Delete fallback code for when precise stack info is disabled.
Delete fallback code for when copying stacks is disabled.
Delete fallback code for when StackCopyAlways is disabled.
Delete Stktop chain - there is only one stack segment now.
Delete M.moreargp, M.moreargsize, M.moreframesize, M.cret.
Delete G.writenbuf (unrelated, just dead).
Delete runtime.lessstack, runtime.oldstack.
Delete many amd64 morestack variants.
Delete initialization of morestack frame/arg sizes (shortens split prologue!).

Replace G's stackguard/stackbase/stack0/stacksize/
syscallstack/syscallguard/forkstackguard with simple stack
bounds (lo, hi).

Update liblink, runtime/cgo for adjustments to G.

LGTM=khr
R=khr, bradfitz
CC=golang-codereviews, iant, r
https://golang.org/cl/137410043
2014-09-09 13:39:57 -04:00
Alex Brainman
d72029e3a3 undo CL 140110043 / 17b5fc2aa130
I have found better approach, then longer wait.
See CL 134360043 for details.

««« original CL description
runtime/pprof: adjust cpuHogger so that tests pass on windows builders

LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/140110043

»»»

LGTM=dave
R=golang-codereviews, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/133500043
2014-09-09 16:05:00 +10:00
Russ Cox
bffb0590c1 runtime: merge mallocgc, gomallocgc
I assumed they were the same when I wrote
cgocallback.go earlier today. Merge them
to eliminate confusion.

I can't tell what gomallocgc did before with
a nil type but without FlagNoScan.
I created a call like that in cgocallback.go
this morning, translating from a C file.
It was supposed to do what the C version did,
namely treat the block conservatively.
Now it will.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/141810043
2014-09-09 01:08:34 -04:00
Russ Cox
0f99a91bb5 runtime: let stack copier update Panic structs for us
It already is updating parts of them; we're just getting lucky
retraversing them and not finding much to do.
Change argp to a pointer so that it will be updated too.
Existing tests break if you apply the change to adjustpanics
without also updating the type of argp.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/139380043
2014-09-08 21:02:36 -04:00
Keith Randall
55c458e05f runtime: on bigger maps, start iterator at a random bucket.
This change brings the iter/delete pattern down to O(n lgn) from O(n^2).

Fixes #8412.

before:
BenchmarkMapPop100	   50000	     32498 ns/op
BenchmarkMapPop1000	     500	   3244851 ns/op
BenchmarkMapPop10000	       5	 270276855 ns/op

after:
BenchmarkMapPop100	  100000	     16169 ns/op
BenchmarkMapPop1000	    5000	    300416 ns/op
BenchmarkMapPop10000	     300	   5990814 ns/op

LGTM=iant
R=golang-codereviews, iant, khr
CC=golang-codereviews
https://golang.org/cl/141270043
2014-09-08 17:42:21 -07:00
Russ Cox
815a843b6a runtime: enable StackCopyAlways
It worked at CL 134660043 on the builders,
so I believe it will stick this time.

LGTM=bradfitz
R=khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/141280043
2014-09-08 20:37:28 -04:00
Keith Randall
1d88f9dd4d runtime: note the double-releasem isn't an error.
LGTM=bradfitz
R=dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/136390043
2014-09-08 15:42:48 -07:00
Russ Cox
176020e1b1 runtime: turn off StackCopyAlways
windows/amd64 failure:
http://build.golang.org/log/1ded5e3ef4bd1226f976e3180772f87e6c918255

# ..\misc\cgo\testso
runtime: copystack: locals size info only for syscall.Syscall
fatal error: split stack not allowed

runtime stack:
runtime.throw(0xa64cc7)
        c:/go/src/runtime/panic.go:395 +0xad fp=0x6fde0 sp=0x6fdb0
runtime.newstack()
        c:/go/src/runtime/stack.c:1001 +0x750 fp=0x6ff20 sp=0x6fde0
runtime.morestack()
        c:/go/src/runtime/asm_amd64.s:306 +0x73 fp=0x6ff28 sp=0x6ff20

goroutine 1 [stack growth, locked to thread]:
runtime.freedefer(0xc0820ce120)
        c:/go/src/runtime/panic.go:162 fp=0xc08201b1a0 sp=0xc08201b198
runtime.deferreturn(0xa69420)
        c:/go/src/runtime/panic.go:211 +0xa8 fp=0xc08201b1e8 sp=0xc08201b1a0
runtime.cgocall_errno(0x498c00, 0xc08201b228, 0x0)
        c:/go/src/runtime/cgocall.go:134 +0x10e fp=0xc08201b210 sp=0xc08201b1e8
syscall.Syscall(0x7786b1d0, 0x2, 0xc0820c85b0, 0xc08201b2d8, 0x0, 0x0, 0x0, 0x0)
        c:/go/src/runtime/syscall_windows.c:74 +0x3c fp=0xc08201b260 sp=0xc08201b210
syscall.findFirstFile1(0xc0820c85b0, 0xc08201b2d8, 0x500000000000000, 0x0, 0x0)
        c:/go/src/syscall/zsyscall_windows.go:340 +0x76 fp=0xc08201b2b0 sp=0xc08201b260
syscall.FindFirstFile(0xc0820c85b0, 0xc08210c500, 0xc0820c85b0, 0x0, 0x0)
        c:/go/src/syscall/syscall_windows.go:907 +0x6a fp=0xc08201b530 sp=0xc08201b2b0
os.openDir(0xc0820b2e40, 0x33, 0x0, 0x0, 0x0)
        c:/go/src/os/file_windows.go:96 +0x110 fp=0xc08201b5e0 sp=0xc08201b530
os.OpenFile(0xc0820b2e40, 0x33, 0x0, 0x0, 0x41, 0x0, 0x0)
        c:/go/src/os/file_windows.go:143 +0x1e9 fp=0xc08201b650 sp=0xc08201b5e0

TBR=khr
CC=golang-codereviews
https://golang.org/cl/138230043
2014-09-08 18:07:50 -04:00
Russ Cox
5103500d13 runtime: mark endcgo go:nosplit
Should help windows/amd64.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/134660043
2014-09-08 18:07:33 -04:00
Russ Cox
857d55a3f9 runtime: mark freedefer and deferclass go:nosplit
This should make deferreturn nosplit all the way down,
which should fix the current windows/amd64 failure.
If not, I will change StackCopyAlways back to 0.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/135600043
2014-09-08 17:37:49 -04:00
Russ Cox
318294286a runtime: enable StackCopyAlways
Let's see how close we are to this being ready.
Will roll back if it breaks any builds in non-trivial ways.

LGTM=r, khr
R=iant, khr, r
CC=golang-codereviews
https://golang.org/cl/138200043
2014-09-08 17:23:40 -04:00
Russ Cox
9e7c22938c runtime: undo stray edit from CL 140380043
Was having serious editor problems on Windows.

TBR=brainman, iant
CC=golang-codereviews
https://golang.org/cl/137370043
2014-09-08 17:01:40 -04:00
Russ Cox
201cfe4afb runtime: run sighandler on g0 stack on windows
The sighander has been run at the bottom of the
currently executing goroutine stack, but it's in C,
and we don't want C on our ordinary goroutine stacks.
Worse, it does a lot of stuff, and it might need more
stack space. There is scary code in traceback_windows.go
that talks about stack splits during sighandler.
Moving sighandler to g0 will eliminate the possibility
of stack splits and such, and then we can delete
traceback_windows.go entirely. Win win.

On the builder, all.bat passes with GOARCH=amd64
and all.bat gets most of the way with GOARCH=386
except for a DLL-loading test that I think is unrelated.

Fixes windows build.

TBR=brainman, iant
CC=golang-codereviews
https://golang.org/cl/140380043
2014-09-08 16:56:46 -04:00
Keith Randall
3a3d47db37 runtime: merge panic1.go back into panic.go
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/139370043
2014-09-08 12:33:08 -07:00
Russ Cox
c81a0ed3c5 liblink, runtime: diagnose and fix C code running on Go stack
This CL contains compiler+runtime changes that detect C code
running on Go (not g0, not gsignal) stacks, and it contains
corrections for what it detected.

The detection works by changing the C prologue to use a different
stack guard word in the G than Go prologue does. On the g0 and
gsignal stacks, that stack guard word is set to the usual
stack guard value. But on ordinary Go stacks, that stack
guard word is set to ^0, which will make any stack split
check fail. The C prologue then calls morestackc instead
of morestack, and morestackc aborts the program with
a message about running C code on a Go stack.

This check catches all C code running on the Go stack
except NOSPLIT code. The NOSPLIT code is allowed,
so the check is complete. Since it is a dynamic check,
the code must execute to be caught. But unlike the static
checks we've been using in cmd/ld, the dynamic check
works with function pointers and other indirect calls.
For example it caught sigpanic being pushed onto Go
stacks in the signal handlers.

Fixes #8667.

LGTM=khr, iant
R=golang-codereviews, khr, iant
CC=golang-codereviews, r
https://golang.org/cl/133700043
2014-09-08 14:05:23 -04:00
Keith Randall
526319830b runtime: a few cleanups.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/134630043
2014-09-08 10:14:41 -07:00
Russ Cox
de4964a78c build: more adjustments for move from src/pkg to src
These were missed in CL 134570043.

Fixes nacl, solaris builds.

TBR=r
CC=golang-codereviews
https://golang.org/cl/136320043
2014-09-08 00:22:40 -04:00
Russ Cox
c007ce824d build: move package sources from src/pkg to src
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
2014-09-08 00:08:51 -04:00
Russ Cox
3f6acf1120 move src/runtime -> src/lib/runtime;
only automatic g4 mv here.

R=r
OCL=30002
CL=30007
2009-06-06 22:04:39 -07:00
Russ Cox
b014be75d2 fix 386 malloc tests,
detect 386 darwin breakpoint line.

R=r
DELTA=22  (4 added, 0 deleted, 18 changed)
OCL=29929
CL=29944
2009-06-05 10:59:37 -07:00
Russ Cox
4f30ec7fcb fix 386 log test
R=r
DELTA=13  (0 added, 1 deleted, 12 changed)
OCL=29928
CL=29943
2009-06-05 10:59:25 -07:00
Russ Cox
a52fb815e4 386-related fixes and guards
R=r
DELTA=44  (19 added, 1 deleted, 24 changed)
OCL=29912
CL=29915
2009-06-04 21:09:06 -07:00
Russ Cox
3a0df4c451 more 386 runtime fixes.
can pass many tests;
current stumbling block is an 8l bug.

R=r
DELTA=122  (83 added, 8 deleted, 31 changed)
OCL=29872
CL=29876
2009-06-04 11:16:03 -07:00
Russ Cox
73c10dd967 386 library updates
R=r
DELTA=161  (153 added, 0 deleted, 8 changed)
OCL=29802
CL=29809
2009-06-02 23:22:12 -07:00
Russ Cox
aa3222d88f 32-bit fixes in lessstack.
avoid tight coupling between deferreturn and jmpdefer.
before, jmpdefer knew the exact frame size of deferreturn
in order to pop it off the stack.  now, deferreturn passes
jmpdefer a pointer to the frame above it explicitly.
that avoids a magic constant and should be less fragile.

R=r
DELTA=32  (6 added, 3 deleted, 23 changed)
OCL=29801
CL=29804
2009-06-02 23:02:12 -07:00
Russ Cox
47fe18bf36 Fix godoc deadlock.
The code was already careful not to use malloc/free
for stack growth during calls to malloc.
Avoid them during calls to free too.

R=r
DELTA=9  (7 added, 0 deleted, 2 changed)
OCL=29606
CL=29610
2009-05-29 13:31:53 -07:00
Russ Cox
6e1762c06e 64-bit integer arithmetic.
passes ridiculous test from CL 29569.

R=ken
OCL=29571
CL=29573
2009-05-29 00:13:09 -07:00
Ken Thompson
e2613711aa detect recursive initialization
R=r
OCL=29544
CL=29544
2009-05-28 16:00:55 -07:00
Ken Thompson
77f668a0f1 added protection against race condition
between first and second pass of converting
[]int to string.

R=r
OCL=29467
CL=29467
2009-05-27 15:56:44 -07:00
Ken Thompson
64c3fe05bf string([]int) conversion
R=r
OCL=29466
CL=29466
2009-05-27 15:38:02 -07:00
Russ Cox
a8e4ed6a3d 8g: 64-bit arithmetic and assorted bug fixes;
can run 64-bit sieve and powser.
interfaces are limping along.
next hurdle is floating point.

R=ken
OCL=29418
CL=29423
2009-05-26 21:07:26 -07:00
Russ Cox
1a0a6f9d50 add NUL when allocating strings, to make use
of getenv by low-level runtime easier.
fix 32-bit bug in gc (there are still more).

R=ken
OCL=29415
CL=29415
2009-05-26 17:39:25 -07:00
Russ Cox
5273868f67 32-bit stack switching bug fix
R=ken
OCL=29412
CL=29412
2009-05-26 17:13:39 -07:00
Russ Cox
021abfbd28 8g: hello world works again
* string format changed
	* files got renamed
	* new files that i forgot to check in last time
updates are all copy and paste from 6g

R=ken
OCL=29385
CL=29400
2009-05-26 14:46:06 -07:00
Kai Backman
7943556970 Added enough arm related scaffolding to create a simple
hello.c program linking against the runtime.

R=rsc
APPROVED=rsc
DELTA=178  (175 added, 0 deleted, 3 changed)
OCL=29283
CL=29380
2009-05-26 11:18:42 -07:00
Russ Cox
23e62d169f stricter interface conversion rule: i.(T)
must have non-nil i.

R=ken
OCL=29136
CL=29136
2009-05-20 18:23:19 -07:00
Russ Cox
2da5022bcf change representation of interface values.
this is not a user-visible change.

before, all interface values were

	struct Itype {
		Sigt *type;
		Sigi *inter;
		void *method[n];
	}

	struct Iface {
		void *addr;
		Itype *itype;
	}

the itype is basically a vtable, but it's unnecessary
if the static type is interface{ }.
for interface values with static type empty, the
new representation is

	struct Eface {
		void *addr;
		Sigt *type;
	}

this complicates the code somewhat, but
it reduces the number of Itypes that
have to be computed and cached,
it opens up opportunities to avoid function
calls in a few common cases,
and it will make it possible to lay out
interface{} values at compile time,
which i think i'll need for the new reflection.

R=ken
OCL=28701
CL=29121
2009-05-20 14:57:55 -07:00
Russ Cox
a343e5ceb1 fix handling of line numbers for first function
R=r
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=28949
CL=28951
2009-05-15 17:26:08 -07:00
Russ Cox
918afd9491 move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Rob Pike
c367d1b789 Move sys.Reflect and sys.Unreflect into unsafe.
R=rsc
DELTA=19  (4 added, 5 deleted, 10 changed)
OCL=28563
CL=28566
2009-05-08 14:57:56 -07:00
Russ Cox
f821e3c7c3 6g tweaks
* byteastring is no longer used
	* do not generate ODCL, OAS for globals
	  (wasn't generating any code but might
	  save one or two init functions)
	* do not call self from Init function

R=ken
OCL=28309
CL=28309
2009-05-05 16:53:46 -07:00
Ken Thompson
5963f59067 more morestack fiddling
R=r
OCL=28204
CL=28204
2009-05-03 19:09:14 -07:00
Ken Thompson
1ed7f18165 code improvement
better calling of morestack

R=r
OCL=28179
CL=28179
2009-05-01 18:07:33 -07:00
Russ Cox
89f8238a99 don't set CLONE_PTRACE -- it confuses strace
R=r
DELTA=4  (3 added, 1 deleted, 0 changed)
OCL=28063
CL=28065
2009-04-29 18:54:44 -07:00
Brendan O'Dea
2cf5c809d0 Ignore SIGPIPE such that write returns EPIPE.
Currently a http server will be killed on receipt of SIGPIPE
if a client closes a socket which the server is trying to
write to.

R=rsc
APPROVED=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=27959
CL=28055
2009-04-29 17:36:58 -07:00
Russ Cox
bafd1787fe fix traceback prints - %S was not advancing pointer enough
R=r
DELTA=6  (5 added, 1 deleted, 0 changed)
OCL=27500
CL=27525
2009-04-15 18:52:28 -07:00
Russ Cox
4b8c13dc20 do not create interfaces containing interfaces
R=r
DELTA=16  (14 added, 0 deleted, 2 changed)
OCL=27464
CL=27466
2009-04-14 19:03:57 -07:00
Russ Cox
a9996d0f89 runtime nits: variable name and comments
R=r
DELTA=10  (0 added, 0 deleted, 10 changed)
OCL=27374
CL=27388
2009-04-13 15:22:36 -07:00
Ken Thompson
907509de4a tweak
R=r
OCL=27344
CL=27344
2009-04-12 22:34:36 -07:00