runtime: more cleanups
Move timenow thunk into time.s
Move declarations for generic c/asm services into stubs.go
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/137360043
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index 2376ab9..3e93025 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -2241,9 +2241,6 @@
RET
-TEXT runtime·timenow(SB), NOSPLIT, $0-0
- JMP time·now(SB)
-
TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
get_tls(CX)
MOVL g(CX), AX
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index a32e03e..1a106dc 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -2186,9 +2186,6 @@
RET
-TEXT runtime·timenow(SB), NOSPLIT, $0-0
- JMP time·now(SB)
-
TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
get_tls(CX)
MOVQ g(CX), AX
diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s
index 5d82d84..32276c8 100644
--- a/src/runtime/asm_amd64p32.s
+++ b/src/runtime/asm_amd64p32.s
@@ -1069,9 +1069,6 @@
MOVB AX, ret+24(FP)
RET
-TEXT runtime·timenow(SB), NOSPLIT, $0-0
- JMP time·now(SB)
-
TEXT runtime·fastrand1(SB), NOSPLIT, $0-4
get_tls(CX)
MOVL g(CX), AX
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index ac78bd9..73d23fc 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -848,9 +848,6 @@
MOVW R0, ret+12(FP)
RET
-TEXT runtime·timenow(SB),NOSPLIT,$0-0
- B time·now(SB)
-
// A Duff's device for zeroing memory.
// The compiler jumps to computed addresses within
// this routine to zero chunks of memory. Do not
diff --git a/src/runtime/extern.go b/src/runtime/extern.go
index 3d06a23..b8db5d0 100644
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
@@ -126,8 +126,6 @@
return callers(skip, &pc[0], len(pc))
}
-func getgoroot() string
-
// GOROOT returns the root of the Go tree.
// It uses the GOROOT environment variable, if set,
// or else the root used during the Go build.
diff --git a/src/runtime/mgc0.go b/src/runtime/mgc0.go
index 0984fc5..ec5edb0 100644
--- a/src/runtime/mgc0.go
+++ b/src/runtime/mgc0.go
@@ -28,8 +28,6 @@
*ret = x
}
-func timenow() (sec int64, nsec int32)
-
func gc_unixnanotime(now *int64) {
sec, nsec := timenow()
*now = sec*1e9 + int64(nsec)
diff --git a/src/runtime/mprof.go b/src/runtime/mprof.go
index 7177c84..89e9915 100644
--- a/src/runtime/mprof.go
+++ b/src/runtime/mprof.go
@@ -295,9 +295,6 @@
atomicstore64(&blockprofilerate, uint64(r))
}
-func fastrand1() uint32 // assembly
-func readgstatus(*g) uint32 // proc.c
-
func blockevent(cycles int64, skip int) {
if cycles <= 0 {
return
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index f3af34a..8bae98c 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -28,6 +28,7 @@
func acquirem() *m
func releasem(mp *m)
func gomcache() *mcache
+func readgstatus(*g) uint32 // proc.c
// mcall switches from the g to the g0 stack and invokes fn(g),
// where g is the goroutine that made the call.
@@ -122,6 +123,9 @@
var hashLoad = loadFactor
// in asm_*.s
+func fastrand1() uint32
+
+// in asm_*.s
//go:noescape
func memeq(a, b unsafe.Pointer, size uintptr) bool
@@ -229,3 +233,6 @@
// to deferreturn.
// in asm_*.s
func return0()
+
+// thunk to call time.now.
+func timenow() (sec int64, nsec int32)
diff --git a/src/runtime/thunk.s b/src/runtime/thunk.s
index 35b250f..7ba22d7 100644
--- a/src/runtime/thunk.s
+++ b/src/runtime/thunk.s
@@ -157,3 +157,6 @@
TEXT runtime·main_main(SB),NOSPLIT,$0-0
JMP main·main(SB)
+
+TEXT runtime·timenow(SB), NOSPLIT, $0-0
+ JMP time·now(SB)