1
0
mirror of https://github.com/golang/go synced 2024-11-14 13:40:30 -07:00
go/test/codegen/writebarrier.go
khr@golang.org 9b4268c3df cmd/compile: simplify prove pass
We don't need noLimit checks in a bunch of places.
Also simplify folding of provable constant results.

At this point in the CL stack, compilebench reports no performance
changes. The only thing of note is that binaries got a bit smaller.

name                      old text-bytes    new text-bytes    delta
HelloSize                       960kB ± 0%        952kB ± 0%  -0.83%  (p=0.000 n=10+10)
CmdGoSize                      12.3MB ± 0%       12.1MB ± 0%  -1.53%  (p=0.000 n=10+10)

Change-Id: Id4be75eec0f8c93f2f3b93a8521ce2278ee2ee2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/599197
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-08-07 16:08:20 +00:00

66 lines
1.7 KiB
Go

// asmcheck
// Copyright 2023 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 combine2string(p *[2]string, a, b string) {
// amd64:`.*runtime[.]gcWriteBarrier4\(SB\)`
// arm64:`.*runtime[.]gcWriteBarrier4\(SB\)`
p[0] = a
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[1] = b
}
func combine4string(p *[4]string, a, b, c, d string) {
// amd64:`.*runtime[.]gcWriteBarrier8\(SB\)`
// arm64:`.*runtime[.]gcWriteBarrier8\(SB\)`
p[0] = a
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[1] = b
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[2] = c
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[3] = d
}
func combine2slice(p *[2][]byte, a, b []byte) {
// amd64:`.*runtime[.]gcWriteBarrier4\(SB\)`
// arm64:`.*runtime[.]gcWriteBarrier4\(SB\)`
p[0] = a
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[1] = b
}
func combine4slice(p *[4][]byte, a, b, c, d []byte) {
// amd64:`.*runtime[.]gcWriteBarrier8\(SB\)`
// arm64:`.*runtime[.]gcWriteBarrier8\(SB\)`
p[0] = a
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[1] = b
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[2] = c
// amd64:-`.*runtime[.]gcWriteBarrier`
// arm64:-`.*runtime[.]gcWriteBarrier`
p[3] = d
}
func trickyWriteNil(p *int, q **int) {
if p == nil {
// We change "= p" to "= 0" in the prove pass, which
// means we have one less pointer that needs to go
// into the write barrier buffer.
// amd64:`.*runtime[.]gcWriteBarrier1`
*q = p
}
}