mirror of
https://github.com/golang/go
synced 2024-11-18 18:54:42 -07:00
runtime: change Windows M.thread from void* to uintptr
It appears to be an opaque bit pattern more than a pointer. The Go garbage collector has discovered that for m0 it is set to 0x4c. Should fix Windows build. TBR=brainman CC=golang-codereviews https://golang.org/cl/149640043
This commit is contained in:
parent
e6708ee9b1
commit
2b1659b57d
@ -479,6 +479,9 @@ TEXT runtime·atomicloaduintptr(SB), NOSPLIT, $0-8
|
|||||||
TEXT runtime·atomicloaduint(SB), NOSPLIT, $0-8
|
TEXT runtime·atomicloaduint(SB), NOSPLIT, $0-8
|
||||||
JMP runtime·atomicload(SB)
|
JMP runtime·atomicload(SB)
|
||||||
|
|
||||||
|
TEXT runtime·atomicstoreuintptr(SB), NOSPLIT, $0-8
|
||||||
|
JMP runtime·atomicstore(SB)
|
||||||
|
|
||||||
// bool runtime·cas64(uint64 *val, uint64 old, uint64 new)
|
// bool runtime·cas64(uint64 *val, uint64 old, uint64 new)
|
||||||
// Atomically:
|
// Atomically:
|
||||||
// if(*val == *old){
|
// if(*val == *old){
|
||||||
|
@ -491,6 +491,9 @@ TEXT runtime·atomicloaduintptr(SB), NOSPLIT, $0-16
|
|||||||
TEXT runtime·atomicloaduint(SB), NOSPLIT, $0-16
|
TEXT runtime·atomicloaduint(SB), NOSPLIT, $0-16
|
||||||
JMP runtime·atomicload64(SB)
|
JMP runtime·atomicload64(SB)
|
||||||
|
|
||||||
|
TEXT runtime·atomicstoreuintptr(SB), NOSPLIT, $0-16
|
||||||
|
JMP runtime·atomicstore64(SB)
|
||||||
|
|
||||||
// bool casp(void **val, void *old, void *new)
|
// bool casp(void **val, void *old, void *new)
|
||||||
// Atomically:
|
// Atomically:
|
||||||
// if(*val == old){
|
// if(*val == old){
|
||||||
|
@ -440,6 +440,9 @@ TEXT runtime·atomicloaduintptr(SB), NOSPLIT, $0-12
|
|||||||
TEXT runtime·atomicloaduint(SB), NOSPLIT, $0-12
|
TEXT runtime·atomicloaduint(SB), NOSPLIT, $0-12
|
||||||
JMP runtime·atomicload(SB)
|
JMP runtime·atomicload(SB)
|
||||||
|
|
||||||
|
TEXT runtime·atomicstoreuintptr(SB), NOSPLIT, $0-12
|
||||||
|
JMP runtime·atomicstore(SB)
|
||||||
|
|
||||||
// bool runtime·cas64(uint64 *val, uint64 old, uint64 new)
|
// bool runtime·cas64(uint64 *val, uint64 old, uint64 new)
|
||||||
// Atomically:
|
// Atomically:
|
||||||
// if(*val == *old){
|
// if(*val == *old){
|
||||||
|
@ -724,6 +724,9 @@ TEXT runtime·atomicloaduintptr(SB),NOSPLIT,$0-8
|
|||||||
TEXT runtime·atomicloaduint(SB),NOSPLIT,$0-8
|
TEXT runtime·atomicloaduint(SB),NOSPLIT,$0-8
|
||||||
B runtime·atomicload(SB)
|
B runtime·atomicload(SB)
|
||||||
|
|
||||||
|
TEXT runtime·atomicstoreuintptr(SB),NOSPLIT,$0-8
|
||||||
|
B runtime·atomicstore(SB)
|
||||||
|
|
||||||
// AES hashing not implemented for ARM
|
// AES hashing not implemented for ARM
|
||||||
TEXT runtime·aeshash(SB),NOSPLIT,$-4-0
|
TEXT runtime·aeshash(SB),NOSPLIT,$-4-0
|
||||||
MOVW $0, R0
|
MOVW $0, R0
|
||||||
|
@ -268,19 +268,19 @@ runtime·mpreinit(M *mp)
|
|||||||
void
|
void
|
||||||
runtime·minit(void)
|
runtime·minit(void)
|
||||||
{
|
{
|
||||||
void *thandle;
|
uintptr thandle;
|
||||||
|
|
||||||
// -1 = current process, -2 = current thread
|
// -1 = current process, -2 = current thread
|
||||||
runtime·stdcall7(runtime·DuplicateHandle, -1, -2, -1, (uintptr)&thandle, 0, 0, DUPLICATE_SAME_ACCESS);
|
runtime·stdcall7(runtime·DuplicateHandle, -1, -2, -1, (uintptr)&thandle, 0, 0, DUPLICATE_SAME_ACCESS);
|
||||||
runtime·atomicstorep(&g->m->thread, thandle);
|
runtime·atomicstoreuintptr(&g->m->thread, thandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from dropm to undo the effect of an minit.
|
// Called from dropm to undo the effect of an minit.
|
||||||
void
|
void
|
||||||
runtime·unminit(void)
|
runtime·unminit(void)
|
||||||
{
|
{
|
||||||
runtime·stdcall1(runtime·CloseHandle, (uintptr)g->m->thread);
|
runtime·stdcall1(runtime·CloseHandle, g->m->thread);
|
||||||
g->m->thread = nil;
|
g->m->thread = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Described in http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/
|
// Described in http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/
|
||||||
@ -532,7 +532,7 @@ void
|
|||||||
runtime·profileloop1(void)
|
runtime·profileloop1(void)
|
||||||
{
|
{
|
||||||
M *mp, *allm;
|
M *mp, *allm;
|
||||||
void *thread;
|
uintptr thread;
|
||||||
|
|
||||||
runtime·stdcall2(runtime·SetThreadPriority, -2, THREAD_PRIORITY_HIGHEST);
|
runtime·stdcall2(runtime·SetThreadPriority, -2, THREAD_PRIORITY_HIGHEST);
|
||||||
|
|
||||||
@ -540,11 +540,11 @@ runtime·profileloop1(void)
|
|||||||
runtime·stdcall2(runtime·WaitForSingleObject, (uintptr)profiletimer, -1);
|
runtime·stdcall2(runtime·WaitForSingleObject, (uintptr)profiletimer, -1);
|
||||||
allm = runtime·atomicloadp(&runtime·allm);
|
allm = runtime·atomicloadp(&runtime·allm);
|
||||||
for(mp = allm; mp != nil; mp = mp->alllink) {
|
for(mp = allm; mp != nil; mp = mp->alllink) {
|
||||||
thread = runtime·atomicloadp(&mp->thread);
|
thread = runtime·atomicloaduintptr(&mp->thread);
|
||||||
// Do not profile threads blocked on Notes,
|
// Do not profile threads blocked on Notes,
|
||||||
// this includes idle worker threads,
|
// this includes idle worker threads,
|
||||||
// idle timer thread, idle heap scavenger, etc.
|
// idle timer thread, idle heap scavenger, etc.
|
||||||
if(thread == nil || mp->profilehz == 0 || mp->blocked)
|
if(thread == 0 || mp->profilehz == 0 || mp->blocked)
|
||||||
continue;
|
continue;
|
||||||
runtime·stdcall1(runtime·SuspendThread, (uintptr)thread);
|
runtime·stdcall1(runtime·SuspendThread, (uintptr)thread);
|
||||||
if(mp->profilehz != 0 && !mp->blocked)
|
if(mp->profilehz != 0 && !mp->blocked)
|
||||||
|
@ -371,7 +371,7 @@ struct M
|
|||||||
uintptr scalararg[4]; // scalar argument/return for mcall
|
uintptr scalararg[4]; // scalar argument/return for mcall
|
||||||
void* ptrarg[4]; // pointer argument/return for mcall
|
void* ptrarg[4]; // pointer argument/return for mcall
|
||||||
#ifdef GOOS_windows
|
#ifdef GOOS_windows
|
||||||
void* thread; // thread handle
|
uintptr thread; // thread handle
|
||||||
// these are here because they are too large to be on the stack
|
// these are here because they are too large to be on the stack
|
||||||
// of low-level NOSPLIT functions.
|
// of low-level NOSPLIT functions.
|
||||||
LibCall libcall;
|
LibCall libcall;
|
||||||
@ -885,7 +885,9 @@ void runtime·atomicstore(uint32 volatile*, uint32);
|
|||||||
void runtime·atomicstore64(uint64 volatile*, uint64);
|
void runtime·atomicstore64(uint64 volatile*, uint64);
|
||||||
uint64 runtime·atomicload64(uint64 volatile*);
|
uint64 runtime·atomicload64(uint64 volatile*);
|
||||||
void* runtime·atomicloadp(void* volatile*);
|
void* runtime·atomicloadp(void* volatile*);
|
||||||
|
uintptr runtime·atomicloaduintptr(uintptr volatile*);
|
||||||
void runtime·atomicstorep(void* volatile*, void*);
|
void runtime·atomicstorep(void* volatile*, void*);
|
||||||
|
void runtime·atomicstoreuintptr(uintptr volatile*, uintptr);
|
||||||
void runtime·atomicor8(byte volatile*, byte);
|
void runtime·atomicor8(byte volatile*, byte);
|
||||||
|
|
||||||
void runtime·setg(G*);
|
void runtime·setg(G*);
|
||||||
|
Loading…
Reference in New Issue
Block a user