Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: src/runtime/stubs.go

Issue 152570049: [dev.power64] code review 152570049: all: merge default into dev.power64 (Closed)
Patch Set: diff -r 36f7fc9495481ed67a159eea0eb2fac35b7c46a5 https://code.google.com/p/go Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/string_test.go ('k') | src/runtime/symtab.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/stubs.go
===================================================================
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -7,9 +7,6 @@ package runtime
import "unsafe"
// Declarations for runtime services implemented in C or assembly.
-// C implementations of these functions are in stubs.goc.
-// Assembly implementations are in various files, see comments with
-// each function.
const ptrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
const regSize = 4 << (^uintreg(0) >> 63) // unsafe.Sizeof(uintreg(0)) but an ideal const
@@ -26,11 +23,12 @@ func roundup(p unsafe.Pointer, n uintptr
return unsafe.Pointer(uintptr(p) + delta)
}
-// in stubs.goc
+// in runtime.c
func getg() *g
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.
@@ -75,6 +73,24 @@ func mcall(fn func(*g))
//go:noescape
func onM(fn func())
+// onMsignal is like onM but is allowed to be used in code that
+// might run on the gsignal stack. Code running on a signal stack
+// may be interrupting an onM sequence on the main stack, so
+// if the onMsignal calling sequence writes to ptrarg/scalararg,
+// it must first save the old values and then restore them when
+// finished. As an exception to the rule, it is fine not to save and
+// restore the values if the program is trying to crash rather than
+// return from the signal handler.
+// Once all the runtime is written in Go, there will be no ptrarg/scalararg
+// and the distinction between onM and onMsignal (and perhaps mcall)
+// can go away.
+//
+// If onMsignal is called from a gsignal stack, it invokes fn directly,
+// without a stack switch. Otherwise onMsignal behaves like onM.
+//
+//go:noescape
+func onM_signalok(fn func())
+
func badonm() {
gothrow("onM called from signal goroutine")
}
@@ -103,6 +119,8 @@ func deferproc_m()
func goexit_m()
func startpanic_m()
func dopanic_m()
+func readmemstats_m()
+func writeheapdump_m()
// memclr clears n bytes starting at ptr.
// in memclr_*.s
@@ -114,11 +132,6 @@ func memclr(ptr unsafe.Pointer, n uintpt
//go:noescape
func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr)
-const (
- concurrentSweep = true
-)
-
-func gosched()
func starttheworld()
func stoptheworld()
func newextram()
@@ -129,13 +142,12 @@ func unlockOSThread()
var hashLoad = loadFactor
// in asm_*.s
+func fastrand1() uint32
+
+// in asm_*.s
//go:noescape
func memeq(a, b unsafe.Pointer, size uintptr) bool
-// Code pointers for the nohash/noequal algorithms. Used for producing better error messages.
-var nohashcode uintptr
-var noequalcode uintptr
-
// noescape hides a pointer from escape analysis. noescape is
// the identity function but escape analysis doesn't think the
// output depends on the input. noescape is inlined and currently
@@ -148,6 +160,7 @@ func noescape(p unsafe.Pointer) unsafe.P
}
func entersyscall()
+func reentersyscall(pc uintptr, sp unsafe.Pointer)
func entersyscallblock()
func exitsyscall()
@@ -167,7 +180,11 @@ func exit(code int32)
func breakpoint()
func nanotime() int64
func usleep(usec uint32)
+
+// careful: cputicks is not guaranteed to be monotonic! In particular, we have
+// noticed drift between cpus on certain os/arch combinations. See issue 8976.
func cputicks() int64
+
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) unsafe.Pointer
func munmap(addr unsafe.Pointer, n uintptr)
func madvise(addr unsafe.Pointer, n uintptr, flags int32)
@@ -226,11 +243,9 @@ const _NoArgs = ^uintptr(0)
func newstack()
func newproc()
-func lessstack()
func morestack()
func mstart()
func rt0_go()
-func sigpanic()
// return0 is a stub used to return 0 from deferproc.
// It is called at the very end of deferproc to signal
@@ -238,3 +253,36 @@ func sigpanic()
// to deferreturn.
// in asm_*.s
func return0()
+
+// thunk to call time.now.
+func timenow() (sec int64, nsec int32)
+
+// in asm_*.s
+// not called directly; definitions here supply type information for traceback.
+func call16(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call32(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call64(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call128(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call256(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call512(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call1024(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call2048(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call4096(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call8192(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call16384(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call32768(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call65536(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call131072(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call262144(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call524288(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call1048576(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call2097152(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call4194304(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call8388608(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call16777216(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call33554432(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call67108864(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call134217728(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call268435456(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call536870912(fn, arg unsafe.Pointer, n, retoffset uint32)
+func call1073741824(fn, arg unsafe.Pointer, n, retoffset uint32)
« no previous file with comments | « src/runtime/string_test.go ('k') | src/runtime/symtab.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b