]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: move gostringw and gogobytes test stubs to Go.
authorKeith Randall <khr@golang.org>
Fri, 5 Sep 2014 22:01:09 +0000 (15:01 -0700)
committerKeith Randall <khr@golang.org>
Fri, 5 Sep 2014 22:01:09 +0000 (15:01 -0700)
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/141150043

src/pkg/runtime/export_test.go
src/pkg/runtime/stubs.goc

index fd7fd182fcf45d3fcc877c53576835f0895c5682..3df02626afdea8c75e51e95298a4e88191de0485 100644 (file)
@@ -142,10 +142,19 @@ var MemclrBytes = memclrBytes
 
 var HashLoad = &hashLoad
 
-func gogoBytes() int32
-
-var GogoBytes = gogoBytes
+// For testing.
+func GogoBytes() int32 {
+       return _RuntimeGogoBytes
+}
 
-func gostringW([]uint16) string
+// in string.c
+//go:noescape
+func gostringw(w *uint16) string
 
-var GostringW = gostringW
+// entry point for testing
+func GostringW(w []uint16) (s string) {
+       onM(func() {
+               s = gostringw(&w[0])
+       })
+       return
+}
index 34cd1b3bb9633d89217d60bf9af87abc6dcb6ad4..e1b1a02101949a2529cff6fd98cc1bbf800b19f0 100644 (file)
@@ -23,12 +23,6 @@ package runtime
 // These invariants do not hold yet but will be established once we have
 // finished converting runtime support code from C to Go.
 
-// entry point for testing
-// TODO: mcall and run on M stack
-func gostringW(str Slice) (s String) {
-       s = runtime·gostringw((uint16*)str.array);
-}
-
 #pragma textflag NOSPLIT
 func runtime·getg() (ret *G) {
        ret = g;
@@ -61,8 +55,3 @@ func reflect·typelinks() (ret Slice) {
         ret.len = runtime·etypelink - runtime·typelink;
         ret.cap = ret.len;
 }
-
-// For testing.
-func gogoBytes() (x int32) {
-       x = RuntimeGogoBytes;
-}