1
0
mirror of https://github.com/golang/go synced 2024-11-12 03:10:22 -07:00

runtime: change textflags from numbers to symbols

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12798043
This commit is contained in:
Keith Randall 2013-08-12 13:47:18 -07:00
parent 2791ef0b67
commit e838334beb
36 changed files with 156 additions and 119 deletions

View File

@ -4,6 +4,7 @@
#include "runtime.h"
#include "type.h"
#include "../../cmd/ld/textflag.h"
#define M0 (sizeof(uintptr)==4 ? 2860486313UL : 33054211828000289ULL)
#define M1 (sizeof(uintptr)==4 ? 3267000013UL : 23344194077549503ULL)
@ -499,7 +500,7 @@ runtime·hashinit(void)
}
// func equal(t *Type, x T, y T) (ret bool)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·equal(Type *t, ...)
{

View File

@ -3,22 +3,23 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "../../cmd/ld/textflag.h"
#pragma textflag 7
#pragma textflag NOSPLIT
uint32
runtime·atomicload(uint32 volatile* addr)
{
return *addr;
}
#pragma textflag 7
#pragma textflag NOSPLIT
void*
runtime·atomicloadp(void* volatile* addr)
{
return *addr;
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint64
runtime·xadd64(uint64 volatile* addr, int64 v)
{
@ -31,7 +32,7 @@ runtime·xadd64(uint64 volatile* addr, int64 v)
return old+v;
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint64
runtime·xchg64(uint64 volatile* addr, uint64 v)
{

View File

@ -3,22 +3,23 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
#include "../../cmd/ld/textflag.h"
#pragma textflag 7
#pragma textflag NOSPLIT
uint32
runtime·atomicload(uint32 volatile* addr)
{
return *addr;
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint64
runtime·atomicload64(uint64 volatile* addr)
{
return *addr;
}
#pragma textflag 7
#pragma textflag NOSPLIT
void*
runtime·atomicloadp(void* volatile* addr)
{

View File

@ -4,6 +4,7 @@
#include "runtime.h"
#include "arch_GOARCH.h"
#include "../../cmd/ld/textflag.h"
static struct {
Lock l;
@ -13,7 +14,7 @@ static struct {
#define LOCK(addr) (&locktab[((uintptr)(addr)>>3)%nelem(locktab)].l)
// Atomic add and return new value.
#pragma textflag 7
#pragma textflag NOSPLIT
uint32
runtime·xadd(uint32 volatile *val, int32 delta)
{
@ -27,7 +28,7 @@ runtime·xadd(uint32 volatile *val, int32 delta)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint32
runtime·xchg(uint32 volatile* addr, uint32 v)
{
@ -40,7 +41,7 @@ runtime·xchg(uint32 volatile* addr, uint32 v)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·procyield(uint32 cnt)
{
@ -50,21 +51,21 @@ runtime·procyield(uint32 cnt)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint32
runtime·atomicload(uint32 volatile* addr)
{
return runtime·xadd(addr, 0);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void*
runtime·atomicloadp(void* volatile* addr)
{
return (void*)runtime·xadd((uint32 volatile*)addr, 0);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·atomicstorep(void* volatile* addr, void* v)
{
@ -77,7 +78,7 @@ runtime·atomicstorep(void* volatile* addr, void* v)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·atomicstore(uint32 volatile* addr, uint32 v)
{
@ -90,7 +91,7 @@ runtime·atomicstore(uint32 volatile* addr, uint32 v)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
bool
runtime·cas64(uint64 volatile *addr, uint64 old, uint64 new)
{
@ -107,7 +108,7 @@ runtime·cas64(uint64 volatile *addr, uint64 old, uint64 new)
return res;
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint64
runtime·xadd64(uint64 volatile *addr, int64 delta)
{
@ -120,7 +121,7 @@ runtime·xadd64(uint64 volatile *addr, int64 delta)
return res;
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint64
runtime·xchg64(uint64 volatile *addr, uint64 v)
{
@ -133,7 +134,7 @@ runtime·xchg64(uint64 volatile *addr, uint64 v)
return res;
}
#pragma textflag 7
#pragma textflag NOSPLIT
uint64
runtime·atomicload64(uint64 volatile *addr)
{
@ -145,7 +146,7 @@ runtime·atomicload64(uint64 volatile *addr)
return res;
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·atomicstore64(uint64 volatile *addr, uint64 v)
{

View File

@ -7,6 +7,7 @@
#include "stack.h"
#include "cgocall.h"
#include "race.h"
#include "../../cmd/ld/textflag.h"
// Cgo call and callback support.
//
@ -244,7 +245,7 @@ struct CallbackArgs
void runtime·cgocallbackg1(void);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·cgocallbackg(void)
{

View File

@ -7,6 +7,7 @@
#include "type.h"
#include "race.h"
#include "malloc.h"
#include "../../cmd/ld/textflag.h"
#define MAXALIGN 8
#define NOSELGEN 1
@ -436,7 +437,7 @@ closed:
}
// chansend1(hchan *chan any, elem any);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·chansend1(ChanType *t, Hchan* c, ...)
{
@ -444,7 +445,7 @@ runtime·chansend1(ChanType *t, Hchan* c, ...)
}
// chanrecv1(hchan *chan any) (elem any);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·chanrecv1(ChanType *t, Hchan* c, ...)
{
@ -452,7 +453,7 @@ runtime·chanrecv1(ChanType *t, Hchan* c, ...)
}
// chanrecv2(hchan *chan any) (elem any, received bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·chanrecv2(ChanType *t, Hchan* c, ...)
{
@ -482,7 +483,7 @@ runtime·chanrecv2(ChanType *t, Hchan* c, ...)
// ... bar
// }
//
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectnbsend(ChanType *t, Hchan *c, ...)
{
@ -512,7 +513,7 @@ runtime·selectnbsend(ChanType *t, Hchan *c, ...)
// ... bar
// }
//
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectnbrecv(ChanType *t, byte *v, Hchan *c, bool selected)
{
@ -538,7 +539,7 @@ runtime·selectnbrecv(ChanType *t, byte *v, Hchan *c, bool selected)
// ... bar
// }
//
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectnbrecv2(ChanType *t, byte *v, bool *received, Hchan *c, bool selected)
{
@ -552,7 +553,7 @@ runtime·selectnbrecv2(ChanType *t, byte *v, bool *received, Hchan *c, bool sele
//
// The "uintptr selected" is really "bool selected" but saying
// uintptr gets us the right alignment for the output parameter block.
#pragma textflag 7
#pragma textflag NOSPLIT
void
reflect·chansend(ChanType *t, Hchan *c, uintptr val, bool nb, uintptr selected)
{
@ -608,7 +609,7 @@ reflect·chanrecv(ChanType *t, Hchan *c, bool nb, uintptr val, bool selected, bo
static void newselect(int32, Select**);
// newselect(size uint32) (sel *byte);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·newselect(int32 size, ...)
{
@ -653,7 +654,7 @@ newselect(int32 size, Select **selp)
static void selectsend(Select *sel, Hchan *c, void *pc, void *elem, int32 so);
// selectsend(sel *byte, hchan *chan any, elem *any) (selected bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectsend(Select *sel, Hchan *c, void *elem, bool selected)
{
@ -694,7 +695,7 @@ selectsend(Select *sel, Hchan *c, void *pc, void *elem, int32 so)
static void selectrecv(Select *sel, Hchan *c, void *pc, void *elem, bool*, int32 so);
// selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectrecv(Select *sel, Hchan *c, void *elem, bool selected)
{
@ -709,7 +710,7 @@ runtime·selectrecv(Select *sel, Hchan *c, void *elem, bool selected)
}
// selectrecv2(sel *byte, hchan *chan any, elem *any, received *bool) (selected bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectrecv2(Select *sel, Hchan *c, void *elem, bool *received, bool selected)
{
@ -751,7 +752,7 @@ selectrecv(Select *sel, Hchan *c, void *pc, void *elem, bool *received, int32 so
static void selectdefault(Select*, void*, int32);
// selectdefault(sel *byte) (selected bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectdefault(Select *sel, bool selected)
{
@ -838,7 +839,7 @@ static void* selectgo(Select**);
//
// overwrites return pc on stack to signal which case of the select
// to run, so cannot appear at the top of a split stack.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·selectgo(Select *sel)
{
@ -1216,7 +1217,7 @@ reflect·rselect(Slice cases, intgo chosen, uintptr word, bool recvOK)
static void closechan(Hchan *c, void *pc);
// closechan(sel *byte);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·closechan(Hchan *c)
{
@ -1225,7 +1226,7 @@ runtime·closechan(Hchan *c)
// For reflect
// func chanclose(c chan)
#pragma textflag 7
#pragma textflag NOSPLIT
void
reflect·chanclose(Hchan *c)
{

View File

@ -593,6 +593,7 @@ static uint8 empty_value[MAXVALUESIZE];
#define SLOW_EQ(x,y) runtime·memeq((x).str, (y).str, (x).len)
#define MAYBE_EQ(x,y) (*(CHECKTYPE*)(x).str == *(CHECKTYPE*)(y).str && *(CHECKTYPE*)((x).str + (x).len - sizeof(CHECKTYPE)) == *(CHECKTYPE*)((y).str + (x).len - sizeof(CHECKTYPE)))
#include "hashmap_fast.c"
#include "../../cmd/ld/textflag.h"
static void
hash_insert(MapType *t, Hmap *h, void *key, void *value)
@ -1181,7 +1182,7 @@ runtime·mapaccess(MapType *t, Hmap *h, byte *ak, byte *av, bool *pres)
}
// mapaccess1(hmap *map[any]any, key any) (val any);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·mapaccess1(MapType *t, Hmap *h, ...)
{
@ -1213,7 +1214,7 @@ runtime·mapaccess1(MapType *t, Hmap *h, ...)
}
// mapaccess2(hmap *map[any]any, key any) (val any, pres bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·mapaccess2(MapType *t, Hmap *h, ...)
{
@ -1297,7 +1298,7 @@ runtime·mapassign(MapType *t, Hmap *h, byte *ak, byte *av)
}
// mapassign1(mapType *type, hmap *map[any]any, key any, val any);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·mapassign1(MapType *t, Hmap *h, ...)
{
@ -1315,7 +1316,7 @@ runtime·mapassign1(MapType *t, Hmap *h, ...)
}
// mapdelete(mapType *type, hmap *map[any]any, key any)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·mapdelete(MapType *t, Hmap *h, ...)
{
@ -1445,7 +1446,7 @@ reflect·mapiternext(struct hash_iter *it)
}
// mapiter1(hiter *any) (key any);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·mapiter1(struct hash_iter *it, ...)
{
@ -1526,7 +1527,7 @@ reflect·maplen(Hmap *h, intgo len)
}
// mapiter2(hiter *any) (key any, val any);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·mapiter2(struct hash_iter *it, ...)
{

View File

@ -12,7 +12,7 @@
// +build ignore
#pragma textflag 7
#pragma textflag NOSPLIT
void
HASH_LOOKUP1(MapType *t, Hmap *h, KEYTYPE key, byte *value)
{
@ -124,7 +124,7 @@ dohash:
FLUSH(&value);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
HASH_LOOKUP2(MapType *t, Hmap *h, KEYTYPE key, byte *value, bool res)
{

View File

@ -7,6 +7,7 @@
#include "type.h"
#include "typekind.h"
#include "malloc.h"
#include "../../cmd/ld/textflag.h"
void
runtime·printiface(Iface i)
@ -170,7 +171,7 @@ copyout(Type *t, void **src, void *dst)
alg->copy(size, dst, *src);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·typ2Itab(Type *t, InterfaceType *inter, Itab **cache, Itab *ret)
{
@ -183,7 +184,7 @@ runtime·typ2Itab(Type *t, InterfaceType *inter, Itab **cache, Itab *ret)
}
// func convT2I(typ *byte, typ2 *byte, cache **byte, elem any) (ret any)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·convT2I(Type *t, InterfaceType *inter, Itab **cache, ...)
{
@ -205,7 +206,7 @@ runtime·convT2I(Type *t, InterfaceType *inter, Itab **cache, ...)
}
// func convT2E(typ *byte, elem any) (ret any)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·convT2E(Type *t, ...)
{
@ -223,7 +224,7 @@ runtime·convT2E(Type *t, ...)
static void assertI2Tret(Type *t, Iface i, byte *ret);
// func ifaceI2T(typ *byte, iface any) (ret any)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·assertI2T(Type *t, Iface i, ...)
{
@ -256,7 +257,7 @@ assertI2Tret(Type *t, Iface i, byte *ret)
}
// func ifaceI2T2(typ *byte, iface any) (ret any, ok bool)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·assertI2T2(Type *t, Iface i, ...)
{
@ -288,7 +289,7 @@ runtime·assertI2TOK(Type *t, Iface i, bool ok)
static void assertE2Tret(Type *t, Eface e, byte *ret);
// func ifaceE2T(typ *byte, iface any) (ret any)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·assertE2T(Type *t, Eface e, ...)
{
@ -319,7 +320,7 @@ assertE2Tret(Type *t, Eface e, byte *ret)
}
// func ifaceE2T2(sigt *byte, iface any) (ret any, ok bool);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·assertE2T2(Type *t, Eface e, ...)
{

View File

@ -6,6 +6,7 @@
#include "runtime.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
// This implementation depends on OS-specific implementations of
//
@ -133,7 +134,7 @@ runtime·notesleep(Note *n)
runtime·futexsleep((uint32*)&n->key, 0, -1);
}
#pragma textflag 7
#pragma textflag NOSPLIT
static bool
notetsleep(Note *n, int64 ns, int64 deadline, int64 now)
{

View File

@ -6,6 +6,7 @@
#include "runtime.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
// This implementation depends on OS-specific implementations of
//
@ -163,7 +164,7 @@ runtime·notesleep(Note *n)
runtime·semasleep(-1);
}
#pragma textflag 7
#pragma textflag NOSPLIT
static bool
notetsleep(Note *n, int64 ns, int64 deadline, M *mp)
{

View File

@ -14,6 +14,7 @@ package runtime
#include "typekind.h"
#include "race.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
// Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K.
#pragma dataflag 16
@ -696,7 +697,7 @@ runtime·mal(uintptr n)
return runtime·mallocgc(n, 0, 0);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·new(Type *typ, uint8 *ret)
{

View File

@ -7,8 +7,9 @@
package runtime
#include "runtime.h"
#include "../../cmd/ld/textflag.h"
#pragma textflag 7
#pragma textflag NOSPLIT
func cmpstring(s1 String, s2 String) (v int) {
uintgo i, l;
byte c1, c2;
@ -40,7 +41,7 @@ func cmpstring(s1 String, s2 String) (v int) {
done:;
}
#pragma textflag 7
#pragma textflag NOSPLIT
func bytes·Compare(s1 Slice, s2 Slice) (v int) {
uintgo i, l;
byte c1, c2;

View File

@ -7,6 +7,7 @@
#include "os_GOOS.h"
#include "signal_unix.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
extern SigTab runtime·sigtab[];
@ -140,7 +141,7 @@ runtime·unminit(void)
// Mach IPC, to get at semaphores
// Definitions are in /usr/include/mach on a Mac.
#pragma textflag 7
#pragma textflag NOSPLIT
static void
macherror(int32 r, int8 *fn)
{
@ -395,7 +396,7 @@ int32 runtime·mach_semaphore_timedwait(uint32 sema, uint32 sec, uint32 nsec);
int32 runtime·mach_semaphore_signal(uint32 sema);
int32 runtime·mach_semaphore_signal_all(uint32 sema);
#pragma textflag 7
#pragma textflag NOSPLIT
int32
runtime·semasleep(int64 ns)
{
@ -462,7 +463,7 @@ runtime·sigpanic(void)
runtime·panicstring(runtime·sigtab[g->sig].name);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·osyield(void)
{

View File

@ -7,6 +7,7 @@
#include "os_GOOS.h"
#include "signal_unix.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
extern SigTab runtime·sigtab[];
extern int32 runtime·sys_umtx_op(uint32*, int32, uint32, void*, void*);
@ -41,7 +42,7 @@ getncpu(void)
// FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and
// thus the code is largely similar. See linux/thread.c and lock_futex.c for comments.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·futexsleep(uint32 *addr, uint32 val, int64 ns)
{

View File

@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "../../cmd/ld/textflag.h"
void
runtime·checkgoarm(void)
@ -12,7 +13,7 @@ runtime·checkgoarm(void)
// TODO(minux)
}
#pragma textflag 7
#pragma textflag NOSPLIT
int64
runtime·cputicks(void)
{

View File

@ -7,6 +7,7 @@
#include "os_GOOS.h"
#include "signal_unix.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
extern SigTab runtime·sigtab[];
@ -32,7 +33,7 @@ enum
// if(*addr == val) sleep
// Might be woken up spuriously; that's allowed.
// Don't sleep longer than ns; ns < 0 means forever.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·futexsleep(uint32 *addr, uint32 val, int64 ns)
{

View File

@ -5,13 +5,14 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "../../cmd/ld/textflag.h"
#define AT_NULL 0
#define AT_RANDOM 25
#define AT_SYSINFO 32
extern uint32 runtime·_vdso;
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·linux_setup_vdso(int32 argc, byte **argv)
{

View File

@ -5,6 +5,7 @@
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "../../cmd/ld/textflag.h"
#define AT_NULL 0
#define AT_PLATFORM 15 // introduced in at least 2.6.11
@ -32,7 +33,7 @@ runtime·checkgoarm(void)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·setup_auxv(int32 argc, void *argv_list)
{
@ -71,7 +72,7 @@ runtime·setup_auxv(int32 argc, void *argv_list)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
int64
runtime·cputicks(void)
{

View File

@ -7,6 +7,7 @@
#include "os_GOOS.h"
#include "signal_unix.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
enum
{
@ -62,7 +63,7 @@ runtime·semacreate(void)
return 1;
}
#pragma textflag 7
#pragma textflag NOSPLIT
int32
runtime·semasleep(int64 ns)
{

View File

@ -6,6 +6,7 @@
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "signal_GOOS_GOARCH.h"
#include "../../cmd/ld/textflag.h"
void
runtime·lwp_mcontext_init(McontextT *mc, void *stack, M *mp, G *gp, void (*fn)(void))
@ -23,7 +24,7 @@ runtime·checkgoarm(void)
// TODO(minux)
}
#pragma textflag 7
#pragma textflag NOSPLIT
int64
runtime·cputicks() {
// Currently cputicks() is used in blocking profiler and to seed runtime·fastrand1().

View File

@ -7,6 +7,7 @@
#include "os_GOOS.h"
#include "signal_unix.h"
#include "stack.h"
#include "../../cmd/ld/textflag.h"
enum
{
@ -59,7 +60,7 @@ runtime·semacreate(void)
return 1;
}
#pragma textflag 7
#pragma textflag NOSPLIT
int32
runtime·semasleep(int64 ns)
{

View File

@ -5,6 +5,7 @@
#include "runtime.h"
#include "os_GOOS.h"
#include "arch_GOARCH.h"
#include "../../cmd/ld/textflag.h"
int8 *goos = "plan9";
extern SigTab runtime·sigtab[];
@ -115,14 +116,14 @@ runtime·initsig(void)
{
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·osyield(void)
{
runtime·sleep(0);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·usleep(uint32 µs)
{
@ -261,7 +262,7 @@ runtime·semacreate(void)
return 1;
}
#pragma textflag 7
#pragma textflag NOSPLIT
int32
runtime·semasleep(int64 ns)
{
@ -327,7 +328,7 @@ runtime·memlimit(void)
static int8 badsignal[] = "runtime: signal received on thread not created by Go.\n";
// This runs on a foreign stack, without an m or a g. No stack split.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·badsignal2(void)
{

View File

@ -6,6 +6,7 @@
#include "type.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "../../cmd/ld/textflag.h"
#pragma dynimport runtime·CloseHandle CloseHandle "kernel32.dll"
#pragma dynimport runtime·CreateEvent CreateEventA "kernel32.dll"
@ -183,7 +184,7 @@ runtime·write(int32 fd, void *buf, int32 n)
#define INFINITE ((uintptr)0xFFFFFFFF)
#pragma textflag 7
#pragma textflag NOSPLIT
int32
runtime·semasleep(int64 ns)
{
@ -254,7 +255,7 @@ runtime·unminit(void)
runtime·remove_exception_handler();
}
#pragma textflag 7
#pragma textflag NOSPLIT
int64
runtime·nanotime(void)
{
@ -280,7 +281,7 @@ time·now(int64 sec, int32 usec)
}
// Calling stdcall on os stack.
#pragma textflag 7
#pragma textflag NOSPLIT
void *
runtime·stdcall(void *fn, int32 count, ...)
{
@ -293,14 +294,14 @@ runtime·stdcall(void *fn, int32 count, ...)
extern void runtime·usleep1(uint32);
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·osyield(void)
{
runtime·usleep1(1);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·usleep(uint32 us)
{

View File

@ -6,6 +6,7 @@
#include "arch_GOARCH.h"
#include "stack.h"
#include "malloc.h"
#include "../../cmd/ld/textflag.h"
// Code related to defer, panic and recover.
@ -122,7 +123,7 @@ freedefer(Defer *d)
// are available sequentially after &fn; they would not be
// copied if a stack split occurred. It's OK for this to call
// functions that split the stack.
#pragma textflag 7
#pragma textflag NOSPLIT
uintptr
runtime·deferproc(int32 siz, FuncVal *fn, ...)
{
@ -161,7 +162,7 @@ runtime·deferproc(int32 siz, FuncVal *fn, ...)
// an argument frame size. deferreturn is a very special function,
// and if the runtime ever asks for its frame size, that means
// the traceback routines are probably broken.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·deferreturn(uintptr arg0, ...)
{
@ -332,7 +333,7 @@ runtime·unwindstack(G *gp, byte *sp)
// The implementation of the predeclared function recover.
// Cannot split the stack because it needs to reliably
// find the stack segment of its caller.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·recover(byte *argp, Eface ret)
{

View File

@ -4,6 +4,7 @@
#include "runtime.h"
#include "type.h"
#include "../../cmd/ld/textflag.h"
//static Lock debuglock;
@ -52,7 +53,7 @@ runtime·prints(int8 *s)
gwrite(s, runtime·findnull((byte*)s));
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·printf(int8 *s, ...)
{
@ -179,7 +180,7 @@ vprintf(int8 *s, byte *base)
//runtime·unlock(&debuglock);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·goprintf(String s, ...)
{

View File

@ -8,6 +8,7 @@
#include "stack.h"
#include "race.h"
#include "type.h"
#include "../../cmd/ld/textflag.h"
// Goroutine scheduler
// The scheduler's job is to distribute ready-to-run goroutines over worker threads.
@ -665,7 +666,7 @@ static void unlockextra(M*);
//
// When the callback is done with the m, it calls dropm to
// put the m back on the list.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·needm(byte x)
{
@ -821,7 +822,7 @@ runtime·dropm(void)
// to runtime.extram. If nilokay is true, then lockextra will
// return a nil list head if that's what it finds. If nilokay is false,
// lockextra will keep waiting until the list head is no longer nil.
#pragma textflag 7
#pragma textflag NOSPLIT
static M*
lockextra(bool nilokay)
{
@ -849,7 +850,7 @@ lockextra(bool nilokay)
return mp;
}
#pragma textflag 7
#pragma textflag NOSPLIT
static void
unlockextra(M *mp)
{
@ -1359,7 +1360,7 @@ runtime·gosched0(G *gp)
// Need to mark it as nosplit, because it runs with sp > stackbase (as runtime·lessstack).
// Since it does not return it does not matter. But if it is preempted
// at the split stack check, GC will complain about inconsistent sp.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·goexit(void)
{
@ -1387,7 +1388,7 @@ goexit0(G *gp)
schedule();
}
#pragma textflag 7
#pragma textflag NOSPLIT
static void
save(void *pc, uintptr sp)
{
@ -1407,7 +1408,7 @@ save(void *pc, uintptr sp)
// Entersyscall cannot split the stack: the runtime·gosave must
// make g->sched refer to the caller's stack segment, because
// entersyscall is going to return immediately after.
#pragma textflag 7
#pragma textflag NOSPLIT
void
·entersyscall(int32 dummy)
{
@ -1460,7 +1461,7 @@ void
}
// The same as runtime·entersyscall(), but with a hint that the syscall is blocking.
#pragma textflag 7
#pragma textflag NOSPLIT
void
·entersyscallblock(int32 dummy)
{
@ -1497,7 +1498,7 @@ void
// Arrange for it to run on a cpu again.
// This is called only from the go syscall library, not
// from the low-level system calls used by the runtime.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·exitsyscall(void)
{
@ -1540,7 +1541,7 @@ runtime·exitsyscall(void)
g->syscallsp = (uintptr)nil;
}
#pragma textflag 7
#pragma textflag NOSPLIT
static bool
exitsyscallfast(void)
{
@ -1660,7 +1661,7 @@ runtime·malg(int32 stacksize)
// are available sequentially after &fn; they would not be
// copied if a stack split occurred. It's OK for this to call
// functions that split the stack.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·newproc(int32 siz, FuncVal* fn, ...)
{

View File

@ -9,6 +9,7 @@
#include "arch_GOARCH.h"
#include "malloc.h"
#include "race.h"
#include "../../cmd/ld/textflag.h"
void runtimerace·Initialize(uintptr *racectx);
void runtimerace·MapShadow(void *addr, uintptr size);
@ -66,7 +67,7 @@ runtime·racemapshadow(void *addr, uintptr size)
// Called from instrumented code.
// If we split stack, getcallerpc() can return runtime·lessstack().
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·racewrite(uintptr addr)
{
@ -77,7 +78,7 @@ runtime·racewrite(uintptr addr)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·racewriterange(uintptr addr, uintptr sz)
{
@ -90,7 +91,7 @@ runtime·racewriterange(uintptr addr, uintptr sz)
// Called from instrumented code.
// If we split stack, getcallerpc() can return runtime·lessstack().
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·raceread(uintptr addr)
{
@ -101,7 +102,7 @@ runtime·raceread(uintptr addr)
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·racereadrange(uintptr addr, uintptr sz)
{
@ -113,7 +114,7 @@ runtime·racereadrange(uintptr addr, uintptr sz)
}
// Called from runtime·racefuncenter (assembly).
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·racefuncenter1(uintptr pc)
{
@ -128,7 +129,7 @@ runtime·racefuncenter1(uintptr pc)
}
// Called from instrumented code.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·racefuncexit(void)
{
@ -337,7 +338,7 @@ runtime·RaceSemrelease(uint32 *s)
}
// func RaceRead(addr unsafe.Pointer)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·RaceRead(void *addr)
{
@ -345,7 +346,7 @@ runtime·RaceRead(void *addr)
}
// func RaceWrite(addr unsafe.Pointer)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·RaceWrite(void *addr)
{
@ -353,7 +354,7 @@ runtime·RaceWrite(void *addr)
}
// func RaceReadRange(addr unsafe.Pointer, len int)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·RaceReadRange(void *addr, intgo len)
{
@ -361,7 +362,7 @@ runtime·RaceReadRange(void *addr, intgo len)
}
// func RaceWriteRange(addr unsafe.Pointer, len int)
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·RaceWriteRange(void *addr, intgo len)
{

View File

@ -4,6 +4,7 @@
#include "runtime.h"
#include "arch_GOARCH.h"
#include "../../cmd/ld/textflag.h"
enum {
maxround = sizeof(uintptr),
@ -415,7 +416,7 @@ runtime·parsedebugvars(void)
// This is a very special function, do not use it if you are not sure what you are doing.
// int64 division is lowered into _divv() call on 386, which does not fit into nosplit functions.
// Handles overflow in a time-specific manner.
#pragma textflag 7
#pragma textflag NOSPLIT
int32
runtime·timediv(int64 v, int32 div, int32 *rem)
{

View File

@ -29,6 +29,7 @@ package runtime
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
#include "cgocall.h"
#include "../../cmd/ld/textflag.h"
static struct {
Note;
@ -156,7 +157,7 @@ func signal_disable(s uint32) {
}
// This runs on a foreign stack, without an m or a g. No stack split.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·badsignal(uintptr sig)
{

View File

@ -8,6 +8,7 @@
#include "typekind.h"
#include "malloc.h"
#include "race.h"
#include "../../cmd/ld/textflag.h"
enum
{
@ -57,7 +58,7 @@ makeslice1(SliceType *t, intgo len, intgo cap, Slice *ret)
}
// appendslice(type *Type, x, y, []T) []T
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·appendslice(SliceType *t, Slice x, Slice y, Slice ret)
{
@ -114,7 +115,7 @@ runtime·appendslice(SliceType *t, Slice x, Slice y, Slice ret)
// appendstr([]byte, string) []byte
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·appendstr(SliceType *t, Slice x, String y, Slice ret)
{
@ -217,7 +218,7 @@ growslice1(SliceType *t, Slice x, intgo newcap, Slice *ret)
}
// copy(to any, fr any, wid uintptr) int
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·copy(Slice to, Slice fm, uintptr width, intgo ret)
{
@ -260,7 +261,7 @@ out:
}
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·slicestringcopy(Slice to, String fm, intgo ret)
{

View File

@ -7,6 +7,7 @@
// It uses true little-endian doubles, while the 7500 used mixed-endian.
#include "runtime.h"
#include "../../cmd/ld/textflag.h"
#define CPSR 14
#define FLAGS_N (1U << 31)
@ -600,7 +601,7 @@ struct Sfregs
uint32 cspr;
};
#pragma textflag 7
#pragma textflag NOSPLIT
uint32*
runtime·_sfloat2(uint32 *lr, Sfregs regs)
{

View File

@ -7,10 +7,11 @@ package runtime
#include "arch_GOARCH.h"
#include "malloc.h"
#include "race.h"
#include "../../cmd/ld/textflag.h"
String runtime·emptystring;
#pragma textflag 7
#pragma textflag NOSPLIT
intgo
runtime·findnull(byte *s)
{
@ -174,7 +175,7 @@ concatstring(intgo n, String *s)
// NOTE: Cannot use func syntax, because we need the ...,
// to signal to the garbage collector that this function does
// not have a fixed size argument count.
#pragma textflag 7
#pragma textflag NOSPLIT
void
runtime·concatstring(intgo n, String s1, ...)
{

View File

@ -4,8 +4,9 @@
#include "runtime.h"
#include "os_GOOS.h"
#include "../../cmd/ld/textflag.h"
#pragma textflag 7
#pragma textflag NOSPLIT
int64
runtime·nanotime(void)
{

View File

@ -23,6 +23,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "../../cmd/ld/textflag.h"
/*
* C runtime for 64-bit divide, others.
*
@ -423,7 +425,7 @@ _rshlv(Vlong *r, Vlong a, int b)
r->lo = (t << (32-b)) | (a.lo >> b);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
_lshv(Vlong *r, Vlong a, int b)
{

View File

@ -23,6 +23,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "../../cmd/ld/textflag.h"
// declared here to avoid include of runtime.h
void runtime·panicstring(char*);
@ -62,7 +64,7 @@ struct Vlong
void runtime·abort(void);
#pragma textflag 7
#pragma textflag NOSPLIT
void
_addv(Vlong *r, Vlong a, Vlong b)
{
@ -72,7 +74,7 @@ _addv(Vlong *r, Vlong a, Vlong b)
r->hi++;
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
_subv(Vlong *r, Vlong a, Vlong b)
{
@ -421,7 +423,7 @@ _rshlv(Vlong *r, Vlong a, int b)
r->lo = (t << (32-b)) | (a.lo >> b);
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
_lshv(Vlong *r, Vlong a, int b)
{
@ -615,7 +617,7 @@ _ul2v(Vlong *ret, ulong ul)
ret->hi = 0;
}
#pragma textflag 7
#pragma textflag NOSPLIT
void
_si2v(Vlong *ret, int si)
{
@ -719,7 +721,7 @@ _v2ul(Vlong rv)
return rv.lo;
}
#pragma textflag 7
#pragma textflag NOSPLIT
long
_v2si(Vlong rv)
{
@ -773,7 +775,7 @@ _gtv(Vlong lv, Vlong rv)
(lv.hi == rv.hi && lv.lo > rv.lo);
}
#pragma textflag 7
#pragma textflag NOSPLIT
int
_gev(Vlong lv, Vlong rv)
{