dispatch_arm64.go raw
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 S_parse_with_padding uintptr
60 S_lookup_small_key uintptr
61 )
62
63 //go:nosplit
64 //go:noescape
65 //go:linkname Quote github.com/bytedance/sonic/internal/native/neon.__quote
66 func Quote(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) int
67
68 //go:nosplit
69 //go:noescape
70 //go:linkname Unquote github.com/bytedance/sonic/internal/native/neon.__unquote
71 func Unquote(s unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) int
72
73 //go:nosplit
74 //go:noescape
75 //go:linkname HTMLEscape github.com/bytedance/sonic/internal/native/neon.__html_escape
76 func HTMLEscape(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) int
77
78 //go:nosplit
79 //go:noescape
80 //go:linkname Value github.com/bytedance/sonic/internal/native/neon.__value
81 func Value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) int
82
83 //go:nosplit
84 //go:noescape
85 //go:linkname SkipOne github.com/bytedance/sonic/internal/native/neon.__skip_one
86 func SkipOne(s *string, p *int, m *types.StateMachine, flags uint64) int
87
88 //go:nosplit
89 //go:noescape
90 //go:linkname SkipOneFast github.com/bytedance/sonic/internal/native/neon.__skip_one_fast
91 func SkipOneFast(s *string, p *int) int
92
93 //go:nosplit
94 //go:noescape
95 //go:linkname GetByPath github.com/bytedance/sonic/internal/native/neon.__get_by_path
96 func GetByPath(s *string, p *int, path *[]interface{}, m *types.StateMachine) int
97
98 //go:nosplit
99 //go:noescape
100 //go:linkname ValidateOne github.com/bytedance/sonic/internal/native/neon.__validate_one
101 func ValidateOne(s *string, p *int, m *types.StateMachine, flags uint64) int
102
103 //go:nosplit
104 //go:noescape
105 //go:linkname I64toa github.com/bytedance/sonic/internal/native/neon.__i64toa
106 func I64toa(out *byte, val int64) (ret int)
107
108 //go:nosplit
109 //go:noescape
110 //go:linkname U64toa github.com/bytedance/sonic/internal/native/neon.__u64toa
111 func U64toa(out *byte, val uint64) (ret int)
112
113 //go:nosplit
114 //go:noescape
115 //go:linkname F64toa github.com/bytedance/sonic/internal/native/neon.__f64toa
116 func F64toa(out *byte, val float64) (ret int)
117
118 //go:nosplit
119 //go:noescape
120 //go:linkname F32toa github.com/bytedance/sonic/internal/native/neon.__f32toa
121 func F32toa(out *byte, val float32) (ret int)
122
123 //go:nosplit
124 //go:noescape
125 //go:linkname ValidateUTF8 github.com/bytedance/sonic/internal/native/neon.__validate_utf8
126 func ValidateUTF8(s *string, p *int, m *types.StateMachine) (ret int)
127
128 //go:nosplit
129 //go:noescape
130 //go:linkname ValidateUTF8Fast github.com/bytedance/sonic/internal/native/neon.__validate_utf8_fast
131 func ValidateUTF8Fast(s *string) (ret int)
132
133 //go:nosplit
134 //go:noescape
135 //go:linkname ParseWithPadding github.com/bytedance/sonic/internal/native/neon.__parse_with_padding
136 func ParseWithPadding(parser unsafe.Pointer) (ret int)
137
138 //go:nosplit
139 //go:noescape
140 //go:linkname LookupSmallKey github.com/bytedance/sonic/internal/native/neon.__lookup_small_key
141 func LookupSmallKey(key *string, table *[]byte, lowerOff int) (index int)
142
143
144 func useNeon() {
145 S_f64toa = neon.S_f64toa
146 S_f32toa = neon.S_f32toa
147 S_i64toa = neon.S_i64toa
148 S_u64toa = neon.S_u64toa
149 S_lspace = neon.S_lspace
150 S_quote = neon.S_quote
151 S_unquote = neon.S_unquote
152 S_value = neon.S_value
153 S_vstring = neon.S_vstring
154 S_vnumber = neon.S_vnumber
155 S_vsigned = neon.S_vsigned
156 S_vunsigned = neon.S_vunsigned
157 S_skip_one = neon.S_skip_one
158 S_skip_one_fast = neon.S_skip_one_fast
159 S_skip_array = neon.S_skip_array
160 S_skip_object = neon.S_skip_object
161 S_skip_number = neon.S_skip_number
162 S_get_by_path = neon.S_get_by_path
163 S_parse_with_padding = neon.S_parse_with_padding
164 S_lookup_small_key = neon.S_lookup_small_key
165 }
166
167 func init() {
168 useNeon()
169 }
170