It is called from Go only in tests.
LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rlh, rsc
https://golang.org/cl/
125610043
package runtime
+import "unsafe"
+
var Fadd64 = fadd64
var Fsub64 = fsub64
var Fmul64 = fmul64
Pushcnt uintptr
}
-func lfstackpush_go(head *uint64, node *LFNode)
-func lfstackpop_go(head *uint64) *LFNode
+var (
+ lfstackpush_m,
+ lfstackpop_m mFunction
+)
+
+func LFStackPush(head *uint64, node *LFNode) {
+ mp := acquirem()
+ mp.ptrarg[0] = unsafe.Pointer(head)
+ mp.ptrarg[1] = unsafe.Pointer(node)
+ onM(&lfstackpush_m)
+ releasem(mp)
+}
-var LFStackPush = lfstackpush_go
-var LFStackPop = lfstackpop_go
+func LFStackPop(head *uint64) *LFNode {
+ mp := acquirem()
+ mp.ptrarg[0] = unsafe.Pointer(head)
+ onM(&lfstackpop_m)
+ node := (*LFNode)(unsafe.Pointer(mp.ptrarg[0]))
+ mp.ptrarg[0] = nil
+ releasem(mp)
+ return node
+}
type ParFor struct {
body *byte
// license that can be found in the LICENSE file.
// Lock-free stack.
+// The following code runs only on g0 stack.
-package runtime
#include "runtime.h"
#include "arch_GOARCH.h"
}
}
-func lfstackpush_go(head *uint64, node *LFNode) {
- runtime·lfstackpush(head, node);
+void
+runtime·lfstackpush_m(void)
+{
+ runtime·lfstackpush(g->m->ptrarg[0], g->m->ptrarg[1]);
+ g->m->ptrarg[0] = nil;
+ g->m->ptrarg[1] = nil;
}
-func lfstackpop_go(head *uint64) (node *LFNode) {
- node = runtime·lfstackpop(head);
+void
+runtime·lfstackpop_m(void)
+{
+ g->m->ptrarg[0] = runtime·lfstackpop(g->m->ptrarg[0]);
}