mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: move slice construction to callers of makeslice
Only return a pointer p to the new slices backing array from makeslice.
Makeslice callers then construct sliceheader{p, len, cap} explictly
instead of makeslice returning the slice.
Reduces go binary size by ~0.2%.
Removes 92 (~3.5%) panicindex calls from go binary.
Change-Id: I29b7c3b5fe8b9dcec96e2c43730575071cfe8a94
Reviewed-on: https://go-review.googlesource.com/c/141822
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
c86d464734
commit
020a18c545
9 changed files with 136 additions and 76 deletions
|
|
@ -266,8 +266,11 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||
infoLocalsRe1 := regexp.MustCompile(`slicevar *= *\[\]string *= *{"def"}`)
|
||||
// Format output from gdb v8.2
|
||||
infoLocalsRe2 := regexp.MustCompile(`^slicevar = .*\nmapvar = .*\nstrvar = 0x[0-9a-f]+ "abc"`)
|
||||
// Format output from gdb v7.7
|
||||
infoLocalsRe3 := regexp.MustCompile(`^mapvar = .*\nstrvar = "abc"\nslicevar *= *\[\]string`)
|
||||
if bl := blocks["info locals"]; !infoLocalsRe1.MatchString(bl) &&
|
||||
!infoLocalsRe2.MatchString(bl) {
|
||||
!infoLocalsRe2.MatchString(bl) &&
|
||||
!infoLocalsRe3.MatchString(bl) {
|
||||
t.Fatalf("info locals failed: %s", bl)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue