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

     1  /*
     2  * Copyright 2021 ByteDance Inc.
     3  *
     4  * Licensed under the Apache License, Version 2.0 (the "License");
     5  * you may not use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     7  *
     8  *     http://www.apache.org/licenses/LICENSE-2.0
     9  *
    10  * Unless required by applicable law or agreed to in writing, software
    11  * distributed under the License is distributed on an "AS IS" BASIS,
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  * See the License for the specific language governing permissions and
    14  * limitations under the License.
    15  */
    16  
    17  package native
    18  
    19  import (
    20  	`unsafe`
    21  
    22  	neon `github.com/bytedance/sonic/internal/native/neon`
    23  	`github.com/bytedance/sonic/internal/native/types`
    24  )
    25  
    26  const (
    27  	MaxFrameSize   uintptr = 200
    28  	BufPaddingSize int     = 64
    29  )
    30  
    31  var (
    32  	S_f64toa uintptr
    33  	S_f32toa uintptr
    34  	S_i64toa uintptr
    35  	S_u64toa uintptr
    36  	S_lspace uintptr
    37  )
    38  
    39  var (
    40  	S_quote   uintptr
    41  	S_unquote uintptr
    42  )
    43  
    44  var (
    45  	S_value     uintptr
    46  	S_vstring   uintptr
    47  	S_vnumber   uintptr
    48  	S_vsigned   uintptr
    49  	S_vunsigned uintptr
    50  )
    51  
    52  var (
    53  	S_skip_one    uintptr
    54  	S_skip_one_fast    uintptr
    55  	S_get_by_path    uintptr
    56  	S_skip_array  uintptr
    57  	S_skip_object uintptr
    58  	S_skip_number uintptr
    59  )
    60  
    61  //go:nosplit
    62  //go:noescape
    63  //go:linkname Quote github.com/bytedance/sonic/internal/native/neon.__quote
    64  func Quote(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) int
    65  
    66  //go:nosplit
    67  //go:noescape
    68  //go:linkname Unquote github.com/bytedance/sonic/internal/native/neon.__unquote
    69  func Unquote(s unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) int
    70  
    71  //go:nosplit
    72  //go:noescape
    73  //go:linkname HTMLEscape github.com/bytedance/sonic/internal/native/neon.__html_escape
    74  func HTMLEscape(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) int
    75  
    76  //go:nosplit
    77  //go:noescape
    78  //go:linkname Value github.com/bytedance/sonic/internal/native/neon.__value
    79  func Value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) int
    80  
    81  //go:nosplit
    82  //go:noescape
    83  //go:linkname SkipOne github.com/bytedance/sonic/internal/native/neon.__skip_one
    84  func SkipOne(s *string, p *int, m *types.StateMachine, flags uint64) int
    85  
    86  //go:nosplit
    87  //go:noescape
    88  //go:linkname SkipOneFast github.com/bytedance/sonic/internal/native/neon.__skip_one_fast
    89  func SkipOneFast(s *string, p *int) int
    90  
    91  //go:nosplit
    92  //go:noescape
    93  //go:linkname GetByPath github.com/bytedance/sonic/internal/native/neon.__get_by_path
    94  func GetByPath(s *string, p *int, path *[]interface{}, m *types.StateMachine) int
    95  
    96  //go:nosplit
    97  //go:noescape
    98  //go:linkname ValidateOne github.com/bytedance/sonic/internal/native/neon.__validate_one
    99  func ValidateOne(s *string, p *int, m *types.StateMachine, flags uint64) int
   100  
   101  //go:nosplit
   102  //go:noescape
   103  //go:linkname I64toa github.com/bytedance/sonic/internal/native/neon.__i64toa
   104  func I64toa(out *byte, val int64) (ret int)
   105  
   106  //go:nosplit
   107  //go:noescape
   108  //go:linkname U64toa github.com/bytedance/sonic/internal/native/neon.__u64toa
   109  func U64toa(out *byte, val uint64) (ret int)
   110  
   111  //go:nosplit
   112  //go:noescape
   113  //go:linkname F64toa github.com/bytedance/sonic/internal/native/neon.__f64toa
   114  func F64toa(out *byte, val float64) (ret int)
   115  
   116  //go:nosplit
   117  //go:noescape
   118  //go:linkname F32toa github.com/bytedance/sonic/internal/native/neon.__f32toa
   119  func F32toa(out *byte, val float32) (ret int)
   120  
   121  //go:nosplit
   122  //go:noescape
   123  //go:linkname ValidateUTF8 github.com/bytedance/sonic/internal/native/neon.__validate_utf8
   124  func ValidateUTF8(s *string, p *int, m *types.StateMachine) (ret int)
   125  
   126  //go:nosplit
   127  //go:noescape
   128  //go:linkname ValidateUTF8Fast github.com/bytedance/sonic/internal/native/neon.__validate_utf8_fast
   129  func ValidateUTF8Fast(s *string) (ret int)
   130  
   131  func useNeon() {
   132  	S_f64toa = neon.S_f64toa
   133  	S_f32toa = neon.S_f32toa
   134  	S_i64toa = neon.S_i64toa
   135  	S_u64toa = neon.S_u64toa
   136  	S_lspace = neon.S_lspace
   137  	S_quote = neon.S_quote
   138  	S_unquote = neon.S_unquote
   139  	S_value = neon.S_value
   140  	S_vstring = neon.S_vstring
   141  	S_vnumber = neon.S_vnumber
   142  	S_vsigned = neon.S_vsigned
   143  	S_vunsigned = neon.S_vunsigned
   144  	S_skip_one = neon.S_skip_one
   145  	S_skip_one_fast = neon.S_skip_one_fast
   146  	S_skip_array = neon.S_skip_array
   147  	S_skip_object = neon.S_skip_object
   148  	S_skip_number = neon.S_skip_number
   149  	S_get_by_path = neon.S_get_by_path
   150  }
   151  
   152  func init() {
   153  	useNeon()
   154  }