Skip to content

Commit e5ee1f2

Browse files
mengzhuogopherbot
authored andcommitted
test/codegen: check zerobase for newobject on 0-sized types
This CL also adds riscv64 checks Change-Id: I693e4e606f470615f6b49085592d6d5ca61473d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/703716 Reviewed-by: Pengcheng Wang <[email protected]> Auto-Submit: Keith Randall <[email protected]> Reviewed-by: Mark Freeman <[email protected]> Reviewed-by: Joel Sing <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 77b93d4 commit e5ee1f2

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

test/codegen/alloc.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,28 @@
1010
package codegen
1111

1212
func zeroAllocNew1() *struct{} {
13-
// 386:-`CALL\truntime\.newobject`
14-
// amd64:-`CALL\truntime\.newobject`
15-
// arm:-`CALL\truntime\.newobject`
16-
// arm64:-`CALL\truntime\.newobject`
13+
// 386:-`CALL\truntime\.newobject`, `LEAL\truntime.zerobase`
14+
// amd64:-`CALL\truntime\.newobject`, `LEAQ\truntime.zerobase`
15+
// arm:-`CALL\truntime\.newobject`, `MOVW\t[$]runtime.zerobase`
16+
// arm64:-`CALL\truntime\.newobject`, `MOVD\t[$]runtime.zerobase`
17+
// riscv64:-`CALL\truntime\.newobject`, `MOV\t[$]runtime.zerobase`
1718
return new(struct{})
1819
}
1920

2021
func zeroAllocNew2() *[0]int {
21-
// 386:-`CALL\truntime\.newobject`
22-
// amd64:-`CALL\truntime\.newobject`
23-
// arm:-`CALL\truntime\.newobject`
24-
// arm64:-`CALL\truntime\.newobject`
22+
// 386:-`CALL\truntime\.newobject`, `LEAL\truntime.zerobase`
23+
// amd64:-`CALL\truntime\.newobject`, `LEAQ\truntime.zerobase`
24+
// arm:-`CALL\truntime\.newobject`, `MOVW\t[$]runtime.zerobase`
25+
// arm64:-`CALL\truntime\.newobject`, `MOVD\t[$]runtime.zerobase`
26+
// riscv64:-`CALL\truntime\.newobject`, `MOV\t[$]runtime.zerobase`
2527
return new([0]int)
2628
}
2729

2830
func zeroAllocSliceLit() []int {
29-
// 386:-`CALL\truntime\.newobject`
30-
// amd64:-`CALL\truntime\.newobject`
31-
// arm:-`CALL\truntime\.newobject`
32-
// arm64:-`CALL\truntime\.newobject`
31+
// 386:-`CALL\truntime\.newobject`, `LEAL\truntime.zerobase`
32+
// amd64:-`CALL\truntime\.newobject`, `LEAQ\truntime.zerobase`
33+
// arm:-`CALL\truntime\.newobject`, `MOVW\t[$]runtime.zerobase`
34+
// arm64:-`CALL\truntime\.newobject`, `MOVD\t[$]runtime.zerobase`
35+
// riscv64:-`CALL\truntime\.newobject`, `MOV\t[$]runtime.zerobase`
3336
return []int{}
3437
}

0 commit comments

Comments
 (0)