mirror of
https://github.com/golang/go.git
synced 2026-01-29 07:02:05 +03:00
[dev.simd] all: merge master (ca37d24) into dev.simd
Conflicts: - src/cmd/compile/internal/typecheck/builtin.go Merge List: + 2025-11-20ca37d24e0bnet/http: drop unused "broken" field from persistConn + 2025-11-204b740af56acmd/internal/obj/x86: handle global reference in From3 in dynlink mode + 2025-11-20790384c6c2spec: adjust rule for type parameter on RHS of alias declaration + 2025-11-20a49b0302d0net/http: correctly close fake net.Conns + 2025-11-2032f5aadd2fcmd/compile: stack allocate backing stores during append + 2025-11-20a18aff8057runtime: select GC mark workers during start-the-world + 2025-11-20829779f4feruntime: split findRunnableGCWorker in two + 2025-11-20ab59569099go/version: use "custom" as an example of a version suffix + 2025-11-19c4bb9653bacmd/compile: Implement LoweredZeroLoop with LSX Instruction on loong64 + 2025-11-197f2ae21fb4cmd/internal/obj/loong64: add MULW.D.W[U] instructions + 2025-11-19a2946f2385crypto: add Encapsulator and Decapsulator interfaces + 2025-11-196b83bd7146crypto/ecdh: add KeyExchanger interface + 2025-11-194fef9f8b55go/types, types2: fix object path for grouped declaration statements + 2025-11-1933529db142spec: escape double-ampersands + 2025-11-19dc42565a20cmd/compile: fix control flow for unsigned divisions proof relations + 2025-11-19e64023dcbfcmd/compile: cleanup useless if statement in prove + 2025-11-192239520d1ctest: go fmt prove.go tests + 2025-11-19489d3dafb7math: switch s390x math.Pow to generic implementation + 2025-11-188c41a482f9runtime: add dlog.hexdump + 2025-11-18e912618bd2runtime: add hexdumper + 2025-11-182cf9d4b62fRevert "net/http: do not discard body content when closing it within request handlers" + 2025-11-184d0658bb08cmd/compile: prefer fixed registers for values + 2025-11-18ba634ca5c7cmd/compile: fold boolean NOT into branches + 2025-11-188806d53c10cmd/link: align sections, not symbols after DWARF compress + 2025-11-18c93766007druntime: do not print recovered when double panic with the same value + 2025-11-189859b43643cmd/asm,cmd/compile,cmd/internal/obj/riscv: use compressed instructions on riscv64 + 2025-11-17b9ef0633f6cmd/internal/sys,internal/goarch,runtime: enable the use of compressed instructions on riscv64 + 2025-11-17a087dea869debug/elf: sync new loong64 relocation types up to LoongArch ELF psABI v20250521 + 2025-11-17e1a12c781fcmd/compile: use 32x32->64 multiplies on arm64 + 2025-11-176caab99026runtime: relax TestMemoryLimit on darwin a bit more + 2025-11-17eda2e8c683runtime: clear frame pointer at thread entry points + 2025-11-176919858338runtime: rename findrunnable references to findRunnable + 2025-11-178e734ec954go/ast: fix BasicLit.End position for raw strings containing \r + 2025-11-17592775ec7dcrypto/mlkem: avoid a few unnecessary inverse NTT calls + 2025-11-17590cf18dafcrypto/mlkem/mlkemtest: add derandomized Encapsulate768/1024 + 2025-11-17c12c337099cmd/compile: teach prove about subtract idioms + 2025-11-17bc15963813cmd/compile: clean up prove pass + 2025-11-171297fae708go/token: add (*File).End method + 2025-11-1765c09eafdfruntime: hoist invariant code out of heapBitsSmallForAddrInline + 2025-11-17594129b80cinternal/runtime/maps: update doc for table.Clear + 2025-11-15c58d075e9acrypto/rsa: deprecate PKCS#1 v1.5 encryption + 2025-11-14d55ecea9e5runtime: usleep before stealing runnext only if not in syscall + 2025-11-14410ef44f00cmd: update x/tools to 59ff18c + 2025-11-1450128a2154runtime: support runtime.freegc in size-specialized mallocs for noscan objects + 2025-11-14c3708350a4cmd/go: tests: rename git-min-vers->git-sha256 + 2025-11-14aea881230dstd: fix printf("%q", int) mistakes + 2025-11-14120f1874efruntime: add more precise test of assist credit handling for runtime.freegc + 2025-11-14fecfcaa4f6runtime: add runtime.freegc to reduce GC work + 2025-11-145a347b775eruntime: set GOEXPERIMENT=runtimefreegc to disabled by default + 2025-11-141a03d0db3fruntime: skip tests for GOEXPERIMENT=arenas that do not handle clobberfree=1 + 2025-11-14cb0d9980f5net/http: do not discard body content when closing it within request handlers + 2025-11-1403ed43988fcmd/compile: allow multi-field structs to be stored directly in interfaces + 2025-11-141bb1f2bf0cruntime: put AddCleanup cleanup arguments in their own allocation + 2025-11-149fd2e44439runtime: add AddCleanup benchmark + 2025-11-1480c91eedbbruntime: ensure weak handles end up in their own allocation + 2025-11-147a8d0b5d53runtime: add debug mode to extend _Grunning-without-P windows + 2025-11-14710abf74dainternal/runtime/cgobench: add Go function call benchmark for comparison + 2025-11-14b24aec598bdoc, cmd/internal/obj/riscv: document the riscv64 assembler + 2025-11-14a0e738c657cmd/compile/internal: remove incorrect riscv64 SLTI rule + 2025-11-142cdcc4150bcmd/compile: fold negation into multiplication + 2025-11-14b57962b7c7bytes: fix panic in bytes.Buffer.Peek + 2025-11-140a569528eacmd/compile: optimize comparisons with single bit difference + 2025-11-141e5e6663e9cmd/compile: remove unnecessary casts and types from riscv64 rules + 2025-11-14ddd8558e61go/types, types2: swap object.color for Checker.objPathIdx + 2025-11-149daaab305ccmd/link/internal/ld: make runtime.buildVersion with experiments valid + 2025-11-13d50a571ddftest: fix tests to work with sizespecializedmalloc turned off + 2025-11-13704f841eabcmd/trace: annotation proc start/stop with thread and proc always + 2025-11-1317a02b9106net/http: remove unused isLitOrSingle and isNotToken + 2025-11-13ff61991aedcmd/go: fix flaky TestScript/mod_get_direct + 2025-11-13129d0cb543net/http/cgi: accept INCLUDED as protocol for server side includes + 2025-11-1377c5130100go/types: minor simplification + 2025-11-137601cd3880go/types: generate cycles.go + 2025-11-137a372affd9go/types, types2: rename definedType to declaredType and clarify docs Change-Id: Ibaa9bdb982364892f80e511c1bb12661fcd5fb86
This commit is contained in:
190
test/codegen/append.go
Normal file
190
test/codegen/append.go
Normal file
@@ -0,0 +1,190 @@
|
||||
// asmcheck
|
||||
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package codegen
|
||||
|
||||
func Append1(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append2(n int) (r []int) {
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return
|
||||
}
|
||||
|
||||
func Append3(n int) (r []int) {
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append4(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growsliceBuf`
|
||||
r = append(r, i)
|
||||
}
|
||||
println(cap(r))
|
||||
// amd64:`.*moveSliceNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append5(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growsliceBuf`
|
||||
r = append(r, i)
|
||||
}
|
||||
useSlice(r)
|
||||
// amd64:`.*moveSliceNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append6(n int) []*int {
|
||||
var r []*int
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, new(i))
|
||||
}
|
||||
// amd64:`.*moveSliceNoCap`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append7(n int) []*int {
|
||||
var r []*int
|
||||
for i := range n {
|
||||
// amd64:`.*growsliceBuf`
|
||||
r = append(r, new(i))
|
||||
}
|
||||
println(cap(r))
|
||||
// amd64:`.*moveSlice`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append8(n int, p *[]int) {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
*p = r
|
||||
}
|
||||
|
||||
func Append9(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
println(len(r))
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append10(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
println(r[3])
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append11(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growsliceBuf`
|
||||
r = append(r, i)
|
||||
}
|
||||
r = r[3:5]
|
||||
// amd64:`.*moveSliceNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append12(n int) []int {
|
||||
var r []int
|
||||
r = nil
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append13(n int) []int {
|
||||
var r []int
|
||||
r, r = nil, nil
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append14(n int) []int {
|
||||
var r []int
|
||||
r = []int{3, 4, 5}
|
||||
for i := range n {
|
||||
// amd64:`.*growsliceBuf`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append15(n int) []int {
|
||||
r := []int{3, 4, 5}
|
||||
for i := range n {
|
||||
// amd64:`.*growsliceBuf`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append16(r []int, n int) []int {
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
func Append17(n int) []int {
|
||||
var r []int
|
||||
for i := range n {
|
||||
// amd64:`.*growslice`
|
||||
r = append(r, i)
|
||||
}
|
||||
for i, x := range r {
|
||||
println(i, x)
|
||||
}
|
||||
// amd64:`.*moveSliceNoCapNoScan`
|
||||
return r
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func useSlice(s []int) {
|
||||
}
|
||||
@@ -318,13 +318,28 @@ func MergeMuls5(a, n int) int {
|
||||
// Multiplications folded negation
|
||||
|
||||
func FoldNegMul(a int) int {
|
||||
// loong64:"SUBVU" "ALSLV [$]2" "ALSLV [$]1"
|
||||
return (-a) * 11
|
||||
// amd64:"IMUL3Q [$]-11" -"NEGQ"
|
||||
// arm64:"MOVD [$]-11" "MUL" -"NEG"
|
||||
// loong64:"ALSLV [$]2" "SUBVU" "ALSLV [$]4"
|
||||
// riscv64:"MOV [$]-11" "MUL" -"NEG"
|
||||
return -a * 11
|
||||
}
|
||||
|
||||
func Fold2NegMul(a, b int) int {
|
||||
// amd64:"IMULQ" -"NEGQ"
|
||||
// arm64:"MUL" -"NEG"
|
||||
// loong64:"MULV" -"SUBVU R[0-9], R0,"
|
||||
return (-a) * (-b)
|
||||
// riscv64:"MUL" -"NEG"
|
||||
return -a * -b
|
||||
}
|
||||
|
||||
func Mul32(a, b int32) int64 {
|
||||
// arm64:"SMULL" -"MOVW"
|
||||
return int64(a) * int64(b)
|
||||
}
|
||||
func Mul32U(a, b uint32) uint64 {
|
||||
// arm64:"UMULL" -"MOVWU"
|
||||
return uint64(a) * uint64(b)
|
||||
}
|
||||
|
||||
// -------------- //
|
||||
|
||||
@@ -313,3 +313,18 @@ func constantWrite(b bool, p *bool) {
|
||||
*p = b
|
||||
}
|
||||
}
|
||||
|
||||
func boolCompare1(p, q *bool) int {
|
||||
// arm64:-"EOR [$]1"
|
||||
if *p == *q {
|
||||
return 5
|
||||
}
|
||||
return 7
|
||||
}
|
||||
func boolCompare2(p, q *bool) int {
|
||||
// arm64:-"EOR [$]1"
|
||||
if *p != *q {
|
||||
return 5
|
||||
}
|
||||
return 7
|
||||
}
|
||||
|
||||
@@ -198,6 +198,126 @@ func ui4d(c <-chan uint8) {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------ //
|
||||
// single bit difference (conjunction) //
|
||||
// ------------------------------------ //
|
||||
|
||||
func sisbc64(c <-chan int64) {
|
||||
// amd64: "ORQ [$]2,"
|
||||
// riscv64: "ORI [$]2,"
|
||||
for x := <-c; x != 4 && x != 6; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func sisbc32(c <-chan int32) {
|
||||
// amd64: "ORL [$]4,"
|
||||
// riscv64: "ORI [$]4,"
|
||||
for x := <-c; x != -1 && x != -5; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func sisbc16(c <-chan int16) {
|
||||
// amd64: "ORL [$]32,"
|
||||
// riscv64: "ORI [$]32,"
|
||||
for x := <-c; x != 16 && x != 48; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func sisbc8(c <-chan int8) {
|
||||
// amd64: "ORL [$]16,"
|
||||
// riscv64: "ORI [$]16,"
|
||||
for x := <-c; x != -15 && x != -31; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbc64(c <-chan uint64) {
|
||||
// amd64: "ORQ [$]4,"
|
||||
// riscv64: "ORI [$]4,"
|
||||
for x := <-c; x != 1 && x != 5; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbc32(c <-chan uint32) {
|
||||
// amd64: "ORL [$]4,"
|
||||
// riscv64: "ORI [$]4,"
|
||||
for x := <-c; x != 2 && x != 6; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbc16(c <-chan uint16) {
|
||||
// amd64: "ORL [$]32,"
|
||||
// riscv64: "ORI [$]32,"
|
||||
for x := <-c; x != 16 && x != 48; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbc8(c <-chan uint8) {
|
||||
// amd64: "ORL [$]64,"
|
||||
// riscv64: "ORI [$]64,"
|
||||
for x := <-c; x != 64 && x != 0; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------ //
|
||||
// single bit difference (disjunction) //
|
||||
// ------------------------------------ //
|
||||
|
||||
func sisbd64(c <-chan int64) {
|
||||
// amd64: "ORQ [$]2,"
|
||||
// riscv64: "ORI [$]2,"
|
||||
for x := <-c; x == 4 || x == 6; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func sisbd32(c <-chan int32) {
|
||||
// amd64: "ORL [$]4,"
|
||||
// riscv64: "ORI [$]4,"
|
||||
for x := <-c; x == -1 || x == -5; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func sisbd16(c <-chan int16) {
|
||||
// amd64: "ORL [$]32,"
|
||||
// riscv64: "ORI [$]32,"
|
||||
for x := <-c; x == 16 || x == 48; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func sisbd8(c <-chan int8) {
|
||||
// amd64: "ORL [$]16,"
|
||||
// riscv64: "ORI [$]16,"
|
||||
for x := <-c; x == -15 || x == -31; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbd64(c <-chan uint64) {
|
||||
// amd64: "ORQ [$]4,"
|
||||
// riscv64: "ORI [$]4,"
|
||||
for x := <-c; x == 1 || x == 5; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbd32(c <-chan uint32) {
|
||||
// amd64: "ORL [$]4,"
|
||||
// riscv64: "ORI [$]4,"
|
||||
for x := <-c; x == 2 || x == 6; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbd16(c <-chan uint16) {
|
||||
// amd64: "ORL [$]32,"
|
||||
// riscv64: "ORI [$]32,"
|
||||
for x := <-c; x == 16 || x == 48; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
func uisbd8(c <-chan uint8) {
|
||||
// amd64: "ORL [$]64,"
|
||||
// riscv64: "ORI [$]64,"
|
||||
for x := <-c; x == 64 || x == 0; x = <-c {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------//
|
||||
// merge NaN checks //
|
||||
// ------------------------------------ //
|
||||
|
||||
@@ -23,7 +23,7 @@ func CountBytes(s []byte) int {
|
||||
|
||||
func ToByteSlice() []byte { // Issue #24698
|
||||
// amd64:`LEAQ type:\[3\]uint8`
|
||||
// amd64:`CALL runtime\.mallocTiny3`
|
||||
// amd64:`CALL runtime\.(newobject|mallocTiny3)`
|
||||
// amd64:-`.*runtime.stringtoslicebyte`
|
||||
return []byte("foo")
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ type T struct{ M string }
|
||||
|
||||
var b bool
|
||||
|
||||
func f1(q *Q, xx []byte) interface{} { // ERROR "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: xx$" "live at entry to f1: xx$"
|
||||
func f1(q *Q, xx []byte) interface{} { // ERROR "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): xx$" "live at entry to f1: xx$"
|
||||
// xx was copied from the stack to the heap on the previous line:
|
||||
// xx was live for the first two prints but then it switched to &xx
|
||||
// being live. We should not see plain xx again.
|
||||
@@ -36,7 +36,7 @@ func f1(q *Q, xx []byte) interface{} { // ERROR "live at call to mallocgcSmallSc
|
||||
//go:noinline
|
||||
func f2(d []byte, n int) (odata, res []byte, e interface{}) { // ERROR "live at entry to f2: d$"
|
||||
if n > len(d) {
|
||||
return d, nil, &T{M: "hello"} // ERROR "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: d"
|
||||
return d, nil, &T{M: "hello"} // ERROR "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+)+: d"
|
||||
}
|
||||
res = d[:n]
|
||||
odata = d[n:]
|
||||
|
||||
20
test/fixedbugs/issue74888.go
Normal file
20
test/fixedbugs/issue74888.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// compile
|
||||
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
type P struct {
|
||||
q struct{}
|
||||
p *int
|
||||
}
|
||||
|
||||
func f(x any) {
|
||||
h(x.(P))
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func h(P) {
|
||||
}
|
||||
24
test/fixedbugs/issue74908.go
Normal file
24
test/fixedbugs/issue74908.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// compile
|
||||
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
type Type struct {
|
||||
any
|
||||
}
|
||||
|
||||
type typeObject struct {
|
||||
e struct{}
|
||||
b *byte
|
||||
}
|
||||
|
||||
func f(b *byte) Type {
|
||||
return Type{
|
||||
typeObject{
|
||||
b: b,
|
||||
},
|
||||
}
|
||||
}
|
||||
19
test/fixedbugs/issue74935.go
Normal file
19
test/fixedbugs/issue74935.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// run
|
||||
|
||||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "reflect"
|
||||
|
||||
type W struct {
|
||||
E struct{}
|
||||
X *byte
|
||||
}
|
||||
|
||||
func main() {
|
||||
w := reflect.ValueOf(W{})
|
||||
_ = w.Field(0).Interface()
|
||||
}
|
||||
10
test/live.go
10
test/live.go
@@ -467,9 +467,9 @@ func f27defer(b bool) {
|
||||
func f27go(b bool) {
|
||||
x := 0
|
||||
if b {
|
||||
go call27(func() { x++ }) // ERROR "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: &x$" "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: &x .autotmp_[0-9]+$" "live at call to newproc: &x$" // allocate two closures, the func literal, and the wrapper for go
|
||||
go call27(func() { x++ }) // ERROR "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): &x$" "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): &x .autotmp_[0-9]+$" "live at call to newproc: &x$" // allocate two closures, the func literal, and the wrapper for go
|
||||
}
|
||||
go call27(func() { x++ }) // ERROR "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: &x$" "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: .autotmp_[0-9]+$" // allocate two closures, the func literal, and the wrapper for go
|
||||
go call27(func() { x++ }) // ERROR "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): &x$" "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): .autotmp_[0-9]+$" // allocate two closures, the func literal, and the wrapper for go
|
||||
printnl()
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ func f31(b1, b2, b3 bool) {
|
||||
g31(g18()) // ERROR "stack object .autotmp_[0-9]+ \[2\]string$"
|
||||
}
|
||||
if b2 {
|
||||
h31(g18()) // ERROR "live at call to convT: .autotmp_[0-9]+$" "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: .autotmp_[0-9]+$"
|
||||
h31(g18()) // ERROR "live at call to convT: .autotmp_[0-9]+$" "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): .autotmp_[0-9]+$"
|
||||
}
|
||||
if b3 {
|
||||
panic(g18())
|
||||
@@ -665,14 +665,14 @@ func f39a() (x []int) {
|
||||
|
||||
func f39b() (x [10]*int) {
|
||||
x = [10]*int{}
|
||||
x[0] = new(int) // ERROR "live at call to mallocTiny[48]: x$"
|
||||
x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
|
||||
printnl() // ERROR "live at call to printnl: x$"
|
||||
return x
|
||||
}
|
||||
|
||||
func f39c() (x [10]*int) {
|
||||
x = [10]*int{}
|
||||
x[0] = new(int) // ERROR "live at call to mallocTiny[48]: x$"
|
||||
x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
|
||||
printnl() // ERROR "live at call to printnl: x$"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -465,9 +465,9 @@ func f27defer(b bool) {
|
||||
func f27go(b bool) {
|
||||
x := 0
|
||||
if b {
|
||||
go call27(func() { x++ }) // ERROR "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: &x$" "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: &x .autotmp_[0-9]+$" "live at call to newproc: &x$" // allocate two closures, the func literal, and the wrapper for go
|
||||
go call27(func() { x++ }) // ERROR "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): &x$" "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): &x .autotmp_[0-9]+$" "live at call to newproc: &x$" // allocate two closures, the func literal, and the wrapper for go
|
||||
}
|
||||
go call27(func() { x++ }) // ERROR "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: &x$" "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: .autotmp_[0-9]+$" // allocate two closures, the func literal, and the wrapper for go
|
||||
go call27(func() { x++ }) // ERROR "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): &x$" "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): .autotmp_[0-9]+$" // allocate two closures, the func literal, and the wrapper for go
|
||||
printnl()
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ func f31(b1, b2, b3 bool) {
|
||||
g31(g18()) // ERROR "stack object .autotmp_[0-9]+ \[2\]string$"
|
||||
}
|
||||
if b2 {
|
||||
h31(g18()) // ERROR "live at call to convT: .autotmp_[0-9]+$" "live at call to mallocgcSmallScanNoHeaderSC[0-9]+: .autotmp_[0-9]+$"
|
||||
h31(g18()) // ERROR "live at call to convT: .autotmp_[0-9]+$" "live at call to (newobject|mallocgcSmallScanNoHeaderSC[0-9]+): .autotmp_[0-9]+$"
|
||||
}
|
||||
if b3 {
|
||||
panic(g18())
|
||||
@@ -663,14 +663,14 @@ func f39a() (x []int) {
|
||||
|
||||
func f39b() (x [10]*int) {
|
||||
x = [10]*int{}
|
||||
x[0] = new(int) // ERROR "live at call to mallocTiny[48]: x$"
|
||||
x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
|
||||
printnl() // ERROR "live at call to printnl: x$"
|
||||
return x
|
||||
}
|
||||
|
||||
func f39c() (x [10]*int) {
|
||||
x = [10]*int{}
|
||||
x[0] = new(int) // ERROR "live at call to mallocTiny[48]: x$"
|
||||
x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
|
||||
printnl() // ERROR "live at call to printnl: x$"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -679,12 +679,12 @@ func natcmp(x, y []uint) (r int) {
|
||||
}
|
||||
|
||||
func suffix(s, suffix string) bool {
|
||||
// todo, we're still not able to drop the bound check here in the general case
|
||||
return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
|
||||
// Note: issue 76304
|
||||
return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix // ERROR "Proved IsSliceInBounds"
|
||||
}
|
||||
|
||||
func constsuffix(s string) bool {
|
||||
return suffix(s, "abc") // ERROR "Proved IsSliceInBounds$"
|
||||
return suffix(s, "abc") // ERROR "Proved IsSliceInBounds$" "Proved slicemask not needed$" "Proved Eq64$"
|
||||
}
|
||||
|
||||
func atexit(foobar []func()) {
|
||||
@@ -991,14 +991,14 @@ func divShiftClean64(n int64) int64 {
|
||||
if n < 0 {
|
||||
return n
|
||||
}
|
||||
return n / int64(16) // ERROR "Proved Div64 is unsigned$"
|
||||
return n / int64(16) // ERROR "Proved Div64 is unsigned$"
|
||||
}
|
||||
|
||||
func divShiftClean32(n int32) int32 {
|
||||
if n < 0 {
|
||||
return n
|
||||
}
|
||||
return n / int32(16) // ERROR "Proved Div32 is unsigned$"
|
||||
return n / int32(16) // ERROR "Proved Div32 is unsigned$"
|
||||
}
|
||||
|
||||
// Bounds check elimination
|
||||
@@ -1079,8 +1079,8 @@ func modu2(x, y uint) int {
|
||||
|
||||
func issue57077(s []int) (left, right []int) {
|
||||
middle := len(s) / 2 // ERROR "Proved Div64 is unsigned$"
|
||||
left = s[:middle] // ERROR "Proved IsSliceInBounds$"
|
||||
right = s[middle:] // ERROR "Proved IsSliceInBounds$"
|
||||
left = s[:middle] // ERROR "Proved IsSliceInBounds$"
|
||||
right = s[middle:] // ERROR "Proved IsSliceInBounds$"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2496,7 +2496,6 @@ func div3pos(x []int) int {
|
||||
return len(x) / 3 // ERROR "Proved Div64 is unsigned"
|
||||
}
|
||||
|
||||
|
||||
var len200 [200]int
|
||||
|
||||
func modbound1(u uint64) int {
|
||||
@@ -2544,9 +2543,9 @@ func rangebound2(x []int) int {
|
||||
func swapbound(v []int) {
|
||||
for i := 0; i < len(v)/2; i++ { // ERROR "Proved Div64 is unsigned|Induction variable"
|
||||
v[i], // ERROR "Proved IsInBounds"
|
||||
v[len(v)-1-i] = // ERROR "Proved IsInBounds"
|
||||
v[len(v)-1-i],
|
||||
v[i] // ERROR "Proved IsInBounds"
|
||||
v[len(v)-1-i] = // ERROR "Proved IsInBounds"
|
||||
v[len(v)-1-i],
|
||||
v[i] // ERROR "Proved IsInBounds"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2569,73 +2568,85 @@ func rightShiftBounds(v, s int) {
|
||||
// We care about the bounds for x printed on the prove(x) lines.
|
||||
|
||||
if -8 <= v && v <= -2 && 1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-4,-1 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-4,-1 "
|
||||
}
|
||||
if -80 <= v && v <= -20 && 1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-40,-3 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-40,-3 "
|
||||
}
|
||||
if -8 <= v && v <= 10 && 1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-4,5 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-4,5 "
|
||||
}
|
||||
if 2 <= v && v <= 10 && 1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=0,5 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=0,5 "
|
||||
}
|
||||
|
||||
if -8 <= v && v <= -2 && 0 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,-1 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,-1 "
|
||||
}
|
||||
if -80 <= v && v <= -20 && 0 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-80,-3 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-80,-3 "
|
||||
}
|
||||
if -8 <= v && v <= 10 && 0 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,10 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,10 "
|
||||
}
|
||||
if 2 <= v && v <= 10 && 0 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=0,10 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=0,10 "
|
||||
}
|
||||
|
||||
if -8 <= v && v <= -2 && -1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,-1 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,-1 "
|
||||
}
|
||||
if -80 <= v && v <= -20 && -1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-80,-3 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-80,-3 "
|
||||
}
|
||||
if -8 <= v && v <= 10 && -1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,10 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=-8,10 "
|
||||
}
|
||||
if 2 <= v && v <= 10 && -1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=0,10 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
prove(x) // ERROR "Proved sm,SM=0,10 "
|
||||
}
|
||||
}
|
||||
|
||||
func unsignedRightShiftBounds(v uint, s int) {
|
||||
if 2 <= v && v <= 10 && -1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=0,10 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=0,10 "
|
||||
}
|
||||
if 2 <= v && v <= 10 && 0 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=0,10 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=0,10 "
|
||||
}
|
||||
if 2 <= v && v <= 10 && 1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=0,5 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=0,5 "
|
||||
}
|
||||
if 20 <= v && v <= 100 && 1 <= s && s <= 3 {
|
||||
x := v>>s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=2,50 "
|
||||
x := v >> s // ERROR "Proved"
|
||||
proveu(x) // ERROR "Proved sm,SM=2,50 "
|
||||
}
|
||||
}
|
||||
|
||||
func subLengths1(b []byte, i int) {
|
||||
if i >= 0 && i <= len(b) {
|
||||
_ = b[len(b)-i:] // ERROR "Proved IsSliceInBounds"
|
||||
}
|
||||
}
|
||||
|
||||
func subLengths2(b []byte, i int) {
|
||||
if i >= 0 && i <= len(b) {
|
||||
_ = b[:len(b)-i] // ERROR "Proved IsSliceInBounds"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,16 +50,16 @@ func TestM1() {
|
||||
|
||||
func TestF2() {
|
||||
var v int // ERROR "moved to heap"
|
||||
F2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to mallocgcSmallNoScanSC[0-9]+: .?autotmp" "live at call to F2: .?autotmp" "escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$"
|
||||
F2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to (newobject|mallocgcSmallNoScanSC[0-9]+): .?autotmp" "live at call to F2: .?autotmp" "escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$"
|
||||
}
|
||||
|
||||
func TestF4() {
|
||||
var v2 int // ERROR "moved to heap"
|
||||
F4(0, 1, uintptr(unsafe.Pointer(&v2)), 2) // ERROR "live at call to mallocgcSmallNoScanSC[0-9]+: .?autotmp" "live at call to F4: .?autotmp" "escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$"
|
||||
F4(0, 1, uintptr(unsafe.Pointer(&v2)), 2) // ERROR "live at call to (newobject|mallocgcSmallNoScanSC[0-9]+): .?autotmp" "live at call to F4: .?autotmp" "escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$"
|
||||
}
|
||||
|
||||
func TestM2() {
|
||||
var t T
|
||||
var v int // ERROR "moved to heap"
|
||||
t.M2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to mallocgcSmallNoScanSC[0-9]+: .?autotmp" "live at call to T.M2: .?autotmp" "escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$"
|
||||
t.M2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to (newobject|mallocgcSmallNoScanSC[0-9]+): .?autotmp" "live at call to T.M2: .?autotmp" "escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user