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

174 Commits

Author SHA1 Message Date
Russ Cox
e4f06812c5 runtime: instrument malloc + garbage collector.
add simple garbage collection benchmark.

R=iant
CC=golang-dev
https://golang.org/cl/204053
2010-02-08 14:32:22 -08:00
Russ Cox
87915b6565 runtime: introduce MemStatsType
R=ken2
CC=golang-dev
https://golang.org/cl/204061
2010-02-07 01:20:44 -08:00
Kai Backman
ebf32c5868 fix comment
R=rsc
CC=golang-dev
https://golang.org/cl/203053
2010-02-06 21:59:46 -08:00
Andrew Gerrand
8ec9ffc742 6l: move mapped symbol table lower in memory
Allows binary to run on some Linux system.

Fix for issue 365.

R=rsc
CC=golang-dev
https://golang.org/cl/199096
2010-02-04 12:46:11 -08:00
Christopher Wedgwood
43d2e59a81 os/signal: send SIGCHLDs to Incoming
R=rsc
CC=golang-dev
https://golang.org/cl/199082
2010-02-03 23:24:28 -08:00
Russ Cox
33e396a4a7 finalizers; merge package malloc into package runtime
R=r, cw
CC=golang-dev
https://golang.org/cl/198085
2010-02-03 16:31:34 -08:00
Russ Cox
1f11ece67f nacl: fix build, finally fixed 8l convergence bug
R=r
CC=golang-dev
https://golang.org/cl/199042
2010-02-01 15:20:19 -08:00
Russ Cox
68796b0270 gc: add ... T, rework plain ...
No longer a distinct type; now a property of func types.

R=ken2
CC=golang-dev
https://golang.org/cl/197042
2010-02-01 00:25:59 -08:00
Russ Cox
a186b77b03 gc: implement defer print/println/panic/panicln
Fixes #219.

R=ken2, r
CC=golang-dev
https://golang.org/cl/194097
2010-01-27 15:37:08 -08:00
Kai Backman
9f5264f299 small embedded target for arm.
R=rsc
CC=golang-dev
https://golang.org/cl/193104
2010-01-26 20:22:59 -08:00
Russ Cox
718be3215f in C and asm, replace pkg·name with ·name
(eliminate assumption of package global name space,
make code easier to move between packages).

R=r
CC=golang-dev
https://golang.org/cl/194072
2010-01-25 18:52:55 -08:00
Russ Cox
1912632019 runtime, type switch: eliminate package global name space assumption
bonus: type switch now detects multiple uses of identical interface types.
bonus: interface types are now order-independent, following the spec.

R=ken2
CC=golang-dev
https://golang.org/cl/194053
2010-01-25 18:23:20 -08:00
Russ Cox
1cecac8134 gc: record full package paths in runtime type data
detect compilation of special package runtime with
compiler flag instead of package name.

R=ken2
CC=golang-dev
https://golang.org/cl/193080
2010-01-24 23:33:59 -08:00
Russ Cox
0365b989a4 runtime: wait to allocate mach semaphores backing Locks until needed
need better management of mach semaphores eventually
but this avoids allocating them for uncontended Locks.

R=r
CC=agl1, golang-dev
https://golang.org/cl/190079
2010-01-19 21:14:15 -08:00
Russ Cox
da9bc7ae7d runtime: add demo running Go on raw (emulated) hw
8l: add GOOS=pchw, stop spelling out all the elf numbers.

R=r
CC=golang-dev
https://golang.org/cl/186144
2010-01-13 19:51:59 -08:00
Devon H. O'Dell
1564b984a5 runtime: GS already set up by setldt in Linux/386; remove duplicate
R=rsc
CC=golang-dev
https://golang.org/cl/186146
2010-01-13 17:50:12 -08:00
Russ Cox
12518e441b runtime cleanup.
* move memory code into $GOOS-specific directory.
  * allow printing of static strings < 256 bytes.
    (dynamic strings will bump maxstring as they are allocated.)
  * use cgo2c for runtime.mal.

R=r, dho
CC=golang-dev
https://golang.org/cl/186143
2010-01-13 17:50:02 -08:00
Russ Cox
f85abf01bc runtime: reset DF flag after running external code on 386
R=r
CC=golang-dev
https://golang.org/cl/186108
2010-01-13 09:08:39 -08:00
Russ Cox
711088106e runtime: fix bug in preemption checks; was causing "lock count" panics
R=r
CC=golang-dev
https://golang.org/cl/186078
2010-01-12 10:03:02 -08:00
Russ Cox
5328df6534 runtime: check for preemption due to garbage collection
in various already expensive routines.

