aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-09-14 17:11:35 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-09-14 17:11:35 +0000
commitbc998d034f45d1828a8663b2eed928faf22a7d01 (patch)
tree8d262a22ca7318f4bcd64269fe8fe9e45bcf8d0f /libgo/runtime
parenta41a6142df74219f596e612d3a7775f68ca6e96f (diff)
downloadgcc-bc998d034f45d1828a8663b2eed928faf22a7d01.zip
gcc-bc998d034f45d1828a8663b2eed928faf22a7d01.tar.gz
gcc-bc998d034f45d1828a8663b2eed928faf22a7d01.tar.bz2
libgo: update to go1.9
Reviewed-on: https://go-review.googlesource.com/63753 From-SVN: r252767
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-now.c15
-rw-r--r--libgo/runtime/proc.c6
-rw-r--r--libgo/runtime/runtime.h51
-rw-r--r--libgo/runtime/runtime_c.c26
4 files changed, 37 insertions, 61 deletions
diff --git a/libgo/runtime/go-now.c b/libgo/runtime/go-now.c
index d24e6ee..13e8f51 100644
--- a/libgo/runtime/go-now.c
+++ b/libgo/runtime/go-now.c
@@ -8,13 +8,22 @@
#include "runtime.h"
-// Return current time. This is the implementation of time.now().
+// Return current time. This is the implementation of time.walltime().
-struct time_now_ret
+struct walltime_ret
+{
+ int64_t sec;
+ int32_t nsec;
+};
+
+struct walltime_ret now() __asm__ (GOSYM_PREFIX "runtime.walltime")
+ __attribute__ ((no_split_stack));
+
+struct walltime_ret
now()
{
struct timespec ts;
- struct time_now_ret ret;
+ struct walltime_ret ret;
clock_gettime (CLOCK_REALTIME, &ts);
ret.sec = ts.tv_sec;
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 3e3437e..e591824 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -375,6 +375,8 @@ bool runtime_isarchive;
extern void kickoff(void)
__asm__(GOSYM_PREFIX "runtime.kickoff");
+extern void minit(void)
+ __asm__(GOSYM_PREFIX "runtime.minit");
extern void mstart1(void)
__asm__(GOSYM_PREFIX "runtime.mstart1");
extern void stopm(void)
@@ -476,6 +478,10 @@ runtime_mstart(void *arg)
gp->entry = nil;
gp->param = nil;
+ // We have to call minit before we call getcontext,
+ // because getcontext will copy the signal mask.
+ minit();
+
initcontext();
// Record top of stack for use by mcall.
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 3324038..dd5a958 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -193,16 +193,6 @@ enum {
};
void runtime_hashinit(void);
-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
- TracebackMaxFrames = 100,
-};
-
/*
* external data
*/
@@ -217,7 +207,6 @@ extern M* runtime_getallm(void)
extern Sched* runtime_sched;
extern uint32 runtime_panicking(void)
__asm__ (GOSYM_PREFIX "runtime.getPanicking");
-extern struct debugVars runtime_debug;
extern bool runtime_isstarted;
extern bool runtime_isarchive;
@@ -253,10 +242,6 @@ void runtime_schedinit(void)
__asm__ (GOSYM_PREFIX "runtime.schedinit");
void runtime_initsig(bool)
__asm__ (GOSYM_PREFIX "runtime.initsig");
-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))
@@ -327,8 +312,6 @@ G* __go_go(void (*pfn)(void*), void*);
int32 runtime_callers(int32, Location*, int32, bool keep_callers);
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)
__asm__ (GOSYM_PREFIX "runtime.startpanic");
@@ -343,22 +326,11 @@ void runtime_blockevent(int64, int32);
extern int64 runtime_blockprofilerate;
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);
G* runtime_timejump(void);
-void runtime_callStopTheWorldWithSema(void)
- __asm__(GOSYM_PREFIX "runtime.callStopTheWorldWithSema");
-void runtime_callStartTheWorldWithSema(void)
- __asm__(GOSYM_PREFIX "runtime.callStartTheWorldWithSema");
-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,
* as fast as spin locks (just a few user-level instructions),
@@ -404,17 +376,6 @@ bool runtime_notetsleepg(Note*, int64) // false - timeout
__asm__ (GOSYM_PREFIX "runtime.notetsleepg");
/*
- * Lock-free stack.
- * Initialize uint64 head to 0, compare with 0 to test for emptiness.
- * The stack does not keep pointers to nodes,
- * so they can be garbage collected if there are no other pointers to nodes.
- */
-void runtime_lfstackpush(uint64 *head, LFNode *node)
- __asm__ (GOSYM_PREFIX "runtime.lfstackpush");
-void* runtime_lfstackpop(uint64 *head)
- __asm__ (GOSYM_PREFIX "runtime.lfstackpop");
-
-/*
* low level C-called
*/
#define runtime_mmap mmap
@@ -454,9 +415,6 @@ void runtime_procyield(uint32)
void runtime_osyield(void)
__asm__(GOSYM_PREFIX "runtime.osyield");
-void runtime_printcreatedby(G*)
- __asm__(GOSYM_PREFIX "runtime.printcreatedby");
-
uintptr runtime_memlimit(void);
#define ISNAN(f) __builtin_isnan(f)
@@ -491,15 +449,6 @@ void runtime_badsignal(int);
Defer* runtime_newdefer(void);
void runtime_freedefer(Defer*);
-struct time_now_ret
-{
- int64_t sec;
- int32_t nsec;
-};
-
-struct time_now_ret now() __asm__ (GOSYM_PREFIX "time.now")
- __attribute__ ((no_split_stack));
-
extern void _cgo_wait_runtime_init_done (void);
extern void _cgo_notify_runtime_init_done (void)
__asm__ (GOSYM_PREFIX "runtime._cgo_notify_runtime_init_done");
diff --git a/libgo/runtime/runtime_c.c b/libgo/runtime/runtime_c.c
index 6da3521..9a6672d 100644
--- a/libgo/runtime/runtime_c.c
+++ b/libgo/runtime/runtime_c.c
@@ -10,6 +10,10 @@
#include <cpuid.h>
#endif
+#ifdef __linux__
+#include <syscall.h>
+#endif
+
#include "config.h"
#include "runtime.h"
@@ -81,13 +85,6 @@ runtime_signalstack(byte *p, uintptr n)
*(int *)0xf1 = 0xf1;
}
-struct debugVars runtime_debug;
-
-void
-runtime_setdebug(struct debugVars* d) {
- runtime_debug = *d;
-}
-
int32 go_open(char *, int32, int32)
__asm__ (GOSYM_PREFIX "runtime.open");
@@ -184,3 +181,18 @@ publicationBarrier()
{
__atomic_thread_fence(__ATOMIC_RELEASE);
}
+
+#ifdef __linux__
+
+/* Currently sbrk0 is only called on GNU/Linux. */
+
+uintptr sbrk0(void)
+ __asm__ (GOSYM_PREFIX "runtime.sbrk0");
+
+uintptr
+sbrk0()
+{
+ return syscall(SYS_brk, (uintptr)(0));
+}
+
+#endif /* __linux__ */