aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic32.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2025-06-17 14:44:56 -0700
committerKeith Randall <khr@golang.org>2025-07-24 16:03:38 -0700
commit741a19ab4197fb528f8d7f7d8a73d3db3ef99355 (patch)
tree53992c6cf41f09265fd7118a5f0c8f55b92ab188 /src/runtime/panic32.go
parentce05ad448fe6ea3b9b33c0eab1143dcb40e3bbc3 (diff)
downloadgo-741a19ab4197fb528f8d7f7d8a73d3db3ef99355.tar.xz
runtime: move bounds check constants to internal/abi
For future use by the compiler. Change-Id: Id3da62006b283ac38008261c0ef88aaf71ef5896 Reviewed-on: https://go-review.googlesource.com/c/go/+/682456 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>
Diffstat (limited to 'src/runtime/panic32.go')
-rw-r--r--src/runtime/panic32.go33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/runtime/panic32.go b/src/runtime/panic32.go
index cd34485a96..9dd4c0eb2e 100644
--- a/src/runtime/panic32.go
+++ b/src/runtime/panic32.go
@@ -7,6 +7,7 @@
package runtime
import (
+ "internal/abi"
"internal/runtime/sys"
)
@@ -16,77 +17,77 @@ import (
// failures in the comparisons for s[x], 0 <= x < y (y == len(s))
func goPanicExtendIndex(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "index out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsIndex})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsIndex})
}
func goPanicExtendIndexU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "index out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsIndex})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsIndex})
}
// failures in the comparisons for s[:x], 0 <= x <= y (y == len(s) or cap(s))
func goPanicExtendSliceAlen(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSliceAlen})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSliceAlen})
}
func goPanicExtendSliceAlenU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSliceAlen})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSliceAlen})
}
func goPanicExtendSliceAcap(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSliceAcap})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSliceAcap})
}
func goPanicExtendSliceAcapU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSliceAcap})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSliceAcap})
}
// failures in the comparisons for s[x:y], 0 <= x <= y
func goPanicExtendSliceB(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSliceB})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSliceB})
}
func goPanicExtendSliceBU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSliceB})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSliceB})
}
// failures in the comparisons for s[::x], 0 <= x <= y (y == len(s) or cap(s))
func goPanicExtendSlice3Alen(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3Alen})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSlice3Alen})
}
func goPanicExtendSlice3AlenU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3Alen})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSlice3Alen})
}
func goPanicExtendSlice3Acap(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3Acap})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSlice3Acap})
}
func goPanicExtendSlice3AcapU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3Acap})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSlice3Acap})
}
// failures in the comparisons for s[:x:y], 0 <= x <= y
func goPanicExtendSlice3B(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3B})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSlice3B})
}
func goPanicExtendSlice3BU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3B})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSlice3B})
}
// failures in the comparisons for s[x:y:], 0 <= x <= y
func goPanicExtendSlice3C(hi int, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3C})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: abi.BoundsSlice3C})
}
func goPanicExtendSlice3CU(hi uint, lo uint, y int) {
panicCheck1(sys.GetCallerPC(), "slice bounds out of range")
- panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3C})
+ panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: abi.BoundsSlice3C})
}
// Implemented in assembly, as they take arguments in registers.