| 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 || arm || mips || mipsle |
| 6 |
|
| 7 |
package runtime |
| 8 |
|
| 9 |
import ( |
| 10 |
"internal/runtime/sys" |
| 11 |
) |
| 12 |
|
| 13 |
// Additional index/slice error paths for 32-bit platforms. |
| 14 |
// Used when the high word of a 64-bit index is not zero. |
| 15 |
|
| 16 |
// failures in the comparisons for s[x], 0 <= x < y (y == len(s)) |
| 17 |
func goPanicExtendIndex(hi int, lo uint, y int) { |
| 18 |
panicCheck1(sys.GetCallerPC(), "index out of range") |
| 19 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsIndex}) |
| 20 |
} |
| 21 |
func goPanicExtendIndexU(hi uint, lo uint, y int) { |
| 22 |
panicCheck1(sys.GetCallerPC(), "index out of range") |
| 23 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsIndex}) |
| 24 |
} |
| 25 |
|
| 26 |
// failures in the comparisons for s[:x], 0 <= x <= y (y == len(s) or cap(s)) |
| 27 |
func goPanicExtendSliceAlen(hi int, lo uint, y int) { |
| 28 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 29 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSliceAlen}) |
| 30 |
} |
| 31 |
func goPanicExtendSliceAlenU(hi uint, lo uint, y int) { |
| 32 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 33 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSliceAlen}) |
| 34 |
} |
| 35 |
func goPanicExtendSliceAcap(hi int, lo uint, y int) { |
| 36 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 37 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSliceAcap}) |
| 38 |
} |
| 39 |
func goPanicExtendSliceAcapU(hi uint, lo uint, y int) { |
| 40 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 41 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSliceAcap}) |
| 42 |
} |
| 43 |
|
| 44 |
// failures in the comparisons for s[x:y], 0 <= x <= y |
| 45 |
func goPanicExtendSliceB(hi int, lo uint, y int) { |
| 46 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 47 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSliceB}) |
| 48 |
} |
| 49 |
func goPanicExtendSliceBU(hi uint, lo uint, y int) { |
| 50 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 51 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSliceB}) |
| 52 |
} |
| 53 |
|
| 54 |
// failures in the comparisons for s[::x], 0 <= x <= y (y == len(s) or cap(s)) |
| 55 |
func goPanicExtendSlice3Alen(hi int, lo uint, y int) { |
| 56 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 57 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3Alen}) |
| 58 |
} |
| 59 |
func goPanicExtendSlice3AlenU(hi uint, lo uint, y int) { |
| 60 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 61 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3Alen}) |
| 62 |
} |
| 63 |
func goPanicExtendSlice3Acap(hi int, lo uint, y int) { |
| 64 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 65 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3Acap}) |
| 66 |
} |
| 67 |
func goPanicExtendSlice3AcapU(hi uint, lo uint, y int) { |
| 68 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 69 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3Acap}) |
| 70 |
} |
| 71 |
|
| 72 |
// failures in the comparisons for s[:x:y], 0 <= x <= y |
| 73 |
func goPanicExtendSlice3B(hi int, lo uint, y int) { |
| 74 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 75 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3B}) |
| 76 |
} |
| 77 |
func goPanicExtendSlice3BU(hi uint, lo uint, y int) { |
| 78 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 79 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3B}) |
| 80 |
} |
| 81 |
|
| 82 |
// failures in the comparisons for s[x:y:], 0 <= x <= y |
| 83 |
func goPanicExtendSlice3C(hi int, lo uint, y int) { |
| 84 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 85 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: true, y: y, code: boundsSlice3C}) |
| 86 |
} |
| 87 |
func goPanicExtendSlice3CU(hi uint, lo uint, y int) { |
| 88 |
panicCheck1(sys.GetCallerPC(), "slice bounds out of range") |
| 89 |
panic(boundsError{x: int64(hi)<<32 + int64(lo), signed: false, y: y, code: boundsSlice3C}) |
| 90 |
} |
| 91 |
|
| 92 |
// Implemented in assembly, as they take arguments in registers. |
| 93 |
// Declared here to mark them as ABIInternal. |
| 94 |
func panicExtendIndex(hi int, lo uint, y int) |
| 95 |
func panicExtendIndexU(hi uint, lo uint, y int) |
| 96 |
func panicExtendSliceAlen(hi int, lo uint, y int) |
| 97 |
func panicExtendSliceAlenU(hi uint, lo uint, y int) |
| 98 |
func panicExtendSliceAcap(hi int, lo uint, y int) |
| 99 |
func panicExtendSliceAcapU(hi uint, lo uint, y int) |
| 100 |
func panicExtendSliceB(hi int, lo uint, y int) |
| 101 |
func panicExtendSliceBU(hi uint, lo uint, y int) |
| 102 |
func panicExtendSlice3Alen(hi int, lo uint, y int) |
| 103 |
func panicExtendSlice3AlenU(hi uint, lo uint, y int) |
| 104 |
func panicExtendSlice3Acap(hi int, lo uint, y int) |
| 105 |
func panicExtendSlice3AcapU(hi uint, lo uint, y int) |
| 106 |
func panicExtendSlice3B(hi int, lo uint, y int) |
| 107 |
func panicExtendSlice3BU(hi uint, lo uint, y int) |
| 108 |
func panicExtendSlice3C(hi int, lo uint, y int) |
| 109 |
func panicExtendSlice3CU(hi uint, lo uint, y int) |