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

View as plain text