aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-02-09 08:19:58 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-02-09 08:19:58 +0000
commit94252f4bcc0a3f487b804ce535cb77b8bef4db83 (patch)
tree7ca86535c5a6b99d4cc432ba5cfddabc5ee4ea16 /libgo/runtime
parentcd6368115dbd75d9187877097c48a0d8d4c04fd4 (diff)
downloadgcc-94252f4bcc0a3f487b804ce535cb77b8bef4db83.zip
gcc-94252f4bcc0a3f487b804ce535cb77b8bef4db83.tar.gz
gcc-94252f4bcc0a3f487b804ce535cb77b8bef4db83.tar.bz2
libgo: Update to weekly.2012-02-07.
From-SVN: r184034
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/malloc.h2
-rw-r--r--libgo/runtime/mgc0.c7
-rw-r--r--libgo/runtime/proc.c2
-rw-r--r--libgo/runtime/runtime.c13
-rw-r--r--libgo/runtime/runtime.h1
5 files changed, 20 insertions, 5 deletions
diff --git a/libgo/runtime/malloc.h b/libgo/runtime/malloc.h
index aa7d9ff..c1cf02c 100644
--- a/libgo/runtime/malloc.h
+++ b/libgo/runtime/malloc.h
@@ -235,7 +235,7 @@ struct MStats
};
extern MStats mstats
- __asm__ ("libgo_runtime.runtime.MemStats");
+ __asm__ ("libgo_runtime.runtime.VmemStats");
// Size classes. Computed and initialized by InitSizes.
diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c
index 26633ab..bd634d5 100644
--- a/libgo/runtime/mgc0.c
+++ b/libgo/runtime/mgc0.c
@@ -1061,11 +1061,11 @@ runtime_gc(int32 force)
runtime_gc(1);
}
-void runtime_UpdateMemStats(void)
- __asm__("libgo_runtime.runtime.UpdateMemStats");
+void runtime_ReadMemStats(MStats *)
+ __asm__("libgo_runtime.runtime.ReadMemStats");
void
-runtime_UpdateMemStats(void)
+runtime_ReadMemStats(MStats *stats)
{
M *m;
@@ -1078,6 +1078,7 @@ runtime_UpdateMemStats(void)
m->gcing = 1;
runtime_stoptheworld();
cachestats();
+ *stats = mstats;
m->gcing = 0;
runtime_semrelease(&gcsema);
runtime_starttheworld(false);
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 04412bd..42a5779 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -525,7 +525,7 @@ mcommoninit(M *m)
runtime_atomicstorep((void**)&runtime_allm, m);
m->id = runtime_sched.mcount++;
- m->fastrand = 0x49f6428aUL + m->id;
+ m->fastrand = 0x49f6428aUL + m->id + runtime_cputicks();
if(m->mcache == nil)
m->mcache = runtime_allocmcache();
diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c
index 922fa20..7c8c436 100644
--- a/libgo/runtime/runtime.c
+++ b/libgo/runtime/runtime.c
@@ -184,6 +184,19 @@ runtime_fastrand1(void)
return x;
}
+int64
+runtime_cputicks(void)
+{
+#if defined(__386__) || defined(__x86_64__)
+ uint32 low, high;
+ asm("rdtsc" : "=a" (low), "=d" (high));
+ return (int64)(((uint64)high << 32) | (uint64)low);
+#else
+ // FIXME: implement for other processors.
+ return 0;
+#endif
+}
+
struct funcline_go_return
{
String retfile;
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 253c49b..41b0ef5 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -286,6 +286,7 @@ void runtime_exitsyscall(void) __asm__("libgo_syscall.syscall.exitsyscall");
void siginit(void);
bool __go_sigsend(int32 sig);
int64 runtime_nanotime(void);
+int64 runtime_cputicks(void);
void runtime_stoptheworld(void);
void runtime_starttheworld(bool);