@@ -3,6 +3,7 @@ package runtime
33// This file implements functions related to Go strings.
44
55import (
6+ "internal/gclayout"
67 "unsafe"
78)
89
@@ -59,7 +60,7 @@ func stringConcat(x, y _string) _string {
5960 return x
6061 } else {
6162 length := x .length + y .length
62- buf := alloc (length , nil )
63+ buf := alloc (length , gclayout . NoPtrs )
6364 memcpy (buf , unsafe .Pointer (x .ptr ), x .length )
6465 memcpy (unsafe .Add (buf , x .length ), unsafe .Pointer (y .ptr ), y .length )
6566 return _string {ptr : (* byte )(buf ), length : length }
@@ -72,7 +73,7 @@ func stringFromBytes(x struct {
7273 len uintptr
7374 cap uintptr
7475}) _string {
75- buf := alloc (x .len , nil )
76+ buf := alloc (x .len , gclayout . NoPtrs )
7677 memcpy (buf , unsafe .Pointer (x .ptr ), x .len )
7778 return _string {ptr : (* byte )(buf ), length : x .len }
7879}
@@ -83,7 +84,7 @@ func stringToBytes(x _string) (slice struct {
8384 len uintptr
8485 cap uintptr
8586}) {
86- buf := alloc (x .length , nil )
87+ buf := alloc (x .length , gclayout . NoPtrs )
8788 memcpy (buf , unsafe .Pointer (x .ptr ), x .length )
8889 slice .ptr = (* byte )(buf )
8990 slice .len = x .length
@@ -100,7 +101,7 @@ func stringFromRunes(runeSlice []rune) (s _string) {
100101 }
101102
102103 // Allocate memory for the string.
103- s .ptr = (* byte )(alloc (s .length , nil ))
104+ s .ptr = (* byte )(alloc (s .length , gclayout . NoPtrs ))
104105
105106 // Encode runes to UTF-8 and store the resulting bytes in the string.
106107 index := uintptr (0 )
0 commit comments