summaryrefslogtreecommitdiff
path: root/libgo/runtime/runtime.h
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-30 13:45:08 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-30 13:45:08 +0000
commit0dad6de4af284961b37001673d8c5b175adbb4e2 (patch)
treed1646c0c4bb59624dfdc04420f835270129cc18e /libgo/runtime/runtime.h
parentb8309f2f1fbb226913f27342e7c78aed8f3d9bd7 (diff)
downloadgcc-0dad6de4af284961b37001673d8c5b175adbb4e2.tar.gz
runtime: copy internal locking code from Go 1.7 runtime
Remove the old locking code written in C. Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go file, so that we can get Go copies of the system time structures and other types. Tweak the compiler so that when compiling the runtime package the address operator does not cause local variables to escape. When the gc compiler compiles the runtime, an escaping local variable is treated as an error. We should implement that, instead of this change, when escape analysis is turned on. Tweak the compiler so that the generated C header does not include names that start with an underscore followed by a non-upper-case letter, except for the special cases of _defer and _panic. Otherwise we translate C types to Go in runtime_sysinfo.go and then generate those Go types back as C types in runtime.inc, which is useless and painful for the C code. Change entersyscall and friends to take a dummy argument, as the gc versions do, to simplify calls from the shared code. Reviewed-on: https://go-review.googlesource.com/30079 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240657 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/runtime.h')
-rw-r--r--libgo/runtime/runtime.h48
1 files changed, 28 insertions, 20 deletions
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index d223ec0ddda..d1aad1e2d73 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -108,8 +108,16 @@ struct FuncVal
#include "array.h"
#include "interface.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.
*/
@@ -392,9 +400,12 @@ 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_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);
@@ -476,21 +487,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.
@@ -578,8 +584,10 @@ void runtime_newErrorCString(const char*, Eface*)
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_procyield(uint32)
+ __asm__(GOSYM_PREFIX "runtime.procyield");
+void runtime_osyield(void)
+ __asm__(GOSYM_PREFIX "runtime.osyield");
void runtime_lockOSThread(void);
void runtime_unlockOSThread(void);
bool runtime_lockedOSThread(void);