Black Lives Matter. Support the Equal Justice Initiative.

Source file src/runtime/panic32.go

Documentation: runtime

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

View as plain text