...

Source file src/runtime/panic32.go

     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	// +build 386 amd64p32 arm mips mipsle
     6	
     7	package 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))
    13	func 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	}
    17	func 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))
    23	func 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	}
    27	func 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	}
    31	func 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	}
    35	func 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
    41	func 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	}
    45	func 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))
    51	func 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	}
    55	func 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	}
    59	func 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	}
    63	func 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
    69	func 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	}
    73	func 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
    79	func 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	}
    83	func 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.
    90	func panicExtendIndex(hi int, lo uint, y int)
    91	func panicExtendIndexU(hi uint, lo uint, y int)
    92	func panicExtendSliceAlen(hi int, lo uint, y int)
    93	func panicExtendSliceAlenU(hi uint, lo uint, y int)
    94	func panicExtendSliceAcap(hi int, lo uint, y int)
    95	func panicExtendSliceAcapU(hi uint, lo uint, y int)
    96	func panicExtendSliceB(hi int, lo uint, y int)
    97	func panicExtendSliceBU(hi uint, lo uint, y int)
    98	func panicExtendSlice3Alen(hi int, lo uint, y int)
    99	func panicExtendSlice3AlenU(hi uint, lo uint, y int)
   100	func panicExtendSlice3Acap(hi int, lo uint, y int)
   101	func panicExtendSlice3AcapU(hi uint, lo uint, y int)
   102	func panicExtendSlice3B(hi int, lo uint, y int)
   103	func panicExtendSlice3BU(hi uint, lo uint, y int)
   104	func panicExtendSlice3C(hi int, lo uint, y int)
   105	func panicExtendSlice3CU(hi uint, lo uint, y int)
   106	

View as plain text