aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 5512f33ea8..2263e16410 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -4,10 +4,7 @@
package runtime
-import (
- "runtime/internal/atomic"
- "unsafe"
-)
+import "unsafe"
// The constant is known to the compiler.
// There is no fundamental theory behind this number.
@@ -253,12 +250,7 @@ func rawstring(size int) (s string, b []byte) {
*(*slice)(unsafe.Pointer(&b)) = slice{p, size, size}
- for {
- ms := maxstring
- if uintptr(size) <= ms || atomic.Casuintptr((*uintptr)(unsafe.Pointer(&maxstring)), ms, uintptr(size)) {
- return
- }
- }
+ return
}
// rawbyteslice allocates a new byte slice. The byte slice is not zeroed.
@@ -371,18 +363,10 @@ func findnullw(s *uint16) int {
return l
}
-var maxstring uintptr = 256 // a hint for print
-
//go:nosplit
func gostringnocopy(str *byte) string {
ss := stringStruct{str: unsafe.Pointer(str), len: findnull(str)}
s := *(*string)(unsafe.Pointer(&ss))
- for {
- ms := maxstring
- if uintptr(len(s)) <= ms || atomic.Casuintptr(&maxstring, ms, uintptr(len(s))) {
- break
- }
- }
return s
}