helps keep cpu utilization up when GOMAXPROCS > 1,
but not a full solution.

http://groups.google.com/group/golang-nuts/t/7a9535c4136d3e2

R=r
CC=golang-dev
https://golang.org/cl/184043
2010-01-09 09:47:45 -08:00
Russ Cox
74a9fc18f6 runtime: close TODO now that 8c bug is fixed
R=r
CC=golang-dev
https://golang.org/cl/183138
2010-01-06 19:24:11 -08:00
Hector Chu
6bfe5f55f4 Ported runtime to Windows.
R=rsc
CC=golang-dev
https://golang.org/cl/176066
2010-01-06 17:58:55 -08:00
Adam Langley
50d6c81d4a runtime: fix race condition
(Thanks to ken and rsc for pointing this out)

rsc:
	ken pointed out that there's a race in the new
	one-lock-per-channel code.  the issue is that
	if one goroutine has gone to sleep doing

	select {
	case <-c1:
	case <-c2:
	}

	and then two more goroutines try to send
	on c1 and c2 simultaneously, the way that
	the code makes sure only one wins is the
	selgen field manipulation in dequeue:

	       // if sgp is stale, ignore it
	       if(sgp->selgen != sgp->g->selgen) {
		       //prints("INVALID PSEUDOG POINTER\n");
		       freesg(c, sgp);
		       goto loop;
	       }

	       // invalidate any others
	       sgp->g->selgen++;

	but because the global lock is gone both
	goroutines will be fiddling with sgp->g->selgen
	at the same time.

This results in a 7% slowdown in the single threaded case for a
ping-pong microbenchmark.

Since the cas predominantly succeeds, adding a simple check first
didn't make any difference.

R=rsc
CC=golang-dev
https://golang.org/cl/180068
2009-12-18 12:25:53 -08:00
Kai Backman
d85bb81878 first stub for softfloats, intercepts float instructions and skips
them in the stream.

R=rsc
https://golang.org/cl/174052
2009-12-17 16:08:42 -08:00
Russ Cox
08579c26dd runtime: if os/signal is not in use, crash on
most signals, so that ordinary programs
	can be killed, for example.

Fixes #434.

R=dsymonds1
CC=golang-dev, hoisie
https://golang.org/cl/180064
2009-12-16 20:20:50 -08:00
David Symonds
b5866494ea os/signal: new package
Fixes #71.

R=rsc, r
https://golang.org/cl/162056
2009-12-15 18:21:29 -08:00
Russ Cox
d16bc7a9f2 runtime: return zero value in x, ok = <-c when ok == false
Fixes #401.

R=ken2
https://golang.org/cl/180053
2009-12-15 16:59:23 -08:00
Robert Griesemer
d65a5cce89 1) Change default gofmt default settings for
parsing and printing to new syntax.

   Use -oldparser to parse the old syntax,
   use -oldprinter to print the old syntax.

2) Change default gofmt formatting settings
   to use tabs for indentation only and to use
   spaces for alignment. This will make the code
   alignment insensitive to an editor's tabwidth.

   Use -spaces=false to use tabs for alignment.

3) Manually changed src/exp/parser/parser_test.go
   so that it doesn't try to parse the parser's
   source files using the old syntax (they have
   new syntax now).

4) gofmt -w src misc test/bench

4th set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180049
2009-12-15 15:40:16 -08:00
Russ Cox
19c18358ca runtime: in exitsyscall, avoid confusing garbage collector
R=r
CC=golang-dev
https://golang.org/cl/178046
2009-12-14 19:06:20 -08:00
Devon H. O'Dell
857d4cf1a9 Remove GOBIN in PATH dependency; don't assume cwd is $GOROOT/src
This change removes the necessity to have GOBIN in $PATH,
and also doesn't assume that the build is being run from
$GOROOT/src. This is a minimal set of necessary changes
to get Go to build happily from the FreeBSD ports
collection.

R=rsc
CC=golang-dev
https://golang.org/cl/171044
2009-12-11 15:14:09 -08:00
Kai Backman
d08d33f389 fix calling convention and make memmove restore the g and m
registers.

R=rsc
https://golang.org/cl/166049
2009-12-10 11:42:01 -08:00
Russ Cox
0400a7f8b1 runtime: start new darwin/amd64 threads on correct stack,
then enable stack check.

