github.com/goshafaq/sonic@v0.0.0-20231026082336-871835fb94c6/internal/decoder/stubs_go120.go (about)

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