stubs_go120.go (1531B)
1 // +build 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 ast 20 21 import ( 22 `unsafe` 23 `unicode/utf8` 24 25 `github.com/bytedance/sonic/internal/rt` 26 ) 27 28 //go:noescape 29 //go:linkname memmove runtime.memmove 30 //goland:noinspection GoUnusedParameter 31 func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr) 32 33 //go:linkname unsafe_NewArray reflect.unsafe_NewArray 34 //goland:noinspection GoUnusedParameter 35 func unsafe_NewArray(typ *rt.GoType, n int) unsafe.Pointer 36 37 //go:linkname growslice reflect.growslice 38 //goland:noinspection GoUnusedParameter 39 func growslice(et *rt.GoType, old rt.GoSlice, cap int) rt.GoSlice 40 41 //go:nosplit 42 func mem2ptr(s []byte) unsafe.Pointer { 43 return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr 44 } 45 46 var ( 47 //go:linkname safeSet encoding/json.safeSet 48 safeSet [utf8.RuneSelf]bool 49 50 //go:linkname hex encoding/json.hex 51 hex string 52 ) 53 54 //go:linkname unquoteBytes encoding/json.unquoteBytes 55 func unquoteBytes(s []byte) (t []byte, ok bool)