github.com/bytedance/sonic@v1.11.7-0.20240517092252-d2edb31b167b/internal/decoder/stubs_go116.go (about)

     1  // +build go1.16,!go1.20
     2  
     3  /*
     4   * Copyright 2021 ByteDance Inc.
     5   *
     6   * Licensed under the Apache License, Version 2.0 (the "License");
     7   * you may not use this file except in compliance with the License.
     8   * You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an "AS IS" BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  package decoder
    20  
    21  import (
    22      `unsafe`
    23      `reflect`
    24  
    25      _ `github.com/cloudwego/base64x`
    26  
    27      `github.com/bytedance/sonic/internal/rt`
    28  )
    29  
    30  //go:linkname _subr__b64decode github.com/cloudwego/base64x._subr__b64decode
    31  var _subr__b64decode uintptr
    32  
    33  // runtime.maxElementSize
    34  const _max_map_element_size uintptr = 128
    35  
    36  func mapfast(vt reflect.Type) bool {
    37      return vt.Elem().Size() <= _max_map_element_size
    38  }
    39  
    40  //go:nosplit
    41  //go:linkname throw runtime.throw
    42  //goland:noinspection GoUnusedParameter
    43  func throw(s string)
    44  
    45  //go:linkname convT64 runtime.convT64
    46  //goland:noinspection GoUnusedParameter
    47  func convT64(v uint64) unsafe.Pointer
    48  
    49  //go:linkname convTslice runtime.convTslice
    50  //goland:noinspection GoUnusedParameter
    51  func convTslice(v []byte) unsafe.Pointer
    52  
    53  //go:linkname convTstring runtime.convTstring
    54  //goland:noinspection GoUnusedParameter
    55  func convTstring(v string) unsafe.Pointer
    56  
    57  //go:noescape
    58  //go:linkname memequal runtime.memequal
    59  //goland:noinspection GoUnusedParameter
    60  func memequal(a unsafe.Pointer, b unsafe.Pointer, size uintptr) bool
    61  
    62  //go:noescape
    63  //go:linkname memmove runtime.memmove
    64  //goland:noinspection GoUnusedParameter
    65  func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr)
    66  
    67  //go:linkname mallocgc runtime.mallocgc
    68  //goland:noinspection GoUnusedParameter
    69  func mallocgc(size uintptr, typ *rt.GoType, needzero bool) unsafe.Pointer
    70  
    71  //go:linkname makeslice runtime.makeslice
    72  //goland:noinspection GoUnusedParameter
    73  func makeslice(et *rt.GoType, len int, cap int) unsafe.Pointer
    74  
    75  //go:linkname makemap_small runtime.makemap_small
    76  func makemap_small() unsafe.Pointer
    77  
    78  //go:linkname mapassign runtime.mapassign
    79  //goland:noinspection GoUnusedParameter
    80  func mapassign(t *rt.GoType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer
    81  
    82  //go:linkname mapassign_fast32 runtime.mapassign_fast32
    83  //goland:noinspection GoUnusedParameter
    84  func mapassign_fast32(t *rt.GoType, h unsafe.Pointer, k uint32) unsafe.Pointer
    85  
    86  //go:linkname mapassign_fast64 runtime.mapassign_fast64
    87  //goland:noinspection GoUnusedParameter
    88  func mapassign_fast64(t *rt.GoType, h unsafe.Pointer, k uint64) unsafe.Pointer
    89  
    90  //go:linkname mapassign_fast64ptr runtime.mapassign_fast64ptr
    91  //goland:noinspection GoUnusedParameter
    92  func mapassign_fast64ptr(t *rt.GoType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer
    93  
    94  //go:linkname mapassign_faststr runtime.mapassign_faststr
    95  //goland:noinspection GoUnusedParameter
    96  func mapassign_faststr(t *rt.GoType, h unsafe.Pointer, s string) unsafe.Pointer
    97  
    98  //go:nosplit
    99  //go:linkname memclrHasPointers runtime.memclrHasPointers
   100  //goland:noinspection GoUnusedParameter
   101  func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
   102  
   103  //go:noescape
   104  //go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers
   105  //goland:noinspection GoUnusedParameter
   106  func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)