@@ -3,6 +3,7 @@ package runtime
3
3
// This file implements functions related to Go strings.
4
4
5
5
import (
6
+ "internal/gclayout"
6
7
"unsafe"
7
8
)
8
9
@@ -59,7 +60,7 @@ func stringConcat(x, y _string) _string {
59
60
return x
60
61
} else {
61
62
length := x .length + y .length
62
- buf := alloc (length , nil )
63
+ buf := alloc (length , gclayout . NoPtrs )
63
64
memcpy (buf , unsafe .Pointer (x .ptr ), x .length )
64
65
memcpy (unsafe .Add (buf , x .length ), unsafe .Pointer (y .ptr ), y .length )
65
66
return _string {ptr : (* byte )(buf ), length : length }
@@ -72,7 +73,7 @@ func stringFromBytes(x struct {
72
73
len uintptr
73
74
cap uintptr
74
75
}) _string {
75
- buf := alloc (x .len , nil )
76
+ buf := alloc (x .len , gclayout . NoPtrs )
76
77
memcpy (buf , unsafe .Pointer (x .ptr ), x .len )
77
78
return _string {ptr : (* byte )(buf ), length : x .len }
78
79
}
@@ -83,7 +84,7 @@ func stringToBytes(x _string) (slice struct {
83
84
len uintptr
84
85
cap uintptr
85
86
}) {
86
- buf := alloc (x .length , nil )
87
+ buf := alloc (x .length , gclayout . NoPtrs )
87
88
memcpy (buf , unsafe .Pointer (x .ptr ), x .length )
88
89
slice .ptr = (* byte )(buf )
89
90
slice .len = x .length
@@ -100,7 +101,7 @@ func stringFromRunes(runeSlice []rune) (s _string) {
100
101
}
101
102
102
103
// Allocate memory for the string.
103
- s .ptr = (* byte )(alloc (s .length , nil ))
104
+ s .ptr = (* byte )(alloc (s .length , gclayout . NoPtrs ))
104
105
105
106
// Encode runes to UTF-8 and store the resulting bytes in the string.
106
107
index := uintptr (0 )
0 commit comments