diff options
| author | Keith Randall <khr@golang.org> | 2025-06-18 17:09:20 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2025-08-05 08:59:28 -0700 |
| commit | 21ab0128b62658ba3e325586f45bb781bee55fda (patch) | |
| tree | 897bd90692ce8dc1965e6704c03a6b0aa3bd8a05 /src/cmd/compile | |
| parent | 802d056c784d6baa8e5fc13a86e24ecc82ec2bf2 (diff) | |
| download | go-21ab0128b62658ba3e325586f45bb781bee55fda.tar.xz | |
cmd/compile: remove support for old-style bounds check calls
This CL rips out the support for old-style assembly stubs.
We need to keep the Go stubs for wasm support.
Change-Id: I23d6d9f2f06be1ded8d22b3e0ef04ff6e252a587
Reviewed-on: https://go-review.googlesource.com/c/go/+/682402
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/cmd/compile')
| -rw-r--r-- | src/cmd/compile/internal/ssa/op.go | 47 | ||||
| -rw-r--r-- | src/cmd/compile/internal/ssagen/ssa.go | 41 |
2 files changed, 1 insertions, 87 deletions
diff --git a/src/cmd/compile/internal/ssa/op.go b/src/cmd/compile/internal/ssa/op.go index d5c7394a26..e8bd5d9acf 100644 --- a/src/cmd/compile/internal/ssa/op.go +++ b/src/cmd/compile/internal/ssa/op.go @@ -485,53 +485,6 @@ const ( BoundsKindCount ) -// boundsABI determines which register arguments a bounds check call should use. For an [a:b:c] slice, we do: -// -// CMPQ c, cap -// JA fail1 -// CMPQ b, c -// JA fail2 -// CMPQ a, b -// JA fail3 -// -// fail1: CALL panicSlice3Acap (c, cap) -// fail2: CALL panicSlice3B (b, c) -// fail3: CALL panicSlice3C (a, b) -// -// When we register allocate that code, we want the same register to be used for -// the first arg of panicSlice3Acap and the second arg to panicSlice3B. That way, -// initializing that register once will satisfy both calls. -// That desire ends up dividing the set of bounds check calls into 3 sets. This function -// determines which set to use for a given panic call. -// The first arg for set 0 should be the second arg for set 1. -// The first arg for set 1 should be the second arg for set 2. -func boundsABI(b int64) int { - switch BoundsKind(b) { - case BoundsSlice3Alen, - BoundsSlice3AlenU, - BoundsSlice3Acap, - BoundsSlice3AcapU, - BoundsConvert: - return 0 - case BoundsSliceAlen, - BoundsSliceAlenU, - BoundsSliceAcap, - BoundsSliceAcapU, - BoundsSlice3B, - BoundsSlice3BU: - return 1 - case BoundsIndex, - BoundsIndexU, - BoundsSliceB, - BoundsSliceBU, - BoundsSlice3C, - BoundsSlice3CU: - return 2 - default: - panic("bad BoundsKind") - } -} - // Returns the bounds error code needed by the runtime, and // whether the x field is signed. func (b BoundsKind) Code() (rtabi.BoundsErrorCode, bool) { diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index bce94d35f9..72928f267b 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -184,42 +184,6 @@ func InitConfig() { BoundsCheckFunc[ssa.BoundsSlice3C] = typecheck.LookupRuntimeFunc("goPanicSlice3C") BoundsCheckFunc[ssa.BoundsSlice3CU] = typecheck.LookupRuntimeFunc("goPanicSlice3CU") BoundsCheckFunc[ssa.BoundsConvert] = typecheck.LookupRuntimeFunc("goPanicSliceConvert") - } else { - BoundsCheckFunc[ssa.BoundsIndex] = typecheck.LookupRuntimeFunc("panicIndex") - BoundsCheckFunc[ssa.BoundsIndexU] = typecheck.LookupRuntimeFunc("panicIndexU") - BoundsCheckFunc[ssa.BoundsSliceAlen] = typecheck.LookupRuntimeFunc("panicSliceAlen") - BoundsCheckFunc[ssa.BoundsSliceAlenU] = typecheck.LookupRuntimeFunc("panicSliceAlenU") - BoundsCheckFunc[ssa.BoundsSliceAcap] = typecheck.LookupRuntimeFunc("panicSliceAcap") - BoundsCheckFunc[ssa.BoundsSliceAcapU] = typecheck.LookupRuntimeFunc("panicSliceAcapU") - BoundsCheckFunc[ssa.BoundsSliceB] = typecheck.LookupRuntimeFunc("panicSliceB") - BoundsCheckFunc[ssa.BoundsSliceBU] = typecheck.LookupRuntimeFunc("panicSliceBU") - BoundsCheckFunc[ssa.BoundsSlice3Alen] = typecheck.LookupRuntimeFunc("panicSlice3Alen") - BoundsCheckFunc[ssa.BoundsSlice3AlenU] = typecheck.LookupRuntimeFunc("panicSlice3AlenU") - BoundsCheckFunc[ssa.BoundsSlice3Acap] = typecheck.LookupRuntimeFunc("panicSlice3Acap") - BoundsCheckFunc[ssa.BoundsSlice3AcapU] = typecheck.LookupRuntimeFunc("panicSlice3AcapU") - BoundsCheckFunc[ssa.BoundsSlice3B] = typecheck.LookupRuntimeFunc("panicSlice3B") - BoundsCheckFunc[ssa.BoundsSlice3BU] = typecheck.LookupRuntimeFunc("panicSlice3BU") - BoundsCheckFunc[ssa.BoundsSlice3C] = typecheck.LookupRuntimeFunc("panicSlice3C") - BoundsCheckFunc[ssa.BoundsSlice3CU] = typecheck.LookupRuntimeFunc("panicSlice3CU") - BoundsCheckFunc[ssa.BoundsConvert] = typecheck.LookupRuntimeFunc("panicSliceConvert") - } - if Arch.LinkArch.PtrSize == 4 { - ExtendCheckFunc[ssa.BoundsIndex] = typecheck.LookupRuntimeVar("panicExtendIndex") - ExtendCheckFunc[ssa.BoundsIndexU] = typecheck.LookupRuntimeVar("panicExtendIndexU") - ExtendCheckFunc[ssa.BoundsSliceAlen] = typecheck.LookupRuntimeVar("panicExtendSliceAlen") - ExtendCheckFunc[ssa.BoundsSliceAlenU] = typecheck.LookupRuntimeVar("panicExtendSliceAlenU") - ExtendCheckFunc[ssa.BoundsSliceAcap] = typecheck.LookupRuntimeVar("panicExtendSliceAcap") - ExtendCheckFunc[ssa.BoundsSliceAcapU] = typecheck.LookupRuntimeVar("panicExtendSliceAcapU") - ExtendCheckFunc[ssa.BoundsSliceB] = typecheck.LookupRuntimeVar("panicExtendSliceB") - ExtendCheckFunc[ssa.BoundsSliceBU] = typecheck.LookupRuntimeVar("panicExtendSliceBU") - ExtendCheckFunc[ssa.BoundsSlice3Alen] = typecheck.LookupRuntimeVar("panicExtendSlice3Alen") - ExtendCheckFunc[ssa.BoundsSlice3AlenU] = typecheck.LookupRuntimeVar("panicExtendSlice3AlenU") - ExtendCheckFunc[ssa.BoundsSlice3Acap] = typecheck.LookupRuntimeVar("panicExtendSlice3Acap") - ExtendCheckFunc[ssa.BoundsSlice3AcapU] = typecheck.LookupRuntimeVar("panicExtendSlice3AcapU") - ExtendCheckFunc[ssa.BoundsSlice3B] = typecheck.LookupRuntimeVar("panicExtendSlice3B") - ExtendCheckFunc[ssa.BoundsSlice3BU] = typecheck.LookupRuntimeVar("panicExtendSlice3BU") - ExtendCheckFunc[ssa.BoundsSlice3C] = typecheck.LookupRuntimeVar("panicExtendSlice3C") - ExtendCheckFunc[ssa.BoundsSlice3CU] = typecheck.LookupRuntimeVar("panicExtendSlice3CU") } // Wasm (all asm funcs with special ABIs) @@ -7758,7 +7722,4 @@ func SpillSlotAddr(spill ssa.Spill, baseReg int16, extraOffset int64) obj.Addr { } } -var ( - BoundsCheckFunc [ssa.BoundsKindCount]*obj.LSym - ExtendCheckFunc [ssa.BoundsKindCount]*obj.LSym -) +var BoundsCheckFunc [ssa.BoundsKindCount]*obj.LSym |
