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 Alg Alg;
|
|
|
|
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;
|
2008-08-04 17:43:49 -06:00
|
|
|
typedef struct 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-11-23 18:08:55 -07:00
|
|
|
typedef struct Usema Usema;
|
2008-12-19 18:11:54 -07:00
|
|
|
typedef struct SigTab SigTab;
|
|
|
|
typedef struct MCache MCache;
|
|
|
|
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;
|
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;
|
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
|
|
|
|
*/
|
2008-08-04 17:43:49 -06:00
|
|
|
struct Lock
|
|
|
|
{
|
|
|
|
uint32 key;
|
2010-04-30 00:45:14 -06:00
|
|
|
#ifdef __WINDOWS__
|
2010-01-06 18:58:55 -07:00
|
|
|
void* event;
|
|
|
|
#else
|
2008-09-09 12:50:14 -06:00
|
|
|
uint32 sema; // for OS X
|
2010-01-06 18:58:55 -07:00
|
|
|
#endif
|
2008-08-04 17:43:49 -06:00
|
|
|
};
|
2008-09-24 11:25:28 -06:00
|
|
|
struct Usema
|
|
|
|
{
|
|
|
|
uint32 u;
|
|
|
|
uint32 k;
|
|
|
|
};
|
2008-09-09 12:50:14 -06:00
|
|
|
union Note
|
2008-08-04 17:43:49 -06:00
|
|
|
{
|
2008-09-09 12:50:14 -06:00
|
|
|
struct { // Linux
|
|
|
|
Lock lock;
|
|
|
|
};
|
|
|
|
struct { // OS X
|
|
|
|
int32 wakeup;
|
2008-09-24 11:25:28 -06:00
|
|
|
Usema sema;
|
2008-09-09 12:50:14 -06:00
|
|
|
};
|
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
|
|
|
{
|
2009-10-03 11:37:12 -06:00
|
|
|
byte* stackguard; // cannot move - also known to linker, libmach, libcgo
|
|
|
|
byte* stackbase; // cannot move - also known to libmach, libcgo
|
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
|
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
|
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;
|
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;
|
2009-07-13 18:28:39 -06:00
|
|
|
G* lockedg;
|
2011-02-27 21:32:42 -07:00
|
|
|
G* idleg;
|
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
|
2010-04-30 00:45:14 -06:00
|
|
|
#ifdef __WINDOWS__
|
2011-02-01 09:49:24 -07:00
|
|
|
void* sehframe;
|
2011-06-29 01:37:56 -06:00
|
|
|
|
|
|
|
#ifdef _64BIT
|
|
|
|
void* gostack;
|
|
|
|
#endif
|
|
|
|
|
2010-01-06 18:58:55 -07:00
|
|
|
#endif
|
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 Alg
|
2008-07-11 20:16:39 -06:00
|
|
|
{
|
2009-06-04 22:09:06 -06:00
|
|
|
uintptr (*hash)(uint32, void*);
|
2008-07-13 15:29:46 -06:00
|
|
|
uint32 (*equal)(uint32, void*, void*);
|
|
|
|
void (*print)(uint32, void*);
|
|
|
|
void (*copy)(uint32, void*, void*);
|
2008-07-11 20:16:39 -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
|
|
|
};
|
|
|
|
|
2010-09-11 19:45:16 -06:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
enum {
|
|
|
|
Windows = 1
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
enum {
|
|
|
|
Windows = 0
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
2009-01-26 10:56:42 -07:00
|
|
|
AMEM,
|
|
|
|
ANOEQ,
|
2008-12-19 13:05:22 -07:00
|
|
|
ASTRING,
|
|
|
|
AINTER,
|
2009-05-20 15:57:55 -06:00
|
|
|
ANILINTER,
|
2010-08-26 11:32:40 -06:00
|
|
|
AMEMWORD,
|
2009-01-26 10:56:42 -07:00
|
|
|
Amax
|
2008-12-19 13:05:22 -07:00
|
|
|
};
|
|
|
|
|
2009-07-02 22:25:46 -06:00
|
|
|
|
|
|
|
enum {
|
|
|
|
Structrnd = sizeof(uintptr)
|
|
|
|
};
|
|
|
|
|
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-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 Alg runtime·algarray[Amax];
|
|
|
|
extern String runtime·emptystring;
|
|
|
|
G* runtime·allg;
|
|
|
|
M* runtime·allm;
|
|
|
|
int32 runtime·goidgen;
|
|
|
|
extern int32 runtime·gomaxprocs;
|
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;
|
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*);
|
|
|
|
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*);
|
|
|
|
void runtime·mcpy(byte*, byte*, uint32);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
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);
|
2011-06-28 13:09:53 -06:00
|
|
|
uint32 runtime·atomicload(uint32 volatile*);
|
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);
|
|
|
|
uintptr runtime·nohash(uint32, void*);
|
|
|
|
uint32 runtime·noequal(uint32, void*, void*);
|
|
|
|
void* runtime·malloc(uintptr size);
|
|
|
|
void runtime·free(void *v);
|
|
|
|
void runtime·addfinalizer(void*, void(*fn)(void*), int32);
|
|
|
|
void runtime·walkfintab(void (*fn)(void*));
|
|
|
|
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*));
|
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);
|
|
|
|
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);
|
|
|
|
void runtime·gettime(int64*, int32*);
|
|
|
|
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: ,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);
|
|
|
|
void runtime·starttheworld(void);
|
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*);
|
|
|
|
void runtime·destroylock(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.
|
|
|
|
* then, any number of threads can call notesleep
|
|
|
|
* and exactly one thread can call notewakeup (once).
|
|
|
|
* once notewakeup has been called, all the notesleeps
|
|
|
|
* will return. future notesleeps will return immediately.
|
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*);
|
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);
|
|
|
|
void runtime·munmap(uint8*, uintptr);
|
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);
|
|
|
|
|
|
|
|
void runtime·mapassign(Hmap*, byte*, byte*);
|
|
|
|
void runtime·mapaccess(Hmap*, byte*, byte*, bool*);
|
|
|
|
void runtime·mapiternext(struct hash_iter*);
|
|
|
|
bool runtime·mapiterkey(struct hash_iter*, void*);
|
|
|
|
void runtime·mapiterkeyvalue(struct hash_iter*, void*, void*);
|
|
|
|
Hmap* runtime·makemap_c(Type*, Type*, int64);
|
|
|
|
|
|
|
|
Hchan* runtime·makechan_c(Type*, int64);
|
|
|
|
void runtime·chansend(Hchan*, void*, bool*);
|
2011-01-18 13:59:19 -07:00
|
|
|
void runtime·chanrecv(Hchan*, void*, 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*);
|
|
|
|
|
|
|
|
void runtime·ifaceE2I(struct InterfaceType*, Eface, Iface*);
|
2011-01-25 14:35:36 -07:00
|
|
|
|