Commit 8090f868 authored by Dmitry Vyukov's avatar Dmitry Vyukov

runtime: cleanup after conversion to Go

Change-Id: I7c41cc6a5ab9fb3b0cc3812cf7e9776884658778
Reviewed-on: https://go-review.googlesource.com/4671Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 01ef6dbf
...@@ -6,6 +6,11 @@ package runtime ...@@ -6,6 +6,11 @@ package runtime
import "unsafe" import "unsafe"
func close(fd int32) int32
//go:noescape
func open(name *byte, mode, perm int32) int32
//go:noescape //go:noescape
func pread(fd int32, buf unsafe.Pointer, nbytes int32, offset int64) int32 func pread(fd int32, buf unsafe.Pointer, nbytes int32, offset int64) int32
......
...@@ -32,7 +32,9 @@ func main() { ...@@ -32,7 +32,9 @@ func main() {
maxstacksize = 250000000 maxstacksize = 250000000
} }
systemstack(newsysmon) systemstack(func() {
newm(sysmon, nil)
})
// Lock the main goroutine onto this, the main OS thread, // Lock the main goroutine onto this, the main OS thread,
// during initialization. Most programs won't care, but a few // during initialization. Most programs won't care, but a few
......
...@@ -81,10 +81,6 @@ func schedinit() { ...@@ -81,10 +81,6 @@ func schedinit() {
} }
} }
func newsysmon() {
_newm(sysmon, nil)
}
func dumpgstatus(gp *g) { func dumpgstatus(gp *g) {
_g_ := getg() _g_ := getg()
print("runtime: gp: gp=", gp, ", goid=", gp.goid, ", gp->atomicstatus=", readgstatus(gp), "\n") print("runtime: gp: gp=", gp, ", goid=", gp.goid, ", gp->atomicstatus=", readgstatus(gp), "\n")
...@@ -638,7 +634,7 @@ func starttheworld() { ...@@ -638,7 +634,7 @@ func starttheworld() {
notewakeup(&mp.park) notewakeup(&mp.park)
} else { } else {
// Start M to run P. Do not start another M below. // Start M to run P. Do not start another M below.
_newm(nil, p) newm(nil, p)
add = false add = false
} }
} }
...@@ -658,7 +654,7 @@ func starttheworld() { ...@@ -658,7 +654,7 @@ func starttheworld() {
// coordinate. This lazy approach works out in practice: // coordinate. This lazy approach works out in practice:
// we don't mind if the first couple gc rounds don't have quite // we don't mind if the first couple gc rounds don't have quite
// the maximum number of procs. // the maximum number of procs.
_newm(mhelpgc, nil) newm(mhelpgc, nil)
} }
_g_.m.locks-- _g_.m.locks--
if _g_.m.locks == 0 && _g_.preempt { // restore the preemption request in case we've cleared it in newstack if _g_.m.locks == 0 && _g_.preempt { // restore the preemption request in case we've cleared it in newstack
...@@ -960,7 +956,7 @@ func unlockextra(mp *m) { ...@@ -960,7 +956,7 @@ func unlockextra(mp *m) {
} }
// Create a new m. It will start off with a call to fn, or else the scheduler. // Create a new m. It will start off with a call to fn, or else the scheduler.
func _newm(fn func(), _p_ *p) { func newm(fn func(), _p_ *p) {
mp := allocm(_p_) mp := allocm(_p_)
mp.nextp = _p_ mp.nextp = _p_
mp.mstartfn = *(*unsafe.Pointer)(unsafe.Pointer(&fn)) mp.mstartfn = *(*unsafe.Pointer)(unsafe.Pointer(&fn))
...@@ -1037,7 +1033,7 @@ func startm(_p_ *p, spinning bool) { ...@@ -1037,7 +1033,7 @@ func startm(_p_ *p, spinning bool) {
if spinning { if spinning {
fn = mspinning fn = mspinning
} }
_newm(fn, _p_) newm(fn, _p_)
return return
} }
if mp.spinning { if mp.spinning {
...@@ -2667,7 +2663,7 @@ func checkdead() { ...@@ -2667,7 +2663,7 @@ func checkdead() {
} }
mp := mget() mp := mget()
if mp == nil { if mp == nil {
_newm(nil, _p_) newm(nil, _p_)
} else { } else {
mp.nextp = _p_ mp.nextp = _p_
notewakeup(&mp.park) notewakeup(&mp.park)
......
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build plan9
package runtime
func close(fd int32) int32
//go:noescape
func open(name *byte, mode, perm int32) int32
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment