| 1 |
// Copyright 2019 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build 386 || amd64p32 || arm || mips || mipsle || armbe || m68k || nios2 || ppc || riscv || s390 || sh || shbe || sparc |
| 6 |
|
| 7 |
package runtime |
| 8 |
|
| 9 |
import _ "unsafe" // for go:linkname |
| 10 |
|
| 11 |
// For gccgo, use go:linkname to export compiler-called functions. |
| 12 |
// |
| 13 |
//go:linkname goPanicExtendIndex |
| 14 |
//go:linkname goPanicExtendIndexU |
| 15 |
//go:linkname goPanicExtendSliceAlen |
| 16 |
//go:linkname goPanicExtendSliceAlenU |
| 17 |
//go:linkname goPanicExtendSliceAcap |
| 18 |
//go:linkname goPanicExtendSliceAcapU |
| 19 |
//go:linkname goPanicExtendSliceB |
| 20 |
//go:linkname goPanicExtendSliceBU |
| 21 |
//go:linkname goPanicExtendSlice3Alen |
| 22 |
//go:linkname goPanicExtendSlice3AlenU |
| 23 |
//go:linkname goPanicExtendSlice3Acap |
| 24 |
//go:linkname goPanicExtendSlice3AcapU |
| 25 |
//go:linkname goPanicExtendSlice3B |
| 26 |
//go:linkname goPanicExtendSlice3BU |
| 27 |
//go:linkname goPanicExtendSlice3C |
| 28 |
//go:linkname goPanicExtendSlice3CU |
| 29 |
|
| 30 |
// Additional index/slice error paths for 32-bit platforms. |
| 31 |
// Used when the high word of a 64-bit index is not zero. |
| 32 |
|
| 33 |
// failures in the comparisons for s[x], 0 <= x < y (y == len(s)) |
| 34 |
func goPanicExtendIndex(x int64, y int) { |
| 35 |
panicCheck1(getcallerpc(), "index out of range") |
| 36 |
panic(boundsError{x: x, signed: true, y: y, code: boundsIndex}) |
| 37 |
} |
| 38 |
func goPanicExtendIndexU(x uint64, y int) { |
| 39 |
panicCheck1(getcallerpc(), "index out of range") |
| 40 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsIndex}) |
| 41 |
} |
| 42 |
|
| 43 |
// failures in the comparisons for s[:x], 0 <= x <= y (y == len(s) or cap(s)) |
| 44 |
func goPanicExtendSliceAlen(x int64, y int) { |
| 45 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 46 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSliceAlen}) |
| 47 |
} |
| 48 |
func goPanicExtendSliceAlenU(x uint64, y int) { |
| 49 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 50 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSliceAlen}) |
| 51 |
} |
| 52 |
func goPanicExtendSliceAcap(x int64, y int) { |
| 53 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 54 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSliceAcap}) |
| 55 |
} |
| 56 |
func goPanicExtendSliceAcapU(x uint64, y int) { |
| 57 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 58 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSliceAcap}) |
| 59 |
} |
| 60 |
|
| 61 |
// failures in the comparisons for s[x:y], 0 <= x <= y |
| 62 |
func goPanicExtendSliceB(x int64, y int) { |
| 63 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 64 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSliceB}) |
| 65 |
} |
| 66 |
func goPanicExtendSliceBU(x uint64, y int) { |
| 67 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 68 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSliceB}) |
| 69 |
} |
| 70 |
|
| 71 |
// failures in the comparisons for s[::x], 0 <= x <= y (y == len(s) or cap(s)) |
| 72 |
func goPanicExtendSlice3Alen(x int64, y int) { |
| 73 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 74 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSlice3Alen}) |
| 75 |
} |
| 76 |
func goPanicExtendSlice3AlenU(x uint64, y int) { |
| 77 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 78 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSlice3Alen}) |
| 79 |
} |
| 80 |
func goPanicExtendSlice3Acap(x int64, y int) { |
| 81 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 82 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSlice3Acap}) |
| 83 |
} |
| 84 |
func goPanicExtendSlice3AcapU(x uint64, y int) { |
| 85 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 86 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSlice3Acap}) |
| 87 |
} |
| 88 |
|
| 89 |
// failures in the comparisons for s[:x:y], 0 <= x <= y |
| 90 |
func goPanicExtendSlice3B(x int64, y int) { |
| 91 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 92 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSlice3B}) |
| 93 |
} |
| 94 |
func goPanicExtendSlice3BU(x uint64, y int) { |
| 95 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 96 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSlice3B}) |
| 97 |
} |
| 98 |
|
| 99 |
// failures in the comparisons for s[x:y:], 0 <= x <= y |
| 100 |
func goPanicExtendSlice3C(x int64, y int) { |
| 101 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 102 |
panic(boundsError{x: x, signed: true, y: y, code: boundsSlice3C}) |
| 103 |
} |
| 104 |
func goPanicExtendSlice3CU(x uint64, y int) { |
| 105 |
panicCheck1(getcallerpc(), "slice bounds out of range") |
| 106 |
panic(boundsError{x: int64(x), signed: false, y: y, code: boundsSlice3C}) |
| 107 |
} |