R=r
https://golang.org/cl/165100
2009-12-08 23:34:45 -08:00
Devon H. O'Dell
5a4a08fab8 Fix stack on FreeBSD / add stack check across the board
FreeBSD was passing stk as the new thread's stack base, while
stk is the top of the stack in go. The added check should cause
a trap if this ever comes up in any new ports, or regresses
in current ones.

R=rsc
CC=golang-dev
https://golang.org/cl/167055
2009-12-08 18:19:30 -08:00
Devon H. O'Dell
cdce7325c8 When SA_SIGINFO is set, we should use __sa_sigaction on FreeBSD
R=rsc
CC=golang-dev
https://golang.org/cl/165097
2009-12-08 18:18:04 -08:00
Russ Cox
0d3301a557 runtime: don't touch pages of memory unnecessarily.
cuts working size for hello world from 6 MB to 1.2 MB.
still some work to be done, but diminishing returns.

R=r
https://golang.org/cl/165080
2009-12-07 15:52:14 -08:00
Russ Cox
33649bd278 runtime: introduce unsafe.New and unsafe.NewArray
to provide functionality previously hacked in to
    reflect and gob.

R=r
https://golang.org/cl/165076
2009-12-07 15:51:58 -08:00
Rob Pike
20c1ec263a pick off special one-byte case in copy. worth 2x in benchmarks (38ns->16ns).
the one-item case could be generalized easily with no cost. worth considering.

R=rsc
CC=golang-dev, cw
https://golang.org/cl/167044
2009-12-07 11:28:02 -08:00
Russ Cox
ed6fd1bcbe runtime: disable pointer scan optimization
* broken by reflect, gob

TBR=r
https://golang.org/cl/166077
2009-12-06 08:18:58 -08:00
Russ Cox
864c757a1c gc/runtime: pass type structure to makeslice.
* inform garbage collector about memory with no pointers in it

1.9s	gcc reverse-complement.c

reverse-complement.go
4.5s / 3.5s	original, with/without bounds checks
3.5s / 3.3s	bounds check reduction
3.3s / 2.8s	smarter garbage collector
2.6s / 2.3s		assembler bytes.IndexByte
2.5s / 2.1s	even smarter garbage collector (this CL)

R=r
https://golang.org/cl/165064
2009-12-04 21:44:05 -08:00
Adam Langley
e79bcf8bfd runtime: shift the index for the sort by one.
Makes the code look cleaner, even if it's a little harder to figure
out from the sort invariants.

R=rsc
CC=golang-dev
https://golang.org/cl/165061
2009-12-04 13:31:18 -08:00
Adam Langley
d1740bb3a6 Remove global chanlock.
On a microbenchmark that ping-pongs on lots of channels, this makes
the multithreaded case about 20% faster and the uniprocessor case
about 1% slower. (Due to cache effects, I expect.)

R=rsc, agl
CC=golang-dev
https://golang.org/cl/166043
2009-12-04 10:57:01 -08:00
Russ Cox
cf37254b1c runtime: fix Caller crash on 386.
Fixes #176.

R=r
https://golang.org/cl/166044
2009-12-03 17:24:14 -08:00
Russ Cox
7e5055ceea runtime: malloc fixes
* throw away dead code
  * add mlookup counter
  * add malloc counter
  * set up for blocks with no pointers

Fixes #367.

R=r
https://golang.org/cl/165050
2009-12-03 17:22:23 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
William Josephson
1444f1bb1d Missed a reference to sc instead of mc in 157065.
R=rsc, dho
https://golang.org/cl/157116
2009-11-20 13:46:47 -08:00
Devon H. O'Dell
7ada6018a7 FreeBSD's mcontext isn't exactly the same as sigcontext, so
we can't use them interchangably.

R=rsc, wjosephson
CC=golang-dev
https://golang.org/cl/156113
2009-11-20 13:08:16 -08:00
Russ Cox
aa4c638b7b x[y:] for strings
R=ken2
https://golang.org/cl/157114
2009-11-20 11:42:28 -08:00
Russ Cox
652f55672d x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
  * remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
  * port cgen_inline into 8g, 5g.
  * use native memmove in maps

R=ken2
https://golang.org/cl/157106
2009-11-20 09:11:46 -08:00
Russ Cox
6e0767bb04 reflect fixes
R=r
https://golang.org/cl/156104
2009-11-19 22:06:32 -08:00
Russ Cox
4aaf948f90 runtime: mask signals during signal handler on OS X
Fixes #265.

R=r
CC=golang-dev
https://golang.org/cl/157084
2009-11-19 11:01:16 -08:00