From c19bd769205d1847639eaddcd897058d8b7218da Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 7 Dec 2011 01:55:49 +0000 Subject: [PATCH] libgo: Add back tests of syscall time. From-SVN: r182075 --- libgo/go/runtime/export_test.go | 7 ++----- libgo/go/runtime/proc_test.go | 4 ---- libgo/runtime/proc.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/libgo/go/runtime/export_test.go b/libgo/go/runtime/export_test.go index eb7a4454742..c603e1b0d79 100644 --- a/libgo/go/runtime/export_test.go +++ b/libgo/go/runtime/export_test.go @@ -18,11 +18,8 @@ var F64toint = f64toint func entersyscall() func exitsyscall() -func LockedOSThread() bool - -/* Useless for gccgo. +func golockedOSThread() bool var Entersyscall = entersyscall var Exitsyscall = exitsyscall - -*/ +var LockedOSThread = golockedOSThread diff --git a/libgo/go/runtime/proc_test.go b/libgo/go/runtime/proc_test.go index 1d20a58a420..32111080a54 100644 --- a/libgo/go/runtime/proc_test.go +++ b/libgo/go/runtime/proc_test.go @@ -74,8 +74,6 @@ func BenchmarkStackGrowth(b *testing.B) { } } -/* These benchmarks are meaningless for gccgo. - func BenchmarkSyscall(b *testing.B) { const CallsPerSched = 1000 procs := runtime.GOMAXPROCS(-1) @@ -125,5 +123,3 @@ func BenchmarkSyscallWork(b *testing.B) { <-c } } - -*/ diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index e5c01f550e6..88831d41a67 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -1156,6 +1156,26 @@ runtime_malg(int32 stacksize, byte** ret_stack, size_t* ret_stacksize) return newg; } +/* For runtime package testing. */ + +void runtime_testing_entersyscall(void) + __asm__("libgo_runtime.runtime.entersyscall"); + +void +runtime_testing_entersyscall() +{ + runtime_entersyscall(); +} + +void runtime_testing_exitsyscall(void) + __asm__("libgo_runtime.runtime.exitsyscall"); + +void +runtime_testing_exitsyscall() +{ + runtime_exitsyscall(); +} + G* __go_go(void (*fn)(void*), void* arg) { @@ -1330,6 +1350,17 @@ runtime_lockedOSThread(void) return g->lockedm != nil && m->lockedg != nil; } +// for testing of callbacks + +_Bool runtime_golockedOSThread(void) + asm("libgo_runtime.runtime.golockedOSThread"); + +_Bool +runtime_golockedOSThread(void) +{ + return runtime_lockedOSThread(); +} + // for testing of wire, unwire uint32 runtime_mid()