mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: simplify mallocgc flag argument
mallocgc can calculate noscan itself. The only remaining flag argument is needzero, so we just make that a boolean arg. Fixes #15379 Change-Id: I839a70790b2a0c9dbcee2600052bfbd6c8148e20 Reviewed-on: https://go-review.googlesource.com/22290 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
731531980a
commit
001e8e8070
8 changed files with 23 additions and 54 deletions
|
|
@ -284,7 +284,7 @@ func stringiter2(s string, k int) (int, rune) {
|
|||
// The storage is not zeroed. Callers should use
|
||||
// b to set the string contents and then drop b.
|
||||
func rawstring(size int) (s string, b []byte) {
|
||||
p := mallocgc(uintptr(size), nil, flagNoScan|flagNoZero)
|
||||
p := mallocgc(uintptr(size), nil, false)
|
||||
|
||||
stringStructOf(&s).str = p
|
||||
stringStructOf(&s).len = size
|
||||
|
|
@ -302,7 +302,7 @@ func rawstring(size int) (s string, b []byte) {
|
|||
// rawbyteslice allocates a new byte slice. The byte slice is not zeroed.
|
||||
func rawbyteslice(size int) (b []byte) {
|
||||
cap := roundupsize(uintptr(size))
|
||||
p := mallocgc(cap, nil, flagNoScan|flagNoZero)
|
||||
p := mallocgc(cap, nil, false)
|
||||
if cap != uintptr(size) {
|
||||
memclr(add(p, uintptr(size)), cap-uintptr(size))
|
||||
}
|
||||
|
|
@ -317,7 +317,7 @@ func rawruneslice(size int) (b []rune) {
|
|||
throw("out of memory")
|
||||
}
|
||||
mem := roundupsize(uintptr(size) * 4)
|
||||
p := mallocgc(mem, nil, flagNoScan|flagNoZero)
|
||||
p := mallocgc(mem, nil, false)
|
||||
if mem != uintptr(size)*4 {
|
||||
memclr(add(p, uintptr(size)*4), mem-uintptr(size)*4)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue