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