2008-06-05 20:38:39 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
/*
|
|
|
|
* basic types
|
|
|
|
*/
|
|
|
|
typedef signed char int8;
|
|
|
|
typedef unsigned char uint8;
|
|
|
|
typedef signed short int16;
|
|
|
|
typedef unsigned short uint16;
|
|
|
|
typedef signed int int32;
|
|
|
|
typedef unsigned int uint32;
|
|
|
|
typedef signed long long int int64;
|
|
|
|
typedef unsigned long long int uint64;
|
|
|
|
typedef float float32;
|
|
|
|
typedef double float64;
|
2009-03-30 01:01:07 -06:00
|
|
|
|
|
|
|
#ifdef _64BIT
|
2008-11-17 13:32:35 -07:00
|
|
|
typedef uint64 uintptr;
|
2009-11-18 10:11:39 -07:00
|
|
|
typedef int64 intptr;
|
2009-03-30 01:01:07 -06:00
|
|
|
#else
|
|
|
|
typedef uint32 uintptr;
|
2009-11-18 10:11:39 -07:00
|
|
|
typedef int32 intptr;
|
2009-03-30 01:01:07 -06:00
|
|
|
#endif
|
2008-06-05 20:38:39 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* get rid of C types
|
2008-11-23 18:08:55 -07:00
|
|
|
* the / / / forces a syntax error immediately,
|
|
|
|
* which will show "last name: XXunsigned".
|
2008-06-05 20:38:39 -06:00
|
|
|
*/
|
2008-11-23 18:08:55 -07:00
|
|
|
#define unsigned XXunsigned / / /
|
|
|
|
#define signed XXsigned / / /
|
|
|
|
#define char XXchar / / /
|
|
|
|
#define short XXshort / / /
|
|
|
|
#define int XXint / / /
|
|
|
|
#define long XXlong / / /
|
|
|
|
#define float XXfloat / / /
|
|
|
|
#define double XXdouble / / /
|
2008-06-05 20:38:39 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* defined types
|
|
|
|
*/
|
|
|
|
typedef uint8 bool;
|
|
|
|
typedef uint8 byte;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Func Func;
|
2008-07-13 15:29:46 -06:00
|
|
|
typedef struct G G;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Gobuf Gobuf;
|
2011-11-02 07:42:01 -06:00
|
|
|
typedef union Lock Lock;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct M M;
|
2008-08-04 17:43:49 -06:00
|
|
|
typedef struct Mem Mem;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef union Note Note;
|
2009-08-25 16:54:25 -06:00
|
|
|
typedef struct Slice Slice;
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Stktop Stktop;
|
2009-04-09 19:16:21 -06:00
|
|
|
typedef struct String String;
|
2008-12-19 18:11:54 -07:00
|
|
|
typedef struct SigTab SigTab;
|
|
|
|
typedef struct MCache MCache;
|
runtime: parallelize garbage collector mark + sweep
Running test/garbage/parser.out.
On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r 1 cpu, no atomics
32.27u 0.58s 32.86r 1 cpu, atomic instructions
33.04u 0.83s 27.47r 2 cpu
On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r 1 cpu, no atomics
34.87u 1.12s 29.60r 2 cpu
36.00u 1.87s 28.43r 3 cpu
36.46u 2.34s 27.10r 4 cpu
38.28u 3.85s 26.92r 5 cpu
37.72u 5.25s 26.73r 6 cpu
39.63u 7.11s 26.95r 7 cpu
39.67u 8.10s 26.68r 8 cpu
On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r 1 cpu, no atomics
43.98u 2.95s 38.69r 2 cpu
On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r 1 cpu, no atomics
57.15u 4.72s 51.54r 2 cpu
The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.
R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082
2011-09-30 07:40:01 -06:00
|
|
|
typedef struct FixAlloc FixAlloc;
|
2008-12-19 18:11:54 -07:00
|
|
|
typedef struct Iface Iface;
|
2009-07-07 12:02:54 -06:00
|
|
|
typedef struct Itab Itab;
|
2010-02-19 21:42:50 -07:00
|
|
|
typedef struct Eface Eface;
|
2009-07-07 12:02:54 -06:00
|
|
|
typedef struct Type Type;
|
2011-08-17 13:54:17 -06:00
|
|
|
typedef struct ChanType ChanType;
|
2011-08-17 12:56:27 -06:00
|
|
|
typedef struct MapType MapType;
|
2009-01-27 13:03:53 -07:00
|
|
|
typedef struct Defer Defer;
|
2010-03-31 12:46:01 -06:00
|
|
|
typedef struct Panic Panic;
|
2011-01-31 04:27:28 -07:00
|
|
|
typedef struct Hmap Hmap;
|
2009-07-08 16:00:54 -06:00
|
|
|
typedef struct Hchan Hchan;
|
2010-02-19 21:42:50 -07:00
|
|
|
typedef struct Complex64 Complex64;
|
|
|
|
typedef struct Complex128 Complex128;
|
2011-08-27 07:17:00 -06:00
|
|
|
typedef struct WinCall WinCall;
|
runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes #1644.
Fixes #1731.
Fixes #2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 13:17:05 -07:00
|
|
|
typedef struct Timers Timers;
|
|
|
|
typedef struct Timer Timer;
|
2008-07-13 15:29:46 -06:00
|
|
|
|
|
|
|
/*
|
2009-08-11 14:30:35 -06:00
|
|
|
* per-cpu declaration.
|
|
|
|
* "extern register" is a special storage class implemented by 6c, 8c, etc.
|
|
|
|
* on machines with lots of registers, it allocates a register that will not be
|
|
|
|
* used in generated code. on the x86, it allocates a slot indexed by a
|
|
|
|
* segment register.
|
|
|
|
*
|
|
|
|
* amd64: allocated downwards from R15
|
2010-10-18 10:32:55 -06:00
|
|
|
* x86: allocated upwards from 0(GS)
|
2010-02-06 22:59:46 -07:00
|
|
|
* arm: allocated downwards from R10
|
2009-08-26 11:47:18 -06:00
|
|
|
*
|
2009-08-11 14:30:35 -06:00
|
|
|
* every C file linked into a Go program must include runtime.h
|
|
|
|
* so that the C compiler knows to avoid other uses of these registers.
|
|
|
|
* the Go compilers know to avoid them.
|
2008-07-13 15:29:46 -06:00
|
|
|
*/
|
2009-08-11 14:30:35 -06:00
|
|
|
extern register G* g;
|
|
|
|
extern register M* m;
|
2008-07-13 15:29:46 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* defined constants
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
// G status
|
2010-04-08 14:24:53 -06:00
|
|
|
//
|
|
|
|
// If you add to this list, add to the list
|
|
|
|
// of "okay during garbage collection" status
|
|
|
|
// in mgc0.c too.
|
2008-07-13 15:29:46 -06:00
|
|
|
Gidle,
|
|
|
|
Grunnable,
|
2008-08-04 17:43:49 -06:00
|
|
|
Grunning,
|
2008-12-05 16:24:18 -07:00
|
|
|
Gsyscall,
|
2008-07-14 15:33:39 -06:00
|
|
|
Gwaiting,
|
2008-08-05 15:18:47 -06:00
|
|
|
Gmoribund,
|
2008-07-13 15:29:46 -06:00
|
|
|
Gdead,
|
|
|
|
};
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
true = 1,
|
|
|
|
false = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* structures
|
|
|
|
*/
|
2011-11-02 07:42:01 -06:00
|
|
|
union Lock
|
2008-08-04 17:43:49 -06:00
|
|
|
{
|
2011-11-02 07:42:01 -06:00
|
|
|
uint32 key; // futex-based impl
|
|
|
|
M* waitm; // linked list of waiting M's (sema-based impl)
|
2008-09-24 11:25:28 -06:00
|
|
|
};
|
2008-09-09 12:50:14 -06:00
|
|
|
union Note
|
2008-08-04 17:43:49 -06:00
|
|
|
{
|
2011-11-02 07:42:01 -06:00
|
|
|
uint32 key; // futex-based impl
|
|
|
|
M* waitm; // waiting M (sema-based impl)
|
2008-08-04 17:43:49 -06:00
|
|
|
};
|
2008-07-13 15:29:46 -06:00
|
|
|
struct String
|
2008-06-05 20:38:39 -06:00
|
|
|
{
|
2009-04-09 19:16:21 -06:00
|
|
|
byte* str;
|
2008-06-05 20:38:39 -06:00
|
|
|
int32 len;
|
2008-07-13 15:29:46 -06:00
|
|
|
};
|
2008-12-19 18:11:54 -07:00
|
|
|
struct Iface
|
|
|
|
{
|
2009-07-07 12:02:54 -06:00
|
|
|
Itab* tab;
|
2009-04-09 19:16:21 -06:00
|
|
|
void* data;
|
2008-12-19 18:11:54 -07:00
|
|
|
};
|
2009-05-20 15:57:55 -06:00
|
|
|
struct Eface
|
|
|
|
{
|
2009-07-07 12:02:54 -06:00
|
|
|
Type* type;
|
2009-05-20 15:57:55 -06:00
|
|
|
void* data;
|
|
|
|
};
|
2010-02-19 21:42:50 -07:00
|
|
|
struct Complex64
|
|
|
|
{
|
|
|
|
float32 real;
|
|
|
|
float32 imag;
|
|
|
|
};
|
|
|
|
struct Complex128
|
|
|
|
{
|
|
|
|
float64 real;
|
|
|
|
float64 imag;
|
|
|
|
};
|
2008-08-27 18:28:30 -06:00
|
|
|
|
2009-08-25 16:54:25 -06:00
|
|
|
struct Slice
|
2008-08-27 18:28:30 -06:00
|
|
|
{ // must not move anything
|
|
|
|
byte* array; // actual data
|
2009-08-25 16:54:25 -06:00
|
|
|
uint32 len; // number of elements
|
2008-11-17 13:32:35 -07:00
|
|
|
uint32 cap; // allocated number of elements
|
2008-08-27 18:28:30 -06:00
|
|
|
};
|
2008-07-11 20:16:39 -06:00
|
|
|
struct Gobuf
|
|
|
|
{
|
2009-06-17 17:31:02 -06:00
|
|
|
// The offsets of these fields are known to (hard-coded in) libmach.
|
2009-06-17 16:12:16 -06:00
|
|
|
byte* sp;
|
|
|
|
byte* pc;
|
|
|
|
G* g;
|
2008-07-11 20:16:39 -06:00
|
|
|
};
|
2008-07-09 12:35:26 -06:00
|
|
|
struct G
|
2008-07-08 18:19:17 -06:00
|
|
|
{
|
2012-01-19 15:13:33 -07:00
|
|
|
byte* stackguard; // cannot move - also known to linker, libmach, runtime/cgo
|
|
|
|
byte* stackbase; // cannot move - also known to libmach, runtime/cgo
|
2009-06-17 16:12:16 -06:00
|
|
|
Defer* defer;
|
2010-03-31 12:46:01 -06:00
|
|
|
Panic* panic;
|
|
|
|
Gobuf sched;
|
runtime: stack split + garbage collection bug
The g->sched.sp saved stack pointer and the
g->stackbase and g->stackguard stack bounds
can change even while "the world is stopped",
because a goroutine has to call functions (and
therefore might split its stack) when exiting a
system call to check whether the world is stopped
(and if so, wait until the world continues).
That means the garbage collector cannot access
those values safely (without a race) for goroutines
executing system calls. Instead, save a consistent
triple in g->gcsp, g->gcstack, g->gcguard during
entersyscall and have the garbage collector refer
to those.
The old code was occasionally seeing (because of
the race) an sp and stk that did not correspond to
each other, so that stk - sp was not the number of
stack bytes following sp. In that case, if sp < stk
then the call scanblock(sp, stk - sp) scanned too
many bytes (anything between the two pointers,
which pointed into different allocation blocks).
If sp > stk then stk - sp wrapped around.
On 32-bit, stk - sp is a uintptr (uint32) converted
to int64 in the call to scanblock, so a large (~4G)
but positive number. Scanblock would try to scan
that many bytes and eventually fault accessing
unmapped memory. On 64-bit, stk - sp is a uintptr (uint64)
promoted to int64 in the call to scanblock, so a negative
number. Scanblock would not scan anything, possibly
causing in-use blocks to be freed.
In short, 32-bit platforms would have seen either
ineffective garbage collection or crashes during garbage
collection, while 64-bit platforms would have seen
either ineffective or incorrect garbage collection.
You can see the invalid arguments to scanblock in the
stack traces in issue 1620.
Fixes #1620.
Fixes #1746.
R=iant, r
CC=golang-dev
https://golang.org/cl/4437075
2011-04-27 21:21:12 -06:00
|
|
|
byte* gcstack; // if status==Gsyscall, gcstack = stackbase to use during gc
|
|
|
|
byte* gcsp; // if status==Gsyscall, gcsp = sched.sp to use during gc
|
|
|
|
byte* gcguard; // if status==Gsyscall, gcguard = stackguard to use during gc
|
2009-10-03 11:37:12 -06:00
|
|
|
byte* stack0;
|
2009-06-17 16:12:16 -06:00
|
|
|
byte* entry; // initial function
|
2008-07-28 12:29:41 -06:00
|
|
|
G* alllink; // on allg
|
2008-07-25 16:55:12 -06:00
|
|
|
void* param; // passed parameter on wakeup
|
|
|
|
int16 status;
|
2008-07-11 20:16:39 -06:00
|
|
|
int32 goid;
|
2009-12-18 13:25:53 -07:00
|
|
|
uint32 selgen; // valid sudog pointer
|
2011-08-22 21:26:39 -06:00
|
|
|
int8* waitreason; // if status==Gwaiting
|
2008-08-05 15:18:47 -06:00
|
|
|
G* schedlink;
|
2009-01-27 13:03:53 -07:00
|
|
|
bool readyonstop;
|
2010-03-31 12:46:01 -06:00
|
|
|
bool ispanic;
|
2009-06-17 16:12:16 -06:00
|
|
|
M* m; // for debuggers, but offset not hard-coded
|
2009-07-13 18:28:39 -06:00
|
|
|
M* lockedm;
|
2011-02-27 21:32:42 -07:00
|
|
|
M* idlem;
|
2010-04-08 19:15:30 -06:00
|
|
|
int32 sig;
|
|
|
|
uintptr sigcode0;
|
|
|
|
uintptr sigcode1;
|
2011-01-18 12:15:11 -07:00
|
|
|
uintptr sigpc;
|
2011-03-02 11:42:02 -07:00
|
|
|
uintptr gopc; // pc of go statement that created this goroutine
|
2011-09-17 01:57:59 -06:00
|
|
|
uintptr end[];
|
2008-08-04 17:43:49 -06:00
|
|
|
};
|
2008-07-08 18:19:17 -06:00
|
|
|
struct M
|
|
|
|
{
|
2009-06-17 17:31:02 -06:00
|
|
|
// The offsets of these fields are known to (hard-coded in) libmach.
|
2009-06-17 16:12:16 -06:00
|
|
|
G* g0; // goroutine with scheduling stack
|
|
|
|
void (*morepc)(void);
|
2011-01-14 12:05:20 -07:00
|
|
|
void* moreargp; // argument pointer for more stack
|
2009-06-17 16:12:16 -06:00
|
|
|
Gobuf morebuf; // gobuf arg to morestack
|
|
|
|
|
2009-06-17 17:31:02 -06:00
|
|
|
// Fields not known to debuggers.
|
2011-01-14 12:05:20 -07:00
|
|
|
uint32 moreframesize; // size arguments to morestack
|
|
|
|
uint32 moreargsize;
|
2009-06-17 16:12:16 -06:00
|
|
|
uintptr cret; // return value from C
|
|
|
|
uint64 procid; // for debuggers, but offset not hard-coded
|
|
|
|
G* gsignal; // signal-handling G
|
|
|
|
uint32 tls[8]; // thread-local storage (for 386 extern register)
|
|
|
|
G* curg; // current running goroutine
|
2008-11-25 17:48:10 -07:00
|
|
|
int32 id;
|
2008-12-19 04:13:39 -07:00
|
|
|
int32 mallocing;
|
2009-06-15 22:31:56 -06:00
|
|
|
int32 gcing;
|
2009-01-26 18:37:05 -07:00
|
|
|
int32 locks;
|
2010-03-24 10:40:09 -06:00
|
|
|
int32 nomemprof;
|
2009-07-13 18:28:39 -06:00
|
|
|
int32 waitnextg;
|
2011-02-16 11:21:13 -07:00
|
|
|
int32 dying;
|
2011-03-23 09:43:37 -06:00
|
|
|
int32 profilehz;
|
runtime: parallelize garbage collector mark + sweep
Running test/garbage/parser.out.
On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r 1 cpu, no atomics
32.27u 0.58s 32.86r 1 cpu, atomic instructions
33.04u 0.83s 27.47r 2 cpu
On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r 1 cpu, no atomics
34.87u 1.12s 29.60r 2 cpu
36.00u 1.87s 28.43r 3 cpu
36.46u 2.34s 27.10r 4 cpu
38.28u 3.85s 26.92r 5 cpu
37.72u 5.25s 26.73r 6 cpu
39.63u 7.11s 26.95r 7 cpu
39.67u 8.10s 26.68r 8 cpu
On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r 1 cpu, no atomics
43.98u 2.95s 38.69r 2 cpu
On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r 1 cpu, no atomics
57.15u 4.72s 51.54r 2 cpu
The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.
R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082
2011-09-30 07:40:01 -06:00
|
|
|
int32 helpgc;
|
2011-07-11 23:23:58 -06:00
|
|
|
uint32 fastrand;
|
2011-07-21 09:29:08 -06:00
|
|
|
uint64 ncgocall;
|
2008-08-05 15:18:47 -06:00
|
|
|
Note havenextg;
|
|
|
|
G* nextg;
|
2009-10-09 16:35:33 -06:00
|
|
|
M* alllink; // on allm
|
2008-08-05 15:18:47 -06:00
|
|
|
M* schedlink;
|
2008-09-09 12:50:14 -06:00
|
|
|
uint32 machport; // Return address for Mach IPC (OS X)
|
2008-12-18 16:42:28 -07:00
|
|
|
MCache *mcache;
|
2011-07-12 10:24:32 -06:00
|
|
|
FixAlloc *stackalloc;
|
2009-07-13 18:28:39 -06:00
|
|
|
G* lockedg;
|
2011-02-27 21:32:42 -07:00
|
|
|
G* idleg;
|
2012-02-08 08:33:54 -07:00
|
|
|
uintptr createstack[32]; // Stack that created this thread.
|
2010-12-09 15:45:27 -07:00
|
|
|
uint32 freglo[16]; // D[i] lsb and F[i]
|
|
|
|
uint32 freghi[16]; // D[i] msb and F[i+16]
|
|
|
|
uint32 fflag; // floating point compare flags
|
2011-11-02 07:42:01 -06:00
|
|
|
M* nextwaitm; // next M waiting for lock
|
|
|
|
uintptr waitsema; // semaphore for parking on locks
|
|
|
|
uint32 waitsemacount;
|
|
|
|
uint32 waitsemalock;
|
runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes #1644.
Fixes #1731.
Fixes #2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 13:17:05 -07:00
|
|
|
|
2011-12-16 13:33:58 -07:00
|
|
|
#ifdef GOOS_windows
|
2011-09-17 01:57:59 -06:00
|
|
|
void* thread; // thread handle
|
2011-09-14 18:23:21 -06:00
|
|
|
#endif
|
2011-09-17 01:57:59 -06:00
|
|
|
uintptr end[];
|
2008-07-11 20:16:39 -06:00
|
|
|
};
|
runtime: stack split + garbage collection bug
The g->sched.sp saved stack pointer and the
g->stackbase and g->stackguard stack bounds
can change even while "the world is stopped",
because a goroutine has to call functions (and
therefore might split its stack) when exiting a
system call to check whether the world is stopped
(and if so, wait until the world continues).
That means the garbage collector cannot access
those values safely (without a race) for goroutines
executing system calls. Instead, save a consistent
triple in g->gcsp, g->gcstack, g->gcguard during
entersyscall and have the garbage collector refer
to those.
The old code was occasionally seeing (because of
the race) an sp and stk that did not correspond to
each other, so that stk - sp was not the number of
stack bytes following sp. In that case, if sp < stk
then the call scanblock(sp, stk - sp) scanned too
many bytes (anything between the two pointers,
which pointed into different allocation blocks).
If sp > stk then stk - sp wrapped around.
On 32-bit, stk - sp is a uintptr (uint32) converted
to int64 in the call to scanblock, so a large (~4G)
but positive number. Scanblock would try to scan
that many bytes and eventually fault accessing
unmapped memory. On 64-bit, stk - sp is a uintptr (uint64)
promoted to int64 in the call to scanblock, so a negative
number. Scanblock would not scan anything, possibly
causing in-use blocks to be freed.
In short, 32-bit platforms would have seen either
ineffective garbage collection or crashes during garbage
collection, while 64-bit platforms would have seen
either ineffective or incorrect garbage collection.
You can see the invalid arguments to scanblock in the
stack traces in issue 1620.
Fixes #1620.
Fixes #1746.
R=iant, r
CC=golang-dev
https://golang.org/cl/4437075
2011-04-27 21:21:12 -06:00
|
|
|
|
2008-07-14 15:33:39 -06:00
|
|
|
struct Stktop
|
2008-07-13 15:29:46 -06:00
|
|
|
{
|
2009-06-17 17:31:02 -06:00
|
|
|
// The offsets of these fields are known to (hard-coded in) libmach.
|
2009-06-17 16:12:16 -06:00
|
|
|
uint8* stackguard;
|
|
|
|
uint8* stackbase;
|
|
|
|
Gobuf gobuf;
|
2011-01-14 12:05:20 -07:00
|
|
|
uint32 argsize;
|
2009-07-08 19:16:09 -06:00
|
|
|
|
2011-01-25 14:35:36 -07:00
|
|
|
uint8* argp; // pointer to arguments in old frame
|
|
|
|
uintptr free; // if free>0, call stackfree using free as size
|
2010-03-31 12:46:01 -06:00
|
|
|
bool panic; // is this frame the top of a panic?
|
2008-07-08 18:19:17 -06:00
|
|
|
};
|
2008-07-13 15:29:46 -06:00
|
|
|
struct SigTab
|
2008-06-05 20:38:39 -06:00
|
|
|
{
|
2008-12-03 15:21:28 -07:00
|
|
|
int32 flags;
|
2008-07-13 15:29:46 -06:00
|
|
|
int8 *name;
|
2008-06-05 20:38:39 -06:00
|
|
|
};
|
2008-12-03 15:21:28 -07:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SigCatch = 1<<0,
|
|
|
|
SigIgnore = 1<<1,
|
|
|
|
SigRestart = 1<<2,
|
2009-12-15 19:21:29 -07:00
|
|
|
SigQueue = 1<<3,
|
2010-04-08 19:15:30 -06:00
|
|
|
SigPanic = 1<<4,
|
2008-12-03 15:21:28 -07:00
|
|
|
};
|
2008-06-05 20:38:39 -06:00
|
|
|
|
2010-03-24 10:40:09 -06:00
|
|
|
// NOTE(rsc): keep in sync with extern.go:/type.Func.
|
|
|
|
// Eventually, the loaded symbol table should be closer to this form.
|
2008-11-23 18:08:55 -07:00
|
|
|
struct Func
|
|
|
|
{
|
2009-04-09 19:16:21 -06:00
|
|
|
String name;
|
|
|
|
String type; // go type string
|
|
|
|
String src; // src file name
|
2009-08-25 16:54:25 -06:00
|
|
|
Slice pcln; // pc/ln tab for this func
|
2010-03-24 10:40:09 -06:00
|
|
|
uintptr entry; // entry pc
|
|
|
|
uintptr pc0; // starting pc, ln for table
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
int32 ln0;
|
2010-03-24 10:40:09 -06:00
|
|
|
int32 frame; // stack frame size
|
2008-11-25 17:48:10 -07:00
|
|
|
int32 args; // number of 32-bit in/out args
|
|
|
|
int32 locals; // number of 32-bit locals
|
2008-11-23 18:08:55 -07:00
|
|
|
};
|
|
|
|
|
2011-08-27 07:17:00 -06:00
|
|
|
struct WinCall
|
|
|
|
{
|
|
|
|
void (*fn)(void*);
|
|
|
|
uintptr n; // number of parameters
|
|
|
|
void* args; // parameters
|
2011-09-14 00:19:45 -06:00
|
|
|
uintptr r1; // return values
|
|
|
|
uintptr r2;
|
2011-08-27 07:17:00 -06:00
|
|
|
uintptr err; // error number
|
|
|
|
};
|
|
|
|
|
2011-12-16 13:33:58 -07:00
|
|
|
#ifdef GOOS_windows
|
2010-09-11 19:45:16 -06:00
|
|
|
enum {
|
|
|
|
Windows = 1
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
enum {
|
|
|
|
Windows = 0
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes #1644.
Fixes #1731.
Fixes #2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 13:17:05 -07:00
|
|
|
struct Timers
|
|
|
|
{
|
|
|
|
Lock;
|
|
|
|
G *timerproc;
|
|
|
|
bool sleeping;
|
|
|
|
bool rescheduling;
|
|
|
|
Note waitnote;
|
|
|
|
Timer **t;
|
|
|
|
int32 len;
|
|
|
|
int32 cap;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Package time knows the layout of this structure.
|
|
|
|
// If this struct changes, adjust ../time/sleep.go:/runtimeTimer.
|
|
|
|
struct Timer
|
|
|
|
{
|
|
|
|
int32 i; // heap index
|
|
|
|
|
|
|
|
// Timer wakes up at when, and then at when+period, ... (period > 0 only)
|
|
|
|
// each time calling f(now, arg) in the timer goroutine, so f must be
|
|
|
|
// a well-behaved function and not block.
|
|
|
|
int64 when;
|
|
|
|
int64 period;
|
|
|
|
void (*f)(int64, Eface);
|
|
|
|
Eface arg;
|
|
|
|
};
|
|
|
|
|
2008-06-05 20:38:39 -06:00
|
|
|
/*
|
|
|
|
* defined macros
|
2011-05-30 02:02:59 -06:00
|
|
|
* you need super-gopher-guru privilege
|
2008-06-05 20:38:39 -06:00
|
|
|
* to add this list.
|
|
|
|
*/
|
|
|
|
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
|
|
|
#define nil ((void*)0)
|
2010-12-13 14:22:19 -07:00
|
|
|
#define offsetof(s,m) (uint32)(&(((s*)0)->m))
|
2008-06-05 20:38:39 -06:00
|
|
|
|
2008-12-19 13:05:22 -07:00
|
|
|
/*
|
|
|
|
* known to compiler
|
|
|
|
*/
|
2011-12-05 07:40:22 -07:00
|
|
|
enum {
|
|
|
|
Structrnd = sizeof(uintptr)
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* type algorithms - known to compiler
|
|
|
|
*/
|
2008-12-19 13:05:22 -07:00
|
|
|
enum
|
|
|
|
{
|
2009-01-26 10:56:42 -07:00
|
|
|
AMEM,
|
2012-01-19 23:32:55 -07:00
|
|
|
AMEM0,
|
2011-08-08 07:35:32 -06:00
|
|
|
AMEM8,
|
|
|
|
AMEM16,
|
|
|
|
AMEM32,
|
|
|
|
AMEM64,
|
|
|
|
AMEM128,
|
2011-12-12 20:22:09 -07:00
|
|
|
ANOEQ,
|
2012-01-19 23:32:55 -07:00
|
|
|
ANOEQ0,
|
2011-08-08 07:35:32 -06:00
|
|
|
ANOEQ8,
|
|
|
|
ANOEQ16,
|
|
|
|
ANOEQ32,
|
|
|
|
ANOEQ64,
|
|
|
|
ANOEQ128,
|
2011-12-12 20:22:09 -07:00
|
|
|
ASTRING,
|
|
|
|
AINTER,
|
|
|
|
ANILINTER,
|
|
|
|
ASLICE,
|
2012-01-26 14:25:07 -07:00
|
|
|
AFLOAT32,
|
|
|
|
AFLOAT64,
|
|
|
|
ACPLX64,
|
|
|
|
ACPLX128,
|
2009-01-26 10:56:42 -07:00
|
|
|
Amax
|
2008-12-19 13:05:22 -07:00
|
|
|
};
|
2011-12-05 07:40:22 -07:00
|
|
|
typedef struct Alg Alg;
|
|
|
|
struct Alg
|
|
|
|
{
|
|
|
|
void (*hash)(uintptr*, uintptr, void*);
|
|
|
|
void (*equal)(bool*, uintptr, void*, void*);
|
|
|
|
void (*print)(uintptr, void*);
|
|
|
|
void (*copy)(uintptr, void*, void*);
|
|
|
|
};
|
2008-12-19 13:05:22 -07:00
|
|
|
|
2011-12-05 07:40:22 -07:00
|
|
|
extern Alg runtime·algarray[Amax];
|
2009-07-02 22:25:46 -06:00
|
|
|
|
2011-12-05 07:40:22 -07:00
|
|
|
void runtime·memhash(uintptr*, uintptr, void*);
|
|
|
|
void runtime·nohash(uintptr*, uintptr, void*);
|
|
|
|
void runtime·strhash(uintptr*, uintptr, void*);
|
|
|
|
void runtime·interhash(uintptr*, uintptr, void*);
|
|
|
|
void runtime·nilinterhash(uintptr*, uintptr, void*);
|
|
|
|
|
|
|
|
void runtime·memequal(bool*, uintptr, void*, void*);
|
|
|
|
void runtime·noequal(bool*, uintptr, void*, void*);
|
|
|
|
void runtime·strequal(bool*, uintptr, void*, void*);
|
|
|
|
void runtime·interequal(bool*, uintptr, void*, void*);
|
|
|
|
void runtime·nilinterequal(bool*, uintptr, void*, void*);
|
|
|
|
|
|
|
|
void runtime·memprint(uintptr, void*);
|
|
|
|
void runtime·strprint(uintptr, void*);
|
|
|
|
void runtime·interprint(uintptr, void*);
|
|
|
|
void runtime·nilinterprint(uintptr, void*);
|
|
|
|
|
|
|
|
void runtime·memcopy(uintptr, void*, void*);
|
|
|
|
void runtime·memcopy8(uintptr, void*, void*);
|
|
|
|
void runtime·memcopy16(uintptr, void*, void*);
|
|
|
|
void runtime·memcopy32(uintptr, void*, void*);
|
|
|
|
void runtime·memcopy64(uintptr, void*, void*);
|
|
|
|
void runtime·memcopy128(uintptr, void*, void*);
|
|
|
|
void runtime·memcopy(uintptr, void*, void*);
|
|
|
|
void runtime·strcopy(uintptr, void*, void*);
|
|
|
|
void runtime·algslicecopy(uintptr, void*, void*);
|
|
|
|
void runtime·intercopy(uintptr, void*, void*);
|
|
|
|
void runtime·nilintercopy(uintptr, void*, void*);
|
2009-07-02 22:25:46 -06:00
|
|
|
|
2009-01-27 13:03:53 -07:00
|
|
|
/*
|
2009-01-27 14:23:28 -07:00
|
|
|
* deferred subroutine calls
|
2009-01-27 13:03:53 -07:00
|
|
|
*/
|
|
|
|
struct Defer
|
|
|
|
{
|
|
|
|
int32 siz;
|
2011-08-18 10:17:09 -06:00
|
|
|
bool nofree;
|
2011-01-14 12:05:20 -07:00
|
|
|
byte* argp; // where args were copied from
|
2010-03-31 12:46:01 -06:00
|
|
|
byte* pc;
|
2009-01-27 13:03:53 -07:00
|
|
|
byte* fn;
|
|
|
|
Defer* link;
|
|
|
|
byte args[8]; // padded to actual size
|
|
|
|
};
|
|
|
|
|
2010-03-31 12:46:01 -06:00
|
|
|
/*
|
|
|
|
* panics
|
|
|
|
*/
|
|
|
|
struct Panic
|
|
|
|
{
|
|
|
|
Eface arg; // argument to panic
|
|
|
|
byte* stackbase; // g->stackbase in panic
|
|
|
|
Panic* link; // link to earlier panic
|
|
|
|
bool recovered; // whether this panic is over
|
|
|
|
};
|
|
|
|
|
2008-07-13 15:29:46 -06:00
|
|
|
/*
|
|
|
|
* external data
|
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
extern String runtime·emptystring;
|
|
|
|
G* runtime·allg;
|
2011-08-22 21:26:39 -06:00
|
|
|
G* runtime·lastg;
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
M* runtime·allm;
|
|
|
|
extern int32 runtime·gomaxprocs;
|
2011-08-16 14:53:02 -06:00
|
|
|
extern bool runtime·singleproc;
|
2011-02-16 11:21:13 -07:00
|
|
|
extern uint32 runtime·panicking;
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
extern int32 runtime·gcwaiting; // gc is waiting to run
|
|
|
|
int8* runtime·goos;
|
runtime: parallelize garbage collector mark + sweep
Running test/garbage/parser.out.
On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r 1 cpu, no atomics
32.27u 0.58s 32.86r 1 cpu, atomic instructions
33.04u 0.83s 27.47r 2 cpu
On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r 1 cpu, no atomics
34.87u 1.12s 29.60r 2 cpu
36.00u 1.87s 28.43r 3 cpu
36.46u 2.34s 27.10r 4 cpu
38.28u 3.85s 26.92r 5 cpu
37.72u 5.25s 26.73r 6 cpu
39.63u 7.11s 26.95r 7 cpu
39.67u 8.10s 26.68r 8 cpu
On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r 1 cpu, no atomics
43.98u 2.95s 38.69r 2 cpu
On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r 1 cpu, no atomics
57.15u 4.72s 51.54r 2 cpu
The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.
R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082
2011-09-30 07:40:01 -06:00
|
|
|
int32 runtime·ncpu;
|
2010-12-08 11:53:30 -07:00
|
|
|
extern bool runtime·iscgo;
|
2008-07-13 15:29:46 -06:00
|
|
|
|
2008-06-30 12:50:36 -06:00
|
|
|
/*
|
|
|
|
* common functions and data
|
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
int32 runtime·strcmp(byte*, byte*);
|
runtime: improve Linux mutex
The implementation is hybrid active/passive spin/blocking mutex.
The design minimizes amount of context switches and futex calls.
The idea is that all critical sections in runtime are intentially
small, so pure blocking mutex behaves badly causing
a lot of context switches, thread parking/unparking and kernel calls.
Note that some synthetic benchmarks become somewhat slower,
that's due to increased contention on other data structures,
it should not affect programs that do any real work.
On 2 x Intel E5620, 8 HT cores, 2.4GHz
benchmark old ns/op new ns/op delta
BenchmarkSelectContended 521.00 503.00 -3.45%
BenchmarkSelectContended-2 661.00 320.00 -51.59%
BenchmarkSelectContended-4 1139.00 629.00 -44.78%
BenchmarkSelectContended-8 2870.00 878.00 -69.41%
BenchmarkSelectContended-16 5276.00 818.00 -84.50%
BenchmarkChanContended 112.00 103.00 -8.04%
BenchmarkChanContended-2 631.00 174.00 -72.42%
BenchmarkChanContended-4 682.00 272.00 -60.12%
BenchmarkChanContended-8 1601.00 520.00 -67.52%
BenchmarkChanContended-16 3100.00 372.00 -88.00%
BenchmarkChanSync 253.00 239.00 -5.53%
BenchmarkChanSync-2 5030.00 4648.00 -7.59%
BenchmarkChanSync-4 4826.00 4694.00 -2.74%
BenchmarkChanSync-8 4778.00 4713.00 -1.36%
BenchmarkChanSync-16 5289.00 4710.00 -10.95%
BenchmarkChanProdCons0 273.00 254.00 -6.96%
BenchmarkChanProdCons0-2 599.00 400.00 -33.22%
BenchmarkChanProdCons0-4 1168.00 659.00 -43.58%
BenchmarkChanProdCons0-8 2831.00 1057.00 -62.66%
BenchmarkChanProdCons0-16 4197.00 1037.00 -75.29%
BenchmarkChanProdCons10 150.00 140.00 -6.67%
BenchmarkChanProdCons10-2 607.00 268.00 -55.85%
BenchmarkChanProdCons10-4 1137.00 404.00 -64.47%
BenchmarkChanProdCons10-8 2115.00 828.00 -60.85%
BenchmarkChanProdCons10-16 4283.00 855.00 -80.04%
BenchmarkChanProdCons100 117.00 110.00 -5.98%
BenchmarkChanProdCons100-2 558.00 218.00 -60.93%
BenchmarkChanProdCons100-4 722.00 287.00 -60.25%
BenchmarkChanProdCons100-8 1840.00 431.00 -76.58%
BenchmarkChanProdCons100-16 3394.00 448.00 -86.80%
BenchmarkChanProdConsWork0 2014.00 1996.00 -0.89%
BenchmarkChanProdConsWork0-2 1207.00 1127.00 -6.63%
BenchmarkChanProdConsWork0-4 1913.00 611.00 -68.06%
BenchmarkChanProdConsWork0-8 3016.00 949.00 -68.53%
BenchmarkChanProdConsWork0-16 4320.00 1154.00 -73.29%
BenchmarkChanProdConsWork10 1906.00 1897.00 -0.47%
BenchmarkChanProdConsWork10-2 1123.00 1033.00 -8.01%
BenchmarkChanProdConsWork10-4 1076.00 571.00 -46.93%
BenchmarkChanProdConsWork10-8 2748.00 1096.00 -60.12%
BenchmarkChanProdConsWork10-16 4600.00 1105.00 -75.98%
BenchmarkChanProdConsWork100 1884.00 1852.00 -1.70%
BenchmarkChanProdConsWork100-2 1235.00 1146.00 -7.21%
BenchmarkChanProdConsWork100-4 1217.00 619.00 -49.14%
BenchmarkChanProdConsWork100-8 1534.00 509.00 -66.82%
BenchmarkChanProdConsWork100-16 4126.00 918.00 -77.75%
BenchmarkSyscall 34.40 33.30 -3.20%
BenchmarkSyscall-2 160.00 121.00 -24.38%
BenchmarkSyscall-4 131.00 136.00 +3.82%
BenchmarkSyscall-8 139.00 131.00 -5.76%
BenchmarkSyscall-16 161.00 168.00 +4.35%
BenchmarkSyscallWork 950.00 950.00 +0.00%
BenchmarkSyscallWork-2 481.00 480.00 -0.21%
BenchmarkSyscallWork-4 268.00 270.00 +0.75%
BenchmarkSyscallWork-8 156.00 169.00 +8.33%
BenchmarkSyscallWork-16 188.00 184.00 -2.13%
BenchmarkSemaSyntNonblock 36.40 35.60 -2.20%
BenchmarkSemaSyntNonblock-2 81.40 45.10 -44.59%
BenchmarkSemaSyntNonblock-4 126.00 108.00 -14.29%
BenchmarkSemaSyntNonblock-8 112.00 112.00 +0.00%
BenchmarkSemaSyntNonblock-16 110.00 112.00 +1.82%
BenchmarkSemaSyntBlock 35.30 35.30 +0.00%
BenchmarkSemaSyntBlock-2 118.00 124.00 +5.08%
BenchmarkSemaSyntBlock-4 105.00 108.00 +2.86%
BenchmarkSemaSyntBlock-8 101.00 111.00 +9.90%
BenchmarkSemaSyntBlock-16 112.00 118.00 +5.36%
BenchmarkSemaWorkNonblock 810.00 811.00 +0.12%
BenchmarkSemaWorkNonblock-2 476.00 414.00 -13.03%
BenchmarkSemaWorkNonblock-4 238.00 228.00 -4.20%
BenchmarkSemaWorkNonblock-8 140.00 126.00 -10.00%
BenchmarkSemaWorkNonblock-16 117.00 116.00 -0.85%
BenchmarkSemaWorkBlock 810.00 811.00 +0.12%
BenchmarkSemaWorkBlock-2 454.00 466.00 +2.64%
BenchmarkSemaWorkBlock-4 243.00 241.00 -0.82%
BenchmarkSemaWorkBlock-8 145.00 137.00 -5.52%
BenchmarkSemaWorkBlock-16 132.00 123.00 -6.82%
BenchmarkContendedSemaphore 123.00 102.00 -17.07%
BenchmarkContendedSemaphore-2 34.80 34.90 +0.29%
BenchmarkContendedSemaphore-4 34.70 34.80 +0.29%
BenchmarkContendedSemaphore-8 34.70 34.70 +0.00%
BenchmarkContendedSemaphore-16 34.80 34.70 -0.29%
BenchmarkMutex 26.80 26.00 -2.99%
BenchmarkMutex-2 108.00 45.20 -58.15%
BenchmarkMutex-4 103.00 127.00 +23.30%
BenchmarkMutex-8 109.00 147.00 +34.86%
BenchmarkMutex-16 102.00 152.00 +49.02%
BenchmarkMutexSlack 27.00 26.90 -0.37%
BenchmarkMutexSlack-2 149.00 165.00 +10.74%
BenchmarkMutexSlack-4 121.00 209.00 +72.73%
BenchmarkMutexSlack-8 101.00 158.00 +56.44%
BenchmarkMutexSlack-16 97.00 129.00 +32.99%
BenchmarkMutexWork 792.00 794.00 +0.25%
BenchmarkMutexWork-2 407.00 409.00 +0.49%
BenchmarkMutexWork-4 220.00 209.00 -5.00%
BenchmarkMutexWork-8 267.00 160.00 -40.07%
BenchmarkMutexWork-16 315.00 300.00 -4.76%
BenchmarkMutexWorkSlack 792.00 793.00 +0.13%
BenchmarkMutexWorkSlack-2 406.00 404.00 -0.49%
BenchmarkMutexWorkSlack-4 225.00 212.00 -5.78%
BenchmarkMutexWorkSlack-8 268.00 136.00 -49.25%
BenchmarkMutexWorkSlack-16 300.00 300.00 +0.00%
BenchmarkRWMutexWrite100 27.10 27.00 -0.37%
BenchmarkRWMutexWrite100-2 33.10 40.80 +23.26%
BenchmarkRWMutexWrite100-4 113.00 88.10 -22.04%
BenchmarkRWMutexWrite100-8 119.00 95.30 -19.92%
BenchmarkRWMutexWrite100-16 148.00 109.00 -26.35%
BenchmarkRWMutexWrite10 29.60 29.40 -0.68%
BenchmarkRWMutexWrite10-2 111.00 61.40 -44.68%
BenchmarkRWMutexWrite10-4 270.00 208.00 -22.96%
BenchmarkRWMutexWrite10-8 204.00 185.00 -9.31%
BenchmarkRWMutexWrite10-16 261.00 190.00 -27.20%
BenchmarkRWMutexWorkWrite100 1040.00 1036.00 -0.38%
BenchmarkRWMutexWorkWrite100-2 593.00 580.00 -2.19%
BenchmarkRWMutexWorkWrite100-4 470.00 365.00 -22.34%
BenchmarkRWMutexWorkWrite100-8 468.00 289.00 -38.25%
BenchmarkRWMutexWorkWrite100-16 604.00 374.00 -38.08%
BenchmarkRWMutexWorkWrite10 951.00 951.00 +0.00%
BenchmarkRWMutexWorkWrite10-2 1001.00 928.00 -7.29%
BenchmarkRWMutexWorkWrite10-4 1555.00 1006.00 -35.31%
BenchmarkRWMutexWorkWrite10-8 2085.00 1171.00 -43.84%
BenchmarkRWMutexWorkWrite10-16 2082.00 1614.00 -22.48%
R=rsc, iant, msolo, fw, iant
CC=golang-dev
https://golang.org/cl/4711045
2011-07-29 10:44:06 -06:00
|
|
|
byte* runtime·strstr(byte*, byte*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
int32 runtime·findnull(byte*);
|
2011-01-11 17:48:15 -07:00
|
|
|
int32 runtime·findnullw(uint16*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·dump(byte*, int32);
|
|
|
|
int32 runtime·runetochar(byte*, int32);
|
|
|
|
int32 runtime·charntorune(int32*, uint8*, int32);
|
2008-06-30 12:50:36 -06:00
|
|
|
|
2008-06-05 20:38:39 -06:00
|
|
|
/*
|
2008-06-16 23:34:50 -06:00
|
|
|
* very low level c-called
|
2008-06-05 20:38:39 -06:00
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
#define FLUSH(x) USED(x)
|
|
|
|
|
|
|
|
void runtime·gogo(Gobuf*, uintptr);
|
|
|
|
void runtime·gogocall(Gobuf*, void(*)(void));
|
runtime: scheduler, cgo reorganization
* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).
Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).
The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack. Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler. If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless. Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.
* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.
Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.
The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).
The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc. Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.
Fixes #1560.
R=iant
CC=golang-dev
https://golang.org/cl/4253054
2011-03-07 08:37:42 -07:00
|
|
|
void runtime·gosave(Gobuf*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·lessstack(void);
|
|
|
|
void runtime·goargs(void);
|
2011-01-11 17:48:15 -07:00
|
|
|
void runtime·goenvs(void);
|
|
|
|
void runtime·goenvs_unix(void);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void* runtime·getu(void);
|
|
|
|
void runtime·throw(int8*);
|
|
|
|
void runtime·panicstring(int8*);
|
|
|
|
uint32 runtime·rnd(uint32, uint32);
|
|
|
|
void runtime·prints(int8*);
|
|
|
|
void runtime·printf(int8*, ...);
|
|
|
|
byte* runtime·mchr(byte*, byte, byte*);
|
|
|
|
int32 runtime·mcmp(byte*, byte*, uint32);
|
|
|
|
void runtime·memmove(void*, void*, uint32);
|
|
|
|
void* runtime·mal(uintptr);
|
|
|
|
String runtime·catstring(String, String);
|
|
|
|
String runtime·gostring(byte*);
|
|
|
|
String runtime·gostringn(byte*, int32);
|
2011-07-28 10:39:50 -06:00
|
|
|
Slice runtime·gobytes(byte*, int32);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
String runtime·gostringnocopy(byte*);
|
2011-01-11 17:48:15 -07:00
|
|
|
String runtime·gostringw(uint16*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·initsig(int32);
|
|
|
|
int32 runtime·gotraceback(void);
|
2011-08-22 21:26:39 -06:00
|
|
|
void runtime·goroutineheader(G*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp);
|
|
|
|
void runtime·tracebackothers(G*);
|
|
|
|
int32 runtime·write(int32, void*, int32);
|
2011-06-07 22:50:10 -06:00
|
|
|
int32 runtime·mincore(void*, uintptr, byte*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
bool runtime·cas(uint32*, uint32, uint32);
|
|
|
|
bool runtime·casp(void**, void*, void*);
|
2011-06-28 13:09:53 -06:00
|
|
|
// Don't confuse with XADD x86 instruction,
|
|
|
|
// this one is actually 'addx', that is, add-and-fetch.
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
uint32 runtime·xadd(uint32 volatile*, int32);
|
runtime: improve Linux mutex
The implementation is hybrid active/passive spin/blocking mutex.
The design minimizes amount of context switches and futex calls.
The idea is that all critical sections in runtime are intentially
small, so pure blocking mutex behaves badly causing
a lot of context switches, thread parking/unparking and kernel calls.
Note that some synthetic benchmarks become somewhat slower,
that's due to increased contention on other data structures,
it should not affect programs that do any real work.
On 2 x Intel E5620, 8 HT cores, 2.4GHz
benchmark old ns/op new ns/op delta
BenchmarkSelectContended 521.00 503.00 -3.45%
BenchmarkSelectContended-2 661.00 320.00 -51.59%
BenchmarkSelectContended-4 1139.00 629.00 -44.78%
BenchmarkSelectContended-8 2870.00 878.00 -69.41%
BenchmarkSelectContended-16 5276.00 818.00 -84.50%
BenchmarkChanContended 112.00 103.00 -8.04%
BenchmarkChanContended-2 631.00 174.00 -72.42%
BenchmarkChanContended-4 682.00 272.00 -60.12%
BenchmarkChanContended-8 1601.00 520.00 -67.52%
BenchmarkChanContended-16 3100.00 372.00 -88.00%
BenchmarkChanSync 253.00 239.00 -5.53%
BenchmarkChanSync-2 5030.00 4648.00 -7.59%
BenchmarkChanSync-4 4826.00 4694.00 -2.74%
BenchmarkChanSync-8 4778.00 4713.00 -1.36%
BenchmarkChanSync-16 5289.00 4710.00 -10.95%
BenchmarkChanProdCons0 273.00 254.00 -6.96%
BenchmarkChanProdCons0-2 599.00 400.00 -33.22%
BenchmarkChanProdCons0-4 1168.00 659.00 -43.58%
BenchmarkChanProdCons0-8 2831.00 1057.00 -62.66%
BenchmarkChanProdCons0-16 4197.00 1037.00 -75.29%
BenchmarkChanProdCons10 150.00 140.00 -6.67%
BenchmarkChanProdCons10-2 607.00 268.00 -55.85%
BenchmarkChanProdCons10-4 1137.00 404.00 -64.47%
BenchmarkChanProdCons10-8 2115.00 828.00 -60.85%
BenchmarkChanProdCons10-16 4283.00 855.00 -80.04%
BenchmarkChanProdCons100 117.00 110.00 -5.98%
BenchmarkChanProdCons100-2 558.00 218.00 -60.93%
BenchmarkChanProdCons100-4 722.00 287.00 -60.25%
BenchmarkChanProdCons100-8 1840.00 431.00 -76.58%
BenchmarkChanProdCons100-16 3394.00 448.00 -86.80%
BenchmarkChanProdConsWork0 2014.00 1996.00 -0.89%
BenchmarkChanProdConsWork0-2 1207.00 1127.00 -6.63%
BenchmarkChanProdConsWork0-4 1913.00 611.00 -68.06%
BenchmarkChanProdConsWork0-8 3016.00 949.00 -68.53%
BenchmarkChanProdConsWork0-16 4320.00 1154.00 -73.29%
BenchmarkChanProdConsWork10 1906.00 1897.00 -0.47%
BenchmarkChanProdConsWork10-2 1123.00 1033.00 -8.01%
BenchmarkChanProdConsWork10-4 1076.00 571.00 -46.93%
BenchmarkChanProdConsWork10-8 2748.00 1096.00 -60.12%
BenchmarkChanProdConsWork10-16 4600.00 1105.00 -75.98%
BenchmarkChanProdConsWork100 1884.00 1852.00 -1.70%
BenchmarkChanProdConsWork100-2 1235.00 1146.00 -7.21%
BenchmarkChanProdConsWork100-4 1217.00 619.00 -49.14%
BenchmarkChanProdConsWork100-8 1534.00 509.00 -66.82%
BenchmarkChanProdConsWork100-16 4126.00 918.00 -77.75%
BenchmarkSyscall 34.40 33.30 -3.20%
BenchmarkSyscall-2 160.00 121.00 -24.38%
BenchmarkSyscall-4 131.00 136.00 +3.82%
BenchmarkSyscall-8 139.00 131.00 -5.76%
BenchmarkSyscall-16 161.00 168.00 +4.35%
BenchmarkSyscallWork 950.00 950.00 +0.00%
BenchmarkSyscallWork-2 481.00 480.00 -0.21%
BenchmarkSyscallWork-4 268.00 270.00 +0.75%
BenchmarkSyscallWork-8 156.00 169.00 +8.33%
BenchmarkSyscallWork-16 188.00 184.00 -2.13%
BenchmarkSemaSyntNonblock 36.40 35.60 -2.20%
BenchmarkSemaSyntNonblock-2 81.40 45.10 -44.59%
BenchmarkSemaSyntNonblock-4 126.00 108.00 -14.29%
BenchmarkSemaSyntNonblock-8 112.00 112.00 +0.00%
BenchmarkSemaSyntNonblock-16 110.00 112.00 +1.82%
BenchmarkSemaSyntBlock 35.30 35.30 +0.00%
BenchmarkSemaSyntBlock-2 118.00 124.00 +5.08%
BenchmarkSemaSyntBlock-4 105.00 108.00 +2.86%
BenchmarkSemaSyntBlock-8 101.00 111.00 +9.90%
BenchmarkSemaSyntBlock-16 112.00 118.00 +5.36%
BenchmarkSemaWorkNonblock 810.00 811.00 +0.12%
BenchmarkSemaWorkNonblock-2 476.00 414.00 -13.03%
BenchmarkSemaWorkNonblock-4 238.00 228.00 -4.20%
BenchmarkSemaWorkNonblock-8 140.00 126.00 -10.00%
BenchmarkSemaWorkNonblock-16 117.00 116.00 -0.85%
BenchmarkSemaWorkBlock 810.00 811.00 +0.12%
BenchmarkSemaWorkBlock-2 454.00 466.00 +2.64%
BenchmarkSemaWorkBlock-4 243.00 241.00 -0.82%
BenchmarkSemaWorkBlock-8 145.00 137.00 -5.52%
BenchmarkSemaWorkBlock-16 132.00 123.00 -6.82%
BenchmarkContendedSemaphore 123.00 102.00 -17.07%
BenchmarkContendedSemaphore-2 34.80 34.90 +0.29%
BenchmarkContendedSemaphore-4 34.70 34.80 +0.29%
BenchmarkContendedSemaphore-8 34.70 34.70 +0.00%
BenchmarkContendedSemaphore-16 34.80 34.70 -0.29%
BenchmarkMutex 26.80 26.00 -2.99%
BenchmarkMutex-2 108.00 45.20 -58.15%
BenchmarkMutex-4 103.00 127.00 +23.30%
BenchmarkMutex-8 109.00 147.00 +34.86%
BenchmarkMutex-16 102.00 152.00 +49.02%
BenchmarkMutexSlack 27.00 26.90 -0.37%
BenchmarkMutexSlack-2 149.00 165.00 +10.74%
BenchmarkMutexSlack-4 121.00 209.00 +72.73%
BenchmarkMutexSlack-8 101.00 158.00 +56.44%
BenchmarkMutexSlack-16 97.00 129.00 +32.99%
BenchmarkMutexWork 792.00 794.00 +0.25%
BenchmarkMutexWork-2 407.00 409.00 +0.49%
BenchmarkMutexWork-4 220.00 209.00 -5.00%
BenchmarkMutexWork-8 267.00 160.00 -40.07%
BenchmarkMutexWork-16 315.00 300.00 -4.76%
BenchmarkMutexWorkSlack 792.00 793.00 +0.13%
BenchmarkMutexWorkSlack-2 406.00 404.00 -0.49%
BenchmarkMutexWorkSlack-4 225.00 212.00 -5.78%
BenchmarkMutexWorkSlack-8 268.00 136.00 -49.25%
BenchmarkMutexWorkSlack-16 300.00 300.00 +0.00%
BenchmarkRWMutexWrite100 27.10 27.00 -0.37%
BenchmarkRWMutexWrite100-2 33.10 40.80 +23.26%
BenchmarkRWMutexWrite100-4 113.00 88.10 -22.04%
BenchmarkRWMutexWrite100-8 119.00 95.30 -19.92%
BenchmarkRWMutexWrite100-16 148.00 109.00 -26.35%
BenchmarkRWMutexWrite10 29.60 29.40 -0.68%
BenchmarkRWMutexWrite10-2 111.00 61.40 -44.68%
BenchmarkRWMutexWrite10-4 270.00 208.00 -22.96%
BenchmarkRWMutexWrite10-8 204.00 185.00 -9.31%
BenchmarkRWMutexWrite10-16 261.00 190.00 -27.20%
BenchmarkRWMutexWorkWrite100 1040.00 1036.00 -0.38%
BenchmarkRWMutexWorkWrite100-2 593.00 580.00 -2.19%
BenchmarkRWMutexWorkWrite100-4 470.00 365.00 -22.34%
BenchmarkRWMutexWorkWrite100-8 468.00 289.00 -38.25%
BenchmarkRWMutexWorkWrite100-16 604.00 374.00 -38.08%
BenchmarkRWMutexWorkWrite10 951.00 951.00 +0.00%
BenchmarkRWMutexWorkWrite10-2 1001.00 928.00 -7.29%
BenchmarkRWMutexWorkWrite10-4 1555.00 1006.00 -35.31%
BenchmarkRWMutexWorkWrite10-8 2085.00 1171.00 -43.84%
BenchmarkRWMutexWorkWrite10-16 2082.00 1614.00 -22.48%
R=rsc, iant, msolo, fw, iant
CC=golang-dev
https://golang.org/cl/4711045
2011-07-29 10:44:06 -06:00
|
|
|
uint32 runtime·xchg(uint32 volatile*, uint32);
|
2011-07-13 12:22:41 -06:00
|
|
|
uint32 runtime·atomicload(uint32 volatile*);
|
2011-07-29 11:47:24 -06:00
|
|
|
void runtime·atomicstore(uint32 volatile*, uint32);
|
2011-07-13 12:22:41 -06:00
|
|
|
void* runtime·atomicloadp(void* volatile*);
|
|
|
|
void runtime·atomicstorep(void* volatile*, void*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·jmpdefer(byte*, void*);
|
|
|
|
void runtime·exit1(int32);
|
|
|
|
void runtime·ready(G*);
|
|
|
|
byte* runtime·getenv(int8*);
|
|
|
|
int32 runtime·atoi(byte*);
|
|
|
|
void runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void));
|
|
|
|
void runtime·signalstack(byte*, int32);
|
|
|
|
G* runtime·malg(int32);
|
|
|
|
void runtime·minit(void);
|
|
|
|
Func* runtime·findfunc(uintptr);
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
int32 runtime·funcline(Func*, uintptr);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void* runtime·stackalloc(uint32);
|
2011-01-25 14:35:36 -07:00
|
|
|
void runtime·stackfree(void*, uintptr);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
MCache* runtime·allocmcache(void);
|
|
|
|
void runtime·mallocinit(void);
|
|
|
|
bool runtime·ifaceeq_c(Iface, Iface);
|
|
|
|
bool runtime·efaceeq_c(Eface, Eface);
|
|
|
|
uintptr runtime·ifacehash(Iface);
|
|
|
|
uintptr runtime·efacehash(Eface);
|
|
|
|
void* runtime·malloc(uintptr size);
|
|
|
|
void runtime·free(void *v);
|
2011-10-06 09:42:51 -06:00
|
|
|
bool runtime·addfinalizer(void*, void(*fn)(void*), int32);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·runpanic(Panic*);
|
|
|
|
void* runtime·getcallersp(void*);
|
2011-01-28 13:03:26 -07:00
|
|
|
int32 runtime·mcount(void);
|
runtime: scheduler, cgo reorganization
* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).
Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).
The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack. Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler. If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless. Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.
* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.
Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.
The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).
The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc. Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.
Fixes #1560.
R=iant
CC=golang-dev
https://golang.org/cl/4253054
2011-03-07 08:37:42 -07:00
|
|
|
void runtime·mcall(void(*)(G*));
|
2011-07-11 23:23:58 -06:00
|
|
|
uint32 runtime·fastrand1(void);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
|
|
|
|
void runtime·exit(int32);
|
|
|
|
void runtime·breakpoint(void);
|
|
|
|
void runtime·gosched(void);
|
runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes #1644.
Fixes #1731.
Fixes #2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 13:17:05 -07:00
|
|
|
void runtime·tsleep(int64);
|
|
|
|
M* runtime·newm(void);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·goexit(void);
|
runtime: scheduler, cgo reorganization
* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).
Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).
The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack. Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler. If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless. Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.
* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.
Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.
The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).
The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc. Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.
Fixes #1560.
R=iant
CC=golang-dev
https://golang.org/cl/4253054
2011-03-07 08:37:42 -07:00
|
|
|
void runtime·asmcgocall(void (*fn)(void*), void*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·entersyscall(void);
|
|
|
|
void runtime·exitsyscall(void);
|
2011-03-02 11:42:02 -07:00
|
|
|
G* runtime·newproc1(byte*, byte*, int32, int32, void*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·siginit(void);
|
|
|
|
bool runtime·sigsend(int32 sig);
|
|
|
|
int32 runtime·callers(int32, uintptr*, int32);
|
2011-03-23 09:43:37 -06:00
|
|
|
int32 runtime·gentraceback(byte*, byte*, byte*, G*, int32, uintptr*, int32);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
int64 runtime·nanotime(void);
|
|
|
|
void runtime·dopanic(int32);
|
2011-02-16 11:21:13 -07:00
|
|
|
void runtime·startpanic(void);
|
2011-03-23 09:43:37 -06:00
|
|
|
void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp);
|
|
|
|
void runtime·resetcpuprofiler(int32);
|
|
|
|
void runtime·setcpuprofilerate(void(*)(uintptr*, int32), int32);
|
runtime: parallelize garbage collector mark + sweep
Running test/garbage/parser.out.
On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r 1 cpu, no atomics
32.27u 0.58s 32.86r 1 cpu, atomic instructions
33.04u 0.83s 27.47r 2 cpu
On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r 1 cpu, no atomics
34.87u 1.12s 29.60r 2 cpu
36.00u 1.87s 28.43r 3 cpu
36.46u 2.34s 27.10r 4 cpu
38.28u 3.85s 26.92r 5 cpu
37.72u 5.25s 26.73r 6 cpu
39.63u 7.11s 26.95r 7 cpu
39.67u 8.10s 26.68r 8 cpu
On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r 1 cpu, no atomics
43.98u 2.95s 38.69r 2 cpu
On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r 1 cpu, no atomics
57.15u 4.72s 51.54r 2 cpu
The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.
R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082
2011-09-30 07:40:01 -06:00
|
|
|
void runtime·usleep(uint32);
|
2012-02-02 12:09:27 -07:00
|
|
|
int64 runtime·cputicks(void);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
|
|
|
|
#pragma varargck argpos runtime·printf 1
|
2008-12-15 11:50:33 -07:00
|
|
|
#pragma varargck type "d" int32
|
|
|
|
#pragma varargck type "d" uint32
|
|
|
|
#pragma varargck type "D" int64
|
|
|
|
#pragma varargck type "D" uint64
|
|
|
|
#pragma varargck type "x" int32
|
|
|
|
#pragma varargck type "x" uint32
|
|
|
|
#pragma varargck type "X" int64
|
|
|
|
#pragma varargck type "X" uint64
|
|
|
|
#pragma varargck type "p" void*
|
2009-03-30 01:01:07 -06:00
|
|
|
#pragma varargck type "p" uintptr
|
2008-12-15 11:50:33 -07:00
|
|
|
#pragma varargck type "s" int8*
|
|
|
|
#pragma varargck type "s" uint8*
|
2009-04-09 19:16:21 -06:00
|
|
|
#pragma varargck type "S" String
|
2008-12-15 11:50:33 -07:00
|
|
|
|
2008-12-05 16:24:18 -07:00
|
|
|
// TODO(rsc): Remove. These are only temporary,
|
|
|
|
// for the mark and sweep collector.
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·stoptheworld(void);
|
runtime: parallelize garbage collector mark + sweep
Running test/garbage/parser.out.
On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r 1 cpu, no atomics
32.27u 0.58s 32.86r 1 cpu, atomic instructions
33.04u 0.83s 27.47r 2 cpu
On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r 1 cpu, no atomics
34.87u 1.12s 29.60r 2 cpu
36.00u 1.87s 28.43r 3 cpu
36.46u 2.34s 27.10r 4 cpu
38.28u 3.85s 26.92r 5 cpu
37.72u 5.25s 26.73r 6 cpu
39.63u 7.11s 26.95r 7 cpu
39.67u 8.10s 26.68r 8 cpu
On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r 1 cpu, no atomics
43.98u 2.95s 38.69r 2 cpu
On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r 1 cpu, no atomics
57.15u 4.72s 51.54r 2 cpu
The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.
R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082
2011-09-30 07:40:01 -06:00
|
|
|
void runtime·starttheworld(bool);
|
2008-12-05 16:24:18 -07:00
|
|
|
|
2008-08-04 17:43:49 -06:00
|
|
|
/*
|
|
|
|
* mutual exclusion locks. in the uncontended case,
|
|
|
|
* as fast as spin locks (just a few user-level instructions),
|
|
|
|
* but on the contention path they sleep in the kernel.
|
2008-08-05 15:18:47 -06:00
|
|
|
* a zeroed Lock is unlocked (no need to initialize each lock).
|
2008-08-04 17:43:49 -06:00
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·lock(Lock*);
|
|
|
|
void runtime·unlock(Lock*);
|
2008-08-04 17:43:49 -06:00
|
|
|
|
|
|
|
/*
|
2009-10-14 14:02:05 -06:00
|
|
|
* sleep and wakeup on one-time events.
|
2008-08-05 15:21:42 -06:00
|
|
|
* before any calls to notesleep or notewakeup,
|
2008-08-05 15:18:47 -06:00
|
|
|
* must call noteclear to initialize the Note.
|
2011-08-03 13:51:55 -06:00
|
|
|
* then, exactly one thread can call notesleep
|
2008-08-05 15:18:47 -06:00
|
|
|
* and exactly one thread can call notewakeup (once).
|
2011-08-03 13:51:55 -06:00
|
|
|
* once notewakeup has been called, the notesleep
|
|
|
|
* will return. future notesleep will return immediately.
|
|
|
|
* subsequent noteclear must be called only after
|
|
|
|
* previous notesleep has returned, e.g. it's disallowed
|
|
|
|
* to call noteclear straight after notewakeup.
|
runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes #1644.
Fixes #1731.
Fixes #2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 13:17:05 -07:00
|
|
|
*
|
|
|
|
* notetsleep is like notesleep but wakes up after
|
|
|
|
* a given number of nanoseconds even if the event
|
|
|
|
* has not yet happened. if a goroutine uses notetsleep to
|
|
|
|
* wake up early, it must wait to call noteclear until it
|
|
|
|
* can be sure that no other goroutine is calling
|
|
|
|
* notewakeup.
|
2008-08-04 17:43:49 -06:00
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·noteclear(Note*);
|
|
|
|
void runtime·notesleep(Note*);
|
|
|
|
void runtime·notewakeup(Note*);
|
runtime: add timer support, use for package time
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes #1644.
Fixes #1731.
Fixes #2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
2011-11-09 13:17:05 -07:00
|
|
|
void runtime·notetsleep(Note*, int64);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* low-level synchronization for implementing the above
|
|
|
|
*/
|
|
|
|
uintptr runtime·semacreate(void);
|
|
|
|
int32 runtime·semasleep(int64);
|
|
|
|
void runtime·semawakeup(M*);
|
|
|
|
// or
|
|
|
|
void runtime·futexsleep(uint32*, uint32, int64);
|
|
|
|
void runtime·futexwakeup(uint32*, uint32);
|
2009-01-13 10:55:24 -07:00
|
|
|
|
2009-11-13 11:08:51 -07:00
|
|
|
/*
|
|
|
|
* This is consistent across Linux and BSD.
|
|
|
|
* If a new OS is added that is different, move this to
|
|
|
|
* $GOOS/$GOARCH/defs.h.
|
|
|
|
*/
|
|
|
|
#define EACCES 13
|
|
|
|
|
2008-06-16 23:34:50 -06:00
|
|
|
/*
|
2011-01-25 14:35:36 -07:00
|
|
|
* low level C-called
|
2008-06-16 23:34:50 -06:00
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
uint8* runtime·mmap(byte*, uintptr, int32, int32, int32, uint32);
|
2011-12-20 15:54:40 -07:00
|
|
|
void runtime·munmap(byte*, uintptr);
|
|
|
|
void runtime·madvise(byte*, uintptr, int32);
|
2011-01-25 14:35:36 -07:00
|
|
|
void runtime·memclr(byte*, uintptr);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·setcallerpc(void*, void*);
|
|
|
|
void* runtime·getcallerpc(void*);
|
2008-06-05 20:38:39 -06:00
|
|
|
|
|
|
|
/*
|
2008-06-16 23:34:50 -06:00
|
|
|
* runtime go-called
|
2008-06-05 20:38:39 -06:00
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·printbool(bool);
|
|
|
|
void runtime·printfloat(float64);
|
|
|
|
void runtime·printint(int64);
|
|
|
|
void runtime·printiface(Iface);
|
|
|
|
void runtime·printeface(Eface);
|
|
|
|
void runtime·printstring(String);
|
|
|
|
void runtime·printpc(void*);
|
|
|
|
void runtime·printpointer(void*);
|
|
|
|
void runtime·printuint(uint64);
|
|
|
|
void runtime·printhex(uint64);
|
|
|
|
void runtime·printslice(Slice);
|
|
|
|
void runtime·printcomplex(Complex128);
|
2010-03-26 15:15:30 -06:00
|
|
|
void reflect·call(byte*, byte*, uint32);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·panic(Eface);
|
|
|
|
void runtime·panicindex(void);
|
|
|
|
void runtime·panicslice(void);
|
2010-10-25 18:55:50 -06:00
|
|
|
|
2010-03-31 16:55:10 -06:00
|
|
|
/*
|
|
|
|
* runtime c-called (but written in Go)
|
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·newError(String, Eface*);
|
|
|
|
void runtime·printany(Eface);
|
|
|
|
void runtime·newTypeAssertionError(Type*, Type*, Type*, String*, String*, String*, String*, Eface*);
|
|
|
|
void runtime·newErrorString(String, Eface*);
|
|
|
|
void runtime·fadd64c(uint64, uint64, uint64*);
|
|
|
|
void runtime·fsub64c(uint64, uint64, uint64*);
|
|
|
|
void runtime·fmul64c(uint64, uint64, uint64*);
|
|
|
|
void runtime·fdiv64c(uint64, uint64, uint64*);
|
|
|
|
void runtime·fneg64c(uint64, uint64*);
|
|
|
|
void runtime·f32to64c(uint32, uint64*);
|
|
|
|
void runtime·f64to32c(uint64, uint32*);
|
|
|
|
void runtime·fcmp64c(uint64, uint64, int32*, bool*);
|
|
|
|
void runtime·fintto64c(int64, uint64*);
|
|
|
|
void runtime·f64tointc(uint64, int64*, bool*);
|
2008-07-08 11:36:43 -06:00
|
|
|
|
|
|
|
/*
|
2009-01-22 17:23:44 -07:00
|
|
|
* wrapped for go users
|
2008-07-08 11:36:43 -06:00
|
|
|
*/
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
float64 runtime·Inf(int32 sign);
|
|
|
|
float64 runtime·NaN(void);
|
|
|
|
float32 runtime·float32frombits(uint32 i);
|
|
|
|
uint32 runtime·float32tobits(float32 f);
|
|
|
|
float64 runtime·float64frombits(uint64 i);
|
|
|
|
uint64 runtime·float64tobits(float64 f);
|
|
|
|
float64 runtime·frexp(float64 d, int32 *ep);
|
|
|
|
bool runtime·isInf(float64 f, int32 sign);
|
|
|
|
bool runtime·isNaN(float64 f);
|
|
|
|
float64 runtime·ldexp(float64 d, int32 e);
|
|
|
|
float64 runtime·modf(float64 d, float64 *ip);
|
|
|
|
void runtime·semacquire(uint32*);
|
|
|
|
void runtime·semrelease(uint32*);
|
|
|
|
String runtime·signame(int32 sig);
|
|
|
|
int32 runtime·gomaxprocsfunc(int32 n);
|
runtime: improve Linux mutex
The implementation is hybrid active/passive spin/blocking mutex.
The design minimizes amount of context switches and futex calls.
The idea is that all critical sections in runtime are intentially
small, so pure blocking mutex behaves badly causing
a lot of context switches, thread parking/unparking and kernel calls.
Note that some synthetic benchmarks become somewhat slower,
that's due to increased contention on other data structures,
it should not affect programs that do any real work.
On 2 x Intel E5620, 8 HT cores, 2.4GHz
benchmark old ns/op new ns/op delta
BenchmarkSelectContended 521.00 503.00 -3.45%
BenchmarkSelectContended-2 661.00 320.00 -51.59%
BenchmarkSelectContended-4 1139.00 629.00 -44.78%
BenchmarkSelectContended-8 2870.00 878.00 -69.41%
BenchmarkSelectContended-16 5276.00 818.00 -84.50%
BenchmarkChanContended 112.00 103.00 -8.04%
BenchmarkChanContended-2 631.00 174.00 -72.42%
BenchmarkChanContended-4 682.00 272.00 -60.12%
BenchmarkChanContended-8 1601.00 520.00 -67.52%
BenchmarkChanContended-16 3100.00 372.00 -88.00%
BenchmarkChanSync 253.00 239.00 -5.53%
BenchmarkChanSync-2 5030.00 4648.00 -7.59%
BenchmarkChanSync-4 4826.00 4694.00 -2.74%
BenchmarkChanSync-8 4778.00 4713.00 -1.36%
BenchmarkChanSync-16 5289.00 4710.00 -10.95%
BenchmarkChanProdCons0 273.00 254.00 -6.96%
BenchmarkChanProdCons0-2 599.00 400.00 -33.22%
BenchmarkChanProdCons0-4 1168.00 659.00 -43.58%
BenchmarkChanProdCons0-8 2831.00 1057.00 -62.66%
BenchmarkChanProdCons0-16 4197.00 1037.00 -75.29%
BenchmarkChanProdCons10 150.00 140.00 -6.67%
BenchmarkChanProdCons10-2 607.00 268.00 -55.85%
BenchmarkChanProdCons10-4 1137.00 404.00 -64.47%
BenchmarkChanProdCons10-8 2115.00 828.00 -60.85%
BenchmarkChanProdCons10-16 4283.00 855.00 -80.04%
BenchmarkChanProdCons100 117.00 110.00 -5.98%
BenchmarkChanProdCons100-2 558.00 218.00 -60.93%
BenchmarkChanProdCons100-4 722.00 287.00 -60.25%
BenchmarkChanProdCons100-8 1840.00 431.00 -76.58%
BenchmarkChanProdCons100-16 3394.00 448.00 -86.80%
BenchmarkChanProdConsWork0 2014.00 1996.00 -0.89%
BenchmarkChanProdConsWork0-2 1207.00 1127.00 -6.63%
BenchmarkChanProdConsWork0-4 1913.00 611.00 -68.06%
BenchmarkChanProdConsWork0-8 3016.00 949.00 -68.53%
BenchmarkChanProdConsWork0-16 4320.00 1154.00 -73.29%
BenchmarkChanProdConsWork10 1906.00 1897.00 -0.47%
BenchmarkChanProdConsWork10-2 1123.00 1033.00 -8.01%
BenchmarkChanProdConsWork10-4 1076.00 571.00 -46.93%
BenchmarkChanProdConsWork10-8 2748.00 1096.00 -60.12%
BenchmarkChanProdConsWork10-16 4600.00 1105.00 -75.98%
BenchmarkChanProdConsWork100 1884.00 1852.00 -1.70%
BenchmarkChanProdConsWork100-2 1235.00 1146.00 -7.21%
BenchmarkChanProdConsWork100-4 1217.00 619.00 -49.14%
BenchmarkChanProdConsWork100-8 1534.00 509.00 -66.82%
BenchmarkChanProdConsWork100-16 4126.00 918.00 -77.75%
BenchmarkSyscall 34.40 33.30 -3.20%
BenchmarkSyscall-2 160.00 121.00 -24.38%
BenchmarkSyscall-4 131.00 136.00 +3.82%
BenchmarkSyscall-8 139.00 131.00 -5.76%
BenchmarkSyscall-16 161.00 168.00 +4.35%
BenchmarkSyscallWork 950.00 950.00 +0.00%
BenchmarkSyscallWork-2 481.00 480.00 -0.21%
BenchmarkSyscallWork-4 268.00 270.00 +0.75%
BenchmarkSyscallWork-8 156.00 169.00 +8.33%
BenchmarkSyscallWork-16 188.00 184.00 -2.13%
BenchmarkSemaSyntNonblock 36.40 35.60 -2.20%
BenchmarkSemaSyntNonblock-2 81.40 45.10 -44.59%
BenchmarkSemaSyntNonblock-4 126.00 108.00 -14.29%
BenchmarkSemaSyntNonblock-8 112.00 112.00 +0.00%
BenchmarkSemaSyntNonblock-16 110.00 112.00 +1.82%
BenchmarkSemaSyntBlock 35.30 35.30 +0.00%
BenchmarkSemaSyntBlock-2 118.00 124.00 +5.08%
BenchmarkSemaSyntBlock-4 105.00 108.00 +2.86%
BenchmarkSemaSyntBlock-8 101.00 111.00 +9.90%
BenchmarkSemaSyntBlock-16 112.00 118.00 +5.36%
BenchmarkSemaWorkNonblock 810.00 811.00 +0.12%
BenchmarkSemaWorkNonblock-2 476.00 414.00 -13.03%
BenchmarkSemaWorkNonblock-4 238.00 228.00 -4.20%
BenchmarkSemaWorkNonblock-8 140.00 126.00 -10.00%
BenchmarkSemaWorkNonblock-16 117.00 116.00 -0.85%
BenchmarkSemaWorkBlock 810.00 811.00 +0.12%
BenchmarkSemaWorkBlock-2 454.00 466.00 +2.64%
BenchmarkSemaWorkBlock-4 243.00 241.00 -0.82%
BenchmarkSemaWorkBlock-8 145.00 137.00 -5.52%
BenchmarkSemaWorkBlock-16 132.00 123.00 -6.82%
BenchmarkContendedSemaphore 123.00 102.00 -17.07%
BenchmarkContendedSemaphore-2 34.80 34.90 +0.29%
BenchmarkContendedSemaphore-4 34.70 34.80 +0.29%
BenchmarkContendedSemaphore-8 34.70 34.70 +0.00%
BenchmarkContendedSemaphore-16 34.80 34.70 -0.29%
BenchmarkMutex 26.80 26.00 -2.99%
BenchmarkMutex-2 108.00 45.20 -58.15%
BenchmarkMutex-4 103.00 127.00 +23.30%
BenchmarkMutex-8 109.00 147.00 +34.86%
BenchmarkMutex-16 102.00 152.00 +49.02%
BenchmarkMutexSlack 27.00 26.90 -0.37%
BenchmarkMutexSlack-2 149.00 165.00 +10.74%
BenchmarkMutexSlack-4 121.00 209.00 +72.73%
BenchmarkMutexSlack-8 101.00 158.00 +56.44%
BenchmarkMutexSlack-16 97.00 129.00 +32.99%
BenchmarkMutexWork 792.00 794.00 +0.25%
BenchmarkMutexWork-2 407.00 409.00 +0.49%
BenchmarkMutexWork-4 220.00 209.00 -5.00%
BenchmarkMutexWork-8 267.00 160.00 -40.07%
BenchmarkMutexWork-16 315.00 300.00 -4.76%
BenchmarkMutexWorkSlack 792.00 793.00 +0.13%
BenchmarkMutexWorkSlack-2 406.00 404.00 -0.49%
BenchmarkMutexWorkSlack-4 225.00 212.00 -5.78%
BenchmarkMutexWorkSlack-8 268.00 136.00 -49.25%
BenchmarkMutexWorkSlack-16 300.00 300.00 +0.00%
BenchmarkRWMutexWrite100 27.10 27.00 -0.37%
BenchmarkRWMutexWrite100-2 33.10 40.80 +23.26%
BenchmarkRWMutexWrite100-4 113.00 88.10 -22.04%
BenchmarkRWMutexWrite100-8 119.00 95.30 -19.92%
BenchmarkRWMutexWrite100-16 148.00 109.00 -26.35%
BenchmarkRWMutexWrite10 29.60 29.40 -0.68%
BenchmarkRWMutexWrite10-2 111.00 61.40 -44.68%
BenchmarkRWMutexWrite10-4 270.00 208.00 -22.96%
BenchmarkRWMutexWrite10-8 204.00 185.00 -9.31%
BenchmarkRWMutexWrite10-16 261.00 190.00 -27.20%
BenchmarkRWMutexWorkWrite100 1040.00 1036.00 -0.38%
BenchmarkRWMutexWorkWrite100-2 593.00 580.00 -2.19%
BenchmarkRWMutexWorkWrite100-4 470.00 365.00 -22.34%
BenchmarkRWMutexWorkWrite100-8 468.00 289.00 -38.25%
BenchmarkRWMutexWorkWrite100-16 604.00 374.00 -38.08%
BenchmarkRWMutexWorkWrite10 951.00 951.00 +0.00%
BenchmarkRWMutexWorkWrite10-2 1001.00 928.00 -7.29%
BenchmarkRWMutexWorkWrite10-4 1555.00 1006.00 -35.31%
BenchmarkRWMutexWorkWrite10-8 2085.00 1171.00 -43.84%
BenchmarkRWMutexWorkWrite10-16 2082.00 1614.00 -22.48%
R=rsc, iant, msolo, fw, iant
CC=golang-dev
https://golang.org/cl/4711045
2011-07-29 10:44:06 -06:00
|
|
|
void runtime·procyield(uint32);
|
|
|
|
void runtime·osyield(void);
|
2011-10-27 19:04:12 -06:00
|
|
|
void runtime·LockOSThread(void);
|
|
|
|
void runtime·UnlockOSThread(void);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
|
2011-08-17 12:56:27 -06:00
|
|
|
void runtime·mapassign(MapType*, Hmap*, byte*, byte*);
|
|
|
|
void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
void runtime·mapiternext(struct hash_iter*);
|
|
|
|
bool runtime·mapiterkey(struct hash_iter*, void*);
|
|
|
|
void runtime·mapiterkeyvalue(struct hash_iter*, void*, void*);
|
2011-08-17 12:56:27 -06:00
|
|
|
Hmap* runtime·makemap_c(MapType*, int64);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
|
2011-08-17 13:54:17 -06:00
|
|
|
Hchan* runtime·makechan_c(ChanType*, int64);
|
2011-08-23 11:13:27 -06:00
|
|
|
void runtime·chansend(ChanType*, Hchan*, byte*, bool*);
|
|
|
|
void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
int32 runtime·chanlen(Hchan*);
|
|
|
|
int32 runtime·chancap(Hchan*);
|
2011-08-22 21:26:39 -06:00
|
|
|
bool runtime·showframe(Func*);
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
|
|
|
|
void runtime·ifaceE2I(struct InterfaceType*, Eface, Iface*);
|
2011-01-25 14:35:36 -07:00
|
|
|
|