summaryrefslogtreecommitdiff
path: root/libgo/runtime/runtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/runtime.h')
-rw-r--r--libgo/runtime/runtime.h670
1 files changed, 200 insertions, 470 deletions
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 73c46e9117..644fe92865 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -7,6 +7,7 @@
#include "go-assert.h"
#include <complex.h>
#include <signal.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -22,9 +23,6 @@
#include <sys/mman.h>
#endif
-#include "interface.h"
-#include "go-alloc.h"
-
#define _STRINGIFY2_(x) #x
#define _STRINGIFY_(x) _STRINGIFY2_(x)
#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
@@ -53,36 +51,35 @@ typedef uintptr uintreg;
/* Defined types. */
-typedef uint8 bool;
+typedef _Bool bool;
typedef uint8 byte;
-typedef struct Func Func;
-typedef struct G G;
-typedef struct Lock Lock;
-typedef struct M M;
-typedef struct P P;
-typedef struct Note Note;
+typedef struct g G;
+typedef struct mutex Lock;
+typedef struct m M;
+typedef struct p P;
+typedef struct note Note;
typedef struct String String;
typedef struct FuncVal FuncVal;
typedef struct SigTab SigTab;
-typedef struct MCache MCache;
+typedef struct mcache MCache;
typedef struct FixAlloc FixAlloc;
-typedef struct Hchan Hchan;
-typedef struct Timers Timers;
-typedef struct Timer Timer;
-typedef struct GCStats GCStats;
-typedef struct LFNode LFNode;
+typedef struct hchan Hchan;
+typedef struct timer Timer;
+typedef struct gcstats GCStats;
+typedef struct lfnode LFNode;
typedef struct ParFor ParFor;
typedef struct ParForThread ParForThread;
-typedef struct CgoMal CgoMal;
+typedef struct cgoMal CgoMal;
typedef struct PollDesc PollDesc;
-typedef struct DebugVars DebugVars;
+typedef struct sudog SudoG;
+typedef struct schedt Sched;
typedef struct __go_open_array Slice;
-typedef struct __go_interface Iface;
-typedef struct __go_empty_interface Eface;
+typedef struct iface Iface;
+typedef struct eface Eface;
typedef struct __go_type_descriptor Type;
-typedef struct __go_defer_stack Defer;
-typedef struct __go_panic_stack Panic;
+typedef struct _defer Defer;
+typedef struct _panic Panic;
typedef struct __go_ptr_type PtrType;
typedef struct __go_func_type FuncType;
@@ -90,46 +87,44 @@ typedef struct __go_interface_type InterfaceType;
typedef struct __go_map_type MapType;
typedef struct __go_channel_type ChanType;
-typedef struct Traceback Traceback;
+typedef struct tracebackg Traceback;
+
+typedef struct location Location;
-typedef struct Location Location;
+struct String
+{
+ const byte* str;
+ intgo len;
+};
+
+struct FuncVal
+{
+ void (*fn)(void);
+ // variable-size, fn-specific data here
+};
+
+#include "array.h"
+
+// Rename Go types generated by mkrsysinfo.sh from C types, to avoid
+// the name conflict.
+#define timeval go_timeval
+#define timespec go_timespec
+
+#include "runtime.inc"
+
+#undef timeval
+#undef timespec
/*
* Per-CPU declaration.
*/
extern M* runtime_m(void);
-extern G* runtime_g(void);
+extern G* runtime_g(void)
+ __asm__(GOSYM_PREFIX "runtime.getg");
extern M runtime_m0;
extern G runtime_g0;
-/*
- * defined constants
- */
-enum
-{
- // G status
- //
- // If you add to this list, add to the list
- // of "okay during garbage collection" status
- // in mgc0.c too.
- Gidle,
- Grunnable,
- Grunning,
- Gsyscall,
- Gwaiting,
- Gmoribund_unused, // currently unused, but hardcoded in gdb scripts
- Gdead,
-};
-enum
-{
- // P status
- Pidle,
- Prunning,
- Psyscall,
- Pgcstop,
- Pdead,
-};
enum
{
true = 1,
@@ -146,184 +141,6 @@ enum
// Global <-> per-M stack segment cache transfer batch size.
StackCacheBatch = 16,
};
-/*
- * structures
- */
-struct Lock
-{
- // Futex-based impl treats it as uint32 key,
- // while sema-based impl as M* waitm.
- // Used to be a union, but unions break precise GC.
- uintptr key;
-};
-struct Note
-{
- // Futex-based impl treats it as uint32 key,
- // while sema-based impl as M* waitm.
- // Used to be a union, but unions break precise GC.
- uintptr key;
-};
-struct String
-{
- const byte* str;
- intgo len;
-};
-struct FuncVal
-{
- void (*fn)(void);
- // variable-size, fn-specific data here
-};
-struct GCStats
-{
- // the struct must consist of only uint64's,
- // because it is casted to uint64[].
- uint64 nhandoff;
- uint64 nhandoffcnt;
- uint64 nprocyield;
- uint64 nosyield;
- uint64 nsleep;
-};
-
-// A location in the program, used for backtraces.
-struct Location
-{
- uintptr pc;
- String filename;
- String function;
- intgo lineno;
-};
-
-struct G
-{
- Defer* defer;
- Panic* panic;
- void* exception; // current exception being thrown
- bool is_foreign; // whether current exception from other language
- void *gcstack; // if status==Gsyscall, gcstack = stackbase to use during gc
- size_t gcstack_size;
- void* gcnext_segment;
- void* gcnext_sp;
- void* gcinitial_sp;
- ucontext_t gcregs;
- byte* entry; // initial function
- void* param; // passed parameter on wakeup
- bool fromgogo; // reached from gogo
- int16 status;
- uint32 selgen; // valid sudog pointer
- int64 goid;
- int64 waitsince; // approx time when the G become blocked
- const char* waitreason; // if status==Gwaiting
- G* schedlink;
- bool ispanic;
- bool issystem; // do not output in stack dump
- bool isbackground; // ignore in deadlock detector
- bool paniconfault; // panic (instead of crash) on unexpected fault address
- M* m; // for debuggers, but offset not hard-coded
- M* lockedm;
- int32 sig;
- int32 writenbuf;
- byte* writebuf;
- uintptr sigcode0;
- uintptr sigcode1;
- // uintptr sigpc;
- uintptr gopc; // pc of go statement that created this goroutine
-
- int32 ncgo;
- CgoMal* cgomal;
-
- Traceback* traceback;
-
- ucontext_t context;
- void* stack_context[10];
-};
-
-struct M
-{
- G* g0; // goroutine with scheduling stack
- G* gsignal; // signal-handling G
- byte* gsignalstack;
- size_t gsignalstacksize;
- void (*mstartfn)(void);
- G* curg; // current running goroutine
- G* caughtsig; // goroutine running during fatal signal
- P* p; // attached P for executing Go code (nil if not executing Go code)
- P* nextp;
- int32 id;
- int32 mallocing;
- int32 throwing;
- int32 gcing;
- int32 locks;
- int32 softfloat;
- int32 dying;
- int32 profilehz;
- int32 helpgc;
- bool spinning; // M is out of work and is actively looking for work
- bool blocked; // M is blocked on a Note
- uint32 fastrand;
- uint64 ncgocall; // number of cgo calls in total
- int32 ncgo; // number of cgo calls currently in progress
- CgoMal* cgomal;
- Note park;
- M* alllink; // on allm
- M* schedlink;
- MCache *mcache;
- G* lockedg;
- Location createstack[32]; // Stack that created this thread.
- uint32 locked; // tracking for LockOSThread
- M* nextwaitm; // next M waiting for lock
- uintptr waitsema; // semaphore for parking on locks
- uint32 waitsemacount;
- uint32 waitsemalock;
- GCStats gcstats;
- bool needextram;
- bool dropextram; // for gccgo: drop after call is done.
- uint8 traceback;
- bool (*waitunlockf)(G*, void*);
- void* waitlock;
- uintptr end[];
-};
-
-struct P
-{
- Lock;
-
- int32 id;
- uint32 status; // one of Pidle/Prunning/...
- P* link;
- uint32 schedtick; // incremented on every scheduler call
- uint32 syscalltick; // incremented on every system call
- M* m; // back-link to associated M (nil if idle)
- MCache* mcache;
- Defer* deferpool; // pool of available Defer structs (see panic.c)
-
- // Cache of goroutine ids, amortizes accesses to runtime_sched.goidgen.
- uint64 goidcache;
- uint64 goidcacheend;
-
- // Queue of runnable goroutines.
- uint32 runqhead;
- uint32 runqtail;
- G* runq[256];
-
- // Available G's (status == Gdead)
- G* gfree;
- int32 gfreecnt;
-
- byte pad[64];
-};
-
-// The m->locked word holds two pieces of state counting active calls to LockOSThread/lockOSThread.
-// The low bit (LockExternal) is a boolean reporting whether any LockOSThread call is active.
-// External locks are not recursive; a second lock is silently ignored.
-// The upper bits of m->lockedcount record the nesting depth of calls to lockOSThread
-// (counting up by LockInternal), popped by unlockOSThread (counting down by LockInternal).
-// Internal locks can be recursive. For instance, a lock for cgo can occur while the main
-// goroutine is holding the lock during the initialization phase.
-enum
-{
- LockExternal = 1,
- LockInternal = 2,
-};
struct SigTab
{
@@ -331,26 +148,6 @@ struct SigTab
int32 flags;
void* fwdsig;
};
-enum
-{
- SigNotify = 1<<0, // let signal.Notify have signal, even if from kernel
- SigKill = 1<<1, // if signal.Notify doesn't take it, exit quietly
- SigThrow = 1<<2, // if signal.Notify doesn't take it, exit loudly
- SigPanic = 1<<3, // if the signal is from the kernel, panic
- SigDefault = 1<<4, // if the signal isn't explicitly requested, don't monitor it
- SigHandling = 1<<5, // our signal handler is registered
- SigGoExit = 1<<6, // cause all runtime procs to exit (only used on Plan 9).
-};
-
-// Layout of in-memory per-function information prepared by linker
-// See http://golang.org/s/go12symtab.
-// Keep in sync with linker and with ../../libmach/sym.c
-// and with package debug/gosym.
-struct Func
-{
- String name;
- uintptr entry; // entry pc
-};
#ifdef GOOS_nacl
enum {
@@ -381,43 +178,6 @@ enum {
};
#endif
-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.
-// For GOOS=nacl, package syscall knows the layout of this structure.
-// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer.
-struct Timer
-{
- intgo 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;
- FuncVal *fv;
- Eface arg;
- uintptr seq;
-};
-
-// Lock-free stack node.
-struct LFNode
-{
- LFNode *next;
- uintptr pushcnt;
-};
-
// Parallel for descriptor.
struct ParFor
{
@@ -431,43 +191,13 @@ struct ParFor
// otherwise parfor may return while other threads are still working
ParForThread *thr; // array of thread descriptors
// stats
- uint64 nsteal;
+ uint64 nsteal __attribute__((aligned(8))); // force alignment for m68k
uint64 nstealcnt;
uint64 nprocyield;
uint64 nosyield;
uint64 nsleep;
};
-// Track memory allocated by code not written in Go during a cgo call,
-// so that the garbage collector can see them.
-struct CgoMal
-{
- CgoMal *next;
- void *alloc;
-};
-
-// Holds variables parsed from GODEBUG env var.
-struct DebugVars
-{
- int32 allocfreetrace;
- int32 cgocheck;
- int32 efence;
- int32 gccheckmark;
- int32 gcpacertrace;
- int32 gcshrinkstackoff;
- int32 gcstackbarrieroff;
- int32 gcstackbarrierall;
- int32 gcstoptheworld;
- int32 gctrace;
- int32 gcdead;
- int32 invalidptr;
- int32 sbrk;
- int32 scavenge;
- int32 scheddetail;
- int32 schedtrace;
- int32 wbshadow;
-};
-
extern bool runtime_precisestack;
extern bool runtime_copystack;
@@ -481,18 +211,16 @@ extern bool runtime_copystack;
#define USED(v) ((void) v)
#define ROUND(x, n) (((x)+(n)-1)&~(uintptr)((n)-1)) /* all-caps to mark as macro: it evaluates n twice */
-byte* runtime_startup_random_data;
-uint32 runtime_startup_random_data_len;
-void runtime_get_random_data(byte**, int32*);
-
enum {
// hashinit wants this many random bytes
HashRandomBytes = 32
};
void runtime_hashinit(void);
-void runtime_traceback(void);
-void runtime_tracebackothers(G*);
+void runtime_traceback(int32)
+ __asm__ (GOSYM_PREFIX "runtime.traceback");
+void runtime_tracebackothers(G*)
+ __asm__ (GOSYM_PREFIX "runtime.tracebackothers");
enum
{
// The maximum number of frames we print for a traceback
@@ -502,21 +230,23 @@ enum
/*
* external data
*/
-extern uintptr runtime_zerobase;
-extern G** runtime_allg;
-extern uintptr runtime_allglen;
+extern uintptr* runtime_getZerobase(void)
+ __asm__(GOSYM_PREFIX "runtime.getZerobase");
+extern G* runtime_getallg(intgo)
+ __asm__(GOSYM_PREFIX "runtime.getallg");
+extern uintptr runtime_getallglen(void)
+ __asm__(GOSYM_PREFIX "runtime.getallglen");
extern G* runtime_lastg;
-extern M* runtime_allm;
+extern M* runtime_getallm(void)
+ __asm__(GOSYM_PREFIX "runtime.getallm");
extern P** runtime_allp;
-extern int32 runtime_gomaxprocs;
-extern uint32 runtime_needextram;
-extern uint32 runtime_panicking;
+extern Sched* runtime_sched;
+extern uint32 runtime_panicking(void)
+ __asm__ (GOSYM_PREFIX "runtime.getPanicking");
extern int8* runtime_goos;
extern int32 runtime_ncpu;
extern void (*runtime_sysargs)(int32, uint8**);
-extern uint32 runtime_Hchansize;
-extern DebugVars runtime_debug;
-extern uintptr runtime_maxstacksize;
+extern struct debugVars runtime_debug;
extern bool runtime_isstarted;
extern bool runtime_isarchive;
@@ -527,63 +257,66 @@ extern bool runtime_isarchive;
#define runtime_strcmp(s1, s2) __builtin_strcmp((s1), (s2))
#define runtime_strncmp(s1, s2, n) __builtin_strncmp((s1), (s2), (n))
#define runtime_strstr(s1, s2) __builtin_strstr((s1), (s2))
-intgo runtime_findnull(const byte*);
-intgo runtime_findnullw(const uint16*);
-void runtime_dump(byte*, int32);
+intgo runtime_findnull(const byte*)
+ __asm__ (GOSYM_PREFIX "runtime.findnull");
-void runtime_gogo(G*);
+void runtime_gogo(G*)
+ __asm__ (GOSYM_PREFIX "runtime.gogo");
struct __go_func_type;
-void runtime_args(int32, byte**);
+void runtime_args(int32, byte**)
+ __asm__ (GOSYM_PREFIX "runtime.args");
void runtime_osinit();
-void runtime_goargs(void);
+void runtime_alginit(void)
+ __asm__ (GOSYM_PREFIX "runtime.alginit");
+void runtime_goargs(void)
+ __asm__ (GOSYM_PREFIX "runtime.goargs");
void runtime_goenvs(void);
-void runtime_goenvs_unix(void);
+void runtime_goenvs_unix(void)
+ __asm__ (GOSYM_PREFIX "runtime.goenvs_unix");
void runtime_throw(const char*) __attribute__ ((noreturn));
void runtime_panicstring(const char*) __attribute__ ((noreturn));
bool runtime_canpanic(G*);
-void runtime_prints(const char*);
void runtime_printf(const char*, ...);
int32 runtime_snprintf(byte*, int32, const char*, ...);
#define runtime_mcmp(a, b, s) __builtin_memcmp((a), (b), (s))
#define runtime_memmove(a, b, s) __builtin_memmove((a), (b), (s))
void* runtime_mal(uintptr);
-String runtime_gostring(const byte*);
-String runtime_gostringnocopy(const byte*);
+String runtime_gostringnocopy(const byte*)
+ __asm__ (GOSYM_PREFIX "runtime.gostringnocopy");
void runtime_schedinit(void);
-void runtime_initsig(bool);
-void runtime_sigenable(uint32 sig);
-void runtime_sigdisable(uint32 sig);
-void runtime_sigignore(uint32 sig);
+void runtime_initsig(bool)
+ __asm__ (GOSYM_PREFIX "runtime.initsig");
int32 runtime_gotraceback(bool *crash);
-void runtime_goroutineheader(G*);
-void runtime_printtrace(Location*, int32, bool);
+void runtime_goroutineheader(G*)
+ __asm__ (GOSYM_PREFIX "runtime.goroutineheader");
+void runtime_printtrace(Slice, G*)
+ __asm__ (GOSYM_PREFIX "runtime.printtrace");
#define runtime_open(p, f, m) open((p), (f), (m))
#define runtime_read(d, v, n) read((d), (v), (n))
#define runtime_write(d, v, n) write((d), (v), (n))
#define runtime_close(d) close(d)
-void runtime_ready(G*);
+void runtime_ready(G*, intgo, bool)
+ __asm__ (GOSYM_PREFIX "runtime.ready");
String runtime_getenv(const char*);
int32 runtime_atoi(const byte*, intgo);
void* runtime_mstart(void*);
-G* runtime_malg(int32, byte**, size_t*);
-void runtime_mpreinit(M*);
-void runtime_minit(void);
-void runtime_unminit(void);
-void runtime_needm(void);
-void runtime_dropm(void);
-void runtime_signalstack(byte*, int32);
-MCache* runtime_allocmcache(void);
-void runtime_freemcache(MCache*);
+G* runtime_malg(bool, bool, byte**, uintptr*)
+ __asm__(GOSYM_PREFIX "runtime.malg");
+void runtime_minit(void)
+ __asm__ (GOSYM_PREFIX "runtime.minit");
+void runtime_signalstack(byte*, uintptr)
+ __asm__ (GOSYM_PREFIX "runtime.signalstack");
+MCache* runtime_allocmcache(void)
+ __asm__ (GOSYM_PREFIX "runtime.allocmcache");
+void runtime_freemcache(MCache*)
+ __asm__ (GOSYM_PREFIX "runtime.freemcache");
void runtime_mallocinit(void);
void runtime_mprofinit(void);
-#define runtime_malloc(s) __go_alloc(s)
-#define runtime_free(p) __go_free(p)
-#define runtime_getcallersp(p) __builtin_frame_address(1)
-int32 runtime_mcount(void);
-int32 runtime_gcount(void);
+#define runtime_getcallersp(p) __builtin_frame_address(0)
void runtime_mcall(void(*)(G*));
-uint32 runtime_fastrand1(void);
-int32 runtime_timediv(int64, int32, int32*);
+uint32 runtime_fastrand(void) __asm__ (GOSYM_PREFIX "runtime.fastrand");
+int32 runtime_timediv(int64, int32, int32*)
+ __asm__ (GOSYM_PREFIX "runtime.timediv");
int32 runtime_round2(int32 x); // round x up to a power of 2.
// atomic operations
@@ -604,63 +337,72 @@ int32 runtime_round2(int32 x); // round x up to a power of 2.
#define runtime_atomicloadp(p) __atomic_load_n (p, __ATOMIC_SEQ_CST)
#define runtime_atomicstorep(p, v) __atomic_store_n (p, v, __ATOMIC_SEQ_CST)
-void runtime_setmg(M*, G*);
-void runtime_newextram(void);
+void runtime_setg(G*)
+ __asm__ (GOSYM_PREFIX "runtime.setg");
+void runtime_newextram(void)
+ __asm__ (GOSYM_PREFIX "runtime.newextram");
#define runtime_exit(s) exit(s)
#define runtime_breakpoint() __builtin_trap()
void runtime_gosched(void);
void runtime_gosched0(G*);
-void runtime_schedtrace(bool);
+void runtime_schedtrace(bool)
+ __asm__ (GOSYM_PREFIX "runtime.schedtrace");
void runtime_park(bool(*)(G*, void*), void*, const char*);
void runtime_parkunlock(Lock*, const char*);
void runtime_tsleep(int64, const char*);
M* runtime_newm(void);
-void runtime_goexit(void);
-void runtime_entersyscall(void) __asm__ (GOSYM_PREFIX "syscall.Entersyscall");
-void runtime_entersyscallblock(void);
-void runtime_exitsyscall(void) __asm__ (GOSYM_PREFIX "syscall.Exitsyscall");
+void runtime_goexit1(void)
+ __asm__ (GOSYM_PREFIX "runtime.goexit1");
+void runtime_entersyscall(int32)
+ __asm__ (GOSYM_PREFIX "runtime.entersyscall");
+void runtime_entersyscallblock(int32)
+ __asm__ (GOSYM_PREFIX "runtime.entersyscallblock");
+void runtime_exitsyscall(int32)
+ __asm__ (GOSYM_PREFIX "runtime.exitsyscall");
G* __go_go(void (*pfn)(void*), void*);
-void siginit(void);
-bool __go_sigsend(int32 sig);
int32 runtime_callers(int32, Location*, int32, bool keep_callers);
-int64 runtime_nanotime(void); // monotonic time
-int64 runtime_unixnanotime(void); // real time, can skip
+int64 runtime_nanotime(void) // monotonic time
+ __asm__(GOSYM_PREFIX "runtime.nanotime");
+int64 runtime_unixnanotime(void) // real time, can skip
+ __asm__ (GOSYM_PREFIX "runtime.unixnanotime");
void runtime_dopanic(int32) __attribute__ ((noreturn));
-void runtime_startpanic(void);
-void runtime_freezetheworld(void);
+void runtime_startpanic(void)
+ __asm__ (GOSYM_PREFIX "runtime.startpanic");
void runtime_unwindstack(G*, byte*);
-void runtime_sigprof();
-void runtime_resetcpuprofiler(int32);
-void runtime_setcpuprofilerate(void(*)(uintptr*, int32), int32);
-void runtime_usleep(uint32);
-int64 runtime_cputicks(void);
-int64 runtime_tickspersecond(void);
+void runtime_sigprof()
+ __asm__ (GOSYM_PREFIX "runtime.sigprof");
+void runtime_resetcpuprofiler(int32)
+ __asm__ (GOSYM_PREFIX "runtime.resetcpuprofiler");
+void runtime_setcpuprofilerate_m(int32)
+ __asm__ (GOSYM_PREFIX "runtime.setcpuprofilerate_m");
+void runtime_cpuprofAdd(Slice)
+ __asm__ (GOSYM_PREFIX "runtime.cpuprofAdd");
+void runtime_usleep(uint32)
+ __asm__ (GOSYM_PREFIX "runtime.usleep");
+int64 runtime_cputicks(void)
+ __asm__ (GOSYM_PREFIX "runtime.cputicks");
+int64 runtime_tickspersecond(void)
+ __asm__ (GOSYM_PREFIX "runtime.tickspersecond");
void runtime_blockevent(int64, int32);
extern int64 runtime_blockprofilerate;
-void runtime_addtimer(Timer*);
-bool runtime_deltimer(Timer*);
-G* runtime_netpoll(bool);
-void runtime_netpollinit(void);
-int32 runtime_netpollopen(uintptr, PollDesc*);
-int32 runtime_netpollclose(uintptr);
-void runtime_netpollready(G**, PollDesc*, int32);
-uintptr runtime_netpollfd(PollDesc*);
-void runtime_netpollarm(PollDesc*, int32);
-void** runtime_netpolluser(PollDesc*);
-bool runtime_netpollclosing(PollDesc*);
-void runtime_netpolllock(PollDesc*);
-void runtime_netpollunlock(PollDesc*);
-void runtime_crash(void);
-void runtime_parsedebugvars(void);
+G* runtime_netpoll(bool)
+ __asm__ (GOSYM_PREFIX "runtime.netpoll");
+void runtime_crash(void)
+ __asm__ (GOSYM_PREFIX "runtime.crash");
+void runtime_parsedebugvars(void)
+ __asm__(GOSYM_PREFIX "runtime.parsedebugvars");
void _rt0_go(void);
-void* runtime_funcdata(Func*, int32);
-int32 runtime_setmaxthreads(int32);
G* runtime_timejump(void);
void runtime_iterate_finq(void (*callback)(FuncVal*, void*, const FuncType*, const PtrType*));
-void runtime_stoptheworld(void);
-void runtime_starttheworld(void);
-extern uint32 runtime_worldsema;
+void runtime_stopTheWorldWithSema(void)
+ __asm__(GOSYM_PREFIX "runtime.stopTheWorldWithSema");
+void runtime_startTheWorldWithSema(void)
+ __asm__(GOSYM_PREFIX "runtime.startTheWorldWithSema");
+void runtime_acquireWorldsema(void)
+ __asm__(GOSYM_PREFIX "runtime.acquireWorldsema");
+void runtime_releaseWorldsema(void)
+ __asm__(GOSYM_PREFIX "runtime.releaseWorldsema");
/*
* mutual exclusion locks. in the uncontended case,
@@ -668,8 +410,10 @@ extern uint32 runtime_worldsema;
* but on the contention path they sleep in the kernel.
* a zeroed Lock is unlocked (no need to initialize each lock).
*/
-void runtime_lock(Lock*);
-void runtime_unlock(Lock*);
+void runtime_lock(Lock*)
+ __asm__(GOSYM_PREFIX "runtime.lock");
+void runtime_unlock(Lock*)
+ __asm__(GOSYM_PREFIX "runtime.unlock");
/*
* sleep and wakeup on one-time events.
@@ -693,21 +437,16 @@ void runtime_unlock(Lock*);
* notesleep/notetsleep are generally called on g0,
* notetsleepg is similar to notetsleep but is called on user g.
*/
-void runtime_noteclear(Note*);
-void runtime_notesleep(Note*);
-void runtime_notewakeup(Note*);
-bool runtime_notetsleep(Note*, int64); // false - timeout
-bool runtime_notetsleepg(Note*, int64); // false - timeout
-
-/*
- * 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);
+void runtime_noteclear(Note*)
+ __asm__ (GOSYM_PREFIX "runtime.noteclear");
+void runtime_notesleep(Note*)
+ __asm__ (GOSYM_PREFIX "runtime.notesleep");
+void runtime_notewakeup(Note*)
+ __asm__ (GOSYM_PREFIX "runtime.notewakeup");
+bool runtime_notetsleep(Note*, int64) // false - timeout
+ __asm__ (GOSYM_PREFIX "runtime.notetsleep");
+bool runtime_notetsleepg(Note*, int64) // false - timeout
+ __asm__ (GOSYM_PREFIX "runtime.notetsleepg");
/*
* Lock-free stack.
@@ -717,7 +456,8 @@ void runtime_futexwakeup(uint32*, uint32);
*/
void runtime_lfstackpush(uint64 *head, LFNode *node)
__asm__ (GOSYM_PREFIX "runtime.lfstackpush");
-LFNode* runtime_lfstackpop(uint64 *head);
+void* runtime_lfstackpop(uint64 *head)
+ __asm__ (GOSYM_PREFIX "runtime.lfstackpop");
/*
* Parallel for over [0, n).
@@ -745,45 +485,19 @@ void __wrap_rtems_task_variable_add(void **);
#endif
/*
- * Names generated by gccgo.
- */
-#define runtime_printbool __go_print_bool
-#define runtime_printfloat __go_print_double
-#define runtime_printint __go_print_int64
-#define runtime_printiface __go_print_interface
-#define runtime_printeface __go_print_empty_interface
-#define runtime_printstring __go_print_string
-#define runtime_printpointer __go_print_pointer
-#define runtime_printuint __go_print_uint64
-#define runtime_printslice __go_print_slice
-#define runtime_printcomplex __go_print_complex
-
-/*
* runtime go-called
*/
-void runtime_printbool(_Bool);
-void runtime_printbyte(int8);
-void runtime_printfloat(double);
-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(complex double);
void reflect_call(const struct __go_func_type *, FuncVal *, _Bool, _Bool,
void **, void **)
__asm__ (GOSYM_PREFIX "reflect.call");
-#define runtime_panic __go_panic
+void runtime_panic(Eface)
+ __asm__ (GOSYM_PREFIX "runtime.gopanic");
+void runtime_panic(Eface)
+ __attribute__ ((noreturn));
/*
* runtime c-called (but written in Go)
*/
-void runtime_printany(Eface)
- __asm__ (GOSYM_PREFIX "runtime.Printany");
void runtime_newTypeAssertionError(const String*, const String*, const String*, const String*, Eface*)
__asm__ (GOSYM_PREFIX "runtime.NewTypeAssertionError");
void runtime_newErrorCString(const char*, Eface*)
@@ -792,17 +506,17 @@ void runtime_newErrorCString(const char*, Eface*)
/*
* wrapped for go users
*/
-void runtime_semacquire(uint32 volatile *, bool);
-void runtime_semrelease(uint32 volatile *);
-int32 runtime_gomaxprocsfunc(int32 n);
-void runtime_procyield(uint32);
-void runtime_osyield(void);
-void runtime_lockOSThread(void);
-void runtime_unlockOSThread(void);
-bool runtime_lockedOSThread(void);
-
-bool runtime_showframe(String, bool);
-void runtime_printcreatedby(G*);
+void runtime_procyield(uint32)
+ __asm__(GOSYM_PREFIX "runtime.procyield");
+void runtime_osyield(void)
+ __asm__(GOSYM_PREFIX "runtime.osyield");
+void runtime_lockOSThread(void)
+ __asm__(GOSYM_PREFIX "runtime.lockOSThread");
+void runtime_unlockOSThread(void)
+ __asm__(GOSYM_PREFIX "runtime.unlockOSThread");
+
+void runtime_printcreatedby(G*)
+ __asm__(GOSYM_PREFIX "runtime.printcreatedby");
uintptr runtime_memlimit(void);
@@ -815,7 +529,8 @@ enum
#define runtime_setitimer setitimer
-void runtime_check(void);
+void runtime_check(void)
+ __asm__ (GOSYM_PREFIX "runtime.check");
// A list of global variables that the garbage collector must scan.
struct root_list {
@@ -835,8 +550,7 @@ extern uintptr runtime_stacks_sys;
struct backtrace_state;
extern struct backtrace_state *__go_get_backtrace_state(void);
-extern _Bool __go_file_line(uintptr, String*, String*, intgo *);
-extern byte* runtime_progname();
+extern _Bool __go_file_line(uintptr, int, String*, String*, intgo *);
extern void runtime_main(void*);
extern uint32 runtime_in_callers;
@@ -861,6 +575,22 @@ struct time_now_ret now() __asm__ (GOSYM_PREFIX "time.now")
extern void _cgo_wait_runtime_init_done (void);
extern void _cgo_notify_runtime_init_done (void);
extern _Bool runtime_iscgo;
-extern _Bool runtime_cgoHasExtraM;
-extern Hchan *runtime_main_init_done;
extern uintptr __go_end __attribute__ ((weak));
+extern void *getitab(const struct __go_type_descriptor *,
+ const struct __go_type_descriptor *,
+ _Bool)
+ __asm__ (GOSYM_PREFIX "runtime.getitab");
+
+extern void runtime_cpuinit(void);
+extern void setIsCgo(void)
+ __asm__ (GOSYM_PREFIX "runtime.setIsCgo");
+extern void setCpuidECX(uint32)
+ __asm__ (GOSYM_PREFIX "runtime.setCpuidECX");
+extern void setSupportAES(bool)
+ __asm__ (GOSYM_PREFIX "runtime.setSupportAES");
+extern void makeMainInitDone(void)
+ __asm__ (GOSYM_PREFIX "runtime.makeMainInitDone");
+extern void closeMainInitDone(void)
+ __asm__ (GOSYM_PREFIX "runtime.closeMainInitDone");
+extern void typedmemmove(const Type *, void *, const void *)
+ __asm__ (GOSYM_PREFIX "runtime.typedmemmove");