2
* Copyright 2021 ByteDance Inc.
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
22
`github.com/bytedance/sonic/internal/cpu`
23
`github.com/bytedance/sonic/internal/native/avx`
24
`github.com/bytedance/sonic/internal/native/avx2`
25
`github.com/bytedance/sonic/internal/native/sse`
26
`github.com/bytedance/sonic/internal/native/types`
27
`github.com/bytedance/sonic/internal/rt`
28
`github.com/bytedance/sonic/loader`
32
MaxFrameSize uintptr = 400
33
BufPaddingSize int = 64
60
S_skip_one_fast uintptr
68
S_validate_one uintptr
69
S_validate_utf8 uintptr
70
S_validate_utf8_fast uintptr
74
__Quote func(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn unsafe.Pointer, flags uint64) int
76
__Unquote func(s unsafe.Pointer, nb int, dp unsafe.Pointer, ep unsafe.Pointer, flags uint64) int
78
__HTMLEscape func(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn unsafe.Pointer) int
80
__Value func(s unsafe.Pointer, n int, p int, v unsafe.Pointer, flags uint64) int
82
__SkipOne func(s unsafe.Pointer, p unsafe.Pointer, m unsafe.Pointer, flags uint64) int
84
__SkipOneFast func(s unsafe.Pointer, p unsafe.Pointer) int
86
__GetByPath func(s unsafe.Pointer, p unsafe.Pointer, path unsafe.Pointer, m unsafe.Pointer) int
88
__ValidateOne func(s unsafe.Pointer, p unsafe.Pointer, m unsafe.Pointer) int
90
__I64toa func(out unsafe.Pointer, val int64) (ret int)
92
__U64toa func(out unsafe.Pointer, val uint64) (ret int)
94
__F64toa func(out unsafe.Pointer, val float64) (ret int)
96
__ValidateUTF8 func(s unsafe.Pointer, p unsafe.Pointer, m unsafe.Pointer) (ret int)
98
__ValidateUTF8Fast func(s unsafe.Pointer) (ret int)
102
func Quote(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) int {
103
return __Quote(rt.NoEscape(unsafe.Pointer(s)), nb, rt.NoEscape(unsafe.Pointer(dp)), rt.NoEscape(unsafe.Pointer(dn)), flags)
107
func Unquote(s unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) int {
108
return __Unquote(rt.NoEscape(unsafe.Pointer(s)), nb, rt.NoEscape(unsafe.Pointer(dp)), rt.NoEscape(unsafe.Pointer(ep)), flags)
112
func HTMLEscape(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) int {
113
return __HTMLEscape(rt.NoEscape(unsafe.Pointer(s)), nb, rt.NoEscape(unsafe.Pointer(dp)), rt.NoEscape(unsafe.Pointer(dn)))
117
func Value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) int {
118
return __Value(rt.NoEscape(unsafe.Pointer(s)), n, p, rt.NoEscape(unsafe.Pointer(v)), flags)
122
func SkipOne(s *string, p *int, m *types.StateMachine, flags uint64) int {
123
return __SkipOne(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(m)), flags)
127
func SkipOneFast(s *string, p *int) int {
128
return __SkipOneFast(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)))
132
func GetByPath(s *string, p *int, path *[]interface{}, m *types.StateMachine) int {
133
return __GetByPath(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(path)), rt.NoEscape(unsafe.Pointer(m)))
137
func ValidateOne(s *string, p *int, m *types.StateMachine) int {
138
return __ValidateOne(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(m)))
142
func I64toa(out *byte, val int64) (ret int) {
143
return __I64toa(rt.NoEscape(unsafe.Pointer(out)), val)
147
func U64toa(out *byte, val uint64) (ret int) {
148
return __U64toa(rt.NoEscape(unsafe.Pointer(out)), val)
152
func F64toa(out *byte, val float64) (ret int) {
153
return __F64toa(rt.NoEscape(unsafe.Pointer(out)), val)
157
func ValidateUTF8(s *string, p *int, m *types.StateMachine) (ret int) {
158
return __ValidateUTF8(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(m)))
162
func ValidateUTF8Fast(s *string) (ret int) {
163
return __ValidateUTF8Fast(rt.NoEscape(unsafe.Pointer(s)))
166
var stubs = []loader.GoC{
167
{"_f64toa", &S_f64toa, &__F64toa},
168
{"_f32toa", &S_f32toa, nil},
169
{"_i64toa", &S_i64toa, &__I64toa},
170
{"_u64toa", &S_u64toa, &__U64toa},
171
{"_lspace", &S_lspace, nil},
172
{"_quote", &S_quote, &__Quote},
173
{"_unquote", &S_unquote, &__Unquote},
174
{"_html_escape", &S_html_escape, &__HTMLEscape},
175
{"_value", &S_value, &__Value},
176
{"_vstring", &S_vstring, nil},
177
{"_vnumber", &S_vnumber, nil},
178
{"_vsigned", &S_vsigned, nil},
179
{"_vunsigned", &S_vunsigned, nil},
180
{"_skip_one", &S_skip_one, &__SkipOne},
181
{"_skip_one_fast", &S_skip_one_fast, &__SkipOneFast},
182
{"_get_by_path", &S_get_by_path, &__GetByPath},
183
{"_skip_array", &S_skip_array, nil},
184
{"_skip_object", &S_skip_object, nil},
185
{"_skip_number", &S_skip_number, nil},
186
{"_validate_one", &S_validate_one, &__ValidateOne},
187
{"_validate_utf8", &S_validate_utf8, &__ValidateUTF8},
188
{"_validate_utf8_fast", &S_validate_utf8_fast, &__ValidateUTF8Fast},
192
loader.WrapGoC(avx.Text__native_entry__, avx.Funcs, stubs, "avx", "avx/native.c")
196
loader.WrapGoC(avx2.Text__native_entry__, avx2.Funcs, stubs, "avx2", "avx2/native.c")
200
loader.WrapGoC(sse.Text__native_entry__, sse.Funcs, stubs, "sse", "sse/native.c")
206
} else if cpu.HasAVX {
208
} else if cpu.HasSSE {
211
panic("Unsupported CPU, maybe it's too old to run Sonic.")