aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/export_test.go
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-08-21 21:10:45 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-08-21 21:10:45 +0400
commitae875e040c6200c9bfae0df9f17d4620abc9e707 (patch)
tree6158f20d768b7ca31dda1b72ad073c7584138978 /src/pkg/runtime/export_test.go
parent31e4ad5846d21cb5db1cc52a38a89acc915701b5 (diff)
downloadgo-ae875e040c6200c9bfae0df9f17d4620abc9e707.tar.xz
runtime: convert lfstack to Go
It is called from Go only in tests. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/125610043
Diffstat (limited to 'src/pkg/runtime/export_test.go')
-rw-r--r--src/pkg/runtime/export_test.go27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/pkg/runtime/export_test.go b/src/pkg/runtime/export_test.go
index adbc1e9955..4ca5a7354f 100644
--- a/src/pkg/runtime/export_test.go
+++ b/src/pkg/runtime/export_test.go
@@ -6,6 +6,8 @@
package runtime
+import "unsafe"
+
var Fadd64 = fadd64
var Fsub64 = fsub64
var Fmul64 = fmul64
@@ -31,11 +33,28 @@ type LFNode struct {